Skip to content

Commit 539d197

Browse files
doc: add usage and installation to README
1 parent 3dcea9f commit 539d197

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
[![Python package](https://github.com/corneliusroemer/pango_aliasor/actions/workflows/pytest.yaml/badge.svg)](https://github.com/corneliusroemer/pango_aliasor/actions/workflows/pytest.yaml)
22

3+
Python convenience library to translate between aliased and unaliased Pango lineages
4+
5+
Useful for:
6+
- constructing a tree of Pango lineages
7+
- semantic sorting of Pango lineages
8+
- ...
9+
10+
## Usage
11+
12+
```python
13+
from pango_aliasor.aliasor import Aliasor
14+
15+
# Initalize aliasor (only needs to be done once)
16+
# If no alias_key.json is passed, downloads the latest version from github
17+
aliasor = Aliasor()
18+
19+
# To use custom alias_key.json, pass the relative path to the file
20+
# aliasor = Aliasor('alias_key.json')
21+
22+
# Go from aliased lineage to unaliased lineage
23+
aliasor.uncompress("BA.5") # 'B.1.1.529.5'
24+
aliasor.uncompress("BE.5") # 'B.1.1.529.5.3.1.5'
25+
aliasor.uncompress("XA") # 'XA'
26+
27+
# Go from unaliased lineage to aliased lineage
28+
aliasor.compress("B.1.1.529.3.1") # 'BA.3.1'
29+
```
30+
31+
See [tests](tests/test_aliasor.py) for more examples.
32+
33+
## Installation
34+
35+
```bash
36+
pip install pango_aliasor
37+
```
38+
339
## Testing
440

541
Run `pytest` from the project root to run all tests.

0 commit comments

Comments
 (0)