Skip to main content

Python bindings for HiGlass

Project description

higlass-python 🔎

A fresh Python library for higlass built on top of:

License Open In Colab

Installation

pip install higlass-python

Usage

import higlass as hg

# Remote data source (tileset)
tileset1 = hg.remote(
    uid="CQMd6V_cRw6iCI_-Unl3PQ",
    server="https://higlass.io/api/v1/",
    name="Rao et al. (2014) GM12878 MboI (allreps) 1kb",
)

# Local tileset
tileset2 = hg.cooler("../data/dataset.mcool")

# Create a `hg.HeatmapTrack` for each tileset
track1 = tileset1.track("heatmap")
track2 = tileset2.track("heatmap")

# Create two independent `hg.View`s, one for each heatmap
view1 = hg.view(track1, width=6)
view2 = hg.view(track2, width=6)

# Lock zoom & location for each `View`
view_lock = hg.lock(view1, view2)

# Concatenate views horizontally and apply synchronization lock
(view1 | view2).locks(view_lock)

Side-by-side Hi-C heatmaps, linked by pan and zoom

To learn more about the new API, check out the updated documentation.

Upgrade Guide

higlass-python v1.0 is a total rewrite of our prior implementation, aimed to offer a more ergonomic and flexible API. While this might present challenges when upgrading existing code, we've prepared documentation to guide you through the new API usage.

If you find a missing feature, please open an issue – we're committed to supporting your use cases with the new API.

Despite the large changes in v1.0, we will strive to avoid breaking changes going forward. However, because of the complete rewrite, the v1.0 release doesn't strictly adhere to semantic versioning. You can think of it as a pre-1.0 release, with breaking changes and new features included in minor releases, and bug fixes in patch releases.

We will aim for strict semantic versioning with the v2.0 release. Your feedback and understanding are greatly appreciated.

Development

higlass-python uses the recommended hatchling build-system, which is convenient to use via the hatch CLI. We recommend installing hatch globally (e.g., via pipx) and running the various commands defined within pyproject.toml. hatch will take care of creating and synchronizing a virtual environment with all dependencies defined in pyproject.toml.

Commands Cheatsheet

All commands are run from the root of the project, from a terminal:

Command Action
hatch run fix Format project with black . and apply linting with ruff --fix .
hatch run lint Lint project with ruff ..
hatch run test Run unit tests with pytest in latest Python version.
hatch run test:test Run unit tests with pytest in all target Python versions.
hatch run docs:build Build the documentation in docs/_build/html.
hatch run docs:serve Start an dev-server for live editing RST files in docs/.

Note: hatch build and hatch publish are available to build and publish the project to PyPI, but all releases are handled automatically via CI.

Alternatively, you can develop higlass-python by manually creating a virtual environment and managing installation and dependencies with pip. For example, create a virtual environment with conda:

conda create -n higlass python=3.11
conda activate higlass

and install higlass-python in editable mode with all optional dependencies:

pip install -e ".[dev,fuse,docs]"

Our CI checks formatting (black .), linting (ruff .), and tests (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

higlass_python-1.0.3.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

higlass_python-1.0.3-py2.py3-none-any.whl (21.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file higlass_python-1.0.3.tar.gz.

File metadata

  • Download URL: higlass_python-1.0.3.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for higlass_python-1.0.3.tar.gz
Algorithm Hash digest
SHA256 ff665f8324ee41610b5f3f8be81e93beede0a3e12f9ff8b10b5bc3a41d58477c
MD5 8486d0de0a137eae40fc05e8b4ea2802
BLAKE2b-256 f246e54afd003d6fc22120bf7de752695aca8343d5481f6e34ced36dfc3e504a

See more details on using hashes here.

File details

Details for the file higlass_python-1.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for higlass_python-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7b6e94126846efb91ebed9937379b521918b7db8204741632342b161ae1586f8
MD5 f8389004a429c78dc23a8d7d498c9955
BLAKE2b-256 94d93db8055cd83b16709437ea82c4ae468a4acc8b96aed7001fbe7e55a2f8bf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page