agct: Another Genome Conversion Tool
Drop-in replacement for the pyliftover tool, using the St. Jude's chainfile crate.
Enables significantly faster chainfile loading from cold start (see analysis/
).
Installation
Install from PyPI:
python3 -m pip install agct
Usage
Initialize a class instance:
from agct import Converter, Genome
c = Converter(Genome.HG38, Genome.HG19)
If a chainfile is unavailable locally, it's downloaded from UCSC and saved using the wags-tails
package -- see the wags-tails configuration instructions for information on how to designate a non-default storage location.
Call convert_coordinate()
:
c.convert_coordinate("chr7", 140453136, "+")
# [['chr7', 140152936, <Strand.POSITIVE: '+'>]]
Development
The Rust toolchain must be installed.
Create a virtual environment and install developer dependencies:
python3 -m virtualenv venv
source venv/bin/activate
python3 -m pip install -e '.[dev,tests]'
This installs Python code as editable, but after any changes to Rust code, run maturin develop
to rebuild the Rust binary:
maturin develop
Be sure to install pre-commit hooks:
pre-commit install
Check Python style with ruff
:
python3 -m ruff format . && python3 -m ruff check --fix .
Use cargo fmt
to check Rust style (must be run from within the rust/
subdirectory):
cd rust/
cargo fmt
Run tests with pytest
:
pytest