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

Annotation of /FortyEight/save_job_signature.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.1 #
2 :     # Compute the job's signature and save the original
3 :     # annotations, subsystems, and features to original_state.tgz.
4 :     #
5 :    
6 :     use strict;
7 :     use FIG_Config;
8 :     use Job48;
9 :    
10 :     @ARGV == 1 or die "Usage: $0 job-dir\n";
11 :    
12 :     my $dir = shift;
13 :    
14 :     my $id;
15 :     if ($dir !~ m,/(\d+)$,)
16 :     {
17 :     die "Job directory does not end with a number\n";
18 :     }
19 :    
20 :     $id = $1;
21 :    
22 :     #
23 :     # Compute the signature, save to JOB_SIGNATURE.
24 :     #
25 :     # The first line of the signature file is the signature itself.
26 :     #
27 :    
28 :     my $rc = system("$FIG_Config::bin/compute_job_signature", $dir, "$dir/JOB_SIGNATURE");
29 :     $rc == 0 or die "compute_job_signature failed with rc=$rc\n";
30 :    
31 :     my $sig = &FIG::file_head("$dir/JOB_SIGNATURE", 1);
32 :     chomp $sig;
33 :    
34 :     my $db = DBMaster->new(-database => $FIG_Config::rast_jobcache_db,
35 :     -backend => 'MySQL',
36 :     -host => $FIG_Config::rast_jobcache_host,
37 :     -user => $FIG_Config::rast_jobcache_user);
38 :    
39 :     #
40 :     # retrieve the job to make sure the directory matches the directory
41 :     # we were given.
42 :     #
43 :    
44 :     my $job = $db->Job->init({ id => $id } );
45 :     $job or die "job $id does not exist\n";
46 :    
47 :     my $jdir = $job->dir;
48 :     if ($jdir ne $dir)
49 :     {
50 :     die "Directory for job $id is $jdir which does not match given directory $dir\n";
51 :     }
52 :    
53 :     $job->job_signature($sig);
54 :    
55 :    
56 :     #
57 :     # Save a tarfile of the original annotations, subsystem analysis,
58 :     # and feaures.
59 :     #
60 :    
61 :     my $org_dir = $job->org_dir;
62 :    
63 :     opendir(D, $org_dir) or die "Cannot opendir $org_dir: $!";
64 :     my @fn_files = grep { $_ ne 'proposed_user_functions' && -f "$org_dir/$_" && /functions/ } readdir(D);
65 :    
66 :     system("tar", "-c", "-z", "-f", "$jdir/pristine_annotations.tgz", "-C", $job->org_dir,
67 :     @fn_files, "Features", "Subsystems", "annotations", "evidence.codes");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3