[Bio] / FortyEight / show_import_list.pl Repository:
ViewVC logotype

View of /FortyEight/show_import_list.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Tue Jan 19 00:09:34 2010 UTC (9 years, 10 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, mgrast_dev_05262011, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, mgrast_dev_10262011, HEAD
Changes since 1.1: +6 -4 lines
misc updates

#
# Show the list of genomes to be imported. Double check
# they are not already in the seed.
#

use FIG_Config;
use strict;
use Job48;

@ARGV == 1 or @ARGV == 2 or die "Usage: $0 import-jobdir [jobfile]\n";

my $idir = shift;
my $file = shift;
$file = "$idir/rast.jobs" unless $file;

open(R, "<", $file) or die "cannot open rast joblist $file: $!";

my($f_job, $f_user, $f_gc, $f_gid, $f_genome, $f_replaces);
format STDOUT_TOP =
RAST   Submitting       GC   Genome ID    Replacment   Organism
Job      User           %                   for
------ ---------------- ---- ------------ ------------ --------------
.
format STDOUT =
@<<<<< @<<<<<<<<<<<<<<< @#.# @<<<<<<<<<<< @<<<<<<<<<<< @*
$f_job, $f_user,        $f_gc, $f_gid,    $f_replaces     $f_genome
.

my @out;
while (my $jobdir = <R>)
{
    chomp $jobdir;
    my $job = new Job48($jobdir);

    my $cand = $job->meta->get_metadata('import.candidate');
    my $action = $job->meta->get_metadata('import.action');
    my $replaces = $job->meta->get_metadata('import.replace');

    my $genome = $job->genome_name;
    my $gid = $job->genome_id;
    $gid = sprintf("%9s", $gid);
#    print "$jobdir:\t$cand\t$action\t$gid\t$genome\n";
    my $seed_dir = "$FIG_Config::organisms/$genome";

    if (0 && -d $seed_dir)
    {
	print "$jobdir exists in seed\n";
    }
    else
    {

	my $fasta = $job->orgdir . "/contigs";
	open(SL, "$FIG_Config::bin/sequence_length_histogram -null -get_gc < $fasta 2>&1 |") or
	    die "sequence_length_histogram pipe failed: $!";
	my $gc;
	while (<SL>)
	{
	    if (/G\+C\s*=\s*([^%]+)/)
	    {
		$gc = $1;
		last;
	    }
	}
	close(SL);
	
	push(@out, [$jobdir,$job, $cand, $action, $genome, $gid, $gc, $replaces]);
    }
}

for my $ent (sort { defined($b->[7]) <=> defined($a->[7]) or $a->[4] cmp $b->[4] } @out)
#for my $ent (sort { (($a->[6] > 60) <=> ($b->[6] > 60)) or  $a->[4] cmp $b->[4] } @out)
{
    my($jobdir,$job, $cand, $action, $genome, $gid, $gc, $replaces) = @$ent;
    $f_user = $job->user;
    $f_job = $job->id;
    $f_gid = $gid;
    $f_gc = $gc;
    $f_genome = $genome;
    $f_replaces = $replaces;

    write;
    #print "$jid\t$user\t$gc\t$gid\t$genome\n";
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3