Skip to main content

Python implementation of GetBaseCountsMultiSample (gbcms) for calculating base counts in BAM files

Project description

gbcms

Complete orientation-aware counting system for genomic variants

Tests Python 3.10+ Ask DeepWiki

Features

  • 🚀 High Performance: Rust-powered core engine with multi-threading
  • 🧬 Complete Variant Support: SNP, MNP, insertion, deletion, and complex variants (DelIns, SNP+Indel)
  • 🧪 WFA + PairHMM Phase 3: Pangenomic fast-path WFA alignment with PairHMM fallback for complex multi-allelic classification
  • 📊 Orientation-Aware: Forward and reverse strand analysis with fragment counting
  • 📏 mFSD (Mutant Fragment Size Distribution): Per-allele cfDNA fragment size profiling with KS test and log-likelihood ratio
  • 🔬 Statistical Analysis: Fisher's exact test for strand bias (read-level and fragment-level)
  • 📁 Flexible I/O: BAM and CRAM input; VCF and MAF variant input/output formats
  • 🎯 Quality Filters: 8 configurable read and quality filtering options with heuristic BAQ
  • 🧬 RNA Mode: Transcriptome-aware counting with strandedness, splice detection, and A-to-I editing
  • 🔗 UMI Support: Molecule-level deduplication with UMI-aware fragment grouping
  • 🔧 Normalize Command: Standalone variant normalization (left-align + REF validation) without counting

Installation

Quick install:

pip install gbcms

From source (requires Rust):

git clone https://github.com/msk-access/gbcms.git
cd gbcms
pip install .

Docker:

docker pull ghcr.io/msk-access/gbcms:X.Y.Z  # Replace X.Y.Z with latest from PyPI

💡 Find the latest version on PyPI or GHCR.

📖 Full documentation: https://msk-access.github.io/gbcms/


Usage

gbcms can be used in two ways:

🔧 Option 1: Standalone CLI (1-10 samples)

Best for: Quick analysis, local processing, direct control

gbcms dna \
    --variants variants.vcf \
    --bam sample1.bam \
    --fasta reference.fa \
    --output-dir results/

Output: results/sample1.vcf

Learn more:


🔄 Option 2: Nextflow Workflow (10+ samples, HPC)

Best for: Many samples, HPC clusters (SLURM), reproducible pipelines

nextflow run nextflow/main.nf \
    --input samplesheet.csv \
    --variants variants.vcf \
    --fasta reference.fa \
    --mode dna \
    -profile slurm

Features:

  • ✅ Automatic parallelization across samples
  • ✅ SLURM/HPC integration
  • ✅ Container support (Docker/Singularity)
  • ✅ Resume failed runs

Learn more:


Which Should I Use?

Scenario Recommendation
1-10 samples, local machine CLI
10+ samples, HPC cluster Nextflow
Quick ad-hoc analysis CLI
Production pipeline Nextflow
Need auto-parallelization Nextflow
Full manual control CLI

Quick Examples

CLI: DNA Single Sample

gbcms dna \
    --variants variants.vcf \
    --bam tumor.bam \
    --fasta hg19.fa \
    --output-dir results/ \
    --threads 4

CLI: RNA-seq

gbcms rna \
    --variants variants.vcf \
    --bam rna_sample:aligned.bam \
    --fasta hg19.fa \
    --rna-editing-db TABLE1_hg38.txt.gz \
    --output-dir results/

CLI: Normalize Variants

gbcms normalize \
    --variants variants.vcf \
    --fasta hg19.fa \
    --output results/normalized.tsv

CLI: Multiple Samples (Sequential)

gbcms dna \
    --variants variants.vcf \
    --bam-list samples.txt \
    --fasta hg19.fa \
    --output-dir results/

Nextflow: Many Samples (Parallel)

# samplesheet.csv:
# sample,bam,bai
# tumor1,/path/to/tumor1.bam,
# tumor2,/path/to/tumor2.bam,

nextflow run nextflow/main.nf \
    --input samplesheet.csv \
    --variants variants.vcf \
    --fasta hg19.fa \
    --mode dna \
    --outdir results \
    -profile slurm

Documentation

📚 Full Documentation: https://msk-access.github.io/gbcms/

Quick Links:


Contributing

See CONTRIBUTING.md for development guidelines.

To contribute to documentation, see the gh-pages branch.


Citation

If you use gbcms in your research, please cite:

Shah, R. et al. (2026). gbcms: A high-performance orientation-aware genotype counting system for genomic variants. Available at: https://github.com/msk-access/gbcms

BibTeX:

@software{pygbcms,
  author       = {Shah, Ronak and contributors},
  title        = {gbcms: A high-performance orientation-aware genotype counting system for genomic variants},
  year         = {2026},
  url          = {https://github.com/msk-access/gbcms},
  note         = {GitHub repository}
}

License

AGPL-3.0 - see LICENSE for details.


Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gbcms-6.0.0.tar.gz (266.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gbcms-6.0.0-cp311-cp311-manylinux_2_34_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

File details

Details for the file gbcms-6.0.0.tar.gz.

File metadata

  • Download URL: gbcms-6.0.0.tar.gz
  • Upload date:
  • Size: 266.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gbcms-6.0.0.tar.gz
Algorithm Hash digest
SHA256 03c3c091c476c3c3b267078eba3776ecf559e883efec06160a5b58f6cb872d77
MD5 35aee1e53a66ca21279d7ee0cbeb9b88
BLAKE2b-256 e242e6f9c5d1c4a46b2a80ac684870fb78d680e8494f30c790b563640584ead2

See more details on using hashes here.

Provenance

The following attestation bundles were made for gbcms-6.0.0.tar.gz:

Publisher: release.yml on msk-access/gbcms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gbcms-6.0.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for gbcms-6.0.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f7119bea0972b3a798a306449a9415f630ff92e771567cc83e659d1d9a94ab09
MD5 e1a31c0e99c1b9b489a6a5d78b185341
BLAKE2b-256 0069ef978e3269a3f0b0768b3aeb225b6211befcc370a74f63baac68ec29e2b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for gbcms-6.0.0-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: release.yml on msk-access/gbcms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page