diff --git a/crisprbact/off_target.py b/crisprbact/off_target.py index 886235f7f0d34510d10a9538f28cab429484e192..89a5a648b0a21e56c1f055b7e619a26743760805 100644 --- a/crisprbact/off_target.py +++ b/crisprbact/off_target.py @@ -47,8 +47,7 @@ def get_off_target_pos(guide, records, seed_size): "pampos", "strand", "recid", - "max_matching_len", - "max_matching_seq", + "longest_perfect_match", "pam_seq", ], zip(*offs), @@ -81,12 +80,12 @@ def gen_extract_off_target_strand_plus( sub_sequence_to_match = sequence_string[start_pos_seq:end_pos_seq][::-1] matching_chars = list(common_start(sub_sequence_to_match, guide_subseq)) matching_substr = "".join(matching_chars) + longest_perfect_match = matching_substr[::-1] + match.group(0)[:-3] yield match.span() + ( match.end(), "+", seqid, - seed_size + len(matching_chars), - matching_substr[::-1] + match.group(0)[:-3], + longest_perfect_match, match.group(0)[-3:], ) @@ -114,12 +113,13 @@ def gen_extract_off_target_strand_minus( guide_subseq = rev_comp(guide[: 20 - seed_size]) matching_chars = list(common_start(sub_sequence_to_match, guide_subseq)) matching_substr = "".join(matching_chars) + longest_perfect_match = match.group(0)[3:] + matching_substr + yield match.span() + ( match.start(), "-", seqid, - seed_size + len(matching_chars), - match.group(0)[3:] + matching_substr, + longest_perfect_match, match.group(0)[:3], )