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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3