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.1

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.1
File Size Uploaded Provenance
genomeblocks-2.0.1.tar.gz 192.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 372.5 kB

Release files / genomeblocks-2.0.1.tar.gz

Download URL genomeblocks-2.0.1.tar.gz
Size 192.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6ef9a63e43e471be9ccad4b238d3fec1a00b845448926d43dc4ff7d3b6e2a012
BLAKE2b-256 checksum
How to use checksums
c2c6543f857fbb7695d736a69e927e90f5a3e9de9c623bd1a7f89ccac7d24451
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.1-py3-none-any.whl

Download URL genomeblocks-2.0.1-py3-none-any.whl
Size 179.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdcaa4537566348eb8e9ad2c7584a20b311ba2731a0ae619d4bdea287432de3c
BLAKE2b-256 checksum
How to use checksums
73d387de9778003b7b5c3ffbfac980de8deeca6559ffc1ee43d65375895dc07a
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.1

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