[Bio] / Sprout / NewStuffCheck.pl Repository:
ViewVC logotype

Diff of /Sprout/NewStuffCheck.pl

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

revision 1.24, Thu Dec 6 14:58:03 2007 UTC revision 1.26, Tue Feb 5 05:15:42 2008 UTC
# Line 91  Line 91 
91    
92  use strict;  use strict;
93  use Tracer;  use Tracer;
 use DocUtils;  
 use TestUtils;  
94  use Cwd;  use Cwd;
95  use File::Copy;  use File::Copy;
96  use File::Path;  use File::Path;
# Line 258  Line 256 
256      Open(\*ORGOUT, ">$options->{orgFile}");      Open(\*ORGOUT, ">$options->{orgFile}");
257      # Start the table.      # Start the table.
258      my @orgHtml = ();      my @orgHtml = ();
259      push @orgHtml, $cgi->h4("Genome Report for $version");      push @orgHtml, $cgi->h4({ align => 'center' }, "Genome Report for $version");
260      push @orgHtml, $cgi->start_table({ border => 2, align => 'center'});      push @orgHtml, $cgi->start_table({ border => 2, align => 'center'});
261      push @orgHtml, $cgi->Tr($cgi->th("Genome"),      push @orgHtml, $cgi->Tr($cgi->th("Genome"),
262                              $cgi->th({align => 'right'}, ["Size (bp)", "Feats", "Contigs", "Subs",                              $cgi->th({align => 'right'}, ["Size (bp)", "Feats", "Contigs", "Subs",
# Line 384  Line 382 
382      my %fixedGroups = $newSprout->Fix(%newGroups);      my %fixedGroups = $newSprout->Fix(%newGroups);
383      for my $group (sort keys %superTable) {      for my $group (sort keys %superTable) {
384          Trace("Checking group $group.");          Trace("Checking group $group.");
385          # Get this group's genus and species.          # Loop through this group's genus/species pairs creating filters
386          my $genus = $superTable{$group}->{genus};          # for a genome query.
387          my $species = $superTable{$group}->{species};          my @filters = ();
388            my @filterParms = ();
389            for my $genusSpecies (@{$superTable{$group}->{content}}) {
390                my ($genus, $species) = @{$genusSpecies};
391                # Filter on genus.
392                my $filter = 'Genome(genus) = ?';
393                push @filterParms, $genus;
394                # If necessary, filter on species.
395                if ($species) {
396                    $filter .= ' AND Genome(species) = ?';
397                    push @filterParms, $species;
398                }
399                # Add this filter to the list.
400                push @filters, "($filter)";
401            }
402            # Get all the genomes that should be in the super-group.
403            my @possibles = $newSprout->GetFlat(['Genome'], join(" OR ", @filters),
404                                                \@filterParms, 'Genome(id)');
405          # Get a hash of the genomes already in it.          # Get a hash of the genomes already in it.
406          my %inGroup = map { $_ => 1 } @{$fixedGroups{$group}};          my %inGroup = map { $_ => 1 } @{$fixedGroups{$group}};
         # Get a list of its possible genomes.  
         my $filter = 'Genome(genus) = ?';  
         my @parms = ($genus);  
         # The species list is tricky because a given group may involve more than  
         # one target species or no target species (which means we want everything).  
         # The species names will be in list references, and we use some PERL trickiness  
         # to generate an OR filter for them.  
         if (scalar @{$species}) {  
             # Create one species filter per species.  
             my @filterClauses = map { 'Genome(species) = ?' } @{$species};  
             # OR the filter clauses together to get a real filter.  
             $filter .= " AND (" . (join " OR ", @filterClauses) . ")";  
             # Add the specieis names to the SQL parameter list.  
             push @parms, @{$species};  
         }  
         my @possibles = $newSprout->GetFlat(['Genome'], $filter, \@parms, 'Genome(id)');  
407          # Get the possibles that aren't in the group and add identifying information.          # Get the possibles that aren't in the group and add identifying information.
408          my @leftOut = NameGenomes($newSprout, [ grep { ! exists $inGroup{$_} } @possibles ]);          my @leftOut = NameGenomes($newSprout, [ grep { ! exists $inGroup{$_} } @possibles ]);
409          # If anything survived, show the list.          # If anything survived, show the list.

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.26

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3