[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.7, Wed Oct 10 20:50:55 2007 UTC revision 1.12, Tue Jun 23 21:18:48 2009 UTC
# Line 9  Line 9 
9  use File::Basename;  use File::Basename;
10  use GenomeMeta;  use GenomeMeta;
11  use Carp 'croak';  use Carp 'croak';
12    use POSIX;
13    
14  @ARGV == 1 or die "Usage: $0 job-dir\n";  @ARGV == 1 or die "Usage: $0 job-dir\n";
15    
# Line 57  Line 58 
58  #  #
59    
60  my $keep_genecalls = $meta->get_metadata("keep_genecalls");  my $keep_genecalls = $meta->get_metadata("keep_genecalls");
61    my $call_using_glimmer = $meta->get_metadata("use_glimmer");
62  my $unformatted = "$raw_dir/unformatted_contigs";  my $unformatted = "$raw_dir/unformatted_contigs";
63    
64  if (! -f $unformatted)  if (! -f $unformatted)
# Line 65  Line 67 
67  }  }
68    
69  #  #
70    # Determine genetic code.
71    #
72    
73    my $genetic_code = $meta->get_metadata("genome.genetic_code");
74    if (!defined($genetic_code))
75    {
76        $meta->add_log_entry("Genetic code not defined; defaulting to 11");
77        $genetic_code = 11;
78    }
79    
80    #
81  # Reformat and split.  # Reformat and split.
82  #  #
83  # Only do this if we are doing gene calling.  # Only do this if we are doing gene calling.
# Line 73  Line 86 
86  my $formatted = "$raw_dir/contigs";  my $formatted = "$raw_dir/contigs";
87  my @cmd;  my @cmd;
88    
89    my $split_size = 3;
90    if ($FIG_Config::rast_contig_ambig_split_size =~ /^\d+$/)
91    {
92        $split_size = $FIG_Config::rast_contig_ambig_split_size;
93    }
94    
95  if ($keep_genecalls)  if ($keep_genecalls)
96  {  {
97      my $reformat_log = "$errdir/reformat_contigs.stderr";      my $reformat_log = "$errdir/reformat_contigs.stderr";
# Line 83  Line 102 
102  {  {
103      my $reformat_split_log = "$errdir/reformat_contigs_split.stderr";      my $reformat_split_log = "$errdir/reformat_contigs_split.stderr";
104    
105      @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=$split_size", $unformatted, $formatted);
106  }  }
107    
108  print "Run @cmd\n";  print "Run @cmd\n";
# Line 117  Line 136 
136      @keep_genecalls_flag = ("--keep");      @keep_genecalls_flag = ("--keep");
137  }  }
138    
139    #
140    # Make sure we don't have any leftover restart directories in $errdir, since
141    # they will make rapid_propagation think it's restarting, which would be bad.
142    # Also reset the status.rp.* values to zero.
143    #
144    
145    my @restart_dirs = <$errdir/$genome.*>;
146    if (@restart_dirs)
147    {
148        my $targ = strftime("$errdir/restart.%Y-%m-%d-%H-%M-%S", localtime);
149        mkdir($targ);
150        for my $dir (@restart_dirs)
151        {
152            my $b = basename($dir);
153            rename($dir, "$targ/$b");
154            $meta->add_log_entry($0, "Moved existing restart directory $b to $targ");
155        }
156    }
157    
158    
159    #
160    # If we are to call using glimmer instead of the usual mechanism, first
161    # invoke call_genome_using_glimmer.
162    #
163    
164    if ($call_using_glimmer)
165    {
166        my @cmd = ("FIG_Config::bin/call_using_glimmer",
167                   "--glimmerV=3",
168                   "--code=$genetic_code",
169                   "--meta=$meta_file",
170                   $raw_dir);
171    
172        print "Run @cmd\n";
173        $meta->add_log_entry($0, ['running', @cmd]);
174    
175        $rc = system(@cmd);
176    
177        if ($rc != 0)
178        {
179            &fatal("call_using_glimmer command failed with rc=$rc: @cmd\n");
180        }
181    }
182    
183    for my $key (grep { /^status\.rp\./ } $meta->get_metadata_keys())
184    {
185        my $old = $meta->get_metadata($key);
186        $meta->add_log_entry($0, "Reset old $key=$old to 0");
187        $meta->set_metadata($key, 0);
188    }
189    
190  @cmd = ("$FIG_Config::bin/rapid_propagation", "--errdir", $errdir,  @cmd = ("$FIG_Config::bin/rapid_propagation", "--errdir", $errdir,
191          @keep_genecalls_flag,          @keep_genecalls_flag,
192            "--code", $genetic_code,
193          "--meta", $meta_file,          "--meta", $meta_file,
194          "--tmpdir", $tmpdir,          "--tmpdir", $tmpdir,
195          $raw_dir, $rp_dir);          $raw_dir, $rp_dir);

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3