[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.29, Mon Aug 20 23:14:33 2007 UTC revision 1.31, Tue Feb 5 05:47:32 2008 UTC
# Line 84  Line 84 
84    
85  use strict;  use strict;
86  use Tracer;  use Tracer;
 use DocUtils;  
 use TestUtils;  
87  use Cwd;  use Cwd;
88  use File::Copy;  use File::Copy;
89  use File::Path;  use File::Path;
# Line 107  Line 105 
105                                              counterStyle => ['countercell', 'style for cells with counter values'],                                              counterStyle => ['countercell', 'style for cells with counter values'],
106                                              linkCGI => ['../FIG/genome_statistics.cgi',                                              linkCGI => ['../FIG/genome_statistics.cgi',
107                                                          'path to CGI script for detailed statistics'],                                                          'path to CGI script for detailed statistics'],
                                             groupFile => ["$FIG_Config::sproutData/groups.tbl",  
                                                           'location of the NMPDR group description file'],  
108                                              noNewCheck => [0, 'if specified, skips the check for new genomes'],                                              noNewCheck => [0, 'if specified, skips the check for new genomes'],
109                                              targetDir => ["$FIG_Config::nmpdr_base/next/html/includes",                                              targetDir => ["$FIG_Config::nmpdr_base/next/html/includes",
110                                                            'target directory'],                                                            'target directory'],
111                                              },                                              },
112                                             "",                                             "",
113                                             @ARGV);                                             @ARGV);
114    # The return type (error/no error) goes in here.
115    my $rtype;
116    eval {
117  # This table controls the special attribute columns. For each we need to know the attribute name and the  # This table controls the special attribute columns. For each we need to know the attribute name and the
118  # column title. If any genomes in a group have a value for one of the special columns, that column is  # column title. If any genomes in a group have a value for one of the special columns, that column is
119  # displayed along with the attribute values.  # displayed along with the attribute values.
# Line 132  Line 131 
131      my %newGroupHash = $sprout->GetGroups();      my %newGroupHash = $sprout->GetGroups();
132      # Extract the genome group data from the new Sprout.      # Extract the genome group data from the new Sprout.
133      if (! $options->{strict}) {      if (! $options->{strict}) {
134          %newGroupHash = Sprout::Fix(%newGroupHash);              %newGroupHash = $sprout->Fix(%newGroupHash);
135      }      }
136      # This hash will be used to determine which genomes are new.      # This hash will be used to determine which genomes are new.
137      my %oldGroupHash = ();      my %oldGroupHash = ();
# Line 146  Line 145 
145          # Extract the genome group data from the old Sprout.          # Extract the genome group data from the old Sprout.
146          %oldGroupHash = $oldSprout->GetGroups();          %oldGroupHash = $oldSprout->GetGroups();
147          if (! $options->{strict}) {          if (! $options->{strict}) {
148              %oldGroupHash = Sprout::Fix(%oldGroupHash);                  %oldGroupHash = $oldSprout->Fix(%oldGroupHash);
149          }          }
150      }      }
151      # Get a FIG object for computing attributes.      # Get a FIG object for computing attributes.
152      my $fig = FIG->new();      my $fig = FIG->new();
153      # Read the group file.          # Get the super-group list.
154      my %groupData = Sprout::ReadGroupFile($options->{groupFile});          my @superGroups = sort keys %newGroupHash;
155      # Set up some useful stuff for the four count columns.      # Set up some useful stuff for the four count columns.
156      my %linkParms = ( s0 => "nothypo_sub", n0 => "nothypo_nosub",      my %linkParms = ( s0 => "nothypo_sub", n0 => "nothypo_nosub",
157                        s1 => "hypo_sub", n1 => "hypo_nosub" );                        s1 => "hypo_sub", n1 => "hypo_nosub" );
# Line 164  Line 163 
163      # Prepare a hash for the summary counters. These will be used on the organism summary page.      # Prepare a hash for the summary counters. These will be used on the organism summary page.
164      my %summaries = ();      my %summaries = ();
165      # Loop through the groups.      # Loop through the groups.
166      for my $groupID (keys %newGroupHash) {          for my $groupID (@superGroups) {
167          Trace("Processing group $groupID.") if T(2);          Trace("Processing group $groupID.") if T(2);
168          # Create a hash for summarizing the counters.          # Create a hash for summarizing the counters.
169          my %groupTotals = ( genomes => 0, pegs => 0, RNAs => 0,          my %groupTotals = ( genomes => 0, pegs => 0, RNAs => 0,
# Line 347  Line 346 
346      for my $groupName (sort keys %summaries) {      for my $groupName (sort keys %summaries) {
347          my $group = $summaries{$groupName};          my $group = $summaries{$groupName};
348          # Compute the link for the current group.          # Compute the link for the current group.
349          my $groupLink = a({ href => $groupData{$groupName}->[0] }, $groupName);              my $groupLink = a({ href => $sprout->GroupPageName($groupName) }, $groupName);
350          # Create the table row.          # Create the table row.
351          my $rowHtml = join("",          my $rowHtml = join("",
352                             td($groupLink),                             td($groupLink),
# Line 366  Line 365 
365      # We're all done.      # We're all done.
366      Trace("Processing complete.") if T(2);      Trace("Processing complete.") if T(2);
367  }  }
368    };
369    if ($@) {
370        Trace("Stats failed with error: $@") if T(0);
371        $rtype = "error";
372    } else {
373        Trace("Stats complete.") if T(2);
374        $rtype = "no error";
375    }
376    if ($options->{phone}) {
377        my $msgID = Tracer::SendSMS($options->{phone}, "GenomeStats terminated with $rtype.");
378        if ($msgID) {
379            Trace("Phone message sent with ID $msgID.") if T(2);
380        } else {
381            Trace("Phone message not sent.") if T(2);
382        }
383    }
384    
385  1;  1;

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.31

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3