Skip to content

Commit

Permalink
Merge pull request #106 from AlexandrovLab/cosmic_v3.4
Browse files Browse the repository at this point in the history
Cosmic v3.4
  • Loading branch information
mdbarnesUCSD authored Nov 20, 2023
2 parents 52741d7 + 0f9e289 commit 6c6b61b
Show file tree
Hide file tree
Showing 34 changed files with 2,233 additions and 88 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Assignment of known mutational signatures to individual samples is performed usi
```python
from SigProfilerAssignment import Analyzer as Analyze
Analyze.cosmic_fit(samples, output, input_type="matrix", context_type="96",
collapse_to_SBS96=True, cosmic_version=3.3, exome=False,
collapse_to_SBS96=True, cosmic_version=3.4, exome=False,
genome_build="GRCh37", signature_database=None,
exclude_signature_subgroups=None, export_probabilities=False,
export_probabilities_per_mutation=False, make_plots=False,
Expand All @@ -58,7 +58,7 @@ Analyze.cosmic_fit(samples, output, input_type="matrix", context_type="96",
| output | String | Path to the output folder. |
| 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". |
| 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". |
| 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. |
| 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. |
| exome | Boolean | Defines if the exome renormalized COSMIC signatures will be used. The default value is False. |
| 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. |
| 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. |
Expand Down Expand Up @@ -98,17 +98,17 @@ The full list of signature subgroups is included in the following table:
| ----------- | ----------- | ----------- | ----------- |
|MMR_deficiency_signatures| 6, 14, 15, 20, 21, 26, 44| 7, 10| 7|
|POL_deficiency_signatures| 10a, 10b, 10c, 10d, 28| 3| -|
|HR_deficiency_signatures| 3| -| 6|
|HR_deficiency_signatures| 3| 13| 6|
|BER_deficiency_signatures| 30, 36| -| -|
|Chemotherapy_signatures| 11, 25, 31, 35, 86, 87, 90| 5| -|
|Chemotherapy_signatures| 11, 25, 31, 35, 86, 87, 90, 99| 5| -|
|Immunosuppressants_signatures| 32| -| -|
|Treatment_signatures| 11, 25, 31, 32, 35, 86, 87, 90| 5| -|
|Treatment_signatures| 11, 25, 31, 32, 35, 86, 87, 90, 99| 5| -|
|APOBEC_signatures| 2, 13| -| -|
|Tobacco_signatures | 4, 29, 92| 2| 3|
|UV_signatures| 7a, 7b, 7c, 7d, 38| 1| 13|
|AA_signatures| 22| -| -|
|AA_signatures| 22a, 22b| 20| 23|
|Colibactin_signatures| 88| -| 18|
|Artifact_signatures| 27, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 95|-|-|
|Artifact_signatures| 27, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 95|14|-|
|Lymphoid_signatures| 9, 84, 85| -| -|

Expand All @@ -126,7 +126,7 @@ Analyze.cosmic_fit(samples=spa.__path__[0]+"/data/tests/vcf_input",
input_type="vcf",
context_type="96",
genome_build="GRCh37",
cosmic_version=3.3)
cosmic_version=3.4)
```


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

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

## <a name="denovo"></a> _De novo_ extraction of mutational signatures downstream analysis
Expand Down
6 changes: 3 additions & 3 deletions SigProfilerAssignment/Analyzer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from SigProfilerAssignment import decomposition as decomp

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):
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):
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)

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):
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):
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)

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):
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):
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)
24 changes: 12 additions & 12 deletions SigProfilerAssignment/DecompositionPlots/PlotDecomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def remove_cosmic_templates():
print("Error: %s : %s" % (TEMPLATE_PATH, e.strerror))

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

if not os.path.exists(TEMPLATE_PATH):
os.mkdir(TEMPLATE_PATH)
Expand Down Expand Up @@ -267,13 +267,13 @@ def genCNV_pngs(denovo_mtx, basis_mtx, output_path, project, mtype):
denovo_plots = dict()
basis_plots = dict()
denovo_plots = sigPlt.plotCNV(denovo_mtx, output_path, project,
plot_type="pdf", percentage=True, aggregate=False,
read_from_file=False, write_to_file=False)
percentage=True, aggregate=False,
read_from_file=False, savefig_format="PIL_Image")

if basis_mtx is not None:
basis_plots = sigPlt.plotCNV(basis_mtx, output_path, project,
plot_type="pdf", percentage=True, aggregate=False,
read_from_file=False, write_to_file=False)
percentage=True, aggregate=False,
read_from_file=False, savefig_format="PIL_Image")
return denovo_plots,basis_plots

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

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

Expand Down Expand Up @@ -458,7 +458,7 @@ def gen_decomposition(denovo_name, basis_names, weights, output_path, project, \

def run_PlotDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names,
weights, nonzero_exposures, output_path, project, mtype,
cosmic_version="3.3", genome_build="GRCh37", exome=False,
cosmic_version="3.4", genome_build="GRCh37", exome=False,
custom_text=None):
"""
Generates a decomposition plot of the denovo_mtx using the basis_mtx.
Expand Down Expand Up @@ -532,10 +532,10 @@ def run_PlotDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names,

return byte_plot

# context="96", genome_build="GRCh37", cosmic_version="3.3", exome=False
# context="96", genome_build="GRCh37", cosmic_version="3.4", exome=False
def run_PlotSSDecomposition(denovo_mtx, denovo_name, basis_mtx, basis_names, \
weights, output_path, project, context_type, genome_build="GRCh37", \
cosmic_version="3.3", custom_text=None, exome=False):
cosmic_version="3.4", custom_text=None, exome=False):
"""
Generates a reconstruction of a sample given a set of signatures.
Expand Down
Loading

0 comments on commit 6c6b61b

Please sign in to comment.