HGVS Parser

Module for parsing HGVS variant descriptions.

class mutalyzer_hgvs_parser.hgvs_parser.AmbigTransformer(visit_tokens: bool = True)

Bases: Transformer

class mutalyzer_hgvs_parser.hgvs_parser.FinalTransformer(visit_tokens: bool = True)

Bases: Transformer

variant(children: list) Tree
variant_predicted(children: list) Tree
variants(children: list) Tree
class mutalyzer_hgvs_parser.hgvs_parser.HgvsParser(grammar_path: str | None = None, start_rule: str | None = None, ignore_white_spaces: bool = True)

Bases: object

HGVS parser object.

Parameters:
  • grammar_path (str) – Path to a different EBNF grammar file.

  • start_rule (str) – Alternative start rule for the grammar.

  • ignore_white_spaces (bool) – Ignore or not white spaces in the description.

parse(description: str) Tree

Parse the provided description.

Parameters:

description (str) – An HGVS description.

Returns:

A parse tree.

Return type:

lark.Tree

status() None

Print parser’s status information.

class mutalyzer_hgvs_parser.hgvs_parser.ProteinTransformer(visit_tokens: bool = True)

Bases: Transformer

P_COORDINATE_SYSTEM(name: Token) Token
extension(children: list) Tree
extension_c(children: list) Tree
extension_n(children: list) Tree
frame_shift(children: list) Tree
p_deletion(children: list) Tree
p_deletion_insertion(children: list) Tree
p_duplication(children: list) Tree
p_equal(children: list) Tree
p_insert(children: list) Tree
p_inserted(children: list) Tree
p_insertion(children: list) Tree
p_length(children: list) Tree
p_location(children: list) Tree
p_point(children: list) Tree
p_range(children: list) Tree
p_repeat(children: list) Tree
p_repeat_mixed(children: list) Tree
p_repeat_number(children: list) Tree
p_substitution(children: list) Tree
p_variant(children: list) Tree
p_variant_certain(children: list) Tree
p_variant_predicted(children: list) Tree
p_variants(children: list) Tree
p_variants_certain(children: list) Tree
p_variants_predicted(children: list) Tree
mutalyzer_hgvs_parser.hgvs_parser.get_parser(grammar_path: str | None = None, start_rule: str | None = None) HgvsParser
mutalyzer_hgvs_parser.hgvs_parser.parse(description: str, grammar_path: str | None = None, start_rule: str | None = None) Tree

Parse the provided HGVS description, or the description part, e.g., a location, a variants list, etc., if an appropriate alternative start_rule is provided.

Parameters:
  • description (str) – Description (or description part) to be parsed.

  • grammar_path (str) – Path towards a different grammar file.

  • start_rule (str) – Alternative start rule for the grammar.

Returns:

Parse tree.

Return type:

lark.Tree