Skip to main content

A Boolean Algebra for Genetic Variants

Project description

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).

Installation

Use pip to install from the Python Package Index (PyPI).

python -m pip install mutalyzer-algebra

Or directly from GitHub for development (after cloning in an active virtual environment).

python -m pip install --upgrade --editable .[dev]

Testing

Run the tests.

python -m coverage run

Usage

Use the command-line interface.

algebra --reference "AAAAA" compare --lhs-hgvs "1_2insTA" --rhs-hgvs "2_3insT"

Or as a Python package.

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.

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.

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: Mutalyzer Algebra

Mutalyzer Algebra on PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mutalyzer-algebra-1.5.1.tar.gz (20.1 kB view details)

Uploaded Source

File details

Details for the file mutalyzer-algebra-1.5.1.tar.gz.

File metadata

  • Download URL: mutalyzer-algebra-1.5.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.12

File hashes

Hashes for mutalyzer-algebra-1.5.1.tar.gz
Algorithm Hash digest
SHA256 d8fe21e732308c61e20eebd48e1b7b984cb2df48152d7389e13225a96ec997b5
MD5 de7fc39e278d980a2b981c1667df45bc
BLAKE2b-256 b58d8f474a85eb3002129fc3d9b96c3a8885578f9b6feec9a62de3eb844cb8f1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page