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

Diff of /Sprout/ShowCounts.pl

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

revision 1.5, Fri Jun 23 19:08:58 2006 UTC revision 1.9, Tue Jun 27 17:06:41 2006 UTC
# Line 60  Line 60 
60    
61  Display this command's parameters and options.  Display this command's parameters and options.
62    
 =item age  
   
 Maximum age in days of an annotation for it to be considered new. The default is  
 C<14>.  
   
63  =item target  =item target
64    
65  Target directory for the include files. The default is C<includes> in the  Target directory for the include files. The default is C<includes> in the
# Line 87  Line 82 
82  # Get the command-line options and parameters.  # Get the command-line options and parameters.
83  my ($options, @parameters) = StandardSetup([qw(Sprout ERDB SFXlate) ],  my ($options, @parameters) = StandardSetup([qw(Sprout ERDB SFXlate) ],
84                                             {                                             {
                                             age => [14, 'maximum age of a new annotation'],  
85                                              target => ["$FIG_Config::nmpdr_pages/includes",                                              target => ["$FIG_Config::nmpdr_pages/includes",
86                                                            'output directory'],                                                            'output directory'],
87                                             },                                             },
# Line 107  Line 101 
101      Trace("Output going to $targetDir.") if T(2);      Trace("Output going to $targetDir.") if T(2);
102      # Get the Sprout object.      # Get the Sprout object.
103      my $sfx = SFXlate->new_sprout_only();      my $sfx = SFXlate->new_sprout_only();
104        # Get the old Sprout.
105        my $oldSprout = SFXlate->new_sprout_only($FIG_Config::oldSproutDB);
106      # Create the counts file.      # Create the counts file.
107      CreateCounts($sfx, $options->{age}, $parameters[0], "$targetDir/version.inc");      CreateCounts($sfx, $oldSprout, $parameters[0], "$targetDir/version.inc");
108      # Create the subsystem summary file.      # Create the subsystem summary file.
109      CreateSubForm($sfx, "$targetDir/forms/subsystems.inc");      CreateSubForm($sfx, "$targetDir/forms/subsystems.inc");
110      # Create the database documentation file.      # Create the database documentation file.
# Line 129  Line 125 
125    
126  A Sprout object for accessing the database.  A Sprout object for accessing the database.
127    
128  =item age  =item oldSfx
129    
130  The maximum age for an annotation to be considered new.  A Sprout object for accessing the previous database.
131    
132  =item versionDate  =item versionDate
133    
# Line 147  Line 143 
143    
144  sub CreateCounts {  sub CreateCounts {
145      # Get the parameters.      # Get the parameters.
146      my ($sfx, $age, $versionDate, $fileName) = @_;      my ($sfx, $oldSfx, $versionDate, $fileName) = @_;
147      # Open the output file.      # Open the output file.
148      my $handle = Open(undef, ">$fileName");      my $handle = Open(undef, ">$fileName");
149      # Start the heading.      # Start the heading.
# Line 175  Line 171 
171      print $handle "<br />$output";      print $handle "<br />$output";
172      # Get the number of subsystems.      # Get the number of subsystems.
173      my $subsystems = $sfx->GetCount(['Subsystem'], "", []);      my $subsystems = $sfx->GetCount(['Subsystem'], "", []);
174      print $handle "<br />$subsystems subsystems";      print $handle "<br />$subsystems active subsystems";
175      # Get the current time and subtract the number of days indicated by the age.      # Count the number of new annotations and features.
176      my $time = time() - $age * 86400;      my %things = ( Annotation => 'annotations',
177      # Count the number of new annotations.                     Feature => 'features',
178      my $newAnnotations = $sfx->GetCount(['Annotation'], "Annotation(time) >= ?",                     Genome => 'organisms'
179                                          [$time]);                   );
180        for my $thing (sort keys %things) {
181            my $newCount = $sfx->GetCount([$thing], "", []);
182            my $oldCount = $oldSfx->GetCount([$thing], "", []);
183            my $delta = $newCount - $oldCount;
184      # Only display them if there's a reasonable number.      # Only display them if there's a reasonable number.
185      if ($newAnnotations > 5) {          if ($delta > 5) {
186          print $handle ", $newAnnotations new annotations";              print $handle ", $delta&nbsp;new&nbsp;$things{$thing}";
187            }
188      }      }
189      # Terminate the heading.      # Terminate the heading.
190      print $handle ".</h3>\n";      print $handle ".</h3>\n";

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3