Learn R Programming

⚠️There's a newer version (0.4.2) of this package.Take me there.

corncob

Count Regression for Correlated Observations with the Beta-binomial

corncob is an R package for modeling relative abundance and testing hypotheses about the effect of covariates on relative abundance. The corncob methodology was specifically developed for modelling microbial abundances based on high throughput sequencing data, such as 16S or whole-genome sequencing.

Installation

To install the corncob package, use the code below to download the development version from Github.

# install.packages("remotes")
remotes::install_github("statdivlab/corncob")
library(corncob)

Docker

Instead of installing corncob to your local system, you can use corncob via the pre-compiled Docker image: quay.io/fhcrc-microbiome/corncob.

Use

The vignettes demonstrate example usage of all main functions (they go over the same analysis, one with phyloseq objects and one without phyloseq objects). Please file an issue if you have a request for a tutorial that is not currently included. You can see the vignette by using the following code:

library(corncob)
# Use this to view the vignette in the corncob HTML help
help(package = "corncob", help_type = "html")
# Use this to view the vignette as an isolated HTML file
utils::browseVignettes(package = "corncob")

Note that R does not allow variable names to start with numbers. Sometimes, when going directly from QIIME2 to phyloseq objects, taxa names will be a large string starting with numbers. To clean these taxa names for use with corncob, use clean_taxa_names(my_phyloseq_object), see ?clean_taxa_names for details.

Documentation

We additionally have a pkgdown website that contains pre-built versions of our function documentation, vignette, and a version of the vignette without phyloseq.

Citation

If you use corncob for your analysis, please cite our manuscript:

Bryan D. Martin, Daniela Witten, and Amy D. Willis. (2020). Modeling microbial abundances and dysbiosis with beta-binomial regression. Annals of Applied Statistics, Volume 14, Number 1, pages 94-115.

An open-access preprint is available on arXiv here.

Bug Reports / Change Requests

If you encounter a bug or would like make a change request, please file it as an issue here.

Copy Link

Version

Install

install.packages('corncob')

Monthly Downloads

578

Version

0.4.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Amy D Willis

Last Published

January 10th, 2024

Functions in corncob (0.4.1)

gr_full

Parameter Gradient Vector
invlogit

Inverse logit transformation
ibd_phylo_taxa

IBD data, taxonomy data frame.
lrtest

Likelihood ratio test
sandSE

Compute sandwich standard errors. Legacy function. Use sand_vcov instead.
sand_vcov

Compute sandwich estimate of variance-covariance matrix
objfun

Objective function
plot.bbdml

Plotting function
%>%

Pipe operator
qbetabinom

Get quantiles of beta binom
pbRao

Parametric bootstrap Rao test
raotest

Rao-type chi-squared test (model-based or robust)
pbWald

Parametric bootstrap Wald test
print.summary.bbdml

Print summary function
print.differentialTest

differentialTest print function
logit

Logit transformation
soil_phylo_taxa

Soil data, taxa table as data frame.
invfishZ

Inverse Fisher's z transformation
soil_phylo_sample

Soil data, sample data.
soil_phylo_otu

Soil data, otu table as data frame.
soil_phylum_small_otu1

Small soil phylum data for examples, sample data as data frame combined with counts for OTU 1 and sequencing depth.
soil_phylum_small_sample

Small soil phylum data for examples, sample data as data frame
waldchisq_test

Wald-type chi-squared test statistic (model-based or robust)
waldt

Wald-type t test (model-based or robust)
score

Compute score at the MLE
plot.differentialTest

differentialTest plot function
otu_to_taxonomy

Transform OTUs to their taxonomic label
soil_phylum_small_otu

Small soil phylum data for examples, otu table as data frame
pbLRT

Parametric bootstrap likelihood ratio test
print.bbdml

Print function
waldchisq

Wald-type chi-squared test
differentialTest

Identify differentially-abundant and differentially-variable taxa
summary.bbdml

Summary function
soil_phylum_contrasts_sample

Small soil phylum data for contrasts examples, sample data as data frame
soil_phylum_contrasts_otu

Small soil phylum data for contrasts examples, otu table as data frame
warn_phyloseq

Function to throw error if the `phyloseq` package is called but it is not installed
simulate.bbdml

Simulate from beta-binomial model
dbetabin

Betabinomial density
HDIbetabinom

Get highest density interval of beta-binomial
bbdml

Maximum Likelihood for the Beta-binomial Distribution
convert_phylo

Function to subset and convert phyloseq data
hessian

Compute Hessian matrix at the MLE
contrastsTest

Identify differentially-abundant and differentially-variable taxa using contrasts
dbetabin_neg

Negative betabinomial density
ibd_phylo_otu

IBD data, OTU count data frame.
corncob-package

Corncob package documentation.
doBoot

Function to run a bootstrap iteration
fishZ

Fisher's z transformation
coth

Hyperbolic cotangent transformation
checkNested

Check for nested models
dbetabinom_cts

Densities of beta binomial distributions, permitting non integer x and size
clean_taxa_names

Rename taxa
genInits

Generate initialization for optimization
getRestrictionTerms

Get index of restricted terms for Wald test
ibd_phylo_sample

IBD data, sample data frame.