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

Annotation of /FortyEight/imp_merge_sims.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : olson 1.1 #
2 :     # Merge the processed sims with the last batch of computed sims.
3 :     #
4 :     # processed sims dir is first flipped into sims.flip
5 :     # update_sims2 then used to merge the flipped and delete ids
6 :     # that are to be deleted.
7 :     #
8 :    
9 :     use strict;
10 :    
11 :     use Data::Dumper;
12 :     use FIG;
13 :     use FIG_Config;
14 :     use File::Basename;
15 :     use File::Copy;
16 :     use ImportJob;
17 :     use GenomeMeta;
18 :     use JobStage;
19 :    
20 :     my $hits_max = 300;
21 :    
22 :     @ARGV == 2 or die "Usage: $0 job-dir sim-dir\n";
23 :    
24 :     my $jobdir = shift;
25 :     my $simdir = shift;
26 :    
27 :     -d $jobdir or die "$0: job dir $jobdir does not exist\n";
28 :    
29 :     my $stage = new JobStage('ImportJob', 'merge_sims', $jobdir);
30 :    
31 :     $stage or die "$0: Could not create job object";
32 :     my $job = $stage->job();
33 :    
34 :     $stage->log("Running on " . $stage->hostname);
35 :    
36 :     $stage->set_status("running");
37 :     $stage->set_running("yes");
38 :    
39 :     $stage->set_qualified_metadata("host", $stage->hostname);
40 :    
41 :     #
42 :     # Set TMPDIR to somewhere with lots of space.
43 :     #
44 :     $ENV{TMPDIR} = $FIG_Config::temp;
45 :    
46 :     my $flipped = "$simdir/sim.flips";
47 :    
48 :     my @cmd = ("$FIG_Config::bin/flip_sims", "$simdir/processed", $flipped);
49 :     $stage->log("Running @cmd");
50 :     my $rc = system(@cmd);
51 :    
52 :     if ($rc == -1)
53 :     {
54 :     $stage->fatal("Flip cmd @cmd failed: $!");
55 :     }
56 :     elsif ($rc != 0)
57 :     {
58 :     $stage->fatal("Flip cmd @cmd failed: rc=$rc");
59 :     }
60 :    
61 :     my $merge_dir= "$simdir/merged";
62 :     if (-d $merge_dir)
63 :     {
64 :     rename($merge_dir, "$merge_dir." . time);
65 :     }
66 :    
67 :     @cmd = ("$FIG_Config::bin/update_sims2",
68 :     "$jobdir/peg.synonyms", $hits_max, "$simdir/processed", "$simdir/merged",
69 :     $flipped, "$jobdir/ids.deleted");
70 :     $stage->log("Running @cmd");
71 :     my $rc = system(@cmd);
72 :    
73 :     if ($rc == -1)
74 :     {
75 :     $stage->fatal("Merge cmd @cmd failed: $!");
76 :     }
77 :     elsif ($rc != 0)
78 :     {
79 :     $stage->fatal("Merge cmd @cmd failed: rc=$rc");
80 :     }
81 :    
82 :     $stage->log("completed");
83 :     $stage->set_running("no");
84 :     $stage->set_status("complete");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3