Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_all_merge_edits(self):
edits = []
for op, group in groupby(self.align_seq,
lambda x: True if x[0] == "M" else False):
if not op:
merged = self.merge_edits(list(group))
edits.append(Edit(self.orig, self.cor, merged[0][1:]))
return edits
def get_all_split_edits(self):
edits = []
for align in self.align_seq:
if align[0] != "M":
edits.append(Edit(self.orig, self.cor, align[1:]))
return edits
# Split alignment into groups of M, T and rest. (T has a number after it)
for op, group in groupby(alignment.align_seq,
lambda x: x[0][0] if x[0][0] in {"M", "T"} else False):
group = list(group)
# Ignore M
if op == "M": continue
# T is always split
elif op == "T":
for seq in group:
edits.append(Edit(alignment.orig, alignment.cor, seq[1:]))
# Process D, I and S subsequence
else:
processed = process_seq(group, alignment)
# Turn the processed sequence into edits
for seq in processed:
edits.append(Edit(alignment.orig, alignment.cor, seq[1:]))
return edits
def get_all_equal_edits(self):
edits = []
for op, group in groupby(self.align_seq, lambda x: x[0]):
if op != "M":
merged = self.merge_edits(list(group))
edits.append(Edit(self.orig, self.cor, merged[0][1:]))
return edits