-
Notifications
You must be signed in to change notification settings - Fork 0
/
q2x_betaDiversity.batch
executable file
·103 lines (83 loc) · 3.04 KB
/
q2x_betaDiversity.batch
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
set -euxo pipefail
cd $(dirname `readlink -f $0`)
prefix=`cat configuration.txt | grep "^prefix" | cut -d "=" -f 2`
CPU=`cat configuration.txt | grep "^CPU" | cut -d "=" -f 2`
investigate_group=`cat configuration.txt | grep "^investigate_group" | cut -d "=" -f 2`
manifest="${prefix}_manifest"
prefix_dada2="${prefix}_da2"
prefix_unoise3="${prefix}_un3"
prefix_uparse="${prefix}_up"
work_dir="betaDiversity"
dada2_tab="${prefix_dada2}_tab_pk_filtered_rarefy"
unoise3_tab="${prefix_unoise3}_tab_pk_filtered_rarefy"
uparse_tab="${prefix_uparse}_tab_pk_filtered_rarefy"
dada2_tree_tab="${prefix_dada2}_tab_pk_ftre2flt_filtered_rarefy"
uparse_tree_tab="${prefix_uparse}_tab_pk_ftre2flt_filtered_rarefy"
unoise3_tree_tab="${prefix_unoise3}_tab_pk_ftre2flt_filtered_rarefy"
if [ ! -d ${work_dir} ];then
mkdir ${work_dir}
else
rm -rf ${work_dir}
mkdir ${work_dir}
fi
pcoaAnalysis(){
qiime diversity pcoa \
--i-distance-matrix ${work_dir}/${prefix_tab}_${metric}_dm.qza \
--p-number-of-dimensions ${dimension} \
--o-pcoa ${work_dir}/${prefix_tab}_${metric}_${dimension}_pcoa.qza
qiime emperor plot \
--i-pcoa ${work_dir}/${prefix_tab}_${metric}_${dimension}_pcoa.qza \
--m-metadata-file ${manifest}.tsv \
--o-visualization ${work_dir}/${prefix_tab}_${metric}_${dimension}_emperor.qzv
}
for metric in jaccard hamming rogerstanimoto minkowski braycurtis euclidean aitchison
do
for tab in ${unoise3_tab} ${dada2_tab} ${uparse_tab}
do
prefix_tab=${tab%_tab*}
qiime diversity beta \
--i-table ${tab}.qza \
--p-metric ${metric} \
--p-n-jobs ${CPU} \
--o-distance-matrix ${work_dir}/${prefix_tab}_${metric}_dm.qza
qiime diversity beta-group-significance \
--i-distance-matrix ${work_dir}/${prefix_tab}_${metric}_dm.qza \
--m-metadata-file ${manifest}.tsv \
--m-metadata-column "${investigate_group}" \
--p-method 'permanova' \
--p-no-pairwise \
--o-visualization ${work_dir}/${prefix_tab}_${metric}_dm_significance.qzv
dimension=2
pcoaAnalysis
# dimension=3
# pcoaAnalysis
done
done
#beta diversity(phylogenetic)
for metric in generalized_unifrac weighted_normalized_unifrac unweighted_unifrac weighted_unifrac
do
for tab in ${unoise3_tree_tab} ${dada2_tree_tab} ${uparse_tree_tab}
do
prefix_tab=${tab%_tab*}
tree=${prefix_tab}_rep_pk_ftre
qiime diversity beta-phylogenetic \
--i-table ${tab}.qza \
--i-phylogeny ${tree}.qza \
--p-metric ${metric} \
--p-threads ${CPU} \
--o-distance-matrix ${work_dir}/${prefix_tab}_${metric}_dm.qza
qiime diversity beta-group-significance \
--i-distance-matrix ${work_dir}/${prefix_tab}_${metric}_dm.qza \
--m-metadata-file ${manifest}.tsv \
--m-metadata-column "${investigate_group}" \
--p-method 'permanova' \
--p-no-pairwise \
--o-visualization ${work_dir}/${prefix_tab}_${metric}_dm_significance.qzv
dimension=2
pcoaAnalysis
# dimension=3
# pcoaAnalysis
done
done
exit 0