[Bio] / FortyEight / find-genomes-not-in-seed.pl Repository:
ViewVC logotype

Diff of /FortyEight/find-genomes-not-in-seed.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Tue Jan 16 21:37:23 2007 UTC revision 1.2, Thu Feb 15 17:29:30 2007 UTC
# Line 16  Line 16 
16  my %genome_to_name;  my %genome_to_name;
17  my %name_to_genome;  my %name_to_genome;
18  my %contig_to_genome;  my %contig_to_genome;
19    my %normalized_name_to_genome;
20    my %normalized_gs_to_genome;
21    
22  for my $g (@genomes)  for my $g (@genomes)
23  {  {
24      my($tax, $vers) = split(/\./, $g);      my($tax, $vers) = split(/\./, $g);
# Line 23  Line 26 
26      my $gs = $fig->genus_species($g);      my $gs = $fig->genus_species($g);
27      $name_to_genome{$gs} = $g;      $name_to_genome{$gs} = $g;
28      $genome_to_name{$g} = $gs;      $genome_to_name{$g} = $gs;
29    
30        #
31        # normalized names
32        #
33        my $ngs = lc($gs);
34        $ngs =~ s/\s//g;
35        $normalized_name_to_genome{$ngs} = $g;
36        if ($gs =~ /^\s*(\S+)\s+(\S+)/)
37        {
38            $normalized_gs_to_genome{lc("$1$2")} = $g;
39  }  }
40    }
41    
42    #warn Dumper(\%normalized_name_to_genome);
43    #warn Dumper(\%normalized_gs_to_genome);
44    
45    
46  #  #
47  # Poke the db to read all contig ids.  # Poke the db to read all contig ids.
48  #  #
49  print "Reading contigs\n";  warn "Reading contigs\n";
50  my $res = $fig->db_handle->SQL(qq(SELECT genome, contig from contig_lengths));  my $res = $fig->db_handle->SQL(qq(SELECT genome, contig from contig_lengths));
51  for my $ent (@$res)  for my $ent (@$res)
52  {  {
# Line 36  Line 54 
54    
55      push @{$contig_to_genome{$contig}}, $genome;      push @{$contig_to_genome{$contig}}, $genome;
56  }  }
57  print "done reading contigs\n";  warn "done reading contigs\n";
58    
59  my @jobs = Job48::all_jobs();  my @jobs = Job48::all_jobs();
60  @jobs = grep { $_->active() } @jobs;  @jobs = grep { $_->active() } @jobs;
# Line 57  Line 75 
75      my @inseed;      my @inseed;
76      my $status = "UNKNOWN";      my $status = "UNKNOWN";
77    
78        #
79        # find normalized names
80        #
81        my $ngs = lc($gs);
82        my $gsonly;
83        $ngs =~ s/\s//g;
84    
85        if ($gs =~ /^\s*(\S+)\s+(\S+)/)
86        {
87            $gsonly = lc("$1$2");
88        }
89    
90    #    warn "$g $gs $ngs $gsonly\n";
91    
92      if (!$job->finished())      if (!$job->finished())
93      {      {
94          $status = "INCOMPLETE";          $status = "INCOMPLETE";
# Line 64  Line 96 
96      elsif (my $sname = $name_to_genome{$gs})      elsif (my $sname = $name_to_genome{$gs})
97      {      {
98          $status = "NAME_IN_SEED";          $status = "NAME_IN_SEED";
99          @inseed = ($sname, $gs);          @inseed = ($sname, $genome_to_name{$sname});
100      }      }
101      else      else
102      {      {
# Line 82  Line 114 
114          }          }
115          else          else
116          {          {
117                if (my $sname = $normalized_name_to_genome{$ngs})
118                {
119                    $status = "NORMALIZED_NAME_IN_SEED";
120                    @inseed = ($sname, $genome_to_name{$sname});
121                }
122                elsif (my $sname = $normalized_gs_to_genome{$gsonly})
123                {
124                    $status = "NORMALIZED_GS_IN_SEED";
125                    @inseed = ($sname, $genome_to_name{$sname});
126                }
127              #              #
128              # Search for contig names that map.              # Search for contig names that map.
129              #              #

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3