Skip to main content

Genomeblocks

Fluent building blocks for regulatory genomics, as columnar tables.

  • Loci: interval tables with set algebra (& | - ^), slop / sort / merge / nearest, indexed lookups and signal extraction.
  • Genes: GTF / GFF3 / UCSC gene models as three linked tables (genes, transcripts, features); annotation and ATAC-supported isoforms.
  • Pairs and Architecture: BEDPE loops and the chromatin-contact graph over CREs — Hi-C weights from .mcool, O/E normalisation, hubs.
  • signal: bigWig signal cubes, TMM normalisation, heatmaps; motifs: motif scanning with any engine; Atlas: GIGGLE-style enrichment.
  • browser, igv_html, View: a matplotlib region view, a shareable IGV page and a one-file interactive browser.

Every table hands itself to pandas, polars, Arrow, bioframe, pyranges, pybedtools, AnnData, duckdb, seaborn and friends, and takes their frames back. The heavy work runs through swappable backends (numpy / cgranges / ncls / bioframe / pyranges / bedtools for intervals, pybigtools / pyBigWig / pure Python for bigWigs, MOODS / lightmotif / Biopython for motifs, graph-tool / scipy / igraph / networkx for graphs, ...) with the same answer whichever engine runs.

📖 Documentation: birkiy.github.io/genomeblocks — start with the quickstart.

Quick Start

import genomeblocks as gb

cre = (gb.Loci.make("atac.narrowPeak")          # a table: numpy columns, row = join key
         .slop(100).sort().merge())

se = cre & gb.as_loci("H3K27ac_SE.bed")          # anything interval-like goes in

genes = gb.Genes.make("gencode.v38.annotation.gtf")   # 0-based tables, GTF or GFF3
labels = genes.annotations(se)                   # Promoter-TSS / Exonic / Intronic / ...

A = (gb.Architecture.make(cre, "loops.bedpe", r=2500)
       .add_mcool("hic.mcool", resolution=5000)
       .normalize().annotate(genes).strength())
hubs = A.prime_hubs()

S = cre.signal(["atac.bw", "h3k27ac.bw"], n_bins=200, flank=3000)   # (rows, tracks, bins)
cre.to_polars(); A.to_pandas(); genes.to_arrow()                    # and back: Loci.from_frame(df)
cre.intersect(se, backend="bioframe")             # or: with gb.use_backend(intervals="pyranges"): ...

Setup

pip install genomeblocks                 # every default backend except a motif engine
pip install "genomeblocks[motifs]"       # + MOODS, the motif engine (compiled at install)
pip install "genomeblocks[lightmotif]"   # or lightmotif (prebuilt wheels); same hits
pip install "genomeblocks[all]"          # + polars, pysam, logomaker and every other engine

The conda package (recipe in conda-recipe/, for Bioconda) ships MOODS. The conda-only engines (graph-tool, cgranges, bedtools) are optional extras; environment.yml builds the full development environment:

conda env create -f environment.yml
conda activate genomeblocks

gb.backends() lists what is installed and what each family uses. See the documentation for installation details, the concepts, module guides, interoperability, backends and the API reference.

License

MIT — see LICENSE.

Metadata

Release files for genomeblocks 2.0.0

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

Source distribution (sdist)

Source distribution for genomeblocks 2.0.0
File Size Uploaded Provenance
genomeblocks-2.0.0.tar.gz 192.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 372.2 kB

Release files / genomeblocks-2.0.0.tar.gz

Download URL genomeblocks-2.0.0.tar.gz
Size 192.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4792be938851003540ffea78e28b729d8758937d692785a23f2e31315f3ace23
BLAKE2b-256 checksum
How to use checksums
03331bc808302714022f1ddc8871fdfe5d758053e88dff2e13023165efdc36ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / genomeblocks-2.0.0-py3-none-any.whl

Download URL genomeblocks-2.0.0-py3-none-any.whl
Size 179.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70dc847c45475c6cf813d0e8e038e5d4da2719432e779d8ae27cea58412c082a
BLAKE2b-256 checksum
How to use checksums
937fb019fa8efb5c0e80efd6f05ff4f9980585bda8b227011624c0b55e38ca27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for genomeblocks 2.0.0

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.

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