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

Diff of /Sprout/GenomeStats.pl

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

revision 1.14, Fri Jun 23 23:09:04 2006 UTC revision 1.21, Sun Aug 27 00:05:04 2006 UTC
# Line 112  Line 112 
112  } elsif (! -d $targetDir) {  } elsif (! -d $targetDir) {
113      Confess("Target directory $targetDir not found.");      Confess("Target directory $targetDir not found.");
114  } else {  } else {
115      # *Get the old Sprout.      # Get the old Sprout.
116      my $oldSprout = SFXlate->new_sprout_only($FIG_Config::oldSproutDB);      my $oldSprout = SFXlate->new_sprout_only($FIG_Config::oldSproutDB);
117      # Extract the genome group data from the old Sprout.      # Extract the genome group data from the old Sprout.
118      my %oldGroupHash = $oldSprout->GetGroups();      my %oldGroupHash = $oldSprout->GetGroups();
# Line 138  Line 138 
138          }          }
139          # Create the output file.          # Create the output file.
140          my $outFileName = "stats-" . lc($groupID) . ".inc";          my $outFileName = "stats-" . lc($groupID) . ".inc";
141          Open(\*GROUPFILE, ">$targetDir/outFileName");          Open(\*GROUPFILE, ">$targetDir/$outFileName");
142          # Get the styles.          # Get the styles.
143          my ($tableStyle, $markerStyle, @rowStyle) = ($options->{tableStyle}, $options->{markerStyle},          my ($tableStyle, $markerStyle, @rowStyle) = ($options->{tableStyle}, $options->{markerStyle},
144                                                       $options->{evenStyle}, $options->{oddStyle});                                                       $options->{evenStyle}, $options->{oddStyle});
# Line 153  Line 153 
153                                                   "Named genes not in subsystems",        # n0                                                   "Named genes not in subsystems",        # n0
154                                                   "Hypothetical genes in subsystems",     # s1                                                   "Hypothetical genes in subsystems",     # s1
155                                                   "Hypothetical genes not in subsystems", # n1                                                   "Hypothetical genes not in subsystems", # n1
156                                                     "Subsystems",
157                                                   "RNAs",                                                   "RNAs",
158                                                     ])) . "\n";                                                     ])) . "\n";
159          # Set up some useful stuff for the four count columns.          # Set up some useful stuff for the four count columns.
# Line 179  Line 180 
180              my $pegCount = Tracer::CommaFormat($sprout->FeatureCount($genomeID, 'peg'));              my $pegCount = Tracer::CommaFormat($sprout->FeatureCount($genomeID, 'peg'));
181              # Get the number of RNAs.              # Get the number of RNAs.
182              my $rnaCount = Tracer::CommaFormat($sprout->FeatureCount($genomeID, 'rna'));              my $rnaCount = Tracer::CommaFormat($sprout->FeatureCount($genomeID, 'rna'));
183                # If there are no RNAs, we say we don't know the number, since we know there
184                # must be RNAs somewhere.
185                if (! $rnaCount) {
186                    $rnaCount = "n/d";
187                }
188              # Now we have four categories of features to work with, for each              # Now we have four categories of features to work with, for each
189              # combination of named or hypothetical vs. in-subsystem or              # combination of named or hypothetical vs. in-subsystem or
190              # not-in-subsystem. First, we get all of the feature assignments for              # not-in-subsystem. First, we get all of the feature assignments for
191              # the genome.              # the genome.
192              my $assignHash = $sprout->GenomeAssignments($genomeID);              my $assignHash = $sprout->GenomeAssignments($genomeID);
193              # Next, we get all of the features in the genome that belong to a              # Next, we get all of the features in the genome that belong to a
194              # subsystem. This involves a query via the subsystem spreadsheet.              # subsystem.
195              my %ssHash = map { $_ => 1 } $sprout->GetFlat(['IsGenomeOf', 'ContainsFeature'],              my %ssHash = $sprout->GenomeSubsystemData($genomeID);
                                                     "IsGenomeOf(from-link) = ?",  
                                                     [$genomeID], 'ContainsFeature(to-link)');  
196              # Create a hash to track the four categories. "s" or "n" indicates              # Create a hash to track the four categories. "s" or "n" indicates
197              # in or out of a subsystem. "1" or "0" indicates hypothetical or              # in or out of a subsystem. "1" or "0" indicates hypothetical or
198              # real.              # real.
# Line 214  Line 218 
218                                               Tracer::Percent($counters{$type}, $totalFeatures)));                                               Tracer::Percent($counters{$type}, $totalFeatures)));
219              }              }
220              my @counterValues = map { $counters{$_} } @columnTypes;              my @counterValues = map { $counters{$_} } @columnTypes;
221                # The last link is a button to look at the subsystem summaries.
222                my $ssCount = $sprout->GetCount(['ParticipatesIn'], 'ParticipatesIn(from-link) = ?',
223                                                   [$genomeID]);
224                my $ssLink = "$options->{linkCGI}?user=\&genome=$genomeID&SPROUT=1&show_subsystems=1";
225                my $ssCol = "<a href=\"$ssLink\">$ssCount</a>";
226              # Create the row text. Note that we use the distributive capability of the TD              # Create the row text. Note that we use the distributive capability of the TD
227              # function to apply the same style to each one.              # function to apply the same style to each one.
228              my $rowHtml = join("",              my $rowHtml = join("",
# Line 221  Line 230 
230                                 td({ class => $numStyle }, $genomeLen),                                 td({ class => $numStyle }, $genomeLen),
231                                 td({ class => $numStyle }, $pegCount),                                 td({ class => $numStyle }, $pegCount),
232                                 td({ class => $counterStyle }, \@counterValues),                                 td({ class => $counterStyle }, \@counterValues),
233                                   td({ class => $numStyle }, $ssCol),
234                                 td({ class => $numStyle }, $rnaCount),                                 td({ class => $numStyle }, $rnaCount),
235                                );                                );
236              # Put it in the row hash.              # Put it in the row hash.

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.21

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3