Skip to content

Commit 0501e5e

Browse files
author
Helyaneh Ziaei-jam
committed
fix merge issues
1 parent ba2735d commit 0501e5e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

ensembletr/recordcluster.py

+24
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,30 @@ def AppendRecordObject(self, ro):
196196
self.record_objs.append(ro)
197197
self.update()
198198

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()
199223
if rec.cyvcf2_record.end < self.last_end:
200224
# Found a record that ends before last end
201225
# Should append the record

0 commit comments

Comments
 (0)