Skip to content

Commit

Permalink
Refactor cloned indexes to use ref_positions instead of s1inds
Browse files Browse the repository at this point in the history
  • Loading branch information
Colelyman committed Mar 12, 2024
1 parent c884f60 commit 6bec6b2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CRISPResso2/CRISPRessoCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def get_cloned_include_idxs_from_quant_window_coordinates(quant_window_coordinat
return [
i
for coord in split_quant_window_coordinates(quant_window_coordinates)
for i in range(s1inds[coord[0]], s1inds[coord[1] + 1])
for i in range(s1inds[coord[0]], s1inds[coord[1]] + 1)
]


Expand Down Expand Up @@ -2035,10 +2035,13 @@ def get_prime_editing_guides(this_amp_seq, this_amp_name, ref0_seq, prime_edited
if amplicon_quant_window_coordinates_arr[this_ref_idx] != "":
this_include_idxs = get_include_idxs_from_quant_window_coordinates(amplicon_quant_window_coordinates_arr[this_ref_idx])
else:
payload = CRISPRessoCOREResources.find_indels_substitutions(fws1, fws2, [])
ref_positions = payload['ref_positions']
this_include_idxs = get_cloned_include_idxs_from_quant_window_coordinates(
amplicon_quant_window_coordinates_arr[clone_ref_idx],
s1inds,
ref_positions,
)

#subtract any indices in 'exclude_idxs' -- e.g. in case some of the cloned include_idxs were near the read ends (excluded)
this_exclude_idxs = sorted(list(set(refs[ref_name]['exclude_idxs'])))
this_include_idxs = sorted(list(set(np.setdiff1d(this_include_idxs, this_exclude_idxs))))
Expand Down

0 comments on commit 6bec6b2

Please sign in to comment.