diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index 689bef98..5704254c 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -17,7 +17,11 @@ import traceback from datetime import datetime from CRISPResso2 import CRISPRessoShared -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot + from CRISPResso2.CRISPRessoReports import CRISPRessoReport from CRISPResso2.CRISPRessoMultiProcessing import get_max_processes, run_plot diff --git a/CRISPResso2/CRISPRessoBatchCORE.py b/CRISPResso2/CRISPRessoBatchCORE.py index 28cc27b6..511e5d7d 100644 --- a/CRISPResso2/CRISPRessoBatchCORE.py +++ b/CRISPResso2/CRISPRessoBatchCORE.py @@ -14,7 +14,10 @@ import traceback from datetime import datetime from CRISPResso2 import CRISPRessoShared -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot from CRISPResso2 import CRISPRessoMultiProcessing from CRISPResso2.CRISPRessoReports import CRISPRessoReport @@ -91,7 +94,7 @@ def main(): crispresso_options_for_batch = list(crispresso_options-options_to_ignore) CRISPRessoShared.check_file(args.batch_settings) - config = CRISPRessoShared.check_custom_config(args) + custom_config = CRISPRessoShared.check_custom_config(args) if args.zip_output and not args.place_report_in_output_folder: warn('Invalid arguement combination: If zip_output is True then place_report_in_output_folder must also be True. Setting place_report_in_output_folder to True.') @@ -610,7 +613,7 @@ def main(): 'save_also_png': save_png, 'sgRNA_intervals': sub_sgRNA_intervals, 'quantification_window_idxs': include_idxs, - 'custom_colors': config['colors'], + 'custom_colors': custom_config['colors'], } debug('Plotting nucleotide percentage quilt for amplicon {0}, sgRNA {1}'.format(amplicon_name, sgRNA)) plot( @@ -635,7 +638,7 @@ def main(): 'save_also_png': save_png, 'sgRNA_intervals': sub_sgRNA_intervals, 'quantification_window_idxs': include_idxs, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } debug('Plotting nucleotide conversion map for amplicon {0}, sgRNA {1}'.format(amplicon_name, sgRNA)) plot( @@ -662,7 +665,7 @@ def main(): 'save_also_png': save_png, 'sgRNA_intervals': consensus_sgRNA_intervals, 'quantification_window_idxs': include_idxs, - 'custom_colors': config['colors'], + 'custom_colors': custom_config['colors'], } debug('Plotting nucleotide quilt for {0}'.format(amplicon_name)) plot( @@ -686,7 +689,7 @@ def main(): 'save_also_png': save_png, 'sgRNA_intervals': consensus_sgRNA_intervals, 'quantification_window_idxs': include_idxs, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } debug('Plotting nucleotide conversion map for {0}'.format(amplicon_name)) plot( @@ -710,7 +713,7 @@ def main(): 'mod_pct_df': modification_percentage_summary_df, 'fig_filename_root': f'{this_nuc_pct_quilt_plot_name}.json', 'save_also_png': save_png, - 'custom_colors': config['colors'], + 'custom_colors': custom_config['colors'], } debug('Plotting nucleotide quilt for {0}'.format(amplicon_name)) plot( @@ -733,7 +736,7 @@ def main(): 'conversion_nuc_from': args.conversion_nuc_from, 'conversion_nuc_to': args.conversion_nuc_to, 'save_also_png': save_png, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } debug('Plotting BE nucleotide conversion map for {0}'.format(amplicon_name)) plot( diff --git a/CRISPResso2/CRISPRessoCORE.py b/CRISPResso2/CRISPRessoCORE.py index 9a7c278e..a028fbb6 100644 --- a/CRISPResso2/CRISPRessoCORE.py +++ b/CRISPResso2/CRISPRessoCORE.py @@ -30,7 +30,13 @@ from CRISPResso2 import CRISPRessoCOREResources from CRISPResso2.CRISPRessoReports import CRISPRessoReport from CRISPResso2 import CRISPRessoShared -from CRISPResso2 import CRISPRessoPlot + +try: + from CRISPRessoPro import __version__ as CRISPRessoProVersion + pro_installed = True +except: + pro_installed = False + from CRISPResso2 import CRISPResso2Align from CRISPResso2 import CRISPRessoMultiProcessing @@ -113,7 +119,6 @@ def get_n_reads_bam(bam_filename,bam_chr_loc=""): #end = time.time() #start = time.time() from matplotlib import font_manager as fm -CRISPRessoPlot.setMatplotlibDefaults() #end = time.time() #start = time.time() @@ -1094,6 +1099,13 @@ def print_stacktrace_if_debug(): raise CRISPRessoShared.BadParameterException("Needleman Wunsch gap extend penalty must be <= 0") + if args.use_matplotlib or not pro_installed: + from CRISPResso2 import CRISPRessoPlot + else: + from CRISPRessoPro import plot as CRISPRessoPlot + CRISPRessoPlot.setMatplotlibDefaults() + + #create output directory crispresso2_info_file = os.path.join(OUTPUT_DIRECTORY, 'CRISPResso2_info.json') crispresso2_info = {'running_info': {}, 'results': {'alignment_stats': {}, 'general_plots': {}}} #keep track of all information for this run to be pickled and saved at the end of the run @@ -1592,6 +1604,10 @@ def get_prime_editing_guides(this_amp_seq, this_amp_name, ref0_seq, prime_edited #now that we're done with adding possible guides and amplicons, go through each amplicon and compute quantification windows info('Computing quantification windows', {'percent_complete': 2}) + if pro_installed: + info(f'CRISPRessoPro v{CRISPRessoProVersion} installed', {'percent_complete': 3}) + else: + info(f'CRISPRessoPro not installed', {'percent_complete': 3}) found_guide_seq = [False]*len(guides) found_coding_seq = [False]*len(coding_seqs) @@ -3377,7 +3393,7 @@ def save_count_vectors_to_file(vectors, vectorNames, refSeq, filename): info('Making Plots...') ############################################################################################################################################### save_png = True - config = CRISPRessoShared.check_custom_config(args) + custom_config = CRISPRessoShared.check_custom_config(args) if args.suppress_report: save_png = False @@ -3456,6 +3472,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'N_TOTAL': N_TOTAL, 'piechart_plot_root': plot_1b_root, 'barplot_plot_root': plot_1c_root, + 'custom_colors': custom_config['colors'], 'save_png': save_png } crispresso2_info['results']['general_plots']['plot_1b_root'] = os.path.basename(plot_1b_root) @@ -3608,7 +3625,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'sgRNA_names': sgRNA_names, 'sgRNA_mismatches': sgRNA_mismatches, 'quantification_window_idxs': include_idxs_list, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], } debug('Plotting nucleotide quilt across amplicon') plot(CRISPRessoPlot.plot_nucleotide_quilt, plot_2a_input) @@ -3655,7 +3672,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'sgRNA_names': sgRNA_names, 'sgRNA_mismatches': sgRNA_mismatches, 'quantification_window_idxs': new_include_idx, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], } debug('Plotting nucleotide distribuition around {0} for {1}'.format(sgRNA_legend, ref_name)) plot(CRISPRessoPlot.plot_nucleotide_quilt, plot_2b_input) @@ -3707,6 +3724,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ ), 'plot_root': plot_root, 'save_also_png': save_png, + 'ref_name': ref_name, } debug('Plotting indel size distribution for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_indel_size_distribution, plot_3a_input) @@ -3788,6 +3806,8 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'xmax_ins': xmax_ins, 'xmax_mut': xmax_mut, 'save_also_png': save_png, + 'custom_colors': custom_config["colors"], + 'ref_name' : ref_name, } debug('Plotting frequency deletions/insertions for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_frequency_deletions_insertions, plot_3b_input) @@ -3833,7 +3853,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ ), }, 'plot_root': plot_root, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], 'save_also_png': save_png, } debug('Plotting amplication modifications for {0}'.format(ref_name)) @@ -3863,7 +3883,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'Mutation position distribution', ref_name, ), 'plot_root': plot_root, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], 'save_also_png': save_png, } debug('Plotting modification frequency for {0}'.format(ref_name)) @@ -3892,7 +3912,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ ), 'ref_name': ref_name, 'plot_root': plot_root, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], 'save_also_png': save_png, } debug('Plotting quantification window locations for {0}'.format(ref_name)) @@ -3924,6 +3944,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ }, 'plot_root': plot_root, 'save_also_png': save_png, + 'ref_name': ref_name, } debug('Plotting position dependent indel for {0}'.format(ref_name)) plot( @@ -3949,7 +3970,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'n_total': N_TOTAL, 'ref_len': ref_len, 'ref_name': ref_names[0], - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], 'save_also_png': save_png, } if ref_name == ref_names[0]: @@ -4020,7 +4041,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'quantification_window_idxs': include_idxs_list, 'sgRNA_names': sgRNA_names, 'sgRNA_mismatches': sgRNA_mismatches, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], } debug('Plotting HDR nucleotide quilt') plot(CRISPRessoPlot.plot_nucleotide_quilt, plot_4g_input) @@ -4069,6 +4090,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'ref_name': ref_name, 'plot_root': plot_root, 'save_also_png': save_png, + 'custom_colors': custom_config['colors'], } debug('Plotting frameshift analysis for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_frameshift_analysis, plot_5_input) @@ -4094,6 +4116,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'plot_root': plot_root, 'save_also_png': save_png, + 'ref_name': ref_name, } debug('Plotting frameshift frequency for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_frameshift_frequency, plot_6_input) @@ -4121,8 +4144,9 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ ref_name, ), 'plot_root': plot_root, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], 'save_also_png': save_png, + 'ref_name': ref_name, } debug('Plotting non-coding mutation positions for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_non_coding_mutations, plot_7_input) @@ -4136,6 +4160,8 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'count_total': count_total, 'plot_root': plot_root, 'save_also_png': save_png, + 'ref_name': ref_name, + 'custom_colors': custom_config['colors'], } debug('Plotting potential splice sites') plot(CRISPRessoPlot.plot_potential_splice_sites, plot_8_input) @@ -4161,7 +4187,8 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'fig_filename_root': fig_filename_root, 'save_also_png': save_png, 'quantification_window_idxs': include_idxs_list, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'], + 'ref_name': ref_name, } debug('Plotting substitutions across reference for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_subs_across_ref, plot_10a_input) @@ -4180,7 +4207,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ ), 'fig_filename_root': fig_filename_root, 'save_also_png': save_png, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } debug('Plotting substitution frequency barplot for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_sub_freqs, plot_10b_input) @@ -4195,7 +4222,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'plot_title': get_plot_title_with_ref_name('Substitution frequency\nin quantification window', ref_name), 'fig_filename_root': fig_filename_root, 'save_also_png': save_png, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } debug('Plotting substitution frequency barplot in quantification window for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_sub_freqs, plot_10c_input) @@ -4286,7 +4313,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'sgRNA_names': sgRNA_names, 'sgRNA_mismatches': sgRNA_mismatches, 'annotate_wildtype_allele': args.annotate_wildtype_allele, - 'custom_colors': config["colors"], + 'custom_colors': custom_config["colors"], } debug('Plotting allele distribution around cut for {0}'.format(ref_name)) plot(CRISPRessoPlot.plot_alleles_table, plot_9_input) @@ -4373,7 +4400,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'conversion_nuc_from': args.conversion_nuc_from, 'fig_filename_root': fig_filename_root, 'save_also_png': save_png, - 'custom_colors': config['colors'], + 'custom_colors': custom_config['colors'], } debug('Plotting conversion at {0}s around the {1} for {2}'.format(args.conversion_nuc_from, sgRNA_legend, ref_name)) plot( @@ -4393,7 +4420,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'conversion_nuc_from': args.conversion_nuc_from, 'fig_filename_root': fig_filename_root, 'save_also_png': save_png, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } debug('Plotting non-reference conversion at {0}s around the {1} for {2}'.format(args.conversion_nuc_from, sgRNA_legend, ref_name)) plot( @@ -4416,7 +4443,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'conversion_nuc_from': args.conversion_nuc_from, 'fig_filename_root': fig_filename_root, 'save_also_png': save_png, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } debug('Plotting scaled non-reference conversion at {0}s around the {1} for {2}'.format(args.conversion_nuc_from, sgRNA_legend, ref_name)) plot( @@ -4483,6 +4510,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'global_non_modified_non_frameshift': global_NON_MODIFIED_NON_FRAMESHIFT, 'plot_root': plot_root, 'save_also_png': save_png, + 'custom_colors': custom_config['colors'], } debug('Plotting global frameshift in-frame mutations pie chart', {'percent_complete': 90}) plot( @@ -4522,6 +4550,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_ 'global_count_total': global_count_total, 'plot_root': plot_root, 'save_also_png': save_png, + 'custom_colors': custom_config['colors'], } debug('Plotting global potential splice sites pie chart', {'percent_complete': 94}) plot(CRISPRessoPlot.plot_impact_on_splice_sites, plot_8a_input) @@ -4609,7 +4638,7 @@ def get_scaffold_len(row, scaffold_start_loc, scaffold_seq): 'sgRNA_names': sgRNA_names, 'sgRNA_mismatches': sgRNA_mismatches, 'quantification_window_idxs': include_idxs_list, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } info('Plotting prime editing nucleotide percentage quilt', {'percent_complete': 96}) plot(CRISPRessoPlot.plot_nucleotide_quilt, plot_11a_input) @@ -4668,7 +4697,7 @@ def get_scaffold_len(row, scaffold_start_loc, scaffold_seq): 'sgRNA_names': sgRNA_names, 'sgRNA_mismatches': sgRNA_mismatches, 'quantification_window_idxs': new_include_idx, - 'custom_colors': config['colors'] + 'custom_colors': custom_config['colors'] } info('Plotting nucleotide quilt', {'percent_complete': 97}) plot(CRISPRessoPlot.plot_nucleotide_quilt, plot_11b_input) diff --git a/CRISPResso2/CRISPRessoCompareCORE.py b/CRISPResso2/CRISPRessoCompareCORE.py index b70892ec..7c68474f 100644 --- a/CRISPResso2/CRISPRessoCompareCORE.py +++ b/CRISPResso2/CRISPRessoCompareCORE.py @@ -10,7 +10,10 @@ import traceback import argparse from CRISPResso2 import CRISPRessoShared -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot from CRISPResso2.CRISPRessoReports import CRISPRessoReport import logging diff --git a/CRISPResso2/CRISPRessoMetaCORE.py b/CRISPResso2/CRISPRessoMetaCORE.py index e2e0b843..873c231b 100644 --- a/CRISPResso2/CRISPRessoMetaCORE.py +++ b/CRISPResso2/CRISPRessoMetaCORE.py @@ -13,7 +13,10 @@ import traceback import json from CRISPResso2 import CRISPRessoShared -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot from CRISPResso2 import CRISPRessoMultiProcessing from CRISPResso2.CRISPRessoReports import CRISPRessoReport diff --git a/CRISPResso2/CRISPRessoPlot.py b/CRISPResso2/CRISPRessoPlot.py index 201da99e..ec747315 100644 --- a/CRISPResso2/CRISPRessoPlot.py +++ b/CRISPResso2/CRISPRessoPlot.py @@ -15,6 +15,11 @@ import matplotlib.cm as cm import matplotlib.gridspec as gridspec import plotly.express as px +import plotly.io as pio +try: + pio.kaleido.scope.chromium_args += ('--single-process',) +except: + pass from collections import defaultdict from copy import deepcopy import re @@ -96,7 +101,7 @@ def hex_to_rgb(value): lv = len(value) return tuple(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3)) -def plot_nucleotide_quilt(nuc_pct_df,mod_pct_df,fig_filename_root, custom_colors, save_also_png=False,sgRNA_intervals=None,min_text_pct=0.5,max_text_pct=0.95,quantification_window_idxs=None,sgRNA_names=None,sgRNA_mismatches=None,shade_unchanged=True,group_column='Batch'): +def plot_nucleotide_quilt(nuc_pct_df,mod_pct_df,fig_filename_root, custom_colors, save_also_png=False,sgRNA_intervals=None,min_text_pct=0.5,max_text_pct=0.95,quantification_window_idxs=None,sgRNA_names=None,sgRNA_mismatches=None,shade_unchanged=True,group_column='Batch', **kwargs): """ Plots a nucleotide quilt with each square showing the percentage of each base at that position in the reference nuc_pct_df: dataframe with percents of each base (ACTGN-) at each position @@ -397,6 +402,7 @@ def plot_indel_size_distribution( title, plot_root, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(10, 10)) densityPct_0 = 0.0 @@ -447,6 +453,8 @@ def plot_frequency_deletions_insertions( xmax_ins, xmax_mut, save_also_png=False, + custom_colors=None, + **kwargs, ): y_values_mut = ref['y_values_mut'] x_bins_mut = ref['x_bins_mut'] @@ -582,6 +590,7 @@ def plot_amplicon_modifications( plot_root, custom_colors, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(10, 10)) @@ -734,6 +743,7 @@ def plot_modification_frequency( plot_root, custom_colors, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(10, 10)) @@ -903,6 +913,7 @@ def plot_quantification_window_locations( plot_root, custom_colors, save_also_png, + **kwargs, ): fig, ax = plt.subplots(figsize=(10, 10)) @@ -1070,6 +1081,7 @@ def plot_position_dependent_indels( plot_titles, plot_root, save_also_png, + **kwargs, ): fig, ax = plt.subplots(1, 2, figsize=(24, 10)) ax1 = ax[0] @@ -1175,6 +1187,7 @@ def plot_global_modifications_reference( plot_root, custom_colors, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(10, 10)) ref1_all_insertion_positions = ref1_all_insertion_count_vectors @@ -1333,6 +1346,7 @@ def plot_frameshift_analysis( ref_name, plot_root, save_also_png=False, + **kwargs, ): """Plot 5: Plot a pie chart to plot_root showing classification of reads with regard to coding region for a specific reference sequence, also including a diagram of where the coding region is within the amplicon. @@ -1481,6 +1495,7 @@ def plot_frameshift_frequency( plot_titles, plot_root, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(1, 2, figsize=(22, 10)) ax1 = ax[0] @@ -1576,6 +1591,7 @@ def plot_global_frameshift_analysis( global_non_modified_non_frameshift, plot_root, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(12, 12)) @@ -1612,6 +1628,7 @@ def plot_global_frameshift_in_frame_mutations( global_hists_inframe, plot_root, save_also_png=False, + **kwargs, ): fig, axs = plt.subplots(2, 1, figsize=(22, 10)) ax1 = axs[0] @@ -1708,6 +1725,7 @@ def plot_impact_on_splice_sites( global_count_total, plot_root, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(12, 12)) patches, texts, autotexts = ax.pie( @@ -1747,6 +1765,7 @@ def plot_non_coding_mutations( plot_root, custom_colors, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(10, 10)) ax.plot( @@ -1887,6 +1906,7 @@ def plot_potential_splice_sites( count_total, plot_root, save_also_png=False, + **kwargs, ): fig, ax = plt.subplots(figsize=(12, 12)) patches, texts, autotexts = ax.pie( @@ -1917,6 +1937,7 @@ def plot_scaffold_indel_lengths( df_scaffold_insertion_sizes, plot_root, save_also_png=False, + **kwargs, ): colors = ['b', 'g'] fig, ax = plt.subplots(figsize=(12, 6)) @@ -2061,7 +2082,7 @@ def add_sgRNA_to_ax(ax,sgRNA_intervals,sgRNA_y_start,sgRNA_y_height,amp_len,x_of else: ax.text(x_offset+min_sgRNA_x, this_sgRNA_y_start + this_sgRNA_y_height/2, 'sgRNA ', horizontalalignment='right', verticalalignment='center', fontsize=font_size) -def plot_conversion_map(nuc_pct_df,fig_filename_root,conversion_nuc_from,conversion_nuc_to,save_also_png,custom_colors,plotPct = 0.9,min_text_pct=0.3,max_text_pct=0.9,conversion_scale_max=None,sgRNA_intervals=None,quantification_window_idxs=None,sgRNA_names=None,sgRNA_mismatches=None): +def plot_conversion_map(nuc_pct_df,fig_filename_root,conversion_nuc_from,conversion_nuc_to,save_also_png,custom_colors,plotPct = 0.9,min_text_pct=0.3,max_text_pct=0.9,conversion_scale_max=None,sgRNA_intervals=None,quantification_window_idxs=None,sgRNA_names=None,sgRNA_mismatches=None,**kwargs): """ Plots a heatmap of conversion across several sequences :param nuc_pct_df combined df of multiple batches @@ -2233,7 +2254,7 @@ def plot_conversion_map(nuc_pct_df,fig_filename_root,conversion_nuc_from,convers plt.close(fig) -def plot_subs_across_ref(ref_len, ref_seq, ref_name, ref_count, all_substitution_base_vectors, plot_title, fig_filename_root, save_also_png, custom_colors, quantification_window_idxs=None): +def plot_subs_across_ref(ref_len, ref_seq, ref_name, ref_count, all_substitution_base_vectors, plot_title, fig_filename_root, save_also_png, custom_colors, quantification_window_idxs=None,**kwargs): """ Plots substitutions across the reference sequece - each position on the x axis reprsents a nucleotide in the reference bars at each x posion show the number of times the reference nucleotide was substituted for another reference @@ -2298,7 +2319,7 @@ def plot_subs_across_ref(ref_len, ref_seq, ref_name, ref_count, all_substitution fig.savefig(fig_filename_root + '.png', bbox_extra_artists=(lgd,), bbox_inches='tight') plt.close(fig) -def plot_sub_freqs(alt_nuc_counts, plot_title, fig_filename_root, save_also_png, custom_colors): +def plot_sub_freqs(alt_nuc_counts, plot_title, fig_filename_root, save_also_png, custom_colors,**kwargs): """ Plots histogram of substitution frequencies for each nucleotide (from nuc X to nuc Y) input: @@ -2328,7 +2349,7 @@ def plot_sub_freqs(alt_nuc_counts, plot_title, fig_filename_root, save_also_png, fig.savefig(fig_filename_root + '.png', bbox_inches='tight') plt.close(fig) -def plot_nuc_freqs(df_nuc_freq, tot_aln_reads, plot_title, fig_filename_root, save_also_png): +def plot_nuc_freqs(df_nuc_freq, tot_aln_reads, plot_title, fig_filename_root, save_also_png,**kwargs): """ Plots a heatmap of the percentage of reads that had each nucletide at each base in the reference Positions in the reference that have more than one allele can be spotted using this plot @@ -2344,7 +2365,7 @@ def plot_nuc_freqs(df_nuc_freq, tot_aln_reads, plot_title, fig_filename_root, sa plt.savefig(fig_filename_root + '.png', bbox_inches='tight') plt.close() -def plot_log_nuc_freqs(df_nuc_freq,tot_aln_reads,plot_title,fig_filename_root,save_also_png,quantification_window_idxs=None): +def plot_log_nuc_freqs(df_nuc_freq,tot_aln_reads,plot_title,fig_filename_root,save_also_png,quantification_window_idxs=None,**kwargs): """ Plots a heatmap of the percentage of reads that had each nucletide at each base in the reference Positions in the reference that have more than one allele can be spotted using this plot @@ -2382,7 +2403,7 @@ def plot_log_nuc_freqs(df_nuc_freq,tot_aln_reads,plot_title,fig_filename_root,sa plt.close(fig) -def plot_conversion_at_sel_nucs(df_subs, ref_name, ref_sequence, plot_title, conversion_nuc_from, fig_filename_root, save_also_png, custom_colors): +def plot_conversion_at_sel_nucs(df_subs, ref_name, ref_sequence, plot_title, conversion_nuc_from, fig_filename_root, save_also_png, custom_colors,**kwargs): ''' Plots the conversion at selected nucleotides Looks for the 'conversion_nuc_from' in the ref_sequence and sets those as 'selected nucleotides' @@ -2444,7 +2465,7 @@ def plot_conversion_at_sel_nucs(df_subs, ref_name, ref_sequence, plot_title, con fig.savefig(fig_filename_root+'.png', bbox_inches='tight', pad_inches=0.1) plt.close(fig) -def plot_conversion_at_sel_nucs_not_include_ref(df_subs, ref_name, ref_sequence, plot_title, conversion_nuc_from, fig_filename_root, save_also_png, custom_colors): +def plot_conversion_at_sel_nucs_not_include_ref(df_subs, ref_name, ref_sequence, plot_title, conversion_nuc_from, fig_filename_root, save_also_png, custom_colors, **text_kwargs): ''' Plots the conversion at selected nucleotides but ignores non-substitutions (for example at nucs that are 'C' in the reference, bars show the proportion of A T G (not C)) Looks for the 'conversion_nuc_from' in the ref_sequence and sets those as 'selected nucleotides' @@ -2516,7 +2537,7 @@ def plot_conversion_at_sel_nucs_not_include_ref(df_subs, ref_name, ref_sequence, fig.savefig(fig_filename_root+'.png', bbox_inches='tight', pad_inches=0.1) plt.close(fig) -def plot_conversion_at_sel_nucs_not_include_ref_scaled(df_subs, ref_name, ref_sequence, plot_title, conversion_nuc_from, fig_filename_root, save_also_png, custom_colors): +def plot_conversion_at_sel_nucs_not_include_ref_scaled(df_subs, ref_name, ref_sequence, plot_title, conversion_nuc_from, fig_filename_root, save_also_png, custom_colors, **kwargs): ''' Plots the conversion at selected nucleotides not including reference base, scaled by number of events Looks for the 'conversion_nuc_from' in the ref_sequence and sets those as 'selected nucleotides' @@ -2786,7 +2807,7 @@ def prep_alleles_table_compare(df_alleles, sample_name_1, sample_name_2, MAX_N_R return X, annot, y_labels, insertion_dict, per_element_annot_kws -def plot_alleles_heatmap(reference_seq,fig_filename_root,X,annot,y_labels,insertion_dict,per_element_annot_kws,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None): +def plot_alleles_heatmap(reference_seq,fig_filename_root,X,annot,y_labels,insertion_dict,per_element_annot_kws,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None,**kwargs): """ Plots alleles in a heatmap (nucleotides color-coded for easy visualization) input: @@ -2955,7 +2976,7 @@ def plot_alleles_heatmap(reference_seq,fig_filename_root,X,annot,y_labels,insert fig.savefig(fig_filename_root+'.png', bbox_inches='tight', bbox_extra_artists=(lgd,)) plt.close(fig) -def plot_alleles_heatmap_hist(reference_seq,fig_filename_root,X,annot,y_labels,insertion_dict,per_element_annot_kws,count_values,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None): +def plot_alleles_heatmap_hist(reference_seq,fig_filename_root,X,annot,y_labels,insertion_dict,per_element_annot_kws,count_values,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None,**kwargs): """ Plots alleles in a heatmap (nucleotides color-coded for easy visualization) input: @@ -3090,7 +3111,7 @@ def plot_alleles_heatmap_hist(reference_seq,fig_filename_root,X,annot,y_labels,i plt.savefig(fig_filename_root+'.png', bbox_inches='tight', bbox_extra_artists=(lgd,), pad_inches=0.1) plt.close() -def plot_alleles_table(reference_seq,df_alleles,fig_filename_root,MIN_FREQUENCY=0.5,MAX_N_ROWS=100,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None,annotate_wildtype_allele='****'): +def plot_alleles_table(reference_seq,df_alleles,fig_filename_root,MIN_FREQUENCY=0.5,MAX_N_ROWS=100,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None,annotate_wildtype_allele='****',**kwargs): """ plots an allele table for a dataframe with allele frequencies input: @@ -3114,7 +3135,7 @@ def plot_alleles_table(reference_seq,df_alleles,fig_filename_root,MIN_FREQUENCY= y_labels[ix] += annotate_wildtype_allele plot_alleles_heatmap(reference_seq, fig_filename_root, X, annot, y_labels, insertion_dict, per_element_annot_kws, SAVE_ALSO_PNG, plot_cut_point, sgRNA_intervals, sgRNA_names, sgRNA_mismatches, custom_colors) -def plot_alleles_table_from_file(alleles_file_name,fig_filename_root,MIN_FREQUENCY=0.5,MAX_N_ROWS=100,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None,annotate_wildtype_allele=''): +def plot_alleles_table_from_file(alleles_file_name,fig_filename_root,MIN_FREQUENCY=0.5,MAX_N_ROWS=100,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None,annotate_wildtype_allele='',**kwargs): """ plots an allele table for a dataframe with allele frequencies infers the reference sequence by finding reference sequences without gaps (-) @@ -3150,7 +3171,7 @@ def plot_alleles_table_from_file(alleles_file_name,fig_filename_root,MIN_FREQUEN y_labels[ix] += annotate_wildtype_allele plot_alleles_heatmap(reference_seq, fig_filename_root, X, annot, y_labels, insertion_dict, per_element_annot_kws, SAVE_ALSO_PNG, plot_cut_point, sgRNA_intervals, sgRNA_names, sgRNA_mismatches, custom_colors) -def plot_alleles_tables_from_folder(crispresso_output_folder,fig_filename_root,MIN_FREQUENCY=None,MAX_N_ROWS=None,SAVE_ALSO_PNG=False,custom_colors=None,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None): +def plot_alleles_tables_from_folder(crispresso_output_folder,fig_filename_root,MIN_FREQUENCY=None,MAX_N_ROWS=None,SAVE_ALSO_PNG=False,custom_colors=None,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,**kwargs): """ plots an allele table for each sgRNA/amplicon in a CRISPresso run (useful for plotting after running using the plot harness) This function is only used for one-off plotting purposes and not for the general CRISPResso analysis @@ -3221,7 +3242,7 @@ def plot_alleles_tables_from_folder(crispresso_output_folder,fig_filename_root,M plot_count += 1 print('Plotted ' + str(plot_count) + ' plots') -def plot_alleles_table_compare(reference_seq,df_alleles,sample_name_1,sample_name_2,fig_filename_root,MIN_FREQUENCY=0.5,MAX_N_ROWS=100,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None): +def plot_alleles_table_compare(reference_seq,df_alleles,sample_name_1,sample_name_2,fig_filename_root,MIN_FREQUENCY=0.5,MAX_N_ROWS=100,SAVE_ALSO_PNG=False,plot_cut_point=True,sgRNA_intervals=None,sgRNA_names=None,sgRNA_mismatches=None,custom_colors=None,**kwargs): """ plots an allele table for a dataframe with allele frequencies from two CRISPResso runs input: @@ -3241,7 +3262,7 @@ def plot_alleles_table_compare(reference_seq,df_alleles,sample_name_1,sample_nam X, annot, y_labels, insertion_dict, per_element_annot_kws = prep_alleles_table_compare(df_alleles, sample_name_1, sample_name_2, MAX_N_ROWS, MIN_FREQUENCY) plot_alleles_heatmap(reference_seq, fig_filename_root, X, annot, y_labels, insertion_dict, per_element_annot_kws, SAVE_ALSO_PNG, plot_cut_point, sgRNA_intervals, sgRNA_names, sgRNA_mismatches, custom_colors) -def plot_nucleotide_quilt_from_folder(crispresso_output_folder,fig_filename_root,save_also_png=False,sgRNA_intervals=None,min_text_pct=0.5,max_text_pct=0.95,quantification_window_idxs=None,sgRNA_names=None,sgRNA_mismatches=None,shade_unchanged=True): +def plot_nucleotide_quilt_from_folder(crispresso_output_folder,fig_filename_root,save_also_png=False,sgRNA_intervals=None,min_text_pct=0.5,max_text_pct=0.95,quantification_window_idxs=None,sgRNA_names=None,sgRNA_mismatches=None,shade_unchanged=True,**kwargs): """ plots an allele table for each sgRNA/amplicon in a CRISPresso run (useful for plotting after running using the plot harness) This function is only used for one-off plotting purposes and not for the general CRISPResso analysis @@ -3317,7 +3338,7 @@ def plot_nucleotide_quilt_from_folder(crispresso_output_folder,fig_filename_root plot_count += 1 print('Plotted ' + str(plot_count) + ' plots') -def plot_unmod_mod_pcts(fig_filename_root,df_summary_quantification,save_png,cutoff=None,max_samples_to_include_unprocessed=20): +def plot_unmod_mod_pcts(fig_filename_root,df_summary_quantification,save_png,cutoff=None,max_samples_to_include_unprocessed=20,**kwargs): """ plots a stacked horizontal barplot for summarizing number of reads, and the percent that are modified and unmodified params: @@ -3376,7 +3397,7 @@ def plot_unmod_mod_pcts(fig_filename_root,df_summary_quantification,save_png,cut fig.savefig(fig_filename_root+'.png', bbox_inches='tight') plt.close(fig) -def plot_reads_total(fig_filename_root,df_summary_quantification,save_png,cutoff=None): +def plot_reads_total(fig_filename_root,df_summary_quantification,save_png,cutoff=None,**kwargs): """ plots a horizontal barplot for summarizing number of reads aligned to each sample """ @@ -3409,7 +3430,7 @@ def plot_reads_total(fig_filename_root,df_summary_quantification,save_png,cutoff def plot_read_barplot(N_READS_INPUT, N_READS_AFTER_PREPROCESSING, N_TOTAL, - plot_root, save_png + plot_root, save_png,**kwargs ): """Plot barplot of total, processed, and aligned reads. @@ -3464,7 +3485,7 @@ def plot_read_barplot(N_READS_INPUT, N_READS_AFTER_PREPROCESSING, N_TOTAL, def plot_class_piechart_and_barplot(class_counts_order, class_counts, ref_names, expected_hdr_amplicon_seq, N_TOTAL, - piechart_plot_root, barplot_plot_root, save_png): + piechart_plot_root, barplot_plot_root, custom_colors, save_png,**kwargs): """Plot a pie chart and barplot of class assignments for reads. Class assignments include: 'MODIFIED','UNMODIFIED','HDR',etc. @@ -3559,7 +3580,7 @@ def plot_class_piechart_and_barplot(class_counts_order, class_counts, ref_names, plt.close() -def plot_class_dsODN_piechart(sizes, labels, plot_root, save_also_png=False): +def plot_class_dsODN_piechart(sizes, labels, plot_root, save_also_png=False,**kwargs): fig, ax = plt.subplots(figsize=(12, 12)) patches, texts, autotexts =ax.pie(sizes, labels=labels, autopct='%1.2f%%') @@ -3584,6 +3605,7 @@ def plot_quantification_comparison_barchart( plot_titles, plot_path, save_also_png=False, + **kwargs ): fig, axs = plt.subplots(1, 2, figsize=(30, 15)) n_groups = 2 @@ -3662,6 +3684,7 @@ def plot_quantification_positions( plot_title, plot_path, save_also_png=False, + **kwargs, ): fig, axs = plt.subplots(2, 1, figsize=(20, 10)) ax1 = axs[0] @@ -3805,7 +3828,7 @@ def plot_quantification_positions( def plot_allele_modification_heatmap( - sample_values, sample_sgRNA_intervals, plot_path, title, + sample_values, sample_sgRNA_intervals, plot_path, title,**kwargs, ): fig = px.imshow( sample_values, @@ -3848,7 +3871,7 @@ def plot_allele_modification_heatmap( def plot_allele_modification_line( - sample_values, sample_sgRNA_intervals, plot_path, title, + sample_values, sample_sgRNA_intervals, plot_path, title,**kwargs, ): fig = px.line(sample_values.transpose()) sgRNA_intervals = set( diff --git a/CRISPResso2/CRISPRessoPooledCORE.py b/CRISPResso2/CRISPRessoPooledCORE.py index d84b987e..58fdac96 100644 --- a/CRISPResso2/CRISPRessoPooledCORE.py +++ b/CRISPResso2/CRISPRessoPooledCORE.py @@ -19,7 +19,10 @@ from CRISPResso2 import CRISPRessoShared from CRISPResso2 import CRISPRessoMultiProcessing from CRISPResso2.CRISPRessoReports import CRISPRessoReport -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot import traceback import logging diff --git a/CRISPResso2/CRISPRessoReports/CRISPRessoReport.py b/CRISPResso2/CRISPRessoReports/CRISPRessoReport.py index 97a405bc..619c992f 100644 --- a/CRISPResso2/CRISPRessoReports/CRISPRessoReport.py +++ b/CRISPResso2/CRISPRessoReports/CRISPRessoReport.py @@ -9,6 +9,12 @@ from jinja_partials import generate_render_partial, render_partial from CRISPResso2 import CRISPRessoShared +try: + from CRISPRessoPro import __version__ + pro_installed = True +except: + pro_installed = False + def render_template(template_name, jinja2_env, **data): """Render a template with partials. @@ -36,6 +42,7 @@ def custom_partial_render(partial_template_name, **partial_data): ), is_default_user=False, is_web=False, + is_pro=pro_installed, ) return template.render(**partial_data) return render_partial( diff --git a/CRISPResso2/CRISPRessoReports/templates/batchReport.html b/CRISPResso2/CRISPRessoReports/templates/batchReport.html index 5ffe28cd..d94c87d3 100644 --- a/CRISPResso2/CRISPRessoReports/templates/batchReport.html +++ b/CRISPResso2/CRISPRessoReports/templates/batchReport.html @@ -45,7 +45,6 @@ {% endblock %} {% block content %} -
diff --git a/CRISPResso2/CRISPRessoReports/templates/layout.html b/CRISPResso2/CRISPRessoReports/templates/layout.html index a028254c..7486bbea 100644 --- a/CRISPResso2/CRISPRessoReports/templates/layout.html +++ b/CRISPResso2/CRISPRessoReports/templates/layout.html @@ -9,7 +9,6 @@ - +{% if is_pro %} + +{% endif %} + {% endblock %} {% block content %} -
diff --git a/CRISPResso2/CRISPRessoReports/templates/report.html b/CRISPResso2/CRISPRessoReports/templates/report.html index 9214d168..68b0707d 100644 --- a/CRISPResso2/CRISPRessoReports/templates/report.html +++ b/CRISPResso2/CRISPRessoReports/templates/report.html @@ -74,6 +74,10 @@ } +{% if is_pro %} + +{% endif %} + {% endblock %} {% block content %} diff --git a/CRISPResso2/CRISPRessoReports/templates/shared/partials/guardrail_warnings.html b/CRISPResso2/CRISPRessoReports/templates/shared/partials/guardrail_warnings.html new file mode 100644 index 00000000..9869e591 --- /dev/null +++ b/CRISPResso2/CRISPRessoReports/templates/shared/partials/guardrail_warnings.html @@ -0,0 +1,5 @@ +{% if 'guardrails' in report_data['run_data']['results'] and report_data['run_data']['results']['guardrails']|length > 0 %} + {% for message in report_data['run_data']['results']['guardrails'] %} + {{message}} + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/CRISPResso2/CRISPRessoReports/templates/wgsReport.html b/CRISPResso2/CRISPRessoReports/templates/wgsReport.html index 5f2008a4..141ffd60 100644 --- a/CRISPResso2/CRISPRessoReports/templates/wgsReport.html +++ b/CRISPResso2/CRISPRessoReports/templates/wgsReport.html @@ -45,7 +45,6 @@ {% endblock %} {% block content %} -
diff --git a/CRISPResso2/CRISPRessoShared.py b/CRISPResso2/CRISPRessoShared.py index 26a212a6..c2690180 100644 --- a/CRISPResso2/CRISPRessoShared.py +++ b/CRISPResso2/CRISPRessoShared.py @@ -24,6 +24,12 @@ import logging from inspect import getmodule, stack +try: + from CRISPRessoPro import __version__ + pro_installed = True +except: + pro_installed = False + from CRISPResso2 import CRISPResso2Align from CRISPResso2 import CRISPRessoCOREResources @@ -384,11 +390,16 @@ def getCRISPRessoArgParser(parser_title="CRISPResso Parameters", required_params parser.add_argument('--bam_chr_loc', type=str, help='Chromosome location in bam for reads to process. For example: "chr1:50-100" or "chrX".', default='') - + + # CRISPRessoPro params + parser.add_argument('--use_matplotlib', default=False, action='store_true', + help='Use matplotlib for plotting instead of plotly when CRISPRessoPro is installed') + # deprecated params parser.add_argument('--save_also_png', default=False, help=argparse.SUPPRESS) # help='Save also .png images in addition to .pdf files') #depreciated -- now pngs are automatically created. Pngs can be suppressed by '--suppress_report' + return parser @@ -1997,7 +2008,8 @@ def check_custom_config(args): logger = logging.getLogger(getmodule(stack()[1][0]).__name__) #Check if crispresso.pro is installed - if not is_C2Pro_installed(): + # if not is_C2Pro_installed(): + if not pro_installed: return config if args.config_file: try: diff --git a/CRISPResso2/CRISPRessoWGSCORE.py b/CRISPResso2/CRISPRessoWGSCORE.py index 75d3ce43..211aeb17 100644 --- a/CRISPResso2/CRISPRessoWGSCORE.py +++ b/CRISPResso2/CRISPRessoWGSCORE.py @@ -19,7 +19,10 @@ from CRISPResso2 import CRISPRessoShared from CRISPResso2 import CRISPRessoMultiProcessing from CRISPResso2.CRISPRessoReports import CRISPRessoReport -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot import logging diff --git a/scripts/plotAmbiguous.py b/scripts/plotAmbiguous.py index ee7c24f1..349d0a7f 100644 --- a/scripts/plotAmbiguous.py +++ b/scripts/plotAmbiguous.py @@ -9,7 +9,10 @@ import numpy as np import pandas as pd import zipfile -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot from CRISPResso2 import CRISPRessoShared def main(): diff --git a/scripts/plotCustomAllelePlot.py b/scripts/plotCustomAllelePlot.py index 7eb32207..97416c5e 100644 --- a/scripts/plotCustomAllelePlot.py +++ b/scripts/plotCustomAllelePlot.py @@ -9,7 +9,10 @@ import numpy as np import pandas as pd import zipfile -from CRISPResso2 import CRISPRessoPlot +try: + from CRISPRessoPro import plot as CRISPRessoPlot +except: + from CRISPResso2 import CRISPRessoPlot from CRISPResso2 import CRISPRessoShared import seaborn as sns import matplotlib