-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow.txt
133 lines (112 loc) · 4.5 KB
/
workflow.txt
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Created: 2/23/21
Last Edited: 6/24/21
## Shorten sequence names
for file in *R1*.gz; do [ -f "$file" ] || continue; mv -vf "$file" "${file//_*R1_001.fastq.gz/_R1.fastq.gz}"; done
for file in *R2*.gz; do [ -f "$file" ] || continue; mv -vf "$file" "${file//_*R2_001.fastq.gz/_R2.fastq.gz}; done
## Activate QIIME2
module load miniconda3
source activate qiime2-2021.2
-----------------------------------------------------------------
## IMPORT & PROCESS
-----------------------------------------------------------------
## Import demux seqs from manfest file
qiime tools import \
--type "SampleData[PairedEndSequencesWithQuality]" \
--input-format PairedEndFastqManifestPhred33 \
--input-path ./manifest.csv \
--output-path ./demux_seqs.qza
## Had to remove some files from manifest.csv to allow import to run.
## See NOTES.txt for details
## cutadapt - remove adapters/primers from sequencing
qiime cutadapt trim-paired \
--i-demultiplexed-sequences demux_seqs.qza \
--p-cores 4 \
--p-adapter-f 'ATTAGAWACCCBDGTAGTCC' \
--p-front-f 'GTGCCAGCMGCCGCGGTAA' \
--p-adapter-r 'TTACCGCGGCKGCTGGCAC' \
--p-front-r 'GGACTACHVGGGTWTCTAAT' \
--o-trimmed-sequences ./trimmed_demux_seqs.qza
## Summarize to get trim lengths in view.qiime2.org
# Will have to move back to local machine to visualize
qiime demux summarize \
--i-data ./trimmed_demux_seqs.qza \
--o-visualization ./trimmed_demux_seqs.qzv
-----------------------------------------------------------------
## DADA2 DENOISE & VISUALIZATION
-----------------------------------------------------------------
## DADA2 Denoise
## Truncation depth determined by viewing trimmed_demux_seqs.qzv
qiime dada2 denoise-paired \
--i-demultiplexed-seqs ./trimmed_demux_seqs.qza \
--p-trunc-len-f 230 \
--p-trunc-len-r 150 \
--o-table ./dada2_table.qza \
--o-representative-sequences ./dada2_rep_seqs.qza \
--o-denoising-stats ./dada2_stats.qza \
--p-n-threads 8
## DADA2 Visualization
# Denoising stats
qiime metadata tabulate \
--m-input-file ./dada2_stats.qza \
--o-visualization ./dada2_stats.qzv
# Get feature table
qiime feature-table summarize \
--i-table ./dada2_table.qza \
--m-sample-metadata-file ./metadata.tsv \
--o-visualization ./dada2_table.qzv
# Get feature-table data
qiime feature-table tabulate-seqs \
--i-data ./dada2_rep_seqs.qza \
--o-visualization ./dada2_rep_seq.qzv
-----------------------------------------------------------------
## PHYLOGENY
-----------------------------------------------------------------
## Assigning phylogeny using de novo mafft fasttree method
qiime phylogeny align-to-tree-mafft-fasttree \
--i-sequences dada2_rep_seqs.qza \
--o-alignment aligned-rep-seqs.qza \
--o-masked-alignment masked-aligned-rep-seqs.qza \
--o-tree unrooted-tree.qza \
--o-rooted-tree rooted-tree.qza
## Visualizing rarefaction depths
# Change the maxdepth to highest count from dada2_stats.qzv
qiime diversity alpha-rarefaction \
--i-table ./dada2_table.qza \
--m-metadata-file ./metadata.tsv \
--o-visualization ./alpha_rarefaction_curves.qzv \
--p-min-depth 1 \
--p-max-depth 138471
## Core metrics files
# Change sampling depth from rarefaction decision
qiime diversity core-metrics-phylogenetic \
--i-table ./dada2_table.qza \
--i-phylogeny ./rooted-tree.qza \
--m-metadata-file ./metadata.tsv \
--p-sampling-depth 40000 \
--output-dir ./core-metrics-results_mafft-40000
## Export feature table
qiime tools export \
--input-path ./core-metrics-results_mafft-40000/rarefied_table.qza \
--output-path ./core-metrics-results_mafft-40000/
biom convert --to-tsv \
-i ./core-metrics-results_mafft-40000/feature-table.biom \
-o ./core-metrics-results_mafft-40000/feature-table_mafft-40000.tsv
-----------------------------------------------------------------
## TAXONOMY
-----------------------------------------------------------------
## Assign taxonomy from readytowear animal-distal-gut classifier
## Assign taxonomy
qiime feature-classifier classify-sklearn \
--i-reads ./dada2_rep_seqs.qza \
--i-classifier ../feature-classifiers/silva138_v4_animal-distal-gut.qza \
--o-classification ./taxonomy.qza
## Visualize taxonomy
qiime metadata tabulate \
--m-input-file ./taxonomy.qza \
--o-visualization ./taxonomy.qzv
## Generate taxa barplot with rarefied feature table from core-metrics-results
qiime taxa barplot \
--i-table ./core-metrics-results_mafft-fasttree_40000/rarefied_table.qza \
--i-taxonomy ./taxonomy.qza \
--m-metadata-file ./metadata.tsv \
--o-visualization ./taxa_barplot_mafft-40000.qzv