Skip to content

Commit d09c3e6

Browse files
authored
Merge pull request #60 from AlexandrovLab/decomp_plot_fix
Decomp plot fix
2 parents 07119f9 + 09ec585 commit d09c3e6

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

SigProfilerAssignment/DecompositionPlots/PlotDecomposition.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,9 @@ def gen_decomposition(denovo_name, basis_names, weights, output_path, project, \
444444

445445

446446
def run_PlotDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names,
447-
weights, nonzero_exposures, output_path, project, mtype, cosmic_version=None, custom_text=None):
447+
weights, nonzero_exposures, output_path, project, mtype,
448+
cosmic_version="3.3", genome_build="GRCh37", exome=False,
449+
custom_text=None):
448450
"""
449451
Generates a decomposition plot of the denovo_mtx using the basis_mtx.
450452
@@ -499,8 +501,8 @@ def run_PlotDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names,
499501
# Load in the COSMIC plots
500502
if mtype != "48":
501503
basis_plots_dict = install_cosmic_plots(context_type=mtype,
502-
genome_build="GRCh37", cosmic_version="3.3",
503-
exome=False)
504+
genome_build=genome_build, cosmic_version=cosmic_version,
505+
exome=exome)
504506
basis_plots_dict = {key: basis_plots_dict[key] for key in basis_names}
505507
basis_plots_dict = open_byte_to_img_dict(basis_plots_dict)
506508
# Generate the reconstruction plot
@@ -568,7 +570,7 @@ def run_PlotSSDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names, \
568570
# Load in the COSMIC plots
569571
basis_plots_dict = install_cosmic_plots(context_type=context_type,
570572
genome_build=genome_build, cosmic_version=cosmic_version,
571-
exome=False)
573+
exome=exome)
572574

573575
# Create reconstructed matrix and plot
574576
reconstructed_mtx,reconstruction_plot_dict = gen_reconstructed_png_numerical(

SigProfilerAssignment/decompose_subroutines.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,11 @@ def signature_decomposition(signatures, mtype, directory, genome_build="GRCh37",
399399
basis_cols = basis_names.copy()
400400
basis_cols.insert(0,cosmic_mut_types_col)
401401
denovo_cols=[denovo_mut_types_col, denovo_name]
402-
byte_plot = sp.run_PlotDecomposition(originalProcessAvg[denovo_cols], denovo_name, cosmic_sigs_DF[basis_cols], basis_names, weights, nonzero_exposures/5000, directory, "test", mtype_par)
402+
byte_plot = sp.run_PlotDecomposition(originalProcessAvg[denovo_cols],
403+
denovo_name, cosmic_sigs_DF[basis_cols], basis_names, weights,
404+
nonzero_exposures/5000, directory, "test", mtype_par,
405+
cosmic_version=cosmic_version, genome_build=genome_build,
406+
exome=exome)
403407
merger.append(byte_plot)
404408
with alive_bar(1, ctrl_c=False,bar='blocks', title=f'Decompositon Plot:{denovo_name}') as bar:
405409
bar()

SigProfilerAssignment/decomposition.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def convert_PDF_to_PNG(input_file_name, output_directory, page_names):
4444
pix.save(out_file_name)
4545

4646
# Create sample reconstruction plots
47-
def generate_sample_reconstruction(cosmic_sigs, samples_input, activities, output_dir):
47+
def generate_sample_reconstruction(cosmic_sigs, samples_input, activities, output_dir, execution_parameters):
4848
project = "test_run"
4949
mtype="96"
5050

@@ -71,7 +71,10 @@ def generate_sample_reconstruction(cosmic_sigs, samples_input, activities, outpu
7171
weights,
7272
output_dir,
7373
project,
74-
mtype)
74+
mtype,
75+
genome_build = execution_parameters["reference_genome"],
76+
cosmic_version = str(execution_parameters["cosmic_version"]),
77+
exome = execution_parameters["exome"])
7578
final_pdf.append(result)
7679

7780
pdf_output_path = os.path.join(output_dir,
@@ -659,7 +662,8 @@ def spa_analyze(samples, output, input_type='matrix', context_type="96", signatu
659662
generate_sample_reconstruction(cosmic_sig_ref,
660663
genomes,
661664
cosmic_activities,
662-
ss_recon_odir)
665+
ss_recon_odir,
666+
execution_parameters)
663667

664668
# Complete JOB_METADATA
665669
sysdata = open(output+"/JOB_METADATA.txt", "a")

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if os.path.exists("dist"):
77
shutil.rmtree("dist")
88

9-
VERSION = '0.0.20'
9+
VERSION = '0.0.21'
1010

1111

1212
def write_version_py(filename='SigProfilerAssignment/version.py'):
@@ -15,7 +15,7 @@ def write_version_py(filename='SigProfilerAssignment/version.py'):
1515
# THIS FILE IS GENERATED FROM SigProfilerAssignment SETUP.PY
1616
short_version = '%(version)s'
1717
version = '%(version)s'
18-
Update = 'Implement sample reconstruction plot'
18+
Update = 'Resolve reference signature default value issue for decomposition plots.'
1919
2020
2121
"""

0 commit comments

Comments
 (0)