qiime 2 분석 균군 데이터 코드
10472 단어 균군 분석
Linux 서버가 있는 파트너는 콘다 설치를 추천합니다. 윈도우즈 노트북에서 체험하고 싶은 분들은 Virtualbox 가상기기를 사용하여 설치하고 학습할 수 있습니다.
#install conda
conda update conda # conda
conda install wget #
#install QIIME2 with conda
wget https://data.qiime2.org/distro/core/qiime2-2018.2-py35-linux-conda.yml #
conda env create -n qiime2-2018.2 --file qiime2-2018.2-py35-linux-conda.yml # qiime2,
# OPTIONAL CLEANUP
rm qiime2-2018.2-py35-linux-conda.yml #
#activate qiime2
source activate qiime2-2017.12 #
#deactivate qiime2
souce deactivate #
2.Obtaining and importing data
#singleSingleEndFastqManifestPhred33
qiime tools import \
--type 'SampleData[SequencesWithQuality]' \
--input-path se-33-manifest \
--output-path single-end-demux.qza \
--source-format SingleEndFastqManifestPhred33
#PairedEndFastqManifestPhred33
qiime tools import \
--type 'SampleData[PairedEndSequencesWithQuality]' \
--input-path pe-33-manifest \
--output-path paired-end-demux.qza \
--source-format PairedEndFastqManifestPhred33
qiime demux summarize \
--i-data single-end-demux.qza \
--o-visualization single-end-demux.qzv
3. Sequence quality control and feature table construction
qiime dada2 denoise-single \
--i-demultiplexed-seqs single-end-demux.qza \
--p-trim-left 0 \
--p-trunc-len 165 \
--o-representative-sequences rep-seqs-dada2.qza \
--o-table table-dada2.qza \
--o-denoising-stats stats-dada2.qza
mv rep-seqs-dada2.qza rep-seqs.qza
mv table-dada2.qza table.qza
4. FeatureTable and FeatureData summaries
qiime feature-table summarize \
--i-table table.qza \
--o-visualization table.qzv \
--m-sample-metadata-file sample-metadata.tsv
#
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
#qiime tools view rep-seqs.qzv #
5. Generate a tree for phylogenetic diversity analyses
#
qiime alignment mafft \
--i-sequences rep-seqs.qza \
--o-alignment aligned-rep-seqs.qza
#
qiime alignment mask \
--i-alignment aligned-rep-seqs.qza \
--o-masked-alignment masked-aligned-rep-seqs.qza
#
qiime phylogeny fasttree \
--i-alignment masked-aligned-rep-seqs.qza \
--o-tree unrooted-tree.qza
#
qiime phylogeny midpoint-root \
--i-tree unrooted-tree.qza \
--o-rooted-tree rooted-tree.qza
6.Alpha and beta diversity analysis
#
qiime diversity core-metrics-phylogenetic \
--i-phylogeny rooted-tree.qza \
--i-table table.qza \
--p-sampling-depth 12052 \
--m-metadata-file sample-metadata.tsv \
--output-dir core-metrics-results
# , :
# beta bray_curtis bray_curtis_distance_matrix.qza
# alpha evenness( , ) evenness_vector.qza
# alpha faith_pd( ) faith_pd_vector.qza
# beta jaccard jaccard_distance_matrix.qza
# alpha observed_otus(OTU ) observed_otus_vector.qza
# alpha ( ) shannon_vector.qza
# beta unweighted_unifrac , unweighted_unifrac_distance_matrix.qza
# beta unweighted_unifrac , weighted_unifrac_distance_matrix.qza
# faith_pd Alpha , 、 ,
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
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
# , qzv , qiime tools view http://view.qiime2.org/
#qiime tools view evenness-group-significance.qzv
# BodySite , unweighted_unifrace
qiime diversity beta-group-significance \
--i-distance-matrix core-metrics-results/unweighted_unifrac_distance_matrix.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-category BodySite \
--o-visualization core-metrics-results/unweighted-unifrac-body-site-significance.qzv \
--p-pairwise
# unweighted-unifrac
qiime emperor plot \
--i-pcoa core-metrics-results/unweighted_unifrac_pcoa_results.qza \
--m-metadata-file sample-metadata.tsv \
--p-custom-axes DaysSinceExperimentStart \
--o-visualization core-metrics-results/unweighted-unifrac-emperor-DaysSinceExperimentStart.qzv
#Alpha rarefaction plotting
qiime diversity alpha-rarefaction \
--i-table table.qza \
--i-phylogeny rooted-tree.qza \
--p-max-depth 12052 \
--m-metadata-file sample-metadata.tsv \
--o-visualization alpha-rarefaction.qzv
7.Training feature classifiers with q2-feature-classifier
wget \
-O "85_otus.fasta" \
"https://data.qiime2.org/2018.11/tutorials/training-feature-classifiers/85_otus.fasta"
wget \
-O "85_otu_taxonomy.txt" \
"https://data.qiime2.org/2018.11/tutorials/training-feature-classifiers/85_otu_taxonomy.txt"
qiime tools import \
--type 'FeatureData[Sequence]' \
--input-path 85_otus.fasta \
--output-path 85_otus.qza
qiime tools import \
--type 'FeatureData[Taxonomy]' \
--source-format HeaderlessTSVTaxonomyFormat \
--input-path 85_otu_taxonomy.txt \
--output-path ref-taxonomy.qza
qiime feature-classifier extract-reads \
--i-sequences 85_otus.qza \
--p-f-primer CCAGACTCCTACGGGAGGCAG \
--p-r-primer CGTATTACCGCGGCTGCTG \
--o-reads ref-seqs.qza
qiime feature-classifier fit-classifier-naive-bayes \
--i-reference-reads ref-seqs.qza \
--i-reference-taxonomy ref-taxonomy.qza \
--o-classifier classifier.qza
qiime feature-classifier classify-sklearn \
--i-classifier classifier.qza \
--i-reads rep-seqs.qza \
--o-classification taxonomy.qza
qiime metadata tabulate \
--m-input-file taxonomy.qza \
--o-visualization taxonomy.qzv
8. Taxonomic analysis
#
qiime taxa barplot \
--i-table table.qza \
--i-taxonomy taxonomy.qza \
--m-metadata-file sample-metadata.tsv \
--o-visualization taxa-bar-plots.qzv
#Differential abundance testing with ANCOM
#filter to gut samples
qiime feature-table filter-samples \
--i-table table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where "BodySite='gut'" \
--o-filtered-table gut-table.qza
#imputation method
qiime composition add-pseudocount \
--i-table gut-table.qza \
--o-composition-table comp-gut-table.qza
9.Subject
qiime composition ancom \
--i-table comp-gut-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column Subject \
--o-visualization ancom-Subject.qzv
#specific taxonomic level
qiime taxa collapse \
--i-table gut-table.qza \
--i-taxonomy taxonomy.qza \
--p-level 6 \
--o-collapsed-table gut-table-l6.qza
qiime composition add-pseudocount \
--i-table gut-table-l6.qza \
--o-composition-table comp-gut-table-l6.qza
qiime composition ancom \
--i-table comp-gut-table-l6.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column Subject \
--o-visualization l6-ancom-Subject.qzv
#shell ##check shell echo $0 ##Bach shell source tab-qiime 10.Importing phylogenetic trees (unrooted)
qiime tools import \
--input-path rep_set.tre \
--output-path unrooted-tree.qza \
--type 'Phylogeny[Unrooted]'
qiime phylogeny midpoint-root \
--i-tree unrooted-tree.qza \
--o-rooted-tree rooted-tree.qza
11.Importing BIOM v1.0.0
qiime tools import \
--input-path otu_table_mc2_w_tax_no_pynast_failures.biom \
--type 'FeatureTable[Frequency]' \
--source-format BIOMV100Format \
--output-path feature-table-1.qza
12.Feature Table summarize
qiime feature-table summarize \
--i-table feature-table-1.qza \
--o-visualization table.qzv \
--m-sample-metadata-file sample-metadata.tsv
13.Alpha and beta diversity analysis
qiime diversity core-metrics-phylogenetic \
--i-phylogeny rooted-tree.qza \
--i-table feature-table-1.qza \
--p-sampling-depth 51162 \
--m-metadata-file sample-metadata.tsv \
--output-dir core-metrics-results
##alpha-group-significance
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
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
14.beta-group-significance
qiime diversity beta-group-significance \
--i-distance-matrix core-metrics-results/unweighted_unifrac_distance_matrix.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column BodySite \
--o-visualization core-metrics-results/unweighted-unifrac-body-site-significance.qzv \
--p-pairwise
qiime diversity beta-group-significance \
--i-distance-matrix core-metrics-results/unweighted_unifrac_distance_matrix.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column Subject \
--o-visualization core-metrics-results/unweighted-unifrac-subject-group-significance.qzv \
--p-pairwise
##PCoA plot
qiime emperor plot \
--i-pcoa core-metrics-results/unweighted_unifrac_pcoa_results.qza \
--m-metadata-file sample-metadata.tsv \
--p-custom-axes DaysSinceExperimentStart \
--o-visualization core-metrics-results/unweighted-unifrac-emperor-DaysSinceExperimentStart.qzv
qiime emperor plot \
--i-pcoa core-metrics-results/bray_curtis_pcoa_results.qza \
--m-metadata-file sample-metadata.tsv \
--p-custom-axes DaysSinceExperimentStart \
--o-visualization core-metrics-results/bray-curtis-emperor-DaysSinceExperimentStart.qzv
#Alpha rarefaction plotting
qiime diversity alpha-rarefaction \
--i-table feature-table-1.qza \
--i-phylogeny rooted-tree.qza \
--p-max-depth 51162 \
--m-metadata-file sample-metadata.tsv \
--o-visualization alpha-rarefaction.qzv
#Taxonomic analysis
#Differential abundance testing with ANCOM