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

Diff of /FortyEight/batch_rast.pl

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

revision 1.4, Tue Jan 12 20:23:30 2010 UTC revision 1.8, Tue Jan 19 17:16:32 2010 UTC
# Line 62  Line 62 
62  my $sims_peg_synonyms = "$sims_data_dir/peg.synonyms";  my $sims_peg_synonyms = "$sims_data_dir/peg.synonyms";
63  my $sims_keep_count = 300;  my $sims_keep_count = 300;
64    
65    my $job48 = new Job48($job_dir);
66    my $meta = $job48->meta;
67    
68    my $host = `hostname`;
69    chomp $host;
70    $meta->add_log_entry($0, "Running phases @phase on $host");
71    
72  #  #
73  # Emulate execution of SGE parallel environment via the  # Emulate execution of SGE parallel environment via the
74  # --parallel N argument.  # --parallel N argument.
# Line 72  Line 79 
79      $ENV{NSLOTS} = $parallel;      $ENV{NSLOTS} = $parallel;
80  }  }
81    
82  if ($phase == 1)  if ($phase{1})
83  {  {
84      &do_upload($job);      &do_upload($job);
85      &do_rp($job);      &do_rp($job);
86  }  }
87    
88  if ($phase == 2)  if ($phase{2})
89  {  {
90      &do_qc($job);      &do_qc($job);
91      &do_correction($job);      &do_correction($job);
92      &do_sims_preprocess($job);      &do_sims_preprocess($job);
93  }  }
94    
95  if ($phase == 3)  if ($phase{3})
96  {  {
97      #      #
98      # If running inside a SGE task array job, execute      # If running inside a SGE task array job, execute
# Line 101  Line 108 
108      }      }
109  }  }
110    
111  if ($phase == 4)  if ($phase{4})
112  {  {
113      &run("$FIG_Config::bin/rp_postproc_sims", $job->dir, $sims_nr_len, $sims_peg_synonyms, $sims_keep_count);      &do_sims_postprocess($job);
114      &do_bbhs($job);      &do_bbhs($job);
115      &do_auto_assign($job);      &do_auto_assign($job);
116      &do_glue_contigs($job);      &do_glue_contigs($job);
117      &do_pchs($job);      &do_pchs($job);
118      &do_scenario($job);      &do_scenario($job);
119      &do_export($job);      &do_export($job);
120        &mark_job_user_complete($job);
121  }  }
122    
123  sub do_upload  sub do_upload
# Line 197  Line 205 
205          die "Tasks not found";          die "Tasks not found";
206      }      }
207    
208        for my $task ($task_start .. $task_end)
209        {
210            $ENV{SGE_TASK_ID} = $task;
211            &run("$FIG_Config::bin/rp_compute_sims", $job->dir);
212        }
213    }
214    
215    sub do_sims_postprocess
216    {
217        my($job) = @_;
218    
219      my $sims_nr_len = $sims_nr;      my $sims_nr_len = $sims_nr;
220      if (-f "$sims_nr-len.btree")      if (-f "$sims_nr-len.btree")
221      {      {
222          $sims_nr_len = "$sims_nr-len.btree";          $sims_nr_len = "$sims_nr-len.btree";
223      }      }
224    
225      for my $task ($task_start .. $task_end)      &run("$FIG_Config::bin/rp_postproc_sims", $job->dir, $sims_nr_len, $sims_peg_synonyms, $sims_keep_count);
     {  
         $ENV{SGE_TASK_ID} = $task;  
         &run("$FIG_Config::bin/rp_compute_sims", $job->dir);  
     }  
226  }  }
227    
228  sub do_bbhs  sub do_bbhs
# Line 246  Line 261 
261      &run("$FIG_Config::bin/rp_write_exports", $job->dir);      &run("$FIG_Config::bin/rp_write_exports", $job->dir);
262  }  }
263    
264    sub mark_job_user_complete
265    {
266        my($job) = @_;
267    
268        my $job_dir = $job->dir;
269        my $meta = $job->meta;
270        my $job_id = $job->id;
271    
272        system("$FIG_Config::bin/send_job_completion_email", $job_dir);
273    
274        $meta->set_metadata("status.final", "complete");
275    
276        #
277        # If the job is a SEED candidate, send VV email.
278        #
279    
280        if ($meta->get_metadata("import.suggested") or
281            $meta->get_metadata("import.candidate"))
282        {
283            my $gname = $job->genome_name;
284            my $mail = Mail::Mailer->new();
285            $mail->open({
286                To => 'Veronika Vonstein <veronika@thefig.info>, Robert Olson<olson@mcs.anl.gov>, Andreas Wilke<wilke@mcs.anl.gov>',
287                From => 'Annotation Server <rast@mcs.anl.gov>',
288                Subject => "RAST job $job_id marked for SEED inclusion",
289            });
290    
291            print $mail <<END;
292    RAST job #$job_id ($gname) was submitted for inclusion into the SEED, and has finished its processing.
293    END
294            $mail->close();
295    
296            #
297            # We also mark the job as ACTIVE again so that the
298            # normal post-seed-acceptance pipeline stages may execute.
299            #
300            open(F, ">$job_dir/ACTIVE");
301            close(F);
302        }
303        else
304        {
305            #
306            # Otherwise it is completely done.
307            #
308            &mark_job_done($job);
309        }
310    }
311    
312    sub mark_job_done
313    {
314        my($job) = @_;
315    
316        #
317        # If we spooled the job out onto the lustre disk, we need to
318        # spool it back.
319        #
320    
321        my $meta = $job->meta;
322        my $job_dir = $job->dir;
323    
324        if ($meta->get_metadata("lustre_required"))
325        {
326            &run("$FIG_Config::bin/rp_lustre_finish", $job_dir);
327        }
328        if (open(D, ">$job_dir/DONE"))
329        {
330            print D time . "\n";
331            close(D);
332        }
333        else
334        {
335            warn "Error opening $job_dir/DONE: $!\n";
336        }
337    
338        unlink("$job_dir/ACTIVE");
339    }
340    
341  sub run  sub run
342  {  {

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3