mutalyzer-algebra
=================
A Boolean Algebra for Genetic Variants
A set of Boolean relations: equivalence; containment, i.e., either a
variant is fully contained in another or a variant fully contains another;
overlap, i.e., two variants have (at least) one common element; and
disjoint, i.e., no common elements that allows for a comprehensive
classification of the relation for every pair of variants by taking all
minimal Longest Common Subsequence (LCS) alignments into account.
[Jonathan K. Vis, Mark A. Santcroos, Walter A. Kosters and Jeroen F.J. Laros.
"A Boolean Algebra for Genetic Variants." In: *Bioinformatics* (2023).](https://doi.org/10.1093/bioinformatics/btad001)
Installation
------------
Use pip to install from the Python Package Index (PyPI).
```bash
python -m pip install mutalyzer-algebra
```
Or directly from GitHub for development (after cloning in an active
virtual environment).
```bash
python -m pip install --upgrade --editable .[dev]
```
Testing
-------
Run the tests.
```bash
python -m coverage run
```
Usage
-----
Use the command-line interface.
```bash
algebra --reference "AAAAA" compare --lhs-hgvs "1_2insTA" --rhs-hgvs "2_3insT"
```
Or as a Python package.
```python
from algebra import compare
from algebra.variants import parse_hgvs
reference = "AAAAA"
lhs = parse_hgvs("1_2insTA")
rhs = parse_hgvs("2_3insT")
# returns: Relation.DISJOINT
compare(reference, lhs, rhs)
reference = "CATATATC"
lhs = parse_hgvs("2_7AT[4]") # observed: CATATATATC
rhs = parse_hgvs("5_6insT") # observed: CATATTATC
# returns: Relation.CONTAINS
compare(reference, lhs, rhs)
```
Extracting variants from sequences.
```python
from algebra.extractor import extract_sequence, to_hgvs
reference = "CATATATC"
observed = "CATATATATC"
canonical, _ = extract_sequence(reference, observed)
# returns: 2_7AT[4]
to_hgvs(canonical, reference)
```
Variant normalization.
```python
from algebra.extractor import extract, to_hgvs
from algebra.variants import parse_hgvs
reference = "CATATATC"
variant = parse_hgvs("6_7dupAT")
canonical, _ = extract(reference, variant)
# returns: 2_7AT[4]
to_hgvs(canonical, reference)
```
See Also
--------
A web interface with integration with [Mutalyzer](https://github.com/mutalyzer): [Mutalyzer Algebra](https://mutalyzer.nl/algebra)
[Mutalyzer Algebra on PyPI](https://pypi.org/project/mutalyzer-algebra/)
Raw data
{
"_id": null,
"home_page": "https://github.com/mutalyzer/algebra",
"name": "mutalyzer-algebra",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "algebra,genomics,graph,string,genetics,edit-distance,alignment,compare,sequence,variants,lcs,relations,hgvs,extractor",
"author": "Mark A. Santcroos, Jonathan K. Vis",
"author_email": "m.a.santcroos@lumc.nl, j.k.vis@lumc.nl",
"download_url": "https://files.pythonhosted.org/packages/b5/8d/8f474a85eb3002129fc3d9b96c3a8885578f9b6feec9a62de3eb844cb8f1/mutalyzer-algebra-1.5.1.tar.gz",
"platform": null,
"description": "mutalyzer-algebra\n=================\nA Boolean Algebra for Genetic Variants \n\nA set of Boolean relations: equivalence; containment, i.e., either a\nvariant is fully contained in another or a variant fully contains another;\noverlap, i.e., two variants have (at least) one common element; and\ndisjoint, i.e., no common elements that allows for a comprehensive\nclassification of the relation for every pair of variants by taking all\nminimal Longest Common Subsequence (LCS) alignments into account.\n\n[Jonathan K. Vis, Mark A. Santcroos, Walter A. Kosters and Jeroen F.J. Laros.\n\"A Boolean Algebra for Genetic Variants.\" In: *Bioinformatics* (2023).](https://doi.org/10.1093/bioinformatics/btad001)\n\nInstallation\n------------\n\nUse pip to install from the Python Package Index (PyPI).\n\n```bash\npython -m pip install mutalyzer-algebra\n```\n\nOr directly from GitHub for development (after cloning in an active\nvirtual environment).\n\n```bash\npython -m pip install --upgrade --editable .[dev]\n```\n\nTesting\n-------\n\nRun the tests.\n\n```bash\npython -m coverage run\n```\n\nUsage\n-----\n\nUse the command-line interface.\n\n```bash\nalgebra --reference \"AAAAA\" compare --lhs-hgvs \"1_2insTA\" --rhs-hgvs \"2_3insT\"\n```\n\nOr as a Python package.\n\n```python\nfrom algebra import compare\nfrom algebra.variants import parse_hgvs\n\n\nreference = \"AAAAA\"\nlhs = parse_hgvs(\"1_2insTA\")\nrhs = parse_hgvs(\"2_3insT\")\n\n# returns: Relation.DISJOINT\ncompare(reference, lhs, rhs)\n\n\nreference = \"CATATATC\"\nlhs = parse_hgvs(\"2_7AT[4]\") # observed: CATATATATC\nrhs = parse_hgvs(\"5_6insT\") # observed: CATATTATC\n\n# returns: Relation.CONTAINS\ncompare(reference, lhs, rhs)\n```\n\nExtracting variants from sequences.\n\n```python\nfrom algebra.extractor import extract_sequence, to_hgvs\n\n\nreference = \"CATATATC\"\nobserved = \"CATATATATC\"\n\ncanonical, _ = extract_sequence(reference, observed)\n# returns: 2_7AT[4]\nto_hgvs(canonical, reference)\n```\n\nVariant normalization.\n\n```python\nfrom algebra.extractor import extract, to_hgvs\nfrom algebra.variants import parse_hgvs\n\n\nreference = \"CATATATC\"\nvariant = parse_hgvs(\"6_7dupAT\")\n\ncanonical, _ = extract(reference, variant)\n# returns: 2_7AT[4]\nto_hgvs(canonical, reference)\n```\n\nSee Also\n--------\n\nA web interface with integration with [Mutalyzer](https://github.com/mutalyzer): [Mutalyzer Algebra](https://mutalyzer.nl/algebra)\n\n[Mutalyzer Algebra on PyPI](https://pypi.org/project/mutalyzer-algebra/)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Boolean Algebra for Genetic Variants",
"version": "1.5.1",
"project_urls": {
"Homepage": "https://github.com/mutalyzer/algebra"
},
"split_keywords": [
"algebra",
"genomics",
"graph",
"string",
"genetics",
"edit-distance",
"alignment",
"compare",
"sequence",
"variants",
"lcs",
"relations",
"hgvs",
"extractor"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b58d8f474a85eb3002129fc3d9b96c3a8885578f9b6feec9a62de3eb844cb8f1",
"md5": "de7fc39e278d980a2b981c1667df45bc",
"sha256": "d8fe21e732308c61e20eebd48e1b7b984cb2df48152d7389e13225a96ec997b5"
},
"downloads": -1,
"filename": "mutalyzer-algebra-1.5.1.tar.gz",
"has_sig": false,
"md5_digest": "de7fc39e278d980a2b981c1667df45bc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20083,
"upload_time": "2024-01-16T09:36:48",
"upload_time_iso_8601": "2024-01-16T09:36:48.379090Z",
"url": "https://files.pythonhosted.org/packages/b5/8d/8f474a85eb3002129fc3d9b96c3a8885578f9b6feec9a62de3eb844cb8f1/mutalyzer-algebra-1.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-16 09:36:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mutalyzer",
"github_project": "algebra",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mutalyzer-algebra"
}