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

Diff of /FigKernelScripts/prepare_metagenome_files_for_download.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Thu Jan 17 21:30:52 2008 UTC revision 1.4, Wed Jan 30 15:40:49 2008 UTC
# Line 13  Line 13 
13  close(DIR);  close(DIR);
14    
15  foreach my $job (@jobs){  foreach my $job (@jobs){
16    
17        if(! -e "$jobs_dir/$job/PUBLIC"){next}
18    
19        print "working on $job\n";
20    
21      my $mg_id;      my $mg_id;
22      open(IN,"$jobs_dir/$job/GENOME_ID");      open(IN,"$jobs_dir/$job/GENOME_ID");
23      while($_ = <IN>){      while($_ = <IN>){
# Line 21  Line 26 
26      }      }
27      close(IN);      close(IN);
28    
29      if(! -d "$jobs_dir/$job/DOWNLOAD"){      if(! -d "$jobs_dir/$job/download"){
30          `mkdir $jobs_dir/$job/DOWNLOAD`;          `mkdir $jobs_dir/$job/download`;
31      };      };
32    
33      `cp $jobs_dir/$job/rp/$mg_id/Features/peg/fasta $jobs_dir/$job/DOWNLOAD/$mg_id.peg.fasta`;      `cp $jobs_dir/$job/rp/$mg_id/Features/peg/fasta $jobs_dir/$job/download/$mg_id.protein.fa`;
34      `cp $jobs_dir/$job/rp/$mg_id/assigned_functions $jobs_dir/$job/DOWNLOAD/$mg_id.assigned_functions.txt`;      `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      opendir(DIR,"$jobs_dir/$job/proc");      opendir(DIR,"$jobs_dir/$job/proc");
40      my @files = readdir(DIR);      my @files = readdir(DIR);
41      close(DIR);      close(DIR);
42      foreach my $file (@files){      foreach my $file (@files){
43          if($file =~/(\d+.fa)$/){          if($file =~/(\d+.fa)$/){
44              `cp $jobs_dir/$job/proc/$file $jobs_dir/$job/DOWNLOAD/$mg_id.normalized.fasta`;              `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              last;              last;
47          }          }
48      }      }
49    
50      `tar -czf $jobs_dir/$job/DOWNLOAD/$mg_id.genome_and_proc_dir.tar.gz $jobs_dir/$job/proc $jobs_dir/$job/rp/$mg_id`;      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        print INDEX "$mg_id.user_id_to_normalized_unique.txt    User Fragment ID Mapping to MG-RAST ID\n";
57        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  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3