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

Annotation of /FortyEight/show_import_list.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.1 #
2 :     # Show the list of genomes to be imported. Double check
3 :     # they are not already in the seed.
4 :     #
5 :    
6 :     use FIG_Config;
7 :     use strict;
8 :     use Job48;
9 :    
10 : olson 1.2 @ARGV == 1 or @ARGV == 2 or die "Usage: $0 import-jobdir [jobfile]\n";
11 : olson 1.1
12 :     my $idir = shift;
13 : olson 1.2 my $file = shift;
14 :     $file = "$idir/rast.jobs" unless $file;
15 : olson 1.1
16 : olson 1.2 open(R, "<", $file) or die "cannot open rast joblist $file: $!";
17 : olson 1.1
18 :     my($f_job, $f_user, $f_gc, $f_gid, $f_genome, $f_replaces);
19 :     format STDOUT_TOP =
20 :     RAST Submitting GC Genome ID Replacment Organism
21 :     Job User % for
22 :     ------ ---------------- ---- ------------ ------------ --------------
23 :     .
24 :     format STDOUT =
25 :     @<<<<< @<<<<<<<<<<<<<<< @#.# @<<<<<<<<<<< @<<<<<<<<<<< @*
26 :     $f_job, $f_user, $f_gc, $f_gid, $f_replaces $f_genome
27 :     .
28 :    
29 :     my @out;
30 :     while (my $jobdir = <R>)
31 :     {
32 :     chomp $jobdir;
33 :     my $job = new Job48($jobdir);
34 :    
35 :     my $cand = $job->meta->get_metadata('import.candidate');
36 :     my $action = $job->meta->get_metadata('import.action');
37 :     my $replaces = $job->meta->get_metadata('import.replace');
38 :    
39 :     my $genome = $job->genome_name;
40 :     my $gid = $job->genome_id;
41 :     $gid = sprintf("%9s", $gid);
42 :     # print "$jobdir:\t$cand\t$action\t$gid\t$genome\n";
43 :     my $seed_dir = "$FIG_Config::organisms/$genome";
44 :    
45 : olson 1.2 if (0 && -d $seed_dir)
46 : olson 1.1 {
47 :     print "$jobdir exists in seed\n";
48 :     }
49 :     else
50 :     {
51 :    
52 :     my $fasta = $job->orgdir . "/contigs";
53 :     open(SL, "$FIG_Config::bin/sequence_length_histogram -null -get_gc < $fasta 2>&1 |") or
54 :     die "sequence_length_histogram pipe failed: $!";
55 :     my $gc;
56 :     while (<SL>)
57 :     {
58 :     if (/G\+C\s*=\s*([^%]+)/)
59 :     {
60 :     $gc = $1;
61 :     last;
62 :     }
63 :     }
64 :     close(SL);
65 :    
66 :     push(@out, [$jobdir,$job, $cand, $action, $genome, $gid, $gc, $replaces]);
67 :     }
68 :     }
69 :    
70 : olson 1.2 for my $ent (sort { defined($b->[7]) <=> defined($a->[7]) or $a->[4] cmp $b->[4] } @out)
71 : olson 1.1 #for my $ent (sort { (($a->[6] > 60) <=> ($b->[6] > 60)) or $a->[4] cmp $b->[4] } @out)
72 :     {
73 :     my($jobdir,$job, $cand, $action, $genome, $gid, $gc, $replaces) = @$ent;
74 :     $f_user = $job->user;
75 :     $f_job = $job->id;
76 :     $f_gid = $gid;
77 :     $f_gc = $gc;
78 :     $f_genome = $genome;
79 :     $f_replaces = $replaces;
80 :    
81 :     write;
82 :     #print "$jid\t$user\t$gc\t$gid\t$genome\n";
83 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3