Skip to content

Commit

Permalink
Fix plot window cloning from Ref1 to HDR
Browse files Browse the repository at this point in the history
Plot window for sgRNA will be the same length after cloning even if the window is shorter or longer after comparing between ref1 and HDR.
  • Loading branch information
kclem committed Nov 14, 2020
1 parent 7403a46 commit 88b6e9c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions CRISPResso2/CRISPRessoCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,9 +1646,11 @@ def get_prime_editing_guides(this_amp_seq,this_amp_name,ref0_seq,prime_edited_se

this_sgRNA_intervals = []
this_sgRNA_mismatches = []
this_sgRNA_plot_idxs = []
for idx,(sgRNA_interval_start,sgRNA_interval_end) in enumerate(refs[clone_ref_name]['sgRNA_intervals']):
this_sgRNA_intervals.append((s1inds[sgRNA_interval_start],s1inds[sgRNA_interval_end]))

sgRNA_cut_point_this = s1inds[refs[clone_ref_name]['sgRNA_cut_points'][idx]]
sgRNA_seq_clone = refs[clone_ref_name]['sequence'][sgRNA_interval_start:sgRNA_interval_end+1]
sgRNA_seq_this = refs[ref_name]['sequence'][s1inds[sgRNA_interval_start]:s1inds[sgRNA_interval_end]+1]
sgRNA_seq_orig_seq = refs[clone_ref_name]['sgRNA_orig_sequences'][idx]
Expand All @@ -1659,15 +1661,11 @@ def get_prime_editing_guides(this_amp_seq,this_amp_name,ref0_seq,prime_edited_se
best_aln_mismatches = rv_mismatches
this_sgRNA_mismatches.append(sorted(best_aln_mismatches))


this_sgRNA_plot_idxs = []
for plot_idx_list in refs[clone_ref_name]['sgRNA_plot_idxs']:
if len(plot_idx_list) > 0:
st = s1inds[plot_idx_list[0]]
en = s1inds[plot_idx_list[-1]]
this_sgRNA_plot_idxs.append(sorted(list(range(st,en+1))))
else:
this_sgRNA_plot_idxs.append([])
ref_seq_length = len(refs[ref_name]['sequence'])
window_around_cut=max(1,args.plot_window_size)
st=max(0,sgRNA_cut_point_this-window_around_cut+1)
en=min(ref_seq_length-1,sgRNA_cut_point_this+window_around_cut+1)
this_sgRNA_plot_idxs.append(sorted(list(range(st,en))))

old_this_sgRNA_plot_idxs = []
for plot_idx_list in refs[clone_ref_name]['sgRNA_plot_idxs']:
Expand Down Expand Up @@ -4393,7 +4391,6 @@ def count_alternate_alleles(sub_base_vectors,ref_name,ref_sequence,ref_total_aln
crispresso2_info['refs'][ref_name]['plot_10d_captions'].append("Figure 10d: Log2 nucleotide frequencies for each position in the plotting window around the " + sgRNA_legend + ". The quantification window is outlined by the dotted box.")
crispresso2_info['refs'][ref_name]['plot_10d_datas'].append([])


fig_filename_root = _jp('10e.'+ref_plot_name+'Selected_conversion_at_'+args.conversion_nuc_from+'s_around_'+sgRNA_label)
CRISPRessoPlot.plot_conversion_at_sel_nucs(
df_subs = plot_nuc_pcts,
Expand Down

0 comments on commit 88b6e9c

Please sign in to comment.