def genDBS_pngs(denovo_mtx, basis_mtx, output_path, project, mtype): denovo_plots = dict() basis_plots = dict() denovo_plots = sigPlt.plotDBS(denovo_mtx, output_path, project, mtype, True) basis_plots = sigPlt.plotDBS(basis_mtx, output_path, project, mtype, True) return denovo_plots, basis_plots
def gen_reconstructed_png(denovo_name, basis_mtx, basis_names, weights, output_path, project, mtype): col_names = [denovo_name] mut_col = basis_mtx.iloc[:, 0] recon_plot = basis_mtx[basis_names[0]] * float(weights[0].strip("%")) / 100 for i in range(1, len(weights)): recon_plot = recon_plot + basis_mtx[basis_names[i]] * ( float(weights[i].strip("%")) / 100) recon_plot = pd.Series(recon_plot, name=denovo_name) reconstruction_mtx = pd.concat([mut_col, recon_plot], axis=1) if mtype in SBS_CONTEXTS: if mtype == "1536": sigPlt.plotSBS(reconstruction_mtx, output_path, "reconstruction_" + project, "96", True) else: sigPlt.plotSBS(reconstruction_mtx, output_path, "reconstruction_" + project, mtype, True) elif mtype in DBS_CONTEXTS: sigPlt.plotDBS(reconstruction_mtx, output_path, "reconstruction_" + project, mtype, True) elif mtype in ID_CONTEXTS: sigPlt.plotID(reconstruction_mtx, output_path, "reconstruction_" + project, mtype, True) else: print(type(mtype)) print("ERROR: mtype is " + mtype + " and is not yet supported.") return reconstruction_mtx
def gen_reconstructed_png(denovo_name, basis_mtx, basis_names, weights, output_path, project, mtype): reconstruction_plot = dict() col_names = [denovo_name] mut_col = basis_mtx.iloc[:, 0] recon_plot = basis_mtx[basis_names[0]] * float(weights[0].strip("%")) / 100 for i in range(1, len(weights)): recon_plot = recon_plot + basis_mtx[basis_names[i]] * ( float(weights[i].strip("%")) / 100) recon_plot = pd.Series(recon_plot, name=denovo_name) reconstruction_mtx = pd.concat([mut_col, recon_plot], axis=1) if mtype in SBS_CONTEXTS: if mtype == "1536" or mtype == "288": reconstruction_plot = sigPlt.plotSBS(reconstruction_mtx, output_path, "reconstruction_" + project, "96", True) else: reconstruction_plot = sigPlt.plotSBS(reconstruction_mtx, output_path, "reconstruction_" + project, mtype, True) elif mtype in DBS_CONTEXTS: reconstruction_plot = sigPlt.plotDBS(reconstruction_mtx, output_path, "reconstruction_" + project, mtype, True) elif mtype in ID_CONTEXTS: reconstruction_plot = sigPlt.plotID(reconstruction_mtx, output_path, "reconstruction_" + project, mtype, True) elif mtype in CNV_CONTEXTS: reconstruction_plot = pltCNV.plotCNV(reconstruction_mtx, output_path, "reconstruction_"+project, plot_type="pdf", \ percentage=True, aggregate=False, read_from_file=False, write_to_file=False) else: print("ERROR: mtype is " + mtype + " and is not yet supported.") return reconstruction_mtx, reconstruction_plot
def genDBS_pngs(denovo_mtx, basis_mtx, output_path, project, mtype): sigPlt.plotDBS(denovo_mtx, output_path, project, mtype, True) sigPlt.plotDBS(basis_mtx, output_path, project, mtype, True)