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

Diff of /FortyEight/create_import_job.pl

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

revision 1.1, Wed Sep 5 21:41:46 2007 UTC revision 1.4, Fri Oct 5 17:23:57 2007 UTC
# Line 28  Line 28 
28  use Job48;  use Job48;
29  use NRTools;  use NRTools;
30    
31  my $usage = "create_import_job prev-nr prev-syn prev-sims";  my $usage = "create_import_job [-import-biodb] [-from-job jobnum] [prev-nr prev-syn prev-sims]";
32    
33  #  #
34  # Incoming NR data.  # Incoming NR data.
35  #  #
36  my $dir_biodb = "/vol/biodb";  my $dir_biodb = "/vol/biodb";
37  #my $dir_biodb_nr_input = "$dir_biodb/processed_data/for_build_nr";  my $dir_biodb_nr_input = "$dir_biodb/processed_data/for_build_nr";
 my $dir_biodb_nr_input = "/local/FIGdisk/FIG/Data/NR";  
   
38    
39  #  #
40  # Existing SEED data  # Existing SEED data
41  #  #
42    
43  #my $dir_reference_seed_data = "/vol/seed-data-anno-mirror/Data.Jan3";  my $dir_reference_seed_data = "/vol/seed-data-anno-mirror/Data.Jan3";
44  my $dir_reference_seed_data = "/local/FIGdisk/FIG/Data";  #my $dir_reference_seed_data = "/local/FIGdisk/FIG/Data";
45    
46  #  #
47  # RAST server from which to pull genomes to import.  # RAST server from which to pull genomes to import.
# Line 55  Line 53 
53  # Startup.  # Startup.
54  #  #
55    
56    my $do_biodb_import;
57    my $from_job_id;
58    
59    while ((@ARGV > 0) && ($ARGV[0] =~ /^-/))
60    {
61        my $arg = shift @ARGV;
62        if ($arg =~ /^-import-biodb/i)
63        {
64            $do_biodb_import++;
65        }
66        elsif ($arg =~ /^-from-job/)
67        {
68            $from_job_id = shift @ARGV;
69        }
70        else
71        {
72            die $usage;
73        }
74    }
75    
76    my $prev_nr_src;
77    my $prev_syn_src;
78    my $prev_sim_dir;
79    my $from_job;
80    
81    if (defined($from_job_id))
82    {
83        @ARGV == 0 or die $usage;
84    
85        $from_job = ImportJob->new($from_job_id);
86        $from_job or die "From-job id $from_job_id does not exist";
87    
88        my $dir = $from_job->dir();
89        $prev_nr_src = "$dir/nr";
90        $prev_syn_src = "$dir/peg.synonyms";
91        $prev_sim_dir = sprintf("$dir/Sims.%03d", $from_job_id);
92    }
93    else
94    {
95  @ARGV == 3 or die $usage;  @ARGV == 3 or die $usage;
96    
97  my $prev_nr_src = shift;      $prev_nr_src = shift;
98  my $prev_syn_src = shift;      $prev_syn_src = shift;
99  my $prev_sim_dir = shift;      $prev_sim_dir = shift;
100    }
101    
102  #  #
103  # Validate  # Validate
# Line 92  Line 130 
130      die "Cannot open previous synonyms file $prev_syn_src: $!\n";      die "Cannot open previous synonyms file $prev_syn_src: $!\n";
131  }  }
132    
133  if (not(-d $prev_sim_dir and <$prev_sim_dir/sims*> > 0))  my @sfiles = <$prev_sim_dir/sims*>;
134    if (not(-d $prev_sim_dir and @sfiles > 0))
135  {  {
136      die "previous sim dir $prev_sim_dir does not appear to contain sims\n";      die "previous sim dir $prev_sim_dir does not appear to contain sims\n";
137  }  }
138    
139    
140    print "Creating import job\n";
141    print "\tprev_nr=$prev_nr_src\n";
142    print "\tprev_syn=$prev_syn_src\n";
143    print "\tprev_sim=$prev_sim_dir\n";
144    
145  #  #
146  # Initial validation.  # Initial validation.
147  #  #
148  &validate_dirs($dir_biodb_nr_input, $dir_reference_seed_data, $dir_rast_jobs);  &validate_dirs($dir_biodb_nr_input, $dir_reference_seed_data, $dir_rast_jobs);
149    
150    if ($do_biodb_import)
151    {
152        &validate_dirs($dir_biodb_nr_input);
153    }
154    
155  #  #
156  # Create our jobdir.  # Create our jobdir.
157  #  #
# Line 164  Line 213 
213  #  #
214  # Scan for RAST jobs to import.  # Scan for RAST jobs to import.
215  #  #
216    # We update our NR component list with the peg features from the job,
217    # and we add the job directory of each to the rast.jobs file. This
218    # will be used later during the installation of these jobs into the SEED.
219    #
220    
221    open(JOBS, ">$jobdir/rast.jobs") or die "Cannot create $jobdir/rast.jobs: $!";
222    
223  my @rast_jobs;  my @rast_jobs;
224  scan_rast_jobs(\@rast_jobs, $dir_rast_jobs);  scan_rast_jobs(\@rast_jobs, $dir_rast_jobs);
225    
226    my @new_rast_jobs;
227  for my $job (@rast_jobs)  for my $job (@rast_jobs)
228  {  {
229      my $gid = $job->genome_id;      my $gid = $job->genome_id;
# Line 178  Line 234 
234    
235      if (exists($NR_dirs{$gid}))      if (exists($NR_dirs{$gid}))
236      {      {
237          die "Rast job $j already exists in SEED server\n";          warn "Rast job $j already exists in SEED server\n";
238            next;
239      }      }
240        push(@new_rast_jobs, $job);
241    
242        print JOBS $job->dir(), "\n";
243    
244      my $fasta = $job->orgdir() . "/Features/peg/fasta";      my $fasta = $job->orgdir() . "/Features/peg/fasta";
245      -f $fasta or die "Job $j has no fasta file in $fasta\n";      -f $fasta or die "Job $j has no fasta file in $fasta\n";
246      $NR_dirs{$gid} = {type => "rast_job", name => $gname, path => $job->orgdir,      $NR_dirs{$gid} = {type => "rast_job", name => $gname, path => $job->orgdir,
247                              fasta_path => $fasta, size => -s _ };                              fasta_path => $fasta, size => -s _ };
248  }  }
249    close(JOBS);
250    @rast_jobs = @new_rast_jobs;
251    
252  open(F, ">$jobdir/all.nr.dirs");  open(F, ">$jobdir/all.nr.dirs");
253  open(F2, ">$jobdir/nr.sources");  open(F2, ">$jobdir/nr.sources");

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3