@@ -126,8 +126,9 @@ def install_cosmic_plots(context_type="96", genome_build="GRCh37", cosmic_versio
126126 savefig_format = "buffer_stream" )
127127 elif context_type_str == "DBS" :
128128 cosmic_mtx = pd .read_csv (cosmic_file_path , sep = "\t " )
129- cosmic_buff_plots = mPlt .plotDBS (cosmic_mtx , "buffer" ,
130- "buffer" , cosmic_mtype , percentage = True )
129+ cosmic_buff_plots = sigPlt .plotDBS (cosmic_mtx , "buffer" ,
130+ "buffer" , cosmic_mtype , percentage = True ,
131+ savefig_format = "buffer_stream" )
131132 elif context_type_str == "ID" :
132133 cosmic_buff_plots = sigPlt .plotID (cosmic_file_path , "buffer" ,
133134 "buffer" , cosmic_mtype , percentage = True ,
@@ -251,11 +252,11 @@ def genSBS_pngs(denovo_mtx, basis_mtx, output_path, project, mtype, ss_decomp=Fa
251252def genDBS_pngs (denovo_mtx , basis_mtx , output_path , project , mtype ):
252253 denovo_plots = dict ()
253254 basis_plots = dict ()
254- denovo_plots = mPlt .plotDBS (denovo_mtx , output_path , project , mtype ,
255- percentage = True )
255+ denovo_plots = sigPlt .plotDBS (denovo_mtx , output_path , project , mtype ,
256+ percentage = True , savefig_format = "buffer_stream" )
256257 if basis_mtx is not None :
257- basis_plots = mPlt .plotDBS (basis_mtx , output_path , project , mtype ,
258- percentage = True )
258+ basis_plots = sigPlt .plotDBS (basis_mtx , output_path , project , mtype ,
259+ percentage = True , savefig_format = "buffer_stream" )
259260 return denovo_plots ,basis_plots
260261
261262def genID_pngs (denovo_mtx , basis_mtx , output_path , project , mtype ):
@@ -332,8 +333,8 @@ def gen_reconstructed_png_percent(denovo_name, basis_mtx, basis_names, weights,
332333 reconstruction_plot = sigPlt .plotSBS (reconstruction_mtx , output_path , \
333334 "reconstruction_" + project , mtype , percentage = True , savefig_format = 'buffer_stream' )
334335 elif mtype in DBS_CONTEXTS :
335- reconstruction_plot = mPlt .plotDBS (reconstruction_mtx , output_path ,
336- "reconstruction_" + project , mtype , percentage = True )
336+ reconstruction_plot = sigPlt .plotDBS (reconstruction_mtx , output_path ,
337+ "reconstruction_" + project , mtype , percentage = True , savefig_format = 'buffer_stream' )
337338 elif mtype in ID_CONTEXTS :
338339 reconstruction_plot = sigPlt .plotID (reconstruction_mtx , output_path ,
339340 "reconstruction_" + project , mtype , percentage = True , savefig_format = 'buffer_stream' )
@@ -367,11 +368,11 @@ def gen_reconstructed_png_numerical(denovo_mtx, denovo_name, basis_mtx, basis_na
367368 "reconstruction_" + project , mtype , percentage = False ,
368369 savefig_format = "buffer_stream" )
369370 elif mtype in DBS_CONTEXTS :
370- reconstruction_plot = mPlt .plotDBS (reconstruction_mtx , output_path ,
371- "reconstruction_" + project , mtype , percentage = False )
371+ reconstruction_plot = sigPlt .plotDBS (reconstruction_mtx , output_path ,
372+ "reconstruction_" + project , mtype , percentage = False , savefig_format = "buffer_stream" )
372373 elif mtype in ID_CONTEXTS :
373374 reconstruction_plot = sigPlt .plotID (reconstruction_mtx , output_path ,
374- "reconstruction_" + project , mtype , percentage = False )
375+ "reconstruction_" + project , mtype , percentage = False , savefig_format = "buffer_stream" )
375376 elif mtype in CNV_CONTEXTS :
376377 reconstruction_plot = sigPlt .plotCNV (reconstruction_mtx , output_path ,
377378 "reconstruction_" + project , plot_type = "pdf" , percentage = True ,
@@ -493,15 +494,15 @@ def run_PlotDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names,
493494 -------
494495 None.
495496 """
496-
497497 # Create the denovo plots and load basis plots
498- if mtype == "48" :
499- denovo_plots_dict , basis_plots_dict = gen_sub_plots (denovo_mtx , basis_mtx ,
500- output_path , project , mtype , ss_decomp = False )
501- else :
498+ if mtype != "48" :
502499 denovo_plots_dict = gen_sub_plots (denovo_mtx , None ,
503500 output_path , project , mtype , ss_decomp = False )
504501 denovo_plots_dict = denovo_plots_dict [0 ]
502+ else :
503+ # cnv basis plots need to be generated and not loaded
504+ denovo_plots_dict , basis_plots_dict = gen_sub_plots (denovo_mtx , basis_mtx ,
505+ output_path , project , mtype , ss_decomp = False )
505506 # Create the matrix and plot for the reconstructed matrix
506507 reconstructed_mtx ,reconstruction_plot_dict = gen_reconstructed_png_percent (
507508 denovo_name , basis_mtx , basis_names , weights , output_path , project , mtype )
0 commit comments