Skip to content

Instantly share code, notes, and snippets.

@wasade
Last active September 9, 2017 15:29
Show Gist options
  • Save wasade/6dbea614117592d573c1969ceb9e8d0b to your computer and use it in GitHub Desktop.
Save wasade/6dbea614117592d573c1969ceb9e8d0b to your computer and use it in GitHub Desktop.
Run the MVP tutorial for q2 2017.2.0 using q2-deblur
#!/bin/bash
set -e
set -x
envname=q2deblur_mvp_test
executiondir=mvp
redeploy=$1
source deactivate
curl=/usr/bin/curl # to circumvent the conda install
if [[ ${redeploy} == "redeploy" ]];
then
if [[ $(conda env list | grep -c ${envname}) == 1 ]];
then
conda env remove -y --name ${envname}
fi
if [[ $(uname) == "Darwin" ]];
then
reqs=https://data.qiime2.org/distro/core/qiime2-2017.2-conda-osx-64.txt
else
reqs=https://data.qiime2.org/distro/core/qiime2-2017.2-conda-linux-64.txt
fi
conda create -y --name ${envname} --file ${reqs}
source activate ${envname}
conda install -y -c bioconda VSEARCH==2.0.3 MAFFT==7.221 SortMeRNA==2.0 biom-format
pip install deblur==1.0.0
pip install https://github.com/wasade/q2-deblur/archive/master.zip
else
source activate ${envname}
fi
if [[ -d ${executiondir} ]];
then
echo "${executiondir} already exists"
exit 1
else
mkdir ${executiondir}
fi
pushd ${executiondir} > /dev/null
${curl} -sL "https://data.qiime2.org/2017.2/tutorials/moving-pictures/sample_metadata.tsv" > "sample-metadata.tsv"
mkdir emp-single-end-sequences
${curl} -sL "https://data.qiime2.org/2017.2/tutorials/moving-pictures/emp-single-end-sequences/barcodes.fastq.gz" > "emp-single-end-sequences/barcodes.fastq.gz"
${curl} -sL "https://data.qiime2.org/2017.2/tutorials/moving-pictures/emp-single-end-sequences/sequences.fastq.gz" > "emp-single-end-sequences/sequences.fastq.gz"
qiime tools import --type EMPSingleEndSequences --input-path emp-single-end-sequences --output-path emp-single-end-sequences.qza
qiime demux emp-single --i-seqs emp-single-end-sequences.qza --m-barcodes-file sample-metadata.tsv --m-barcodes-category BarcodeSequence --o-per-sample-sequences demux.qza
qiime demux summarize --i-data demux.qza --o-visualization demux.qzv
qiime deblur denoise-16S --i-demultiplexed-seqs demux.qza --p-trim-length 100 --o-representative-sequences rep-seqs --o-table table
# qiime dada2 plot-qualities --i-demultiplexed-seqs demux.qza --o-visualization demux-qual-plots --p-n 10
# qiime dada2 denoise --i-demultiplexed-seqs demux.qza --p-trim-left 0 --p-trunc-len 100 --o-representative-sequences rep-seqs --o-table table
qiime feature-table summarize --i-table table.qza --o-visualization table --m-sample-metadata-file sample-metadata.tsv
qiime feature-table tabulate-seqs --i-data rep-seqs.qza --o-visualization rep-seqs
qiime alignment mafft --i-sequences rep-seqs.qza --o-alignment aligned-rep-seqs
qiime alignment mask --i-alignment aligned-rep-seqs.qza --o-masked-alignment masked-aligned-rep-seqs
qiime phylogeny fasttree --i-alignment masked-aligned-rep-seqs.qza --o-tree unrooted-tree
qiime phylogeny midpoint-root --i-tree unrooted-tree.qza --o-rooted-tree rooted-tree
qiime diversity core-metrics --i-phylogeny rooted-tree.qza --i-table table.qza --p-sampling-depth 1441 --output-dir cm1441
qiime diversity alpha-group-significance --i-alpha-diversity cm1441/faith_pd_vector.qza --m-metadata-file sample-metadata.tsv --o-visualization cm1441/faith-pd-group-significance
qiime diversity alpha-group-significance --i-alpha-diversity cm1441/evenness_vector.qza --m-metadata-file sample-metadata.tsv --o-visualization cm1441/evenness-group-significance
qiime diversity alpha-correlation --i-alpha-diversity cm1441/faith_pd_vector.qza --m-metadata-file sample-metadata.tsv --o-visualization cm1441/faith-pd-correlation
qiime diversity alpha-correlation --i-alpha-diversity cm1441/evenness_vector.qza --m-metadata-file sample-metadata.tsv --o-visualization cm1441/evenness-correlation
qiime diversity beta-group-significance --i-distance-matrix cm1441/unweighted_unifrac_distance_matrix.qza --m-metadata-file sample-metadata.tsv --m-metadata-category BodySite --o-visualization cm1441/unweighted-unifrac-body-site-significance
qiime diversity beta-group-significance --i-distance-matrix cm1441/unweighted_unifrac_distance_matrix.qza --m-metadata-file sample-metadata.tsv --m-metadata-category Subject --o-visualization cm1441/unweighted-unifrac-subject-group-significance
qiime diversity bioenv --i-distance-matrix cm1441/unweighted_unifrac_distance_matrix.qza --m-metadata-file sample-metadata.tsv --o-visualization cm1441/unweighted-unifrac-bioenv
qiime diversity bioenv --i-distance-matrix cm1441/bray_curtis_distance_matrix.qza --m-metadata-file sample-metadata.tsv --o-visualization cm1441/bray-curtis-bioenv
qiime emperor plot --i-pcoa cm1441/unweighted_unifrac_pcoa_results.qza --o-visualization cm1441/unweighted-unifrac-emperor --m-metadata-file sample-metadata.tsv --p-custom-axis DaysSinceExperimentStart
qiime emperor plot --i-pcoa cm1441/bray_curtis_pcoa_results.qza --o-visualization cm1441/bray-curtis-emperor --m-metadata-file sample-metadata.tsv --p-custom-axis DaysSinceExperimentStart
${curl} -sL "https://data.qiime2.org/2017.2/common/gg-13-8-99-515-806-nb-classifier.qza" > "gg-13-8-99-515-806-nb-classifier.qza"
qiime feature-classifier classify --i-classifier gg-13-8-99-515-806-nb-classifier.qza --i-reads rep-seqs.qza --o-classification taxonomy
qiime taxa tabulate --i-data taxonomy.qza --o-visualization taxonomy
qiime taxa barplot --i-table table.qza --i-taxonomy taxonomy.qza --m-metadata-file sample-metadata.tsv --o-visualization taxa-bar-plots
qiime composition add-pseudocount --i-table table.qza --o-composition-table comp-table
qiime composition ancom --i-table comp-table.qza --m-metadata-file sample-metadata.tsv --m-metadata-category BodySite --o-visualization ancom-BodySite
qiime taxa collapse --i-table table.qza --i-taxonomy taxonomy.qza --p-level 2 --o-collapsed-table table-l2
qiime composition add-pseudocount --i-table table-l2.qza --o-composition-table comp-table-l2
qiime composition ancom --i-table comp-table-l2.qza --m-metadata-file sample-metadata.tsv --m-metadata-category BodySite --o-visualization l2-ancom-BodySite
popd > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment