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'
# Find parent lineage
aliasor.parent("BQ.1") # 'BE.1.1.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 Distribution
pango_aliasor-0.3.0.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pango_aliasor-0.3.0.tar.gz.
File metadata
- Download URL: pango_aliasor-0.3.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e48154796e40515e481589bc628bb31d153ba652b42dbe174b9a7f32dc85a72
|
|
| MD5 |
3f96e947a9f3d34e0fe5307ba75e3dd4
|
|
| BLAKE2b-256 |
9b8ded8a8d5e0dbe4ef9206d9a5c424f4232870c50509c1fbe38bd7393e16810
|
File details
Details for the file pango_aliasor-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pango_aliasor-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80c2d9eb37d150f9e67e8111e166feb12a849ad715937c4c21a34b016d48302e
|
|
| MD5 |
b16fde29db296bafa0999f90f39af653
|
|
| BLAKE2b-256 |
076057dc4c7698e05c0fb650a851c3afbdafa3843313c61baf6f761c0d780d35
|