Q2-corncob: Community Tutorial


(Pauline Trinh) #1

QIIME2 Tutorial: q2-corncob

This is a community tutorial for q2-corncob version 1.0. corncob is in active development and is available in R (https://github.com/bryandmartin/corncob) or as a QIIME 2 plugin (https://github.com/statdivlab/q2-corncob).

corncob is based in R and requires installation of dependencies VGAM, devtools, magrittr, phyloseq, and dplyr into your conda environment before installing corncob. Please refer to the following instructions on how to install corncob and its dependencies.

Activate your QIIME Environment

  • Here we activate our example version of QIIME, qiime2-2018.8. If you’re not sure what your current version of QIIME is you can run conda env list in the command line to see a list of installed QIIME environments.

source activate qiime2-2018.8

Install corncob dependencies

(Expected installation time ~3-5 minutes)


conda install -c bioconda -c conda-forge bioconductor-phyloseq r-devtools r-magrittr r-dplyr r-vgam unzip

  • Note: When installing select y to proceed with installation when prompted.

Install corncob and q2-corncob


pip install git+https://github.com/statdivlab/q2-corncob.git

qiime dev refresh-cache

Check that corncob is installed


qiime corncob --help

Using q2-corncob

corncob is an individual taxon regression model that uses abundance tables and sample data. corncob is able to model differential abundance and differential variability and address the following statistical challenges with modeling micriobial relative abundance:

  • different sequencing depth

  • excessive zeros from unobserved taxa

  • high variability of empirical relative abundance (overdispersion)

  • within-taxon correlation

  • hypothesis testing with categorical and continuous covariates

A vignette on how to use corncob in R can be found here.

Currently, q2-corncob has made available the following functions within corncob:

  • differentialtest()

Citing corncob

The manuscript for corncob is currently In Prep.

How to use q2-corncob

For this tutorial we will be using data from the “Moving Pictures” tutorial. q2-corncob requires input of a FeatureTable, Metadata, Taxonomy, and a covariate of interest.
**Note: In q2-corncob v1.0 we require input of a taxonomy file, however, q2-corncob v2.0 will remove the necessity for a taxonomy file.

table.qza

taxonomy.qza

metadata.tsv

Let’s say that we are interested in seeing if there are ASV’s that are differentially abundant or differentially variable across groups of ReportedAntibioticUsage.


qiime corncob differentialtest \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-variable ReportedAntibioticUsage \
--i-taxonomy taxonomy.qza \
--o-output corncobresults

Our results show a table of features, taxonomic assignment, and fdr controlled p-values for differential abundance and differential variance.

results


Q2-corncob error: tidyr needs to be installed
#3

Hi Pauline,

I installed the plugin under qiime2-2019.1 and the install test passed. However, when I tried to use it I got the following error:
Plugin error from corncob:

Command ‘[‘differentialtest.R’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpl26o8gzp/table.tsv’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpl26o8gzp/metadata.tsv’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/qiime2-archive-3zdxrhm8/19d6d329-df0d-42d6-b0be-e021de6891f5/data/taxonomy.tsv’, ‘ThermalFeature’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpl26o8gzp/data.tsv’]’ returned non-zero exit status 1.

In checking the debug log there is this warning:
Error: tidyr needs to be installed!

Any possible solution? Thanks!
Mircea


(Evan Bolyen) #4

Hey @mpodar,

You could run this in your environment:

conda install -c bioconda -c conda-forge r-tidyr

However there are probably other packages which also are missing, so this process may need to be repeated for other packages.

(cc @Pauline_Trinh)


#5

hi Evan

youre right , not out of the woods yet. After tidyr I also had to install gfortran for Mohave. But now the error in de dubug file seems to refer to “test execution”, I am pasting below relevant text from the log file. Any help would be greatly appreciated ! Thanks

Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: differentialtest.R /var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpep2p5kqk/table.tsv /var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpep2p5kqk/metadata.tsv /var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/qiime2-archive-89hqqbd0/7224759e-03bb-4179-a382-485165ca8c86/data/taxonomy.tsv ReportedAntibioticUsage /var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpep2p5kqk/data.tsv

R version 3.4.1 (2017-06-30)
Great! phyloseq is already available

Loading required package: methods
Thank goodness! devtools is already available

You have magrittr installed!

You have tidyr installed!

Skipping install of ‘tidyr’ from a github remote, the SHA1 (0b27690d) has not changed since last install.
Use force = TRUE to force installation

Attaching package: ‘tidyr’

The following object is masked from ‘package:magrittr’:

extract

You have vgam installed!

Loading required package: stats4
Loading required package: splines

Attaching package: ‘VGAM’

The following object is masked from ‘package:tidyr’:

fill

Warning message:
Expected 7 pieces. Missing pieces filled with NA in 183 rows [1, 4, 8, 10, 17, 21, 23, 27, 38, 39, 44, 48, 59, 65, 69, 73, 74, 76, 83, 86, …].
phyloseq-class experiment-level object
otu_table() OTU Table: [ 759 taxa and 34 samples ]
sample_data() Sample Data: [ 34 samples by 10 sample variables ]
tax_table() Taxonomy Table: [ 759 taxa by 8 taxonomic ranks ]
OTU Table: [759 taxa and 34 samples]

Skipping install of ‘corncob’ from a github remote, the SHA1 (e1931970) has not changed since last install.
Use force = TRUE to force installation

Attaching package: ‘corncob’

The following objects are masked from ‘package:VGAM’:

logit, lrtest

[1] “ReportedAntibioticUsage”
Error: argument “test” is missing, with no default
Execution halted
Traceback (most recent call last):
File “/Users/mpb/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2cli/commands.py”, line 274, in call
results = action(**arguments)
File “</Users/mpb/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/decorator.py:decorator-gen-454>”, line 2, in differentialtest
File “/Users/mpb/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 231, in bound_callable
output_types, provenance)
File “/Users/mpb/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 365, in callable_executor
output_views = self._callable(**view_args)
File “/Users/mpb/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_corncob/_differentialtest.py”, line 56, in differentialtest
run_commands([cmd])
File “/Users/mpb/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_corncob/_differentialtest.py”, line 36, in run_commands
subprocess.run(cmd, check=True)
File “/Users/mpb/miniconda3/envs/qiime2-2019.1/lib/python3.6/subprocess.py”, line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘differentialtest.R’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpep2p5kqk/table.tsv’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpep2p5kqk/metadata.tsv’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/qiime2-archive-89hqqbd0/7224759e-03bb-4179-a382-485165ca8c86/data/taxonomy.tsv’, ‘ReportedAntibioticUsage’, ‘/var/folders/w4/v7g21fb95mn4kb1dd0ykhlbshlcxw8/T/tmpep2p5kqk/data.tsv’]’ returned non-zero exit status 1.


(Pauline Trinh) #6

@mpodar Sorry for chiming in late (no pun intended)! the ‘corncob’ package in R recently went through a lot of changes and the q2-corncob plug-in has not been updated to accommodate the new changes. As of now, I would use corncob through R (https://github.com/bryandmartin/corncob) until the q2 plugin is up to date (pending sometime by March!).