[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.3 - (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 : mkubal 1.3 if($job != 13){next;}
17 :    
18 : mkubal 1.1 my $mg_id;
19 :     open(IN,"$jobs_dir/$job/GENOME_ID");
20 :     while($_ = <IN>){
21 :     chomp($_);
22 :     $mg_id = $_;
23 :     }
24 :     close(IN);
25 : mkubal 1.2
26 : mkubal 1.3 if(! -d "$jobs_dir/$job/download"){
27 :     `mkdir $jobs_dir/$job/download`;
28 : mkubal 1.2 };
29 : mkubal 1.1
30 : mkubal 1.3 `cp $jobs_dir/$job/rp/$mg_id/Features/peg/fasta $jobs_dir/$job/download/$mg_id.protein.fa`;
31 :     `gzip $jobs_dir/$job/download/$mg_id.protein.fa`;
32 :    
33 :     `cp $jobs_dir/$job/rp/$mg_id/assigned_functions $jobs_dir/$job/download/$mg_id.functions.txt`;
34 :     `gzip $jobs_dir/$job/download/$mg_id.functions.txt`;
35 :    
36 : mkubal 1.1 opendir(DIR,"$jobs_dir/$job/proc");
37 :     my @files = readdir(DIR);
38 :     close(DIR);
39 :     foreach my $file (@files){
40 :     if($file =~/(\d+.fa)$/){
41 : mkubal 1.3 `cp $jobs_dir/$job/proc/$file $jobs_dir/$job/download/$mg_id.dna.fa`;
42 :     `gzip $jobs_dir/$job/download/$mg_id.dna.fa`;
43 : mkubal 1.1 last;
44 :     }
45 :     }
46 : mkubal 1.3
47 :     open(INDEX,">$jobs_dir/$job/download/index");
48 :     print INDEX "$mg_id.all_internal_data.tar.gz MGRAST data directories\n";
49 :     print INDEX "$mg_id.complete.gbk.gz Genbank File\n";
50 :     print INDEX "$mg_id.dna.fa.gz Normalized DNA FASTA\n";
51 :     print INDEX "$mg_id.functions.txt.gz Assigned Protein Functions\n";
52 :     print INDEX "$mg_id.protein.fa.gz Assigned Protein Sequences FASTA\n";
53 :     close(INDEX);
54 :    
55 :     `tar -czf $jobs_dir/$job/download/$mg_id.all_internal_data.tar.gz $jobs_dir/$job/proc $jobs_dir/$job/rp/$mg_id`;
56 : mkubal 1.1 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3