Sovereign 8s.is mirror of standardgalactic/comigration-metagenomics
  • Python 63.5%
  • Jupyter Notebook 34.1%
  • Shell 2.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Matt Carter 1151fcef4f
Merge pull request #3 from zhiru-liu/cphmm-install-and-repro-docs
Updated readme & reproduction guide
2026-09-02 18:38:40 -07:00
cphmm_analysis Adopt installable cphmm package; streamline README; add reproduction guide 2026-07-13 15:58:16 -04:00
data_processing updated various pipelines; updated cphmm anlaysis codes 2025-03-17 09:05:42 -07:00
example added test data for one species 2025-06-12 12:47:36 -04:00
figure_generation added MC scripts and files. 2025-05-21 12:37:07 -07:00
identical_tract_analysis moments cleanup; updating SI figure plotting 2025-03-18 16:06:15 -07:00
mag_processing added MC scripts and files. 2025-05-21 12:37:07 -07:00
moments_analysis moments cleanup; updating SI figure plotting 2025-03-18 16:06:15 -07:00
snv_catalog_pipeline added MC scripts and files. 2025-05-21 12:37:07 -07:00
utils added test data for one species 2025-06-12 12:47:36 -04:00
config.py Adopt installable cphmm package; streamline README; add reproduction guide 2026-07-13 15:58:16 -04:00
environment.yml Adopt installable cphmm package; streamline README; add reproduction guide 2026-07-13 15:58:16 -04:00
README.md Adopt installable cphmm package; streamline README; add reproduction guide 2026-07-13 15:58:16 -04:00
REPRODUCE.md Adopt installable cphmm package; streamline README; add reproduction guide 2026-07-13 15:58:16 -04:00

Comigration Metagenomics Analysis Pipeline

This repository contains the analysis pipeline for investigating population structure and co-migration patterns in human gut microbiomes using metagenomics data.

The pipeline is organized into several analysis modules that can be run independently. For detailed instructions, refer to the Snakefile and README.md within each module directory.

Module Overview:

  1. SNV Catalog Pipeline - Generates single nucleotide variant (SNV) catalogs from assembled genomes (MAGs)
  2. Data Processing - Computes core genome statistics, genome coverage, and site frequency spectra
  3. Moments Analysis - Fits demographic models and estimates population parameters
  4. Identical Tract Analysis - Analyzes identity-by-state genomic segments
  5. CP-HMM Analysis - Infers recombination events and clonal divergence times using closely related genomes

System Requirements

Software Dependencies

The analysis modules use a small, standard scientific-Python stack, provided as a conda environment file (environment.yml):

conda env create -f environment.yml
conda activate comig

This installs Python 3.8, Snakemake, and the core packages (pandas, numpy, scipy, matplotlib, seaborn, scikit-learn, pyarrow) plus moments and dadi for the demographic inference. Figure generation additionally uses R (≥4.0) with ggplot2, dplyr, tidyr, and data.table.

Additional tools:

  • CP-HMM: For recombination inference (external dependency from Liu & Good 2024); see cphmm repo. Install it as a package (clone the repo and run pip install -e .); it requires Python ≥3.8 (tested on 3.10) and is numba-accelerated.
  • FastSimBac: Bacterial genome simulation (optional, for validation analyses); for installation instructions see FastSimBac bitbucket

Note — building SNV catalogs from MAGs. The snv_catalog_pipeline/ module additionally requires Biopython and the bioinformatics tools MMseqs2 (protein clustering), Prodigal (gene prediction), and MUMmer (nucmer, delta-filter, show-coords, show-snps, show-diff; whole-genome alignment). These are not needed if you start from the provided SNV catalogs.

Apple Silicon Compatibility

  • The moments package does not natively support ARM architecture. Install it using x86 emulation via the osx-64 channel and refer to the moments installation guide. This is the only module that requires x86 emulation; the other analyses (including CP-HMM) run natively on Apple Silicon.

Reproducing the analyses

Each analysis module has its own README.md and Snakefile describing how to run it. For an end-to-end guide — starting from the Supplementary Data deposited on Zenodo and mapping each analysis to the figure it produces — see REPRODUCE.md.

Citation

If you use this pipeline, please cite the associated publication:

[Citation information to be added upon publication]

Contact

For questions or issues, please contact:

  • Matt Carter - matthewmcarter2 at gmail.com
  • Zhiru Liu - zhiru at stanford.edu