Skip to content

Commit 6c6b61b

Browse files
authored
Merge pull request #106 from AlexandrovLab/cosmic_v3.4
Cosmic v3.4
2 parents 52741d7 + 0f9e289 commit 6c6b61b

34 files changed

+2233
-88
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Assignment of known mutational signatures to individual samples is performed usi
4141
```python
4242
from SigProfilerAssignment import Analyzer as Analyze
4343
Analyze.cosmic_fit(samples, output, input_type="matrix", context_type="96",
44-
collapse_to_SBS96=True, cosmic_version=3.3, exome=False,
44+
collapse_to_SBS96=True, cosmic_version=3.4, exome=False,
4545
genome_build="GRCh37", signature_database=None,
4646
exclude_signature_subgroups=None, export_probabilities=False,
4747
export_probabilities_per_mutation=False, make_plots=False,
@@ -58,7 +58,7 @@ Analyze.cosmic_fit(samples, output, input_type="matrix", context_type="96",
5858
| output | String | Path to the output folder. |
5959
| input_type | String | Three accepted input types:<ul><li> "vcf": if using mutation calling file/s (VCF, MAF, simple text file) as input</li><li>"seg:TYPE": if using a segmentation file as input. Please check the required format at https://github.com/AlexandrovLab/SigProfilerMatrixGenerator#copy-number-matrix-generation. The accepted callers for TYPE are the following {"ASCAT", "ASCAT_NGS", "SEQUENZA", "ABSOLUTE", "BATTENBERG", "FACETS", "PURPLE", "TCGA"}. For example:"seg:BATTENBERG"</li><li>"matrix": if using a mutational matrix as input</li></ul>The default value is "matrix". |
6060
| context_type | String | Required context type if `input_type` is "vcf". `context_type` takes which context type of the input data is considered for assignment. Valid options include "96", "288", "1536", "DINUC", and "ID". The default value is "96". |
61-
| cosmic_version | Float | Defines the version of the COSMIC reference signatures. Takes a positive float among 1, 2, 3, 3.1, 3.2 and 3.3. The default value is 3.3. |
61+
| cosmic_version | Float | Defines the version of the COSMIC reference signatures. Takes a positive float among 1, 2, 3, 3.1, 3.2, 3.3, and 3.4. The default value is 3.4. |
6262
| exome | Boolean | Defines if the exome renormalized COSMIC signatures will be used. The default value is False. |
6363
| genome_build | String | The reference genome build, used for select the appropriate version of the COSMIC reference signatures, as well as processing the mutation calling file/s. Supported genomes include "GRCh37", "GRCh38", "mm9", "mm10" and "rn6". The default value is "GRCh37". If the selected genome is not in the supported list, the default genome will be used. |
6464
| signature_database | String | Path to the input set of known mutational signatures (only in case that COSMIC reference signatures are not used), a tab delimited file that contains the signature matrix where the rows are mutation types and columns are signature IDs. |
@@ -98,17 +98,17 @@ The full list of signature subgroups is included in the following table:
9898
| ----------- | ----------- | ----------- | ----------- |
9999
|MMR_deficiency_signatures| 6, 14, 15, 20, 21, 26, 44| 7, 10| 7|
100100
|POL_deficiency_signatures| 10a, 10b, 10c, 10d, 28| 3| -|
101-
|HR_deficiency_signatures| 3| -| 6|
101+
|HR_deficiency_signatures| 3| 13| 6|
102102
|BER_deficiency_signatures| 30, 36| -| -|
103-
|Chemotherapy_signatures| 11, 25, 31, 35, 86, 87, 90| 5| -|
103+
|Chemotherapy_signatures| 11, 25, 31, 35, 86, 87, 90, 99| 5| -|
104104
|Immunosuppressants_signatures| 32| -| -|
105-
|Treatment_signatures| 11, 25, 31, 32, 35, 86, 87, 90| 5| -|
105+
|Treatment_signatures| 11, 25, 31, 32, 35, 86, 87, 90, 99| 5| -|
106106
|APOBEC_signatures| 2, 13| -| -|
107107
|Tobacco_signatures | 4, 29, 92| 2| 3|
108108
|UV_signatures| 7a, 7b, 7c, 7d, 38| 1| 13|
109-
|AA_signatures| 22| -| -|
109+
|AA_signatures| 22a, 22b| 20| 23|
110110
|Colibactin_signatures| 88| -| 18|
111-
|Artifact_signatures| 27, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 95|-|-|
111+
|Artifact_signatures| 27, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 95|14|-|
112112
|Lymphoid_signatures| 9, 84, 85| -| -|
113113

114114
@@ -126,7 +126,7 @@ Analyze.cosmic_fit(samples=spa.__path__[0]+"/data/tests/vcf_input",
126126
input_type="vcf",
127127
context_type="96",
128128
genome_build="GRCh37",
129-
cosmic_version=3.3)
129+
cosmic_version=3.4)
130130
```
131131

132132

@@ -139,7 +139,7 @@ from SigProfilerAssignment import Analyzer as Analyze
139139
Analyze.cosmic_fit(samples=spa.__path__[0]+"/data/tests/cnv_input/all.breast.ascat.summary.sample.tsv",
140140
output="example_sf",
141141
input_type="seg:ASCAT_NGS",
142-
cosmic_version=3.3,
142+
cosmic_version=3.4,
143143
collapse_to_SBS96=False)
144144
```
145145

@@ -153,7 +153,7 @@ Analyze.cosmic_fit(samples=spa.__path__[0]+"/data/tests/txt_input/sample_matrix_
153153
output="example_mm",
154154
input_type="matrix",
155155
genome_build="GRCh37",
156-
cosmic_version=3.3)
156+
cosmic_version=3.4)
157157
```
158158

159159
## <a name="denovo"></a> _De novo_ extraction of mutational signatures downstream analysis

SigProfilerAssignment/Analyzer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from SigProfilerAssignment import decomposition as decomp
22

3-
def decompose_fit(samples, output, signatures=None, signature_database=None,nnls_add_penalty=0.05, nnls_remove_penalty=0.01, initial_remove_penalty=0.05,genome_build="GRCh37", cosmic_version=3.3, make_plots=True, collapse_to_SBS96=True,connected_sigs=True, verbose=False,devopts=None,new_signature_thresh_hold=0.8,exclude_signature_subgroups=None,exome=False,input_type='matrix',context_type="96",export_probabilities=True, export_probabilities_per_mutation=False):
3+
def decompose_fit(samples, output, signatures=None, signature_database=None,nnls_add_penalty=0.05, nnls_remove_penalty=0.01, initial_remove_penalty=0.05,genome_build="GRCh37", cosmic_version=3.4, make_plots=True, collapse_to_SBS96=True,connected_sigs=True, verbose=False,devopts=None,new_signature_thresh_hold=0.8,exclude_signature_subgroups=None,exome=False,input_type='matrix',context_type="96",export_probabilities=True, export_probabilities_per_mutation=False):
44
decomp.spa_analyze(samples=samples, output=output, signatures=signatures, signature_database=signature_database,nnls_add_penalty=nnls_add_penalty, nnls_remove_penalty=nnls_remove_penalty, initial_remove_penalty=initial_remove_penalty,genome_build=genome_build, cosmic_version=cosmic_version, make_plots=make_plots, collapse_to_SBS96=collapse_to_SBS96,connected_sigs=connected_sigs, verbose=verbose,decompose_fit_option= True,denovo_refit_option=False,cosmic_fit_option=False,devopts=devopts,new_signature_thresh_hold=new_signature_thresh_hold,exclude_signature_subgroups=exclude_signature_subgroups,exome=exome,input_type=input_type,context_type=context_type,export_probabilities=export_probabilities, export_probabilities_per_mutation=export_probabilities_per_mutation)
55

6-
def denovo_fit(samples, output, signatures=None, signature_database=None,nnls_add_penalty=0.05,nnls_remove_penalty=0.01, initial_remove_penalty=0.05, genome_build="GRCh37", cosmic_version=3.3, make_plots=True, collapse_to_SBS96=True,connected_sigs=True, verbose=False,devopts=None,new_signature_thresh_hold=0.8,exome=False,input_type='matrix',context_type="96",export_probabilities=True, export_probabilities_per_mutation=False):
6+
def denovo_fit(samples, output, signatures=None, signature_database=None,nnls_add_penalty=0.05,nnls_remove_penalty=0.01, initial_remove_penalty=0.05, genome_build="GRCh37", cosmic_version=3.4, make_plots=True, collapse_to_SBS96=True,connected_sigs=True, verbose=False,devopts=None,new_signature_thresh_hold=0.8,exome=False,input_type='matrix',context_type="96",export_probabilities=True, export_probabilities_per_mutation=False):
77
decomp.spa_analyze(samples=samples, output=output, signatures=signatures, signature_database=signature_database,nnls_add_penalty=nnls_add_penalty, nnls_remove_penalty=nnls_remove_penalty, initial_remove_penalty=initial_remove_penalty,genome_build=genome_build, cosmic_version=cosmic_version, new_signature_thresh_hold=new_signature_thresh_hold, make_plots=make_plots, collapse_to_SBS96=collapse_to_SBS96,connected_sigs=connected_sigs, verbose=verbose,decompose_fit_option= False,denovo_refit_option=True,cosmic_fit_option=False,devopts=devopts,exome=exome,input_type=input_type,context_type=context_type,export_probabilities=export_probabilities, export_probabilities_per_mutation=export_probabilities_per_mutation)
88

9-
def cosmic_fit(samples, output, signatures=None, signature_database=None,nnls_add_penalty=0.05, nnls_remove_penalty=0.01, initial_remove_penalty=0.05,genome_build="GRCh37", cosmic_version=3.3, make_plots=True, collapse_to_SBS96=True,connected_sigs=True, verbose=False,devopts=None,exclude_signature_subgroups=None,exome=False,input_type='matrix',context_type="96",export_probabilities=True, export_probabilities_per_mutation=False, sample_reconstruction_plots=False):
9+
def cosmic_fit(samples, output, signatures=None, signature_database=None,nnls_add_penalty=0.05, nnls_remove_penalty=0.01, initial_remove_penalty=0.05,genome_build="GRCh37", cosmic_version=3.4, make_plots=True, collapse_to_SBS96=True,connected_sigs=True, verbose=False,devopts=None,exclude_signature_subgroups=None,exome=False,input_type='matrix',context_type="96",export_probabilities=True, export_probabilities_per_mutation=False, sample_reconstruction_plots=False):
1010
decomp.spa_analyze(samples=samples, output=output, signatures=signatures, signature_database=signature_database,nnls_add_penalty=nnls_add_penalty, nnls_remove_penalty=nnls_remove_penalty, initial_remove_penalty=initial_remove_penalty,genome_build=genome_build, cosmic_version=cosmic_version, make_plots=make_plots, collapse_to_SBS96=collapse_to_SBS96,connected_sigs=connected_sigs, verbose=verbose,decompose_fit_option= False,denovo_refit_option=False,cosmic_fit_option=True,devopts=devopts,exclude_signature_subgroups=exclude_signature_subgroups,exome=exome,input_type=input_type,context_type=context_type,export_probabilities=export_probabilities, export_probabilities_per_mutation=export_probabilities_per_mutation, sample_reconstruction_plots=sample_reconstruction_plots)

SigProfilerAssignment/DecompositionPlots/PlotDecomposition.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def remove_cosmic_templates():
5959
print("Error: %s : %s" % (TEMPLATE_PATH, e.strerror))
6060

6161
# Create a set of serialized JSON reference signature plots for fast loading
62-
def install_cosmic_plots(context_type="96", genome_build="GRCh37", cosmic_version="3.3", exome=False):
62+
def install_cosmic_plots(context_type="96", genome_build="GRCh37", cosmic_version="3.4", exome=False):
6363

6464
if not os.path.exists(TEMPLATE_PATH):
6565
os.mkdir(TEMPLATE_PATH)
@@ -267,13 +267,13 @@ def genCNV_pngs(denovo_mtx, basis_mtx, output_path, project, mtype):
267267
denovo_plots = dict()
268268
basis_plots = dict()
269269
denovo_plots = sigPlt.plotCNV(denovo_mtx, output_path, project,
270-
plot_type="pdf", percentage=True, aggregate=False,
271-
read_from_file=False, write_to_file=False)
270+
percentage=True, aggregate=False,
271+
read_from_file=False, savefig_format="PIL_Image")
272272

273273
if basis_mtx is not None:
274274
basis_plots = sigPlt.plotCNV(basis_mtx, output_path, project,
275-
plot_type="pdf", percentage=True, aggregate=False,
276-
read_from_file=False, write_to_file=False)
275+
percentage=True, aggregate=False,
276+
read_from_file=False, savefig_format="PIL_Image")
277277
return denovo_plots,basis_plots
278278

279279
# signames, weights
@@ -339,8 +339,8 @@ def gen_reconstructed_png_percent(denovo_name, basis_mtx, basis_names,
339339
savefig_format='PIL_Image')
340340
elif mtype in CNV_CONTEXTS:
341341
reconstruction_plot = sigPlt.plotCNV(reconstruction_mtx, output_path,
342-
"reconstruction_"+project, plot_type="pdf", percentage=True,
343-
aggregate=False, read_from_file=False, write_to_file=False)
342+
"reconstruction_"+project, percentage=True,
343+
aggregate=False, read_from_file=False, savefig_format='PIL_Image')
344344
else:
345345
print("ERROR: mtype is " + mtype + " and is not yet supported.")
346346

@@ -375,8 +375,8 @@ def gen_reconstructed_png_numerical(denovo_mtx, denovo_name, basis_mtx, basis_na
375375
"reconstruction_" + project, mtype, percentage=False, savefig_format="PIL_Image")
376376
elif mtype in CNV_CONTEXTS:
377377
reconstruction_plot = sigPlt.plotCNV(reconstruction_mtx, output_path,
378-
"reconstruction_"+project, plot_type="pdf", percentage=True,
379-
aggregate=False, read_from_file=False, write_to_file=False)
378+
"reconstruction_"+project, percentage=True,
379+
aggregate=False, read_from_file=False, savefig_format="PIL_Image")
380380
else:
381381
print("ERROR: mtype is " + mtype + " and is not yet supported.")
382382

@@ -458,7 +458,7 @@ def gen_decomposition(denovo_name, basis_names, weights, output_path, project, \
458458

459459
def run_PlotDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names,
460460
weights, nonzero_exposures, output_path, project, mtype,
461-
cosmic_version="3.3", genome_build="GRCh37", exome=False,
461+
cosmic_version="3.4", genome_build="GRCh37", exome=False,
462462
custom_text=None):
463463
"""
464464
Generates a decomposition plot of the denovo_mtx using the basis_mtx.
@@ -532,10 +532,10 @@ def run_PlotDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names,
532532

533533
return byte_plot
534534

535-
# context="96", genome_build="GRCh37", cosmic_version="3.3", exome=False
535+
# context="96", genome_build="GRCh37", cosmic_version="3.4", exome=False
536536
def run_PlotSSDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names, \
537537
weights, output_path, project, context_type, genome_build="GRCh37", \
538-
cosmic_version="3.3", custom_text=None, exome=False):
538+
cosmic_version="3.4", custom_text=None, exome=False):
539539
"""
540540
Generates a reconstruction of a sample given a set of signatures.
541541

0 commit comments

Comments
 (0)