Skip to main content

Tools for preprocessing and analyzing high-resolution chromatin contact data.

Project description

touche

PyPI Tests PyPI Downloads

Python API and CLI tools for analyzing enhancer-promoter contacts (touches) from high-resolution chromatin contact data, refactored from the Danko Lab E-P_contacts reference workflows.

touche starts from processed pairs files. Raw FASTQ processing, alignment, deduplication, and cooler generation should be handled by an external workflow such as distiller-nf.

Status

The current implementation includes CLI tools+API for:

  • Micro-C pairs conversion, filtering, QC, and chromosome-sharded NPZ caches
  • local-decay contact calling, pair-type assignment, and plotting
  • Aggregated peak analysis (APA) aggregation and inter-sample APA comparison
  • enhancer/promoter local-background counting and treatment comparison
  • pipeline run wrappers that preserve intermediate outputs and write JSON manifests

Installation

Install with pip from PyPI (package name is ep-touche):

pip install ep-touche
touche --help

uv can also install and run the package:

uv add ep-touche
uv run touche --help

local-decay also supports a statsmodels-backed LOWESS path (lowess_backend="statsmodels") for exact reference comparisons (at the cost of being much slower than our custom implementation). Install the optional legacy extra only if you need that backend:

pip install ep-touche[legacy]
# or: uv sync --extra legacy

Older CPUs and Rosetta

Polars publishes an lts-cpu wheel for older CPUs and for x86-64 Python on Apple Silicon under Rosetta. Because polars-lts-cpu provides the same import polars module but is a different Python distribution, it does not automatically satisfy ep-touche's normal polars>=1.0 dependency. If the standard Polars wheel does not run on your machine, install ep-touche, then replace Polars in that environment:

pip install ep-touche
pip uninstall polars
pip install "polars-lts-cpu>=1.0"

CLI Overview

touche preprocess --help
touche local-decay --help
touche apa --help
touche background --help

Available command groups:

  • touche preprocess: convert/filter pairs, write QC summaries, and build NPZ caches.
  • touche local-decay: call observed/expected contacts, assign pair types, plot distributions, or run the full local-decay workflow.
  • touche apa: aggregate APA matrices, compare treatment/control APAs, or run a paired APA workflow.
  • touche background: count EP/background contacts, compare treatment ratios, or run the full EP/background workflow.

See the CLI reference for examples, common options, and expected outputs.

Typical workflow

Start from analysis-ready .pairs or .pairs.gz files produced by distiller-nf or an equivalent workflow.

  1. Filter or convert pairs with touche preprocess.
  2. For real or repeated local-decay runs, build a position-only cache with touche preprocess build-cache --no-metadata.
  3. Use the run wrappers for end-to-end analyses: touche local-decay run, touche apa run, and touche background run.
  4. Use individual subcommands such as local-decay call or background count when debugging or replacing one stage.

Many of the computation-heavy steps use numba acceleration and parallelism. Set NUMBA_NUM_THREADS before running to control CPU usage (default is to use all threads on machine):

NUMBA_NUM_THREADS=8 touche background run ...

Python API

For notebooks and custom scripts, import the provisional API surface:

import touche.api as tt

indexes = tt.build_contact_indexes("sample.nodups_30_intra.pairs.gz", source="touche")

The API is organized around reading pairs and anchors once, running in-memory compute functions such as compute_apa, compute_local_decay, and compute_ep_and_background, then displaying or saving returned Matplotlib figures as needed. Long-running CLI and API calls support optional progress bars and lightweight profiling. See the API guide for examples.

Documentation

Detailed usage notes live under docs/:

  • Docs index: human-facing guides and documentation conventions.
  • CLI reference: command groups, common options, examples, outputs, and run-wrapper manifests.
  • Micro-C preprocessing: distiller-nf boundary, pairs format expectations, filtering, QC, and cache building.
  • API: provisional in-memory APIs for notebooks, interactive analyses, and custom scripts.
  • Reproducing reference plots: end-to-end commands for the reference local-decay, APA, and EP/background plots.
  • Testing and publishing: CI, local checks, and PyPI release workflow for the ep-touche distribution.

Implementation plans, experiment logs, and agent-facing notes belong in notes/.

Development

Development is managed with uv.

git clone https://github.com/adamyhe/touche.git
cd touche/
uv sync --dev
uv run touche --help
uv run pytest

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

ep_touche-0.1.1.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

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

ep_touche-0.1.1-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

Details for the file ep_touche-0.1.1.tar.gz.

File metadata

  • Download URL: ep_touche-0.1.1.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ep_touche-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5567834d9ce1d1157c717c00cd9a38dd2111cea1f36d077229e9c8a6814e559
MD5 70e1096dc28e418f12cda20ac39d78b5
BLAKE2b-256 c35ce38960f54992815b0719df6bc43c72b25f26b948e77da4d9c083fc57972e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ep_touche-0.1.1.tar.gz:

Publisher: publish.yml on adamyhe/touche

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

File details

Details for the file ep_touche-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ep_touche-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ep_touche-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 879c46dbe15c336ab95a0939e17243eb27eb1b707135cf531604d5d40ae2148f
MD5 cd00f9b3136dc965640ea3d899ae9ba2
BLAKE2b-256 30c62665c848e237bc4a8a982b3a0a51d8520f20f7985a1b35db99e538d1835c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ep_touche-0.1.1-py3-none-any.whl:

Publisher: publish.yml on adamyhe/touche

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