[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.6, Fri Jun 23 22:54:55 2006 UTC revision 1.7, Tue Jun 27 16:45:07 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 176  Line 172 
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 subsystems";
     # Get the current time and subtract the number of days indicated by the age.  
     my $time = time() - $age * 86400;  
175      # Count the number of new annotations.      # Count the number of new annotations.
176      my $newAnnotations = $sfx->GetCount(['Annotation'], "Annotation(time) >= ?",      my $newAnnotations = $sfx->GetCount(['Annotation'], "", []);
177                                          [$time]);      my $oldAnnotations = $oldSfx->GetCount(['Annotation'], "", []);
178        my $delta = $newAnnotations - $oldAnnotations;
179      # Only display them if there's a reasonable number.      # Only display them if there's a reasonable number.
180      if ($newAnnotations > 5) {      if ($newAnnotations > 5) {
181          print $handle ", $newAnnotations updated annotations";          print $handle ", $delta new annotations";
182      }      }
183      # Terminate the heading.      # Terminate the heading.
184      print $handle ".</h3>\n";      print $handle ".</h3>\n";

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3