Skip to main content

An ANTLR based parser for colloquial protein variant nomenclature

Project description

Protein Variant Nomenclature Parser

This repository contains a Python library for parsing and validating colloquial protein variant nomenclature strings like BRAF V600E that commonly appear in manuscripts.

Features

  • Parse protein variant nomenclature strings in the following formats:
    • Single amino acid substitution, e.g.: BRAF V600E, BRAFV600E, PTEN R130G, TP53 R175H
    • Range of amino acid substitutions: BRAFVK600_601>E
  • Extract the components of the nomenclature string, such as gene name, prefix amino acid, position or range, and suffix amino acid
  • Validate whether a given string conforms to the expected format

Usage

For parsing:

from protein_variant_nomenclature_parser.parser import parse

mutation_string = "BRAF V600E"
parsed_components = parse(mutation_string)

print(parsed_components)
ProteinVariant(gene='BRAF', amino_acid_before='V', number_or_range=NumberOrRange(start=600, end=None), amino_acid_after='E')

For validation:

from protein_variant_nomenclature_parser.parser import parse
from protein_variant_nomenclature_parser.parser import InvalidProteinVariantError


mutation_string = "INVALID V600E"

try:
    parse(mutation_string)
except InvalidProteinVariantError:
    print(f"{mutation_string} is not valid")

Supported Nomenclature

The parser supports all HUGO gene names.

The parser supports the following amino acid single letter codes and stop codon (*).

Installation

From PyPI

pip install protein-variant-nomenclature-parser

From Source

To install the library, clone the repository and install it using pip:

git clone https://github.com/yourusername/protein-variant-nomenclature-parser.git
cd protein-variant-nomenclature-parser
make install

Docker container

A docker container is available:

docker pull jeffquinnmsk/protein-variant-nomenclature-parser:latest

License

This project is licensed under the MIT License. See the LICENSE file for more information.

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

Built Distribution

File details

Details for the file protein-variant-nomenclature-parser-0.3.0.tar.gz.

File metadata

File hashes

Hashes for protein-variant-nomenclature-parser-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f025a3294654d1fb12f4dbea5d4c723bab9456004c88a92bb5463a1a706e33aa
MD5 0968f22adf5323cd404709b2f3960480
BLAKE2b-256 7e91524753611ef5cae724d9ebfb19ea22da338db91a11f37556f8b540860660

See more details on using hashes here.

File details

Details for the file protein_variant_nomenclature_parser-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for protein_variant_nomenclature_parser-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9473d4042359a4bcb6bf0c919afde9a8f2b9aed8eccdc981456295c328321e0
MD5 7483ce5152885c494c5d405a373db2c1
BLAKE2b-256 3b1b8fc09344b03c00e0451260e4b20bab31c2d297cb32e36eb16e70bdcc3805

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