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

Diff of /Sprout/NewStuffCheck.pl

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

revision 1.1, Thu Aug 24 07:59:23 2006 UTC revision 1.2, Thu Aug 24 08:11:39 2006 UTC
# Line 9  Line 9 
9    
10  =over 4  =over 4
11    
12    =item summary
13    
14    Do not display details, only difference summaries.
15    
16  =item user  =item user
17    
18  Name suffix to be used for log files. If omitted, the PID is used.  Name suffix to be used for log files. If omitted, the PID is used.
# Line 57  Line 61 
61  # Get the command-line options and parameters.  # Get the command-line options and parameters.
62  my ($options, @parameters) = StandardSetup([qw(Sprout) ],  my ($options, @parameters) = StandardSetup([qw(Sprout) ],
63                                             {                                             {
64                                                  summary => ["", "if specified, detailed lists of the different items will not be displayed"],
65                                                phone => ["", "phone number (international format) to call when load finishes"],                                                phone => ["", "phone number (international format) to call when load finishes"],
66                                             },                                             },
67                                             "",                                             "",
# Line 65  Line 70 
70  my $rtype;  my $rtype;
71  # Insure we catch errors.  # Insure we catch errors.
72  eval {  eval {
73        Trace("Processing genomes.") if T(2);
74      # Get the old Sprout.      # Get the old Sprout.
75      my $oldSprout = SFXlate->new_sprout_only($FIG_Config::oldSproutDB);      my $oldSprout = SFXlate->new_sprout_only($FIG_Config::oldSproutDB);
76      # Get its genomes in alphabetical order.      # Get its genomes in alphabetical order.
# Line 76  Line 82 
82      # Compare the two gene lists.      # Compare the two gene lists.
83      my ($insertedGenomes, $deletedGenomes) = Tracer::CompareLists(\@newGenomes, \@oldGenomes);      my ($insertedGenomes, $deletedGenomes) = Tracer::CompareLists(\@newGenomes, \@oldGenomes);
84      # Display the lists.      # Display the lists.
85      ShowLists('New Genomes' => $insertedGenomes, 'Deleted Genomes' => $deletedGenomes);      ShowLists(! $options->{summary},
86                  'New Genomes'     => $insertedGenomes,
87                  'Deleted Genomes' => $deletedGenomes);
88      # Next, we get the subsystems.      # Next, we get the subsystems.
89        Trace("Processing subsystems.") if T(2);
90      my @oldSubsystems = GetSubsystems($oldSprout);      my @oldSubsystems = GetSubsystems($oldSprout);
91      my @newSubsystems = GetSubsystems($newSprout);      my @newSubsystems = GetSubsystems($newSprout);
92      # Compare and display the subsystem lists.      # Compare and display the subsystem lists.
93      my ($insertedSubs, $deletedSubs) = Tracer::CompareLists(\@newSubsystems, \@oldSubsystems);      my ($insertedSubs, $deletedSubs) = Tracer::CompareLists(\@newSubsystems, \@oldSubsystems);
94      ShowLists('New Subsystems' => $insertedSubs, 'Deleted Subsystems' => $deletedSubs);      ShowLists(! $options->{summary},
95                  'New Subsystems'     => $insertedSubs,
96                  'Deleted Subsystems' => $deletedSubs);
97      # Now we process the features of the common genes. First we need a hash      # Now we process the features of the common genes. First we need a hash
98      # of the inserted stuff so we know to skip it.      # of the inserted stuff so we know to skip it.
99      my %skipGenes = map { $_->[0] => 1 } @{$insertedGenomes};      my %skipGenes = map { $_->[0] => 1 } @{$insertedGenomes};
# Line 91  Line 102 
102          # Only process this gene if it's common to both          # Only process this gene if it's common to both
103          my ($genomeID, $genomeName) = @{$genome};          my ($genomeID, $genomeName) = @{$genome};
104          if (! exists $skipGenes{$genomeID}) {          if (! exists $skipGenes{$genomeID}) {
105                Trace("Processing $genomeID.") if T(3);
106              # Get the new and old features. This will be very stressful to the machine,              # Get the new and old features. This will be very stressful to the machine,
107              # because there are lots of features.              # because there are lots of features.
108              my @oldFeatures = GetFeatures($oldSprout, $genomeID);              my @oldFeatures = GetFeatures($oldSprout, $genomeID);
109              my @newFeatures = GetFeatures($newSprout, $genomeID);              my @newFeatures = GetFeatures($newSprout, $genomeID);
110                Trace("Comparing features for $genomeID.") if T(3);
111              # Compare the lists.              # Compare the lists.
112              my ($insertedFeatures, $deletedFeatures) = Tracer::CompareLists(\@newFeatures, \@oldFeatures);              my ($insertedFeatures, $deletedFeatures) = Tracer::CompareLists(\@newFeatures, \@oldFeatures);
113              # If either list has data, we want to display it.              # If either list has data, we want to display it.
114              if (scalar @{$insertedFeatures} + scalar @{$deletedFeatures} > 0) {              if (! scalar @{$insertedFeatures} + scalar @{$deletedFeatures} > 0) {
115                  ShowLists("New Features for $genomeID"      => $insertedFeatures,                  Trace("Displaying feature differences.") if T(3);
116                    ShowLists($options->{summary},
117                              "New Features for $genomeID"      => $insertedFeatures,
118                            "Features Deleted from $genomeID" => $deletedFeatures);                            "Features Deleted from $genomeID" => $deletedFeatures);
119              }              }
120          }          }
# Line 226  Line 241 
241    
242  =head3 ShowLists  =head3 ShowLists
243    
244  C<< ShowLists(%lists); >>  C<< ShowLists($all, %lists); >>
245    
246  Display a set of lists. The name and count are displayed at level 2 and  Display a set of lists. Each list should consist of 2-tuples.
 the entries at level 3. Each list should consist of 2-tuples.  
247    
248  =over 4  =over 4
249    
250    =item all
251    
252    TRUE if details should be displayed; FALSE if only summaries should be displayed.
253    
254  =item lists  =item lists
255    
256  A hash mapping list names to list references.  A hash mapping list names to list references.
# Line 241  Line 259 
259    
260  sub ShowLists {  sub ShowLists {
261      # Get the parameters.      # Get the parameters.
262        my $all = shift @_;
263      my %lists = @_;      my %lists = @_;
264      # Loop through the lists in alphabetical order by list name.      # Loop through the lists in alphabetical order by list name.
265      for my $listName (keys %lists) {      for my $listName (keys %lists) {
# Line 250  Line 269 
269          my $listSize = scalar @{$list};          my $listSize = scalar @{$list};
270          # Display the header.          # Display the header.
271          if ($listSize == 0) {          if ($listSize == 0) {
272              Trace("*** $listName: no entries") if T(2);              print "*** $listName: no entries\n";
273          } elsif ($listSize == 1) {          } elsif ($listSize == 1) {
274              Trace("*** $listName: one entry") if T(2);              print "*** $listName: one entry\n";
275          } else {          } else {
276              Trace("*** $listName: $listSize entries") if T(2);              print "*** $listName: $listSize entries\n";
277          }          }
278          # If we're at trace level 3, display the list.          # If we're at trace level 3, display the list.
279          if (T(3)) {          if ($all) {
280              # Put a spacer under the title.              # Put a spacer under the title.
281              Trace("");              print "\n";
282              # Get the width of the name column.              # Get the width of the name column.
283              my $width = 0;              my $width = 0;
284              for my $entryLen (map { length $_->[0] } @{$list}) {              for my $entryLen (map { length $_->[0] } @{$list}) {
# Line 268  Line 287 
287              # Now display the list.              # Now display the list.
288              for my $entry (@{$list}) {              for my $entry (@{$list}) {
289                  my ($name, $data) = @{$entry};                  my ($name, $data) = @{$entry};
290                  Trace("    $name" . (" " x ($width - length $name)) . " $data");                  print "    $name" . (" " x ($width - length $name)) . " $data\n";
291              }              }
292              Trace("");              print "\n\n";
             Trace("");  
293          }          }
294      }      }
295  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3