[Bio] / FigKernelScripts / TransactFeatures.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/TransactFeatures.pl

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

revision 1.6, Thu Aug 11 05:16:46 2005 UTC revision 1.12, Mon Aug 15 21:08:56 2005 UTC
# Line 37  Line 37 
37  Annotate the features created by the transactions so as to indicate how they were  Annotate the features created by the transactions so as to indicate how they were
38  derived.  derived.
39    
40    =item check
41    
42    Verify that the locations and translations of the new and changed features are
43    correct.
44    
45  =item fix  =item fix
46    
47  Fix the locations of new features and verify the translations of new and changed  Fix the locations and translations of the new and changed features.
48  features.  
49    =item aliasMove
50    
51    Move the aliases from the old features to the ones that replaced them.
52    
53    =item attribute
54    
55    Move the attributes from the old features to the ones that replaced them.
56    
57    =item attributeCheck
58    
59    Same as C<attribute>, but no changes are made to the database.
60    
61  =back  =back
62    
# Line 155  Line 171 
171  Assume that the transaction files do not contain aliases. This means that in CHANGE  Assume that the transaction files do not contain aliases. This means that in CHANGE
172  records the translation will immediately follow the location.  records the translation will immediately follow the location.
173    
174    =item sql
175    
176    Trace SQL commands.
177    
178    =item start
179    
180    ID of the first genome to process. This allows restarting a transaction run that failed
181    in the middle. The default is to run all transaction files.
182    
183    =back
184    
185  =cut  =cut
186    
187  use strict;  use strict;
# Line 170  Line 197 
197  use ApplyTransactions;  use ApplyTransactions;
198  use CountTransactions;  use CountTransactions;
199  use AnnotateTransactions;  use AnnotateTransactions;
200    use AttributeTransactions;
201  use FixTransactions;  use FixTransactions;
202    use MoveAliases;
203    
204  # Get the command-line options.  # Get the command-line options.
205  my ($options, @parameters) = Tracer::ParseCommand({ trace => 3, safe => 0, noAlias => 0 }, @ARGV);  my ($options, @parameters) = Tracer::ParseCommand({ trace => 3, sql => 0, safe => 0, noAlias => 0,
206                                                        start => ' '},
207                                                      @ARGV);
208    # Get the command.
209    my $mainCommand = lc shift @parameters;
210  # Set up tracing.  # Set up tracing.
211  my $traceLevel = $options->{trace};  my $traceLevel = $options->{trace};
212  TSetup("$traceLevel Tracer DocUtils FIG", "TEXT");  my $tracing = "$traceLevel Tracer DocUtils FIG";
213    if ($options->{sql}) {
214        $tracing .= " SQL";
215    }
216    TSetup($tracing, "TEXT");
217  # Get the FIG object.  # Get the FIG object.
218  my $fig = FIG->new();  my $fig = FIG->new();
 # Get the command.  
 my $mainCommand = lc shift @parameters;  
219  # Create the transaction object.  # Create the transaction object.
220  my $controlBlock;  my $controlBlock;
221  if ($mainCommand eq 'count' || $mainCommand eq 'register') {  if ($mainCommand eq 'count' || $mainCommand eq 'register') {
# Line 189  Line 224 
224      $controlBlock = ApplyTransactions->new($options, $mainCommand, @parameters);      $controlBlock = ApplyTransactions->new($options, $mainCommand, @parameters);
225  } elsif ($mainCommand eq 'annotate') {  } elsif ($mainCommand eq 'annotate') {
226      $controlBlock = AnnotateTransactions->new($options, $mainCommand, @parameters);      $controlBlock = AnnotateTransactions->new($options, $mainCommand, @parameters);
227  } elsif ($mainCommand eq 'fix') {  } elsif ($mainCommand eq 'fix' || $mainCommand eq 'check') {
228      $controlBlock = FixTransactions->new($options, $mainCommand, @parameters);      $controlBlock = FixTransactions->new($options, $mainCommand, @parameters);
229    } elsif ($mainCommand eq 'aliasmove') {
230        $controlBlock = MoveAliases->new($options, $mainCommand, @parameters);
231    } elsif ($mainCommand eq 'attribute') {
232        $controlBlock = AttributeTransactions->new($options, $mainCommand, @parameters);
233    } elsif ($mainCommand eq 'attributecheck') {
234        $controlBlock = AttributeTransactions->new($options, $mainCommand, @parameters);
235  } else {  } else {
236      Confess("Invalid command \"$mainCommand\" specified on command line.");      Confess("Invalid command \"$mainCommand\" specified on command line.");
237  }  }
# Line 205  Line 246 
246      my $orgsFound = 0;      my $orgsFound = 0;
247      my %transFiles = ();      my %transFiles = ();
248      my @transDirectory = OpenDir($parameters[0], 1);      my @transDirectory = OpenDir($parameters[0], 1);
249        # Pull out the "start" option value. This will be a space if all genomes should
250        # be processed, in which case it will always compare less than the genome ID.
251        my $startGenome = $options->{start};
252      # The next step is to create a hash of organism IDs to file names. This      # The next step is to create a hash of organism IDs to file names. This
253      # saves us some painful parsing later.      # saves us some painful parsing later.
254      for my $transFileName (@transDirectory) {      for my $transFileName (@transDirectory) {
255            # Parse the file name. This will only match if it's a real transaction file.
256          if ($transFileName =~ /^tbl_diff_(\d+\.\d+)$/) {          if ($transFileName =~ /^tbl_diff_(\d+\.\d+)$/) {
257                # Get the genome ID;
258                my $genomeID = $1;
259                # If we're skipping, only include this genome ID if it's equal to
260                # or greater than the start value.
261                if ($genomeID > $startGenome) {
262              $transFiles{$1} = "$parameters[0]/$transFileName";              $transFiles{$1} = "$parameters[0]/$transFileName";
263              $orgsFound++;              $orgsFound++;
264          }          }
265      }      }
266        }
267      Trace("$orgsFound genome transaction files found in directory $parameters[0].") if T(2);      Trace("$orgsFound genome transaction files found in directory $parameters[0].") if T(2);
268      if (! $orgsFound) {      if (! $orgsFound) {
269          Confess("No \"tbl_diff\" files found in directory $parameters[1].");          Confess("No \"tbl_diff\" files found in directory $parameters[1].");

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3