Hgvs parser

Module for parsing HGVS variant descriptions.

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

Bases: lark.visitors.Transformer

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

Bases: lark.visitors.Transformer

variant(children)
variant_predicted(children)
variants(children)
class mutalyzer_hgvs_parser.hgvs_parser.HgvsParser(grammar_path=None, start_rule=None, ignore_white_spaces=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)

Parse the provided description.

Parameters:description (str) – An HGVS description.
Returns:A parse tree.
Return type:lark.Tree
status()

Print parser’s status information.

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

Bases: lark.visitors.Transformer

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

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