Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

LoopSage

Python OpenMM Numba PyVista Docker NumPy SciPy MDTraj pytest GPL v3 license

LoopSage is an energy-based stochastic model of chromatin loop extrusion. Cohesin complexes are modelled as loop-extruding factors (LEFs) that slide along a chromatin fibre, are blocked by CTCF sites and rebind elsewhere. A Metropolis / simulated-annealing Monte Carlo samples ensembles of loop configurations that agree with your loop data (e.g. ChIA-PET, HiChIP, Hi-C loops, or CTCF peaks). Each ensemble can be turned into 3D structures with a short OpenMM molecular-dynamics run.

From one command you get an HTML report with the contact maps, loop statistics, 3D structures and diagnostics.

Installation

Python 3.10 or newer is required. openmm and pyBigWig install most reliably from conda. hic-straw (reads .hic files for the optional --hic reference) is installed with the package. It needs a C++ compiler and libcurl when no wheel exists for your system.

git clone https://github.com/SFGLab/pyLoopSage.git
cd pyLoopSage
conda create -n loopsage python=3.11 -y && conda activate loopsage
conda install -c conda-forge "openmm>=8.5.1" pybigwig -y
pip install -r requirements.txt && pip install -e .

Then install the package (pip install -e .) to get the loopsage command (version 2.0.0rc2).

Usage

# Minimal run: loops file + region
loopsage -f loops.bedpe -r chr1:77000000-95000000

# Settings from a config file, with command-line overrides
loopsage -c config.ini -t 4 --n-replicas 3

# BEDPE without orientation columns: read CTCF orientation from the reference genome, keep loops with >= 3 PET
loopsage -f loops.bedpe -r chr1:77000000-95000000 --motif-genome hg38.fa --min-pet 3

# See every option
loopsage -h
  • Input: a .bedpe loop file, or .bed / .narrowPeak CTCF sites, plus the genomic region.
  • CTCF motif search (optional): with --motif-genome FASTA every loop anchor is scanned for the CTCF motif (bundled JASPAR MA0139.1, or your own --motif-pfm) and the orientation probabilities are added automatically; --min-pet N keeps only loops with at least N PET counts (works without a genome too). Needs no extra packages; the genome is read through a .fai index and never loaded into memory. Hits are accepted at --motif-pvalue (default 1e-5). The report shows a progress bar while searching and a diagnostics section (loops kept, motif scores, orientation calls). The annotated loops are saved in the run's data folder.
  • Config: config_example.ini lists every parameter with a short description; command-line flags override it.
  • Output: results/<chrom>_<start>_<end>_<run>/, with the report in report/report.html.
  • MD platform: --platform auto (default) tries CUDA, then OpenCL, then the multi-threaded CPU platform, and the chosen platform is always printed. Force one with --platform CUDA|OpenCL|CPU.
  • Monte Carlo: --method Metropolis|Annealing, --t-init, --t-final, --mc-steps, --sample-every and --burnin control the sampler (all also keys in the config file).
  • Parallelism: -t/--threads sets worker threads and --n-replicas runs independent Monte Carlo chains (default 1).
  • Demo: python demo/run_demo.py quick runs a small example in seconds.

Detailed documentation of the model, parameters and outputs is in markdown/.

Tests

Run the whole suite in parallel, with a per-module report:

python tools/run_tests.py             # all tests, one worker per two cores
python tools/run_tests.py -j 8 --html # 8 workers, also writes test_report/report.html
python tools/run_tests.py -k contrast # only tests whose name matches

Plain PYTHONPATH=src python -m pytest -q also works, but runs the files one after another (about 15 minutes). Tests of optional packages (hicstraw, pyBigWig) are skipped when those are not installed.

Citation

If you use LoopSage, please cite:

  • Korsak, S. and Plewczynski, D. LoopSage: An energy-based Monte Carlo approach for the loop extrusion modelling of chromatin. Methods (2024).
  • Jodkowska, K., Parteka-Tojek, Z., Agarwal, A., Denkiewicz, M., Korsak, S., Chiliński, M., Banecki, K., & Plewczynski, D. Improved cohesin HiChIP protocol and bioinformatic analysis for robust detection of chromatin loops and stripes. bioRxiv (2024). https://doi.org/10.1101/2024.05.16.594268

License

GNU General Public License v3.0.

Metadata

Release files for pyLoopSage 2.0.0rc2

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

Source distribution (sdist)

Source distribution for pyLoopSage 2.0.0rc2
File Size Uploaded Provenance Actions
pyloopsage-2.0.0rc2.tar.gz 236.4 kB Without provenance Details for pyloopsage-2.0.0rc2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyLoopSage 2.0.0rc2
File Interpreter ABI Platform Actions
pyloopsage-2.0.0rc2-py3-none-any.whl Python 3 none any Details for pyloopsage-2.0.0rc2-py3-none-any.whl

Total release size: 470.4 kB

Release files / pyloopsage-2.0.0rc2.tar.gz

Download URL pyloopsage-2.0.0rc2.tar.gz
Size 236.4 kB
Tags Source
SHA-256 checksum
How to use checksums
951eed01be273126f008c1a82e2cabfd400772411685043f3ae68faab4b9031a
BLAKE2b-256 checksum
How to use checksums
f1bca6af093d53d053ea45409786ced2af0b811e6f044511b04fca4dba64eadc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pyloopsage-2.0.0rc2-py3-none-any.whl

Download URL pyloopsage-2.0.0rc2-py3-none-any.whl
Size 234.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2aaebe7c63ba3d23bc8bec17996dabbfad273d35a490f82286d35dd69ccdb534
BLAKE2b-256 checksum
How to use checksums
e86bd6dc9d64f7ee077147bd508d2aa91af0cf8ea07c171e2fe06ada9f6b7994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pyLoopSage 2.0.0rc2

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