Commit 0501e5e Helyaneh Ziaei-jam
committed
1 parent ba2735d commit 0501e5e Copy full SHA for 0501e5e
File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,30 @@ def AppendRecordObject(self, ro):
196
196
self .record_objs .append (ro )
197
197
self .update ()
198
198
199
+ def update (self ):
200
+ r"""
201
+ Update prepend/append sequences
202
+ of individual record objects so they
203
+ start and end at the same location.
204
+ Extends all alleles to the maximum region
205
+ spanned by all records in the cluster.
206
+ """
207
+ self .first_pos = min ([rec .pos for rec in self .record_objs ])
208
+ self .last_end = max ([rec .cyvcf2_record .end for rec in self .record_objs ])
209
+
210
+ print (
211
+ f"Analysing record cluster ranged in { self .record_objs [0 ].cyvcf2_record .CHROM } :{ self .first_pos } -{ self .last_end } ." )
212
+ ref_record = ""
213
+ for rec in self .record_objs :
214
+ if rec .pos == self .first_pos :
215
+ ref_record = rec
216
+ for rec in self .record_objs :
217
+ self .vcf_types [convert_type_to_idx [rec .vcf_type ]] = True
218
+ chrom = rec .cyvcf2_record .CHROM
219
+ if rec .pos > self .first_pos :
220
+ # Found a record that starts after
221
+ # Should prepend the record
222
+ rec .prepend_seq = self .fasta [chrom ][self .first_pos - 1 : rec .pos - 1 ].seq .upper ()
199
223
if rec .cyvcf2_record .end < self .last_end :
200
224
# Found a record that ends before last end
201
225
# Should append the record
You can’t perform that action at this time.
0 commit comments