Skip to main content

BIRDMAn

GitHub Actions CI Documentation Status PyPI DOI

Overview

Bayesian Inferential Regression for Differential Microbiome Analysis (BIRDMAn) is a framework for differential abundance analysis of microbiome count data using Bayesian inference.

Quantifying differential abundance (DA) in microbiome studies is challenging due to data characteristics (e.g., compositionality, sparsity) and study designs (e.g., repeated measures, meta-analysis, cross-over). BIRDMAn is a flexible DA method that accounts for these data characteristics and diverse experimental designs by fitting hierarchical Bayesian models in Stan via CmdStanPy, returning full posterior distributions over per-feature effects so that uncertainty is quantified alongside every estimate.

BIRDMAn ships with default negative-binomial models (fixed-effects and linear-mixed-effects variants, in both whole-table and per-feature forms) and exposes the underlying Stan templates so users can write their own custom models against the same fitting and post-processing machinery. Fits are returned as ArviZ InferenceData objects.

See the documentation for details on usage, including a walkthrough of the default models and a guide to writing custom Stan code.

For a runnable example, see this Google Colab notebook.

Installation

BIRDMAn requires Python 3.10 or higher.

We recommend using mamba for installation of dependencies.

mamba install -c conda-forge biom-format patsy xarray arviz cmdstanpy
pip install birdman

Quick example

The snippet below uses the macaque gut microbiome table bundled with the repo at tests/data/ (clone the repo, or substitute your own BIOM table and metadata):

import biom
import pandas as pd
from birdman import NegativeBinomial

table = biom.load_table("tests/data/macaque_tbl.biom")
metadata = pd.read_csv("tests/data/macaque_metadata.tsv", sep="\t", index_col=0)
metadata.index = metadata.index.astype(str)  # match BIOM sample IDs

nb = NegativeBinomial(
    table=table,
    formula="host_common_name",
    metadata=metadata,
)
nb.compile_model()
nb.fit_model(method="vi", num_draws=500)

inference = nb.to_inference()
inference.posterior["beta_var"]  # per-covariate, per-feature effects

Citation

If you use BIRDMAn, please cite our manuscript:

Rahman G, Morton JT, Martino C, Sepich-Poore GD, Allaband C, Guccione C, Chen Y, Hakim D, Estaki M, Knight R. BIRDMAn: A Bayesian differential abundance framework that enables robust inference of host-microbe associations. bioRxiv. 2023. doi:10.1101/2023.01.30.526328.

Contributing

Issues and pull requests are welcome.

License

BIRDMAn is released under the BSD 3-Clause License, see LICENSE.

Metadata

Release files for birdman 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for birdman 0.2.1
File Size Uploaded Provenance Actions
birdman-0.2.1.tar.gz 23.6 kB Without provenance Details for birdman-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for birdman 0.2.1
File Interpreter ABI Platform Actions
birdman-0.2.1-py3-none-any.whl Python 3 none any Details for birdman-0.2.1-py3-none-any.whl

Total release size: 53.3 kB

Release files / birdman-0.2.1.tar.gz

Download URL birdman-0.2.1.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6b3037e9f0fd9d908d23ab9eed9a671992b146f44cfdc14e40a081ebcf385ea2
BLAKE2b-256 checksum
How to use checksums
b04a70ebc14d25977ad89668b5c9dd4e3cbaace1c1dea7f3a2282c21bfd001de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / birdman-0.2.1-py3-none-any.whl

Download URL birdman-0.2.1-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da23609b3c5f3b3edc1680ff072363af41fa2645f2e17ba099afd762e9ece327
BLAKE2b-256 checksum
How to use checksums
aa2430a6d7f4c7a778ec3f8aaa67b1355c7ee9bc9fa447c5eed25b52ec404fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for birdman 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page