[Bio] / FigKernelScripts / prepare_metagenome_files_for_download.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/prepare_metagenome_files_for_download.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : mkubal 1.1 if(scalar(@ARGV) != 1){
2 :     print "usage: prepare_metagenome_files_for_download location_of_jobs_dir\n";
3 :     print "example: prepare_metagenome_files_for_download /vol/mg-rast/Jobs.dev\n";
4 :     exit;
5 :     }
6 :    
7 :     #$job_dirs such as /vol/mg-rast/Jobs.dev
8 :     my $jobs_dir = shift(@ARGV);
9 :    
10 :    
11 :     opendir(DIR,$jobs_dir);
12 :     @jobs = readdir(DIR);
13 :     close(DIR);
14 :    
15 :     foreach my $job (@jobs){
16 :     my $mg_id;
17 :     open(IN,"$jobs_dir/$job/GENOME_ID");
18 :     while($_ = <IN>){
19 :     chomp($_);
20 :     $mg_id = $_;
21 :     }
22 :     close(IN);
23 : mkubal 1.2
24 :     if(! -d "$jobs_dir/$job/DOWNLOAD"){
25 :     `mkdir $jobs_dir/$job/DOWNLOAD`;
26 :     };
27 : mkubal 1.1
28 : mkubal 1.2 `cp $jobs_dir/$job/rp/$mg_id/Features/peg/fasta $jobs_dir/$job/DOWNLOAD/$mg_id.peg.fasta`;
29 :     `cp $jobs_dir/$job/rp/$mg_id/assigned_functions $jobs_dir/$job/DOWNLOAD/$mg_id.assigned_functions.txt`;
30 : mkubal 1.1
31 :     opendir(DIR,"$jobs_dir/$job/proc");
32 :     my @files = readdir(DIR);
33 :     close(DIR);
34 :     foreach my $file (@files){
35 :     if($file =~/(\d+.fa)$/){
36 : mkubal 1.2 `cp $jobs_dir/$job/proc/$file $jobs_dir/$job/DOWNLOAD/$mg_id.normalized.fasta`;
37 : mkubal 1.1 last;
38 :     }
39 :     }
40 :    
41 : mkubal 1.2 `tar -czf $jobs_dir/$job/DOWNLOAD/$mg_id.genome_and_proc_dir.tar.gz $jobs_dir/$job/proc $jobs_dir/$job/rp/$mg_id`;
42 : mkubal 1.1 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3