[Bio] / FortyEight / rp_rapid_propagation.pl Repository:
ViewVC logotype

Diff of /FortyEight/rp_rapid_propagation.pl

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

revision 1.1, Thu Feb 1 20:03:54 2007 UTC revision 1.7, Wed Oct 10 20:50:55 2007 UTC
# Line 8  Line 8 
8  use FIG_Config;  use FIG_Config;
9  use File::Basename;  use File::Basename;
10  use GenomeMeta;  use GenomeMeta;
11    use Carp 'croak';
12    
13  @ARGV == 1 or die "Usage: $0 job-dir\n";  @ARGV == 1 or die "Usage: $0 job-dir\n";
14    
# Line 15  Line 16 
16    
17  -d $jobdir or die "$0: job dir $jobdir does not exist\n";  -d $jobdir or die "$0: job dir $jobdir does not exist\n";
18    
19    my $hostname = `hostname`;
20    chomp $hostname;
21    
22  my $genome = &FIG::file_head("$jobdir/GENOME_ID");  my $genome = &FIG::file_head("$jobdir/GENOME_ID");
23  chomp $genome;  chomp $genome;
24  $genome =~ /^\d+\.\d+/ or die "$0: Cannnot find genome ID for jobdir $jobdir\n";  $genome =~ /^\d+\.\d+/ or die "$0: Cannnot find genome ID for jobdir $jobdir\n";
# Line 35  Line 39 
39      &fatal("raw genome directory $raw_dir does not exist");      &fatal("raw genome directory $raw_dir does not exist");
40  }  }
41    
42    $meta->set_metadata("rp.hostname", $hostname);
43    
44  #  #
45  # Perform the rapid propagation.  # Perform the rapid propagation.
# Line 48  Line 53 
53  # and rerun reformat_contigs without the split option in order  # and rerun reformat_contigs without the split option in order
54  # to recover the original contig coordinates.  # to recover the original contig coordinates.
55  #  #
56    # If keep_genecalls is enabled, we do not split the contigs.
57    #
58    
59    my $keep_genecalls = $meta->get_metadata("keep_genecalls");
60  my $unformatted = "$raw_dir/unformatted_contigs";  my $unformatted = "$raw_dir/unformatted_contigs";
61    
62  if (! -f $unformatted)  if (! -f $unformatted)
# Line 59  Line 67 
67  #  #
68  # Reformat and split.  # Reformat and split.
69  #  #
70    # Only do this if we are doing gene calling.
71    #
72    
73  my $formatted = "$raw_dir/contigs";  my $formatted = "$raw_dir/contigs";
74    my @cmd;
75    
76    if ($keep_genecalls)
77    {
78        my $reformat_log = "$errdir/reformat_contigs.stderr";
79    
80        @cmd = ("$FIG_Config::bin/reformat_contigs", "-v", "-logfile=$reformat_log", $unformatted, $formatted);
81    }
82    else
83    {
84  my $reformat_split_log = "$errdir/reformat_contigs_split.stderr";  my $reformat_split_log = "$errdir/reformat_contigs_split.stderr";
85    
86  my @cmd = ("$FIG_Config::bin/reformat_contigs", "-v", "-logfile=$reformat_split_log", "-split", $unformatted, $formatted);      @cmd = ("$FIG_Config::bin/reformat_contigs", "-v", "-logfile=$reformat_split_log", "-split", $unformatted, $formatted);
87    }
88    
89  print "Run @cmd\n";  print "Run @cmd\n";
90    
# Line 84  Line 105 
105    
106  &FIG::verify_dir("$jobdir/rp");  &FIG::verify_dir("$jobdir/rp");
107    
108    #
109    # Determine if we are keeping the original gene calls.
110    #
111    
112    my @keep_genecalls_flag;
113    
114    if ($keep_genecalls)
115    {
116        $meta->add_log_entry($0, "Keeping original gene calls");
117        @keep_genecalls_flag = ("--keep");
118    }
119    
120  @cmd = ("$FIG_Config::bin/rapid_propagation", "--errdir", $errdir,  @cmd = ("$FIG_Config::bin/rapid_propagation", "--errdir", $errdir,
121          "--meta", $meta_file, "--tmpdir", $tmpdir, $raw_dir, $rp_dir);          @keep_genecalls_flag,
122            "--meta", $meta_file,
123            "--tmpdir", $tmpdir,
124            $raw_dir, $rp_dir);
125  print "Run @cmd\n";  print "Run @cmd\n";
126  $meta->add_log_entry($0, ['running', @cmd]);  $meta->add_log_entry($0, ['running', @cmd]);
127    
# Line 116  Line 152 
152      my($msg) = @_;      my($msg) = @_;
153    
154      $meta->add_log_entry($0, ['fatal error', $msg]);      $meta->add_log_entry($0, ['fatal error', $msg]);
155      $meta->set_metadata("status.auto_assign", "error");      $meta->set_metadata("rp.error", $msg);
156        $meta->set_metadata("rp.running", "no");
157        $meta->set_metadata("status.rp", "error");
158    
159      croak "$0: $msg";      croak "$0: $msg";
160  }  }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3