Lift over positions between genomic reference assemblies, using the St. Jude's chainfile crate.
Enables significantly faster chainfile loading from cold start (see analysis/).
Install from PyPI:
python3 -m pip install agctInitialize a class instance:
from agct import Converter, Assembly, Strand
c = Converter(Assembly.HG19, Assembly.HG38)If a chainfile is unavailable locally, it's downloaded from UCSC and saved using the
wags-tailspackage -- 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, 140453137, Strand.POSITIVE)
# returns [LiftoverResult(chrom='chr7', start=140753336, end=140753337, strand=<Strand.POSITIVE: '+'>)]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 developBe sure to install pre-commit hooks:
pre-commit installCheck 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 fmtRun tests with pytest:
pytest