Pango lineage aliasing and dealiasing
Project description
Python convenience library to translate between aliased and unaliased Pango lineages
Useful for:
- constructing a tree of Pango lineages
- semantic sorting of Pango lineages
- ...
Usage
from pango_aliasor.aliasor import Aliasor
# Initalize aliasor (only needs to be done once)
# If no alias_key.json is passed, downloads the latest version from github
aliasor = Aliasor()
# To use custom alias_key.json, pass the relative path to the file
# aliasor = Aliasor('alias_key.json')
# Go from aliased lineage to unaliased lineage
aliasor.uncompress("BA.5") # 'B.1.1.529.5'
aliasor.uncompress("BE.5") # 'B.1.1.529.5.3.1.5'
aliasor.uncompress("XA") # 'XA'
# Go from unaliased lineage to aliased lineage
aliasor.compress("B.1.1.529.3.1") # 'BA.3.1'
aliasor.partial_compress("B.1.1.529.3.1",up_to=1) # 'BA.3.1'
aliasor.partial_compress("B.1.1.529.3.1.1.2",up_to=1) # 'BA.3.1.1.2'
aliasor.partial_compress("B.1.1.529.3.1",accepted_aliases=["AY"]) # 'B.1.1.529.3.1'
aliasor.partial_compress("B.1.617.2",accepted_aliases=["AY"]) # 'AY.2'
aliasor.partial_compress('B.1.1.529.2.75.1.2',up_to=4, accepted_aliases={"BA"}) == 'BL.2'
See tests for more examples.
Installation
pip install pango_aliasor
Testing
Run pytest
from the project root to run all tests.
Release
- Bump version in
setup.cfg
- Release using
gh release create
- Build using
python3 -m build
- Publish to Pypi using
twine upload dist/pango_aliasor*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for pango_aliasor-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adbe206102deab883af21fd085295d74d3f99457c75a622aedc3a91096a456fc |
|
MD5 | 88aae5520156586581bd7a55ca7f35e8 |
|
BLAKE2b-256 | 8e187e08b5cda83ed3330d820f1231a63f770956c2e5b173cc43871cbaba334d |