@@ -81,17 +81,20 @@ def _get_csq_value(
81
81
82
82
83
83
def _get_alt_allele_details (
84
- alt : vcfpy . AltRecord , csqs : List [str ], index_map : Dict
84
+ alt : str , ref : str , csqs : List [str ], index_map : Dict
85
85
) -> model .AlternativeVariantAllele :
86
86
"""Creates AlternativeVariantAllele based on
87
87
target alt allele and CSQ entires"""
88
88
frequency = None
89
89
consequences = []
90
+ allele_type = _set_allele_type (
91
+ len (alt ) < 2 , len (ref ) < 2 , len (alt ) == len (ref )
92
+ )[0 ]
90
93
91
94
for str_csq in csqs :
92
95
csq_values = str_csq .split ("|" )
93
96
94
- if csq_values [index_map ["Allele" ]] != alt . value :
97
+ if csq_values [index_map ["Allele" ]] != alt :
95
98
continue
96
99
97
100
frequency = _get_csq_value (csq_values , "AF" , frequency , index_map )
@@ -134,8 +137,8 @@ def _get_alt_allele_details(
134
137
)
135
138
136
139
return model .AlternativeVariantAllele (
137
- allele_sequence = alt . value ,
138
- allele_type = alt . type ,
140
+ allele_sequence = alt ,
141
+ allele_type = allele_type ,
139
142
representative_population_allele_frequency = frequency ,
140
143
predicted_molecular_consequences = consequences ,
141
144
)
@@ -152,7 +155,7 @@ def get_results_from_path(
152
155
153
156
154
157
def get_results_from_stream (
155
- page_size : int , page : int , vcf_stream : IO
158
+ page_size : int , page : int , vcf_stream : Any
156
159
) -> model .VepResultsResponse :
157
160
"""Generates a page of VCF data in the format described in
158
161
APISpecification.yaml for a given VCF stream"""
@@ -215,14 +218,19 @@ def _get_results_from_vcfpy(
215
218
# from competting vcf module
216
219
location = model .Location (
217
220
region_name = record .CHROM ,
218
- start = record .begin ,
219
- end = record .end if record . end else record . begin + ref_len ,
221
+ start = record .POS ,
222
+ end = record .POS + ref_len ,
220
223
)
221
224
longest_alt = len (max ((a .value for a in record .ALT ), key = len ))
222
225
226
+ alt_allele_strings = list (set ([
227
+ csq_string .split ("|" )[prediction_index_map ["Allele" ]]
228
+ for csq_string in record .INFO ["CSQ" ]
229
+ ]))
230
+
223
231
alt_alleles = [
224
- _get_alt_allele_details (alt , record .INFO ["CSQ" ], prediction_index_map )
225
- for alt in record . ALT
232
+ _get_alt_allele_details (alt , record .REF , record . INFO ["CSQ" ], prediction_index_map )
233
+ for alt in alt_allele_strings
226
234
]
227
235
228
236
variants .append (
0 commit comments