[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.15, Mon Sep 12 00:24:37 2005 UTC
# Line 7  Line 7 
7  a command. The second specifies a directory full of transaction files. The third  a command. The second specifies a directory full of transaction files. The third
8  specifies a file that tells us which feature IDs are available for each organism.  specifies a file that tells us which feature IDs are available for each organism.
9    
10  C<TransactFeatures> I<[options]> I<command> I<transactionDirectory> I<idFile>  C<TransactFeatures> [I<options>] I<command> I<transactionDirectory> I<idFile>
11    
12  The supported commands are  The supported commands are
13    
# Line 16  Line 16 
16  =item count  =item count
17    
18  Count the number of IDs needed to process the ADD and CHANGE transactions. This  Count the number of IDs needed to process the ADD and CHANGE transactions. This
19  will produce an listing of the number of feature IDs needed for each  will produce a listing of the number of feature IDs needed for each
20  organism and feature type. This command is mostly a sanity check: it provides  organism and feature type. This command is mostly a sanity check: it provides
21  useful statistics without changing anything.  useful statistics without changing anything.
22    
# Line 28  Line 28 
28    
29  =item process  =item process
30    
31  Process the transactions and update the FIG data store. This will also create  Process the transactions and update the FIG data store. This will also update
32  a copy of each transaction file in which the pseudo-IDs have been replaced by  the NR file and queue features for similarity generation.
 real IDs.  
33    
34  =item annotate  =item fudge
35    
36  Annotate the features created by the transactions so as to indicate how they were  Convert transactions that have already been applied to new transactions that can
37  derived.  be used to test the transaction processor.
   
 =item fix  
   
 Fix the locations of new features and verify the translations of new and changed  
 features.  
38    
39  =back  =back
40    
# Line 155  Line 149 
149  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
150  records the translation will immediately follow the location.  records the translation will immediately follow the location.
151    
152    =item sql
153    
154    Trace SQL commands.
155    
156    =item tblFiles
157    
158    Output TBL files containing the corrected IDs. (B<process> command only)
159    
160    =item start
161    
162    ID of the first genome to process. This allows restarting a transaction run that failed
163    in the middle. The default is to run all transaction files.
164    
165    =back
166    
167  =cut  =cut
168    
169  use strict;  use strict;
170  use Tracer;  use Tracer;
171  use DocUtils;  use DocUtils;
 use TestUtils;  
172  use Cwd;  use Cwd;
173  use File::Copy;  use File::Copy;
174  use File::Path;  use File::Path;
# Line 169  Line 177 
177  use TransactionProcessor;  use TransactionProcessor;
178  use ApplyTransactions;  use ApplyTransactions;
179  use CountTransactions;  use CountTransactions;
180  use AnnotateTransactions;  use FudgeTransactions;
 use FixTransactions;  
181    
182  # Get the command-line options.  # Get the command-line options.
183  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,
184                                                        start => ' ', tblFiles => 0},
185                                                      @ARGV);
186    # Get the command.
187    my $mainCommand = lc shift @parameters;
188  # Set up tracing.  # Set up tracing.
189  my $traceLevel = $options->{trace};  my $traceLevel = $options->{trace};
190  TSetup("$traceLevel Tracer DocUtils FIG", "TEXT");  my $tracing = "$traceLevel Tracer DocUtils FIG";
191    if ($options->{sql}) {
192        $tracing .= " SQL";
193    }
194    TSetup($tracing, "TEXT");
195  # Get the FIG object.  # Get the FIG object.
196  my $fig = FIG->new();  my $fig = FIG->new();
 # Get the command.  
 my $mainCommand = lc shift @parameters;  
197  # Create the transaction object.  # Create the transaction object.
198  my $controlBlock;  my $controlBlock;
199  if ($mainCommand eq 'count' || $mainCommand eq 'register') {  if ($mainCommand eq 'count' || $mainCommand eq 'register') {
200      $controlBlock = CountTransactions->new($options, $mainCommand, @parameters);      $controlBlock = CountTransactions->new($options, $mainCommand, @parameters);
201  } elsif ($mainCommand eq 'process') {  } elsif ($mainCommand eq 'process') {
202      $controlBlock = ApplyTransactions->new($options, $mainCommand, @parameters);      $controlBlock = ApplyTransactions->new($options, $mainCommand, @parameters);
203  } elsif ($mainCommand eq 'annotate') {  } elsif ($mainCommand eq 'fudge') {
204      $controlBlock = AnnotateTransactions->new($options, $mainCommand, @parameters);      $controlBlock = FudgeTransactions->new($options, $mainCommand, @parameters);
 } elsif ($mainCommand eq 'fix') {  
     $controlBlock = FixTransactions->new($options, $mainCommand, @parameters);  
205  } else {  } else {
206      Confess("Invalid command \"$mainCommand\" specified on command line.");      Confess("Invalid command \"$mainCommand\" specified on command line.");
207  }  }
# Line 205  Line 216 
216      my $orgsFound = 0;      my $orgsFound = 0;
217      my %transFiles = ();      my %transFiles = ();
218      my @transDirectory = OpenDir($parameters[0], 1);      my @transDirectory = OpenDir($parameters[0], 1);
219        # Pull out the "start" option value. This will be a space if all genomes should
220        # be processed, in which case it will always compare less than the genome ID.
221        my $startGenome = $options->{start};
222      # 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
223      # saves us some painful parsing later.      # saves us some painful parsing later.
224      for my $transFileName (@transDirectory) {      for my $transFileName (@transDirectory) {
225            # Parse the file name. This will only match if it's a real transaction file.
226          if ($transFileName =~ /^tbl_diff_(\d+\.\d+)$/) {          if ($transFileName =~ /^tbl_diff_(\d+\.\d+)$/) {
227                # Get the genome ID;
228                my $genomeID = $1;
229                # If we're skipping, only include this genome ID if it's equal to
230                # or greater than the start value.
231                if ($genomeID ge $startGenome) {
232              $transFiles{$1} = "$parameters[0]/$transFileName";              $transFiles{$1} = "$parameters[0]/$transFileName";
233              $orgsFound++;              $orgsFound++;
234          }          }
235      }      }
236        }
237      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);
238      if (! $orgsFound) {      if (! $orgsFound) {
239          Confess("No \"tbl_diff\" files found in directory $parameters[1].");          Confess("No \"tbl_diff\" files found in directory $parameters[1].");
# Line 253  Line 274 
274                  }                  }
275                  $controlBlock->IncrementStat($command);                  $controlBlock->IncrementStat($command);
276              }              }
277                # Close the transaction input file.
278                close TRANS;
279              # Terminate processing for this genome.              # Terminate processing for this genome.
280              my $orgStats = $controlBlock->EndGenome();              my $orgStats = $controlBlock->EndGenome();
281              Trace("Statistics for $genomeID\n\n" . $orgStats->Show() . "\n") if T(3);              Trace("Statistics for $genomeID\n\n" . $orgStats->Show() . "\n") if T(3);
             # Close the transaction input file.  
             close TRANS;  
282          }          }
283      }      }
284      # Terminate processing.      # Terminate processing.

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3