Skip to content

Commit

Permalink
Fix allele state
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Feb 26, 2021
1 parent 9dd3044 commit 2cb0287
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions tests/fixtures/validators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ amino_acid_substitution:
- query: BRAF V600E
- query: NP_004324.2:p.Val600Glu
- query: NP_005219.2:p.Thr790Met
- query: EGFR Leu858Arg
should_not_match:
- query: NP_004324.2:p.Val600000000000Glu
- query: NP_004324.2:p.Glu600Val
Expand Down
15 changes: 8 additions & 7 deletions variant/validators/polypeptide_sequence_variant_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,17 @@ def get_vrs_allele(self, sequence_id, s) -> dict:
)

state = models.SequenceState(sequence=s.alt_protein)
state_dict = state.as_dict()
if len(state_dict['sequence']) == 3:
for one, three in \
self._amino_acid_cache._amino_acid_code_conversion.items():
if three == state_dict['sequence']:
state.sequence = one

allele = models.Allele(location=seq_location,
state=state)
allele['_id'] = ga4gh_identify(allele)
allele = allele.as_dict()
if len(allele['state']['sequence']) == 3:
for one, three in \
self._amino_acid_cache._amino_acid_code_conversion:
if three == allele['state']['sequence']:
allele['state']['sequence'] = one
return allele
return allele.as_dict()

def get_hgvs_expr(self, classification) -> str:
"""Return HGVS expression for a classification.
Expand Down

0 comments on commit 2cb0287

Please sign in to comment.