[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.25, Fri Dec 7 18:29:34 2007 UTC
# Line 384  Line 384 
384      my %fixedGroups = $newSprout->Fix(%newGroups);      my %fixedGroups = $newSprout->Fix(%newGroups);
385      for my $group (sort keys %superTable) {      for my $group (sort keys %superTable) {
386          Trace("Checking group $group.");          Trace("Checking group $group.");
387          # Get this group's genus and species.          # Loop through this group's genus/species pairs creating filters
388          my $genus = $superTable{$group}->{genus};          # for a genome query.
389          my $species = $superTable{$group}->{species};          my @filters = ();
390            my @filterParms = ();
391            for my $genusSpecies (@{$superTable{$group}->{content}}) {
392                my ($genus, $species) = @{$genusSpecies};
393                # Filter on genus.
394                my $filter = 'Genome(genus) = ?';
395                push @filterParms, $genus;
396                # If necessary, filter on species.
397                if ($species) {
398                    $filter .= ' AND Genome(species) = ?';
399                    push @filterParms, $species;
400                }
401                # Add this filter to the list.
402                push @filters, "($filter)";
403            }
404            # Get all the genomes that should be in the super-group.
405            my @possibles = $newSprout->GetFlat(['Genome'], join(" OR ", @filters),
406                                                \@filterParms, 'Genome(id)');
407          # Get a hash of the genomes already in it.          # Get a hash of the genomes already in it.
408          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)');  
409          # 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.
410          my @leftOut = NameGenomes($newSprout, [ grep { ! exists $inGroup{$_} } @possibles ]);          my @leftOut = NameGenomes($newSprout, [ grep { ! exists $inGroup{$_} } @possibles ]);
411          # If anything survived, show the list.          # If anything survived, show the list.

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3