-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathqiime_workflow2.pl
executable file
·59 lines (53 loc) · 2.56 KB
/
qiime_workflow2.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl
# Script: /rhome/sahrendt/Scripts/qiime_workflow.pl
# Description: Generate shell scripts for processing qiime Amazon_air files w/ UNITE db
# Author: Steven Ahrendt
# email: [email protected]
# Date: 04.03.2014
##################################
use warnings;
use strict;
use Getopt::Long;
use Cwd;
#####-----Global Variables-----#####
#my $REGS = 7;
my $PWD = getcwd;
my $dataset = "Amazon";
my $db = "UNITE";
my @regs = qw(R1_11META R1_8META R1_9META R2_11META R2_8META R2_9META);
my ($help,$verb);
GetOptions( 'h|help' => \$help,
'v|verbose' => \$verb);
my $usage = "Usage: /rhome/sahrendt/Scripts/qiime_workflow.pl\n";
die $usage if $help;
#####-----Main-----#####
foreach my $reg (@regs)
{
my $sh_file = "qiime_$dataset\_$db\_$reg\.sh";
my $prefix = "$reg\_final";
open(my $sh, ">", $sh_file);
loadModules($sh);
print $sh "pick_otus.py -i $reg/$prefix.fasta -o $reg\_otus/\n";
#print $sh "rename 's/seqs/$prefix\/' $reg\_otus/seqs*\n";
print $sh "pick_rep_set.py -i $reg\_otus/$prefix\_otus.txt -f ./$reg/$prefix.fasta -l $reg\_otus/$prefix\_rep_set.log -o $reg\_otus/$prefix\_rep_set.fasta\n";
print $sh "align_seqs.py -i $reg\_otus/$prefix\_rep_set.fasta -m muscle -o $reg\_otus/muscle_alignment/\n";
print $sh "ln -s /srv/projects/db/QIIME/UNITE_2014-02-09/sh_refs_qiime_ver6_99_09.02.2014.fasta ./$reg\_otus/UNITE_ver6_99_09_02_2014.fna\n";
print $sh "ln -s $PWD/UNITE_ver6_99_09_02_2014.txt ./$reg\_otus/UNITE_ver6_99_09_02_2014.txt\n";
print $sh "assign_taxonomy.py -i $reg\_otus/$prefix\_rep_set.fasta -r $reg\_otus/UNITE_ver6_99_09_02_2014.fna -t $reg\_otus/UNITE_ver6_99_09_02_2014.txt -o $reg\_otus/UNITE_taxonomy --rdp_max_memory 12000\n";
print $sh "filter_alignment.py -i $reg\_otus/muscle_alignment/$prefix\_rep_set_aligned.fasta -o $reg\_otus/muscle_alignment_filtered --suppress_lane_mask_filter\n";
print $sh "mkdir $reg\_otus/fasttree_phylogeny\n";
print $sh "make_phylogeny.py -i $reg\_otus/muscle_alignment_filtered/$prefix\_rep_set_aligned_pfiltered.fasta -o $reg\_otus/fasttree_phylogeny/$prefix\_rep_set_aligned_pfiltered.tre -l $reg\_otus/fasttree_phylogeny/$prefix\_rep_set_aligned_pfiltered.log\n";
print $sh "make_otu_table.py -i $reg\_otus/$prefix\_otus.txt -t $reg\_otus/UNITE_taxonomy/$prefix\_rep_set_tax_assignments.txt -o $reg\_otus/$prefix\_otu_table.biom\n";
close($sh);
print `chmod 744 $sh_file`;
}
warn "Done.\n";
exit(0);
#####-----Subroutines-----#####
sub loadModules
{
my $fh = shift @_;
print $fh "module load qiime\n";
print $fh "module load ncbi-blast\n";
print $fh "module load FastTree\n";
}