[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.13, Sun Jun 18 10:07:00 2006 UTC revision 1.19, Thu Aug 24 17:29:45 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 137  Line 137 
137              %oldGenomes = map { $_ => 1 } @{$oldGroupHash{$groupID}};              %oldGenomes = map { $_ => 1 } @{$oldGroupHash{$groupID}};
138          }          }
139          # Create the output file.          # Create the output file.
140          Open(\*GROUPFILE, ">$targetDir/$groupID.inc");          my $outFileName = "stats-" . lc($groupID) . ".inc";
141            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 152  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                                                     "",
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 178  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 213  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 $ssLink = "$options->{linkCGI}?user=\&genome=$genomeID&SPROUT=1&show_subsystems=1";
223                my $ssCol = "<a href=\"$ssLink\"><img src=\"../images/button-ss.gif\"></a>";
224              # 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
225              # function to apply the same style to each one.              # function to apply the same style to each one.
226              my $rowHtml = join("",              my $rowHtml = join("",
# Line 220  Line 228 
228                                 td({ class => $numStyle }, $genomeLen),                                 td({ class => $numStyle }, $genomeLen),
229                                 td({ class => $numStyle }, $pegCount),                                 td({ class => $numStyle }, $pegCount),
230                                 td({ class => $counterStyle }, \@counterValues),                                 td({ class => $counterStyle }, \@counterValues),
231                                   td($ssCol),
232                                 td({ class => $numStyle }, $rnaCount),                                 td({ class => $numStyle }, $rnaCount),
233                                );                                );
234              # Put it in the row hash.              # Put it in the row hash.

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.19

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3