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

Diff of /Sprout/SimLoad.pl

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

revision 1.3, Fri Jan 6 20:35:01 2006 UTC revision 1.4, Wed Jan 11 19:39:20 2006 UTC
# Line 33  Line 33 
33  =item trace  =item trace
34    
35  Trace level for output messages. A higher number means more  Trace level for output messages. A higher number means more
36  messages. The default is C<2>. Trace messages are sent to  messages. The default is C<3>. Trace messages are sent to
37  the file C<trace.log> in the B<$FIG_Config::tmp>  the file C<trace.log> in the B<$FIG_Config::tmp>
38  directory.  directory.
39    
40    =item sql
41    
42    If specified, SQL activity will be traced at the specified
43    trace level.
44    
45  =item load  =item load
46    
47  C<yes> to load the data into the database, else C<no>.  C<yes> to load the data into the database, else C<no>.
# Line 280  Line 285 
285  my $TRAILER = 999999999;  my $TRAILER = 999999999;
286    
287  # Parse the command line.  # Parse the command line.
288  my ($options, @arguments) = Tracer::ParseCommand({ trace => 1,  my ($options, @arguments) = Tracer::StandardSetup(['SimBlocks'],
289                                                    load => 'yes',                                                    { load => 'yes',
290                                                    generate => 'yes'},                                                    generate => 'yes'},
291                                                   @ARGV);                                                   @ARGV);
292  # Extract the directory name from the argument array.  # Extract the directory name from the argument array.
# Line 289  Line 294 
294  if ($arguments[0]) {  if ($arguments[0]) {
295      $inDirectoryTree = Cwd::abs_path($arguments[0]);      $inDirectoryTree = Cwd::abs_path($arguments[0]);
296  }  }
 # Set up tracing.  
 my $traceLevel = $options->{trace};  
 TSetup("$traceLevel Tracer ERDB SimBlocks DBKernel SQL", "+>$FIG_Config::temp/trace.log");  
297  # Get the output directory.  # Get the output directory.
298  my $outDirectory = $FIG_Config::simBlocksData;  my $outDirectory = $FIG_Config::simBlocksData;
299  # Insure that it exists.  # Insure that it exists.
300  if (! -d $outDirectory) {  if (! -d $outDirectory) {
301      Trace("Creating output directory $outDirectory.") if T(2);      Trace("Creating output directory $outDirectory.") if T(2);
302      mkpath($outDirectory);      mkpath($outDirectory);
303  } else {  } elsif ($options->{generate} eq 'yes') {
304      # Here we have an output directory already. Clear any      # Here we have an output directory already and are going to generate new
305      # leftover data from previous runs.      # load files. Clear any leftover data from previous runs.
306      my @files = grep { $_ =~ /.dtx$/ } Tracer::OpenDir($outDirectory);      my @files = grep { $_ =~ /.dtx$/ } Tracer::OpenDir($outDirectory);
307      my $numFiles = @files;      my $numFiles = @files;
308      if ($numFiles > 0) {      if ($numFiles > 0) {
# Line 500  Line 502 
502                  Trace("No regions found for block $blockID at $blocksCount in block input file.") if T(0);                  Trace("No regions found for block $blockID at $blocksCount in block input file.") if T(0);
503                  $errorCount++;                  $errorCount++;
504              } else {              } else {
505                  Trace("$regionCounter regions found in block $blockID.") if T(2);                  Trace("$regionCounter regions found in block $blockID.") if T(4);
506                  # Write the block record.                  # Write the block record.
507                  my $variance = $blockData{"snip-count"} / $blockData{len};                  my $variance = $blockData{"snip-count"} / $blockData{len};
508                  print BLOCKSOUT join("\t", $blockID, $blockData{description}, $blockData{len},                  print BLOCKSOUT join("\t", $blockID, $blockData{description}, $blockData{len},
# Line 527  Line 529 
529                                            $regionPeg{$region}, $location->Left, $content) . "\n";                                            $regionPeg{$region}, $location->Left, $content) . "\n";
530                      print CONTAINSOUT join("\t", $location->Contig, $region,                      print CONTAINSOUT join("\t", $location->Contig, $region,
531                                             $location->Length, $location->Left) . "\n";                                             $location->Length, $location->Left) . "\n";
532                      print INCLUDESOUT join("\t", $blockID, $region);                      print INCLUDESOUT join("\t", $blockID, $region) . "\n";
533                  }                  }
534                  # Finally, we need to connect this block to the genomes in which it occurs.                  # Finally, we need to connect this block to the genomes in which it occurs.
535                  for my $genomeID (keys %genomesFound) {                  for my $genomeID (keys %genomesFound) {
# Line 558  Line 560 
560          $contigsCount++;          $contigsCount++;
561      }      }
562      Trace("$contigsCount contigs found.") if T(2);      Trace("$contigsCount contigs found.") if T(2);
563        # Close the output files.
564        close CONTIGSOUT;
565        close CONSISTSOUT;
566      # Now warn the user about all the genomes that didn't have blocks.      # Now warn the user about all the genomes that didn't have blocks.
567      for my $genomeID (keys %genomes) {      for my $genomeID (keys %genomes) {
568          if (! $genomes{$genomeID}) {          if (! $genomes{$genomeID}) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3