@@ -54,10 +54,11 @@ def validate(self, classification: Classification) \
5454 errors .append (f"Non matching tokens found for "
5555 f"{ self .variant_name ()} ." )
5656
57- if len (gene_tokens ) == 0 :
58- errors .append (f'No gene tokens for a { self .variant_name ()} .' )
57+ len_gene_tokens = len (gene_tokens )
5958
60- if len (gene_tokens ) > 1 :
59+ if len_gene_tokens == 0 :
60+ errors .append (f'No gene tokens for a { self .variant_name ()} .' )
61+ elif len_gene_tokens > 1 :
6162 errors .append ('More than one gene symbol found for a single'
6263 f' { self .variant_name ()} ' )
6364
@@ -106,15 +107,16 @@ def get_valid_invalid_results(self, classification_tokens, transcripts,
106107 hgvs_expr = self .get_hgvs_expr (classification , t , s , False )
107108 allele = self .get_allele_from_hgvs (hgvs_expr , errors )
108109
110+ # MANE Select Transcript
111+ if hgvs_expr not in mane_transcripts_dict .keys ():
112+ mane_transcripts_dict [hgvs_expr ] = {
113+ 'classification_token' : s ,
114+ 'transcript_token' : t
115+ }
116+
109117 if not allele :
110118 errors .append ("Unable to find allele." )
111119 else :
112- # MANE Select Transcript
113- if hgvs_expr not in mane_transcripts_dict .keys ():
114- mane_transcripts_dict [hgvs_expr ] = {
115- 'classification_token' : s ,
116- 'transcript_token' : t
117- }
118120 if len (allele ['state' ]['sequence' ]) == 3 :
119121 allele ['state' ]['sequence' ] = \
120122 self ._amino_acid_cache .convert_three_to_one (
@@ -151,7 +153,7 @@ def check_ref_aa(self, t, aa, pos, errors):
151153
152154 :param string t: Transcript
153155 :param str aa: Expected Amino Acid
154- :param str pos: Expected position
156+ :param int pos: Expected position
155157 :param list errors: List of errors
156158 """
157159 ref_aa_del = \
@@ -174,9 +176,9 @@ def get_hgvs_expr(self, classification, t, s, is_hgvs) -> str:
174176 :param Classification classification: A classification for a list of
175177 tokens
176178 :param str t: Transcript retrieved from transcript mapping
179+ :param Token s: The classification token
177180 :param bool is_hgvs: Whether or not classification is HGVS token
178- :return: A tuple containing the hgvs expression and whether or not
179- it's an Ensembl Transcript
181+ :return: HGVS expression for the variant
180182 """
181183 if not is_hgvs :
182184 prefix = f"{ t } :{ s .reference_sequence .lower ()} ."
0 commit comments