[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.7, Sun Jun 18 07:39:38 2006 UTC revision 1.13, Sun Jun 18 10:07:00 2006 UTC
# Line 61  Line 61 
61    
62  Style to use for small-text markers (e.g. NEW!)  Style to use for small-text markers (e.g. NEW!)
63    
64    =item numStyle
65    
66    Style to use for numeric cells.
67    
68    =item counterStyle
69    
70    Style to use for counter cells.
71    
72  =item linkCGI  =item linkCGI
73    
74  Path to the CGI script for displaying detailed statistics.  Path to the CGI script for displaying detailed statistics.
# Line 90  Line 98 
98                                              evenStyle => ['even', 'style for even rows'],                                              evenStyle => ['even', 'style for even rows'],
99                                              tableStyle => ['genomestats', 'style for whole table'],                                              tableStyle => ['genomestats', 'style for whole table'],
100                                              markerStyle => ['tinytext', 'style for markers'],                                              markerStyle => ['tinytext', 'style for markers'],
101                                                numStyle => ['numcell', 'style for cells with numeric values'],
102                                                counterStyle => ['countercell', 'style for cells with counter values'],
103                                              linkCGI => ['../FIG/genome_statistics.cgi',                                              linkCGI => ['../FIG/genome_statistics.cgi',
104                                                          'path to CGI script for detailed statistics'],                                                          'path to CGI script for detailed statistics'],
105                                             },                                             },
# Line 131  Line 141 
141          # Get the styles.          # Get the styles.
142          my ($tableStyle, $markerStyle, @rowStyle) = ($options->{tableStyle}, $options->{markerStyle},          my ($tableStyle, $markerStyle, @rowStyle) = ($options->{tableStyle}, $options->{markerStyle},
143                                                       $options->{evenStyle}, $options->{oddStyle});                                                       $options->{evenStyle}, $options->{oddStyle});
144            my ($numStyle, $counterStyle) = ($options->{numStyle}, $options->{counterStyle});
145          # Start the table.          # Start the table.
146          print GROUPFILE "<table class=\"$tableStyle\">\n";          print GROUPFILE "<table class=\"$tableStyle\">\n";
147          # Create the header row.          # Create the header row.
148          print GROUPFILE Tr( { class => 'odd' }, th("Strain annotated in NMPDR",          print GROUPFILE Tr( { class => 'odd' }, th(["Strain annotated in NMPDR",
149                                                   "Genome size, bp",                                                   "Genome size, bp",
150                                                   "Protein Encoding Genes (PEGs)",                                                   "Protein Encoding Genes (PEGs)",
151                                                   "Named genes in subsystems",            # s0                                                   "Named genes in subsystems",            # s0
152                                                   "Named genes not in subsystems",        # n0                                                   "Named genes not in subsystems",        # n0
153                                                   "Hypothetical genes in subsystems",     # s1                                                   "Hypothetical genes in subsystems",     # s1
154                                                   "Hypothetical genes not in subsystems", # n1                                                   "Hypothetical genes not in subsystems", # n1
155                                                   "RNAs")) . "\n";                                                   "RNAs",
156                                                       ])) . "\n";
157          # Set up some useful stuff for the four count columns.          # Set up some useful stuff for the four count columns.
158          my %linkParms = ( s0 => "nohypo_sub", n0 => "nohypo_nosub",          my %linkParms = ( s0 => "nothypo_sub", n0 => "nothypo_nosub",
159                            s1 => "hypo_sub", n1 => "hypo_nosub" );                            s1 => "hypo_sub", n1 => "hypo_nosub" );
160          my @columnTypes = ('s0', 'n0', 's1', 'n1');          my @columnTypes = ('s0', 'n0', 's1', 'n1');
161          # The data rows will be built next. We'll be putting them into a hash keyed by          # The data rows will be built next. We'll be putting them into a hash keyed by
# Line 161  Line 173 
173                  $new = " <span class=\"$markerStyle\">NEW!</span>";                  $new = " <span class=\"$markerStyle\">NEW!</span>";
174              }              }
175              # Get the genome length.              # Get the genome length.
176              my $genomeLen = $sprout->GenomeLength($genomeID);              my $genomeLen = Tracer::CommaFormat($sprout->GenomeLength($genomeID));
177              # Get the number of PEGs.              # Get the number of PEGs.
178              my $pegCount = $sprout->FeatureCount($genomeID, 'peg');              my $pegCount = Tracer::CommaFormat($sprout->FeatureCount($genomeID, 'peg'));
179              # Get the number of RNAs.              # Get the number of RNAs.
180              my $rnaCount = $sprout->FeatureCount($genomeID, 'rna');              my $rnaCount = Tracer::CommaFormat($sprout->FeatureCount($genomeID, 'rna'));
181              # Now we have four categories of features to work with, for each              # Now we have four categories of features to work with, for each
182              # combination of named or hypothetical vs. in-subsystem or              # combination of named or hypothetical vs. in-subsystem or
183              # not-in-subsystem. First, we get all of the feature assignments for              # not-in-subsystem. First, we get all of the feature assignments for
# Line 200  Line 212 
212                                       sprintf("%d(%.1f%%)", $counters{$type},                                       sprintf("%d(%.1f%%)", $counters{$type},
213                                               Tracer::Percent($counters{$type}, $totalFeatures)));                                               Tracer::Percent($counters{$type}, $totalFeatures)));
214              }              }
215              # Create the row text.              my @counterValues = map { $counters{$_} } @columnTypes;
216              my $rowHtml = td( "$genomeName$new", $genomeLen, $pegCount,              # Create the row text. Note that we use the distributive capability of the TD
217                                map { $counters{$_} } @columnTypes,              # function to apply the same style to each one.
218                                $rnaCount );              my $rowHtml = join("",
219                                   td("$genomeName$new"),
220                                   td({ class => $numStyle }, $genomeLen),
221                                   td({ class => $numStyle }, $pegCount),
222                                   td({ class => $counterStyle }, \@counterValues),
223                                   td({ class => $numStyle }, $rnaCount),
224                                  );
225              # Put it in the row hash.              # Put it in the row hash.
226              $rows{$genomeName} = $rowHtml;              $rows{$genomeName} = $rowHtml;
227          }          }
# Line 222  Line 240 
240              # Count the row.              # Count the row.
241              $rowCount++;              $rowCount++;
242          }          }
243          # All done, close the file.          # All done, terminate the table and close the file.
244            print GROUPFILE "</table>\n";
245          close GROUPFILE;          close GROUPFILE;
246          Trace("$rowCount genomes processed.") if T(2);          Trace("$rowCount genomes processed.") if T(2);
247      }      }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3