[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.10, Tue Oct 3 02:48:59 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                                             {                                             {
85                                              age => [14, 'maximum age of a new annotation'],                                              trace => [2, 'tracing level'],
86                                              target => ["$FIG_Config::nmpdr_pages/includes",                                              target => ["$FIG_Config::nmpdr_pages/includes",
87                                                            'output directory'],                                                            'output directory'],
88                                             },                                             },
# Line 107  Line 102 
102      Trace("Output going to $targetDir.") if T(2);      Trace("Output going to $targetDir.") if T(2);
103      # Get the Sprout object.      # Get the Sprout object.
104      my $sfx = SFXlate->new_sprout_only();      my $sfx = SFXlate->new_sprout_only();
105        # Get the old Sprout.
106        my $oldSprout = SFXlate->new_sprout_only($FIG_Config::oldSproutDB);
107      # Create the counts file.      # Create the counts file.
108      CreateCounts($sfx, $options->{age}, $parameters[0], "$targetDir/version.inc");      CreateCounts($sfx, $oldSprout, $parameters[0], "$targetDir/version.inc");
109      # Create the subsystem summary file.      # Create the subsystem summary file.
110      CreateSubForm($sfx, "$targetDir/forms/subsystems.inc");      CreateSubForm($sfx, "$targetDir/forms/subsystems.inc");
111      # Create the database documentation file.      # Create the database documentation file.
# Line 129  Line 126 
126    
127  A Sprout object for accessing the database.  A Sprout object for accessing the database.
128    
129  =item age  =item oldSfx
130    
131  The maximum age for an annotation to be considered new.  A Sprout object for accessing the previous database.
132    
133  =item versionDate  =item versionDate
134    
# Line 147  Line 144 
144    
145  sub CreateCounts {  sub CreateCounts {
146      # Get the parameters.      # Get the parameters.
147      my ($sfx, $age, $versionDate, $fileName) = @_;      my ($sfx, $oldSfx, $versionDate, $fileName) = @_;
148      # Open the output file.      # Open the output file.
149      my $handle = Open(undef, ">$fileName");      my $handle = Open(undef, ">$fileName");
150      # Start the heading.      # Start the heading.
# Line 175  Line 172 
172      print $handle "<br />$output";      print $handle "<br />$output";
173      # Get the number of subsystems.      # Get the number of subsystems.
174      my $subsystems = $sfx->GetCount(['Subsystem'], "", []);      my $subsystems = $sfx->GetCount(['Subsystem'], "", []);
175      print $handle "<br />$subsystems subsystems";      print $handle "<br />$subsystems active subsystems";
176      # Get the current time and subtract the number of days indicated by the age.      # Count the number of new annotations and features.
177      my $time = time() - $age * 86400;      my %things = ( Annotation => 'annotations',
178      # Count the number of new annotations.                     Feature => 'features',
179      my $newAnnotations = $sfx->GetCount(['Annotation'], "Annotation(time) >= ?",                     Genome => 'organisms'
180                                          [$time]);                   );
181        for my $thing (sort keys %things) {
182            my $newCount = $sfx->GetCount([$thing], "", []);
183            my $oldCount = $oldSfx->GetCount([$thing], "", []);
184            my $delta = $newCount - $oldCount;
185      # Only display them if there's a reasonable number.      # Only display them if there's a reasonable number.
186      if ($newAnnotations > 5) {          if ($delta > 5) {
187          print $handle ", $newAnnotations new annotations";              print $handle ", $delta&nbsp;new&nbsp;$things{$thing}";
188            }
189      }      }
190      # Terminate the heading.      # Terminate the heading.
191      print $handle ".</h3>\n";      print $handle ".</h3>\n";

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3