#一、导入数据Import data
分析前需要准备的文件见上一篇文章
qiime tools import \
--type 'SampleData[PairedEndSequencesWithQuality]' \
--input-path sample_data/pe-33-manifest.csv \
--output-path results/paired-end-demux.qza \
--input-format PairedEndFastqManifestPhred33
#demux结果可视化Visualization of demux
qiime demux summarize \
--i-data results/paired-end-demux.qza \
--o-visualization results/demux.qzv
#去除非生物序列(我这步去的是引物)Removing non-biological sequences
qiime cutadapt trim-paired \
--i-demultiplexed-sequences paired-end-demux.qza \
--p-front-f ACTCCTACGGGAGGCAGCA \
--p-front-r GGACTACHVGGGTWTCTAAT \
--o-trimmed-sequences paired-end-trimmed-seqs.qza
#去除引物的序列可视化Visualization of sequences removed primer
qiime demux summarize \
--i-data paired-end-trimmed-seqs.qza \
--o-visualization paired-end-trimmed-seqs.qzv
#合并双端序列Join paired sequences (allow 1 mismatches for at least 10 bp overlap, no limit of q-score);这一步设置了2个参数:至少有10bp重合,每10bp里最多允许1个bp错配
time qiime vsearch join-pairs \
--i-demultiplexed-seqs paired-end-trimmed-seqs.qza \
--p-minovlen 10 \
--p-maxdiffs 1 \
--o-joined-sequences demux-joined.qza
#把上面的结果可视化Viewing a summary of joined data with read quality
qiime demux summarize \
--i-data demux-joined-1-noqscore.qza \
--o-visualization demux-joined.qzv
#对合并好的序列进行质控,这里推荐使用默认参数,把质量分数低于4的过滤掉Quality control of joined-sequences
qiime quality-filter q-score-joined \
--i-demux demux-joined.qza \
--o-filtered-sequences demux-joined-filtered.qza \
--o-filter-stats demux-joined-filtered-stats.qza
#对质控后的合并序列可视化Visualization of filterd-paied sequence
qiime demux summarize \
--i-data demux-joined-filtered.qza \
--o-visualization demux-joined-filtered.qzv
#对质控后的stats文件可视化Visualization of stats results using metadata tabulate
qiime metadata tabulate \
--m-input-file demux-joined-filtered-stats.qza \
--o-visualization demux-joined-filtered-stats.qzv
#降噪,400这个参数如何确定,参照上一篇的教程Deblur (trim-length 400),40是线程数
qiime deblur denoise-16S \
--i-demultiplexed-seqs demux-joined-1-noqscore-filtered.qza \
--p-trim-length 400 \
--p-sample-stats \
--p-jobs-to-start 40 \
--o-representative-sequences rep-seqs.qza \
--o-table table.qza \
--o-stats deblur-stats.qza
#deblur的stats结果可视化Visualization of stats results
qiime deblur visualize-stats\
--i-deblur-stats deblur-stats.qza \
--o-visualization deblur-stats.qzv
#feature-table可视化Visualization of deblur table
qiime feature-table summarize \
--i-table table.qza \
--o-visualization table.qzv \
--m-sample-metadata-file sample-metadata.tsv
#抽平feature-table,11562这个参数如何确定看上一个教程Rarefy the feature-table
qiime feature-table rarefy \
--i-table table.qza \
--p-sampling-depth 11562 \
--o-rarefied-table table-rarefied.qza
qiime feature-table summarize \
--i-table table-rarefied.qza \
--o-visualization table-rarefied.qzv\
--m-sample-metadata-file sample-metadata.tsv
#打开table-rarefied.qza里面有个data,打开里面的feature-table,extract就可以得到feature-table.biom,然后用下面的命令把它转为tsv格式
biom convert -i feature-table.biom -o feature-table.tsv --to-tsv --header-key taxonomy
#生成进化树和多样性参数Generate a tree for phylogenetic diversity analyse
time qiime phylogeny align-to-tree-mafft-fasttree \
--i-sequences 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
###Alpha & Beta diversity analyse
#Calculate core-metric-phylogenetic
qiime diversity core-metrics-phylogenetic \
--i-phylogeny rooted-tree.qza \
--i-table table.qza \
--p-sampling-depth 11562 \
--m-metadata-file sample-metadata.tsv \
--output-dir core-metrics-results
#稀释虚线Alpha rarefaction plotting (rarefaction curves)
time qiime diversity alpha-rarefaction \
--i-table table.qza \
--i-phylogeny rooted-tree.qza \
--p-max-depth 10000 \
--m-metadata-file sample-metadata.tsv \
--o-visualization alpha-rarefaction.qzv
#Faith系统发育多样性可视化
qiime diversity alpha-group-significance \
--i-alpha-diversity core-metrics-results/faith_pd_vector.qza \
--m-metadata-file sample-metadata.tsv \
--o-visualization core-metrics-results/faith-pd-group-significance.qzv
#Evenness 均匀度可视化(每个ASV丰度的均匀度)
qiime diversity alpha-group-significance \
--i-alpha-diversity core-metrics-results/evenness_vector.qza \
--m-metadata-file sample-metadata.tsv \
--o-visualization core-metrics-results/evenness-group-significance.qzv
#Shannon diversity可视化(综合Evenness和Richness的指标)
qiime diversity alpha-group-significance \
--i-alpha-diversity core-metrics-results/shannon_vector.qza \
--m-metadata-file sample-metadata.tsv \
--o-visualization core-metrics-results/shannon_vector.qzv
#Richness可视化
qiime diversity alpha-group-significance \
--i-alpha-diversity core-metrics-results/observed_features_vector.qza \
--m-metadata-file sample-metadata.tsv \
--o-visualization core-metrics-results/observed_features_vector.qzv
###Annoation
##Download the feature-classifier
#mkdir training-feature-classifiers
mkdir training-feature-classifiers
#cd training-feature-classifiers
cd training-feature-classifiers
#Download the feature-classifier
wget \
-O "silva-138-99-nb-classifier.qza" \
https://data.qiime2.org/2020.6/common/silva-138-99-nb-classifier.qza
cd ..
#Taxonomy & visualization
time qiime feature-classifier classify-sklearn \
--i-classifier training-feature-classifiers/silva-138-99-nb-classifier.qza \
--i-reads rep-seqs-1-20.qza \
--o-classification taxonomy.qza
qiime metadata tabulate \
--m-input-file taxonomy.qza \
--o-visualization taxonomy.qzv
qiime taxa barplot \
--i-table table-1-20-rarefied.qza \
--i-taxonomy taxonomy.qza \
--m-metadata-file sample-metadata.tsv \
--o-visualization taxa-bar-plots.qzv