Skip to content

About

EM model for RAD-seq

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

accmix logo
Under active development — interfaces may evolve
License: CC BY-NC-ND 4.0 PyPI version

accmix: Accessibility Mixture Model

CLI toolkit to (1) scan PWMs genome-wide, (2) compute accessibility-derived site scores s_l, (3) annotate with TSS/conservation/TPM, and (4) fit and evaluate a Gaussian EM with a logistic prior.

Full user and API documentation: https://yangli04.github.io/RAD-seq_EM_model/


1. System requirements

Operating systems

  • Tested on Ubuntu 24.04 LTS (kernel 6.17, x86_64).
  • Expected to work on any recent Linux distribution and macOS (12+). Not tested on Windows; use WSL2.

Software dependencies (versions verified during testing)

  • Python ≥ 3.12.
  • polars 1.41, numpy 2.4, scipy 1.17, pandas 3.0, pyarrow 24
  • pyranges1 1.3.8
  • metagene 0.0.16, scikit-learn 1.8, numba 0.65, pybigwig 0.3.25
  • matplotlib 3.10, seaborn 0.13
  • typer 0.26, tqdm 4.67

A minimum-version manifest is in pyproject.toml.

Non-standard hardware

None. CPU-only; no GPU required. ~4 GB RAM is sufficient for the demo; full genome-wide runs scale with the number of motif hits and benefit from ≥16 GB RAM.


2. Installation guide

Instructions

Create a fresh Python 3.12 environment (micromamba shown; conda/venv work the same):

micromamba create -y -n accmix python=3.12 -c conda-forge
micromamba activate accmix

Install from source (development install):

git clone https://github.com/yangli04/RAD-seq_EM_model.git
cd RAD-seq_EM_model
pip install -e .

or from PyPI:

pip install accmix

Verify the CLI:

accmix --help

Typical install time

On a normal desktop (Ubuntu 24.04, 8-core CPU, warm pip cache, broadband):

  • Environment creation: ~10 s
  • pip install -e . (or pip install accmix): ~30 s
  • Total: ~40 s (first-ever install with a cold pip cache: ~2–3 min)

3. Demo

Get the demo dataset

All files referenced under data/... are bundled in one archive. Download from Box:

https://uchicago.box.com/s/tsmy_wbgi_mvl4_7w9n_ynq6_6hur_3c8d_nirv

Note for humans: Box link is mildly obfuscated to deter automated scrapers. Before using, remove all underscores _ from the path segment after /s/. The resulting URL should contain only letters and digits in the share token.

Unpack at the repo root so the structure matches:

RAD-seq_EM_model/
├── data/
│   ├── fasta/test.fa
│   ├── pwms/M00124_example.txt
│   ├── clipseq/ELAVL1_HeLa.bed
│   ├── AS/ANC1C.hisat3n_table.bed6
│   ├── AS/ANC1xC.hisat3n_table.bed6
│   └── evaluation/...
└── ...

Run the demo

Four-step pipeline using the bundled example PWM M00124:

# (1) Scan PWM and GC across the test genome
accmix scan \
  -f data/fasta/test.fa \
  -p data/pwms/M00124_example.txt \
  -o results/M00124_example

# (2) Compute accessibility-derived s_l from AS native/fixed tables
accmix annotate-acc \
  -n data/AS/ANC1C.hisat3n_table.bed6 \
  -f data/AS/ANC1xC.hisat3n_table.bed6 \
  -t results/M00124_example_topA.tsv.gz \
  -o results/M00124_example_sl.parquet

# (3) Add TSS / conservation / TPM annotations
accmix annotate-tss \
  -i results/M00124_example_sl.parquet \
  -o results/M00124_example_annotated.parquet \
  -r data/evaluation/RNAseq_HeLa_TPM.parquet \
  -c data/evaluation/phastCons100way.bed.gz \
  -p data/evaluation/phastCons100way.parquet \
  -y data/evaluation/phyloP100way.parquet \
  -R data/fasta/test.fa

# (4) Fit the EM model
accmix model \
  -i results/M00124_example_annotated.parquet \
  -o results/RBP_Motif \
  -r ExampleRBP \
  -m M00124

Expected output

After step (1):

  • results/M00124_example_topA.tsv.gz — top-strand PWM hits with inner/outer scores
  • results/M00124_example_botB.tsv.gz — bottom-strand PWM hits

After step (2):

  • results/M00124_example_sl.parquet — sites with the s_l accessibility score column

After step (3):

  • results/M00124_example_annotated.parquet — sites with added tss_dist, phastCons, phyloP, TPM columns

After step (4):

  • results/RBP_Motif.<id>.model.parquet — original sites annotated with prior_p and posterior_r
  • results/RBP_Motif.<id>.model.json — fitted Gaussian + logistic-prior parameters

4. Instructions for use

To run on your own data, replace the demo inputs with files in the same formats:

Stage Input Format
scan Genome FASTA, PWM .fa (indexed or plain); PWM in TRANSFAC-style matrix
annotate-acc AS native / fixed tables, PWM hits .bed6 from hisat-3n table conversion; PWM hits from step 1
annotate-tss s_l parquet + annotation tracks Parquet; phastCons/phyloP as parquet or .bed.gz; TPM as parquet
model Annotated parquet Output of annotate-tss
evaluate Model parquet + CLIP/PIP-seq peaks .bed peaks

Each subcommand documents its full option list:

accmix scan --help
accmix annotate-acc --help
accmix annotate-tss --help
accmix model --help
accmix evaluate --help

Key tunables:

  • annotate-acc -M / -N: inner / outer flank size (defaults: 50 / 500). Outer flank length is N − M.
  • model -r / -m: RBP and motif identifiers used to name outputs.

See the full CLI reference at https://yangli04.github.io/RAD-seq_EM_model/cli/ for every flag and default.


5. Reproduction instructions (optional)

To reproduce the figures and tables from the manuscript:

  1. Install per Section 2.
  2. Download the full Box archive (Section 3, Demo) — this includes all example PWMs, AS tables, conservation tracks, and CLIP/PIP-seq evaluation data.
  3. Run the Snakemake pipeline driver:
    snakemake -s Snakefile --cores 8
  4. Generated tables and figures will appear under results/ (or follow the symlinked path if you redirect results/ to a larger disk).

A step-by-step reproducibility walkthrough — including expected intermediate file sizes and the exact PWM/cell-line manifest — is maintained at:

https://yangli04.github.io/RAD-seq_EM_model/reproducibility/

The full user guide, API reference, and tutorials live at:

https://yangli04.github.io/RAD-seq_EM_model/


Citation

If you use this package, please cite:

Li Y., accmix: Accessibility Mixture Model, GitHub repository, https://github.com/yangli04/RAD-seq_EM_model

About

EM model for RAD-seq

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages