Skip to content

Commit

Permalink
Remove nested f strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Snicker7 committed Mar 29, 2024
1 parent 6af51b5 commit e03ba9c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions CRISPResso2/CRISPRessoCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -3671,10 +3671,11 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_
mod_df_for_plot.insert(0, 'Batch', ref_name)

plot_root = _jp('2a.'+ ref_plot_name + 'Nucleotide_percentage_quilt')
pro_output_name = f'plot_{os.path.basename(plot_root)}.json'
plot_2a_input = {
'nuc_pct_df': nuc_df_for_plot,
'mod_pct_df': mod_df_for_plot,
'fig_filename_root': f'{_jp(f'plot_{os.path.basename(plot_root)}.json')}' if not args.use_matplotlib and pro_installed else plot_root,
'fig_filename_root': f'{_jp(pro_output_name)}' if not args.use_matplotlib and pro_installed else plot_root,
'save_also_png': save_png,
'sgRNA_intervals': sgRNA_intervals,
'sgRNA_names': sgRNA_names,
Expand Down Expand Up @@ -3718,10 +3719,11 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_
for x in include_idxs_list:
new_include_idx += [x - new_sel_cols_start]
plot_root = _jp('2b.'+ ref_plot_name + 'Nucleotide_percentage_quilt_around_' + sgRNA_label)
pro_output_name = f'plot_{os.path.basename(plot_root)}.json'
plot_2b_input = {
'nuc_pct_df': nuc_df_for_plot.iloc[:, sel_cols],
'mod_pct_df': mod_df_for_plot.iloc[:, sel_cols],
'fig_filename_root': f'{_jp(f'plot_{os.path.basename(plot_root)}.json')}' if not args.use_matplotlib and pro_installed else plot_root,
'fig_filename_root': f'{_jp(pro_output_name)}' if not args.use_matplotlib and pro_installed else plot_root,
'save_also_png': save_png,
'sgRNA_intervals': new_sgRNA_intervals,
'sgRNA_names': sgRNA_names,
Expand Down Expand Up @@ -4087,10 +4089,11 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_
hdr_nucleotide_percentage_summary_df.rename(columns={'Batch':'Amplicon'}).to_csv(nuc_freq_filename,sep='\t',header=True,index=False)

plot_root = _jp('4g.HDR_nucleotide_percentage_quilt')
pro_output_name = f'plot_{os.path.basename(plot_root)}.json'
plot_4g_input = {
'nuc_pct_df': hdr_nucleotide_percentage_summary_df,
'mod_pct_df': hdr_modification_percentage_summary_df,
'fig_filename_root': f'{_jp(f'plot_{os.path.basename(plot_root)}.json')}' if not args.use_matplotlib and pro_installed else plot_root,
'fig_filename_root': f'{_jp(pro_output_name)}' if not args.use_matplotlib and pro_installed else plot_root,
'save_also_png': save_png,
'sgRNA_intervals': sgRNA_intervals,
'quantification_window_idxs': include_idxs_list,
Expand Down Expand Up @@ -4684,10 +4687,11 @@ def get_scaffold_len(row, scaffold_start_loc, scaffold_seq):
include_idxs_list = refs[ref_names[0]]['include_idxs']

plot_root = _jp('11a.Prime_editing_nucleotide_percentage_quilt')
pro_output_name = f'plot_{os.path.basename(plot_root)}.json'
plot_11a_input = {
'nuc_pct_df': pe_nucleotide_percentage_summary_df,
'mod_pct_df': pe_modification_percentage_summary_df,
'fig_filename_root': f'{_jp(f'plot_{os.path.basename(plot_root)}.json')}' if not args.use_matplotlib and pro_installed else plot_root,
'fig_filename_root': f'{_jp(pro_output_name)}' if not args.use_matplotlib and pro_installed else plot_root,
'save_also_png': save_png,
'sgRNA_intervals': sgRNA_intervals,
'sgRNA_names': sgRNA_names,
Expand Down Expand Up @@ -4743,10 +4747,11 @@ def get_scaffold_len(row, scaffold_start_loc, scaffold_seq):
for x in pe_include_idxs_list:
new_include_idx += [x - new_sel_cols_start]
plot_root = _jp('11b.Nucleotide_percentage_quilt_around_' + sgRNA_label)
pro_output_name = f'plot_{os.path.basename(plot_root)}.json'
plot_11b_input = {
'nuc_pct_df': pe_nucleotide_percentage_summary_df.iloc[:, sel_cols],
'mod_pct_df': pe_modification_percentage_summary_df.iloc[:, sel_cols],
'fig_filename_root': f'{_jp(f'plot_{os.path.basename(plot_root)}.json')}' if not args.use_matplotlib and pro_installed else plot_root,
'fig_filename_root': f'{_jp(pro_output_name)}' if not args.use_matplotlib and pro_installed else plot_root,
'save_also_png': save_png,
'sgRNA_intervals': new_sgRNA_intervals,
'sgRNA_names': sgRNA_names,
Expand Down

0 comments on commit e03ba9c

Please sign in to comment.