biocommons/hgvs

Parsing repeat expansions

nh13 opened this issue · 1 comments

nh13 commented

I am getting errors parsing examples from repeat expansions. I see there's a Repeat class in edit.py, so I am clearly missing something (i.e. probably PEBKAC).

>>> p.parse("NC_000014.8:g.101179660TG[14]")
Traceback (most recent call last):
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/hgvs/parser.py", line 131, in rule_fxn
    return self._grammar(s).__getattr__(rule_name)()
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/parsley.py", line 98, in invokeRule
    raise err
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/ometa/runtime.py", line 554, in many
    v, _ = fn()
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 843, in _G_many_226
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/ometa/runtime.py", line 495, in _apply
    [rule(), self.input])
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 2668, in rule_dna
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/ometa/runtime.py", line 495, in _apply
    [rule(), self.input])
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 2683, in rule_dna_iupac
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/ometa/runtime.py", line 649, in pred
    raise e
ometa.runtime.ParseError: 
NC_000014.8:g.101179660TG[14]
                         ^
Parse error at line 1, column 25: expected the character '='. trail: [dna_iupac dna dna_ident dna_edit g_posedit g_variant hgvs_variant]`

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/hgvs/parser.py", line 113, in parse
    return self.parse_hgvs_variant(v)
  File "/Users/nhomer/miniconda3/envs/hgvs/lib/python3.10/site-packages/hgvs/parser.py", line 133, in rule_fxn
    raise HGVSParseError("{s}: char {exc.position}: {reason}".format(
hgvs.exceptions.HGVSParseError: NC_000014.8:g.101179660TG[14]: char 25: expected the character '='

I tried some of the other examples: LRG_763t1:c.53AGC[23]

reece commented

I wish you were missing something. Closing as duplicate of #113.