diff --git a/conf/modules.config b/conf/modules.config index 89151074..5802f645 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -574,6 +574,17 @@ process { ] ] } + + withName: SIGPROFILERASSIGNMENTINDELS { + ext.context_type = "ID" // define context as ID only when running with this call of the module + publishDir = [ + [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/signatures/sigprofilerassignment" }, + pattern: "**{txt,pdf}", + ] + ] + } withName: HDPREASSIGNMENT { publishDir = [ diff --git a/modules/local/signatures/sigprofiler/assignment/cosmic_fit/main.nf b/modules/local/signatures/sigprofiler/assignment/cosmic_fit/main.nf index b3f77163..0d9a35e1 100644 --- a/modules/local/signatures/sigprofiler/assignment/cosmic_fit/main.nf +++ b/modules/local/signatures/sigprofiler/assignment/cosmic_fit/main.nf @@ -16,11 +16,13 @@ process SIGPROFILERASSIGNMENT_COSMIC_FIT { script: - def name = "${meta.id}.${type}" def assembly = task.ext.genome_assembly ?: "GRCh38" - + def context_type = task.ext.context_type ?: "96" // "96", "288", "1536", "DINUC", and "ID" + def name = "${meta.id}.${type}.${context_type}" + // FIXME: the definition of subgroups to exclude seems not to work in the new CLI SigProfilerAssignment // def exclude_signature_subgroups = params.exclude_subgroups ? "--exclude_signature_subgroups \"${params.exclude_subgroups}\"" : "" + // The default input format is "matrix". """ mkdir -p spa_volume export SIGPROFILERMATRIXGENERATOR_VOLUME='./spa_volume' @@ -28,11 +30,12 @@ process SIGPROFILERASSIGNMENT_COSMIC_FIT { export SIGPROFILERASSIGNMENT_VOLUME='./spa_volume' SigProfilerAssignment cosmic_fit \\ - ${matrix} \\ + ${matrix} \\ output_${name} \\ --signature_database ${reference_signatures} \\ --genome_build ${assembly} \\ --cpu ${task.cpus} \\ + --context_type ${context_type} \\ --volume spa_volume cp output_${name}/Assignment_Solution/Activities/Decomposed_MutationType_Probabilities.txt output_${name}/Assignment_Solution/Activities/Decomposed_MutationType_Probabilities.${name}.txt; diff --git a/modules/local/signatures/sigprofiler/matrixgenerator/main.nf b/modules/local/signatures/sigprofiler/matrixgenerator/main.nf index 432709b6..9710bad0 100644 --- a/modules/local/signatures/sigprofiler/matrixgenerator/main.nf +++ b/modules/local/signatures/sigprofiler/matrixgenerator/main.nf @@ -9,6 +9,7 @@ process SIGPROFILER_MATRIXGENERATOR { output: path("**plots/*"), optional : true, emit: output_plots + path("**ID/*ID83*"), optional : true, emit: matrix_ID83 path("**ID/*") , optional : true, emit: matrices_ID path("**DBS/*") , optional : true, emit: matrices_DBS path("**SBS/*") , optional : true, emit: matrices_SBS diff --git a/nextflow.config b/nextflow.config index ffc7f647..51a5353a 100644 --- a/nextflow.config +++ b/nextflow.config @@ -115,6 +115,7 @@ params { cosmic_ref_signatures = "COSMIC_v3.4_SBS_GRCh38.txt" + indel_ref_signatures = "COSMIC_v3.4_ID_GRCh37.txt" // note that for IDs it has been defined in the GRCh37 genome version wgs_trinuc_counts = "assets/trinucleotide_counts/trinuc_counts.homo_sapiens.tsv" cadd_scores = "CADD/v1.7/hg38/whole_genome_SNVs.tsv.gz" cadd_scores_ind = "CADD/v1.7/hg38/whole_genome_SNVs.tsv.gz.tbi" diff --git a/nextflow_schema.json b/nextflow_schema.json index b100be58..3de7241c 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -729,6 +729,15 @@ "fa_icon": "far fa-file-code", "default": "COSMIC_v3.4_SBS_GRCh38.txt" }, + "indel_ref_signatures": { + "type": "string", + "format": "file-path", + "mimetype": "text/plain", + "description": "Path to file containing the reference indel (ID) signatures to use in SigProfilerAssignment.", + "help_text": "You can obtain it from COSMIC website. Note that for ID signatures the GRCh37 genome version is used.", + "fa_icon": "far fa-file-code", + "default": "COSMIC_v3.4_ID_GRCh37.txt" + }, "wgs_trinuc_counts": { "type": "string", "format": "file-path", diff --git a/workflows/deepcsa.nf b/workflows/deepcsa.nf index 32960cb9..8a70a0ed 100644 --- a/workflows/deepcsa.nf +++ b/workflows/deepcsa.nf @@ -112,6 +112,7 @@ include { DNA_2_PROTEIN_MAPPING as DNA2PROTEINMAPPING } from '../m include { MAF_2_VCF as MAF2VCF } from '../modules/local/maf2vcf/main' include { SIGPROFILER_MATRIXGENERATOR as SIGPROMATRIXGENERATOR } from '../modules/local/signatures/sigprofiler/matrixgenerator/main' +include { SIGPROFILERASSIGNMENT_COSMIC_FIT as SIGPROFILERASSIGNMENTINDELS } from '../modules/local/signatures/sigprofiler/assignment/cosmic_fit/main' include { MUTATIONS_2_SIGNATURES as MUTS2SIGS } from '../modules/local/mutations2sbs/main' @@ -121,7 +122,7 @@ include { MUTATIONS_2_SIGNATURES as MUTS2SIGS } from '../m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -workflow DEEPCSA{ +workflow DEEPCSA { // // Input channel definitions features_table = channel.fromPath( params.features_table ?: params.input, checkIfExists: true) @@ -132,6 +133,11 @@ workflow DEEPCSA{ cosmic_ref = params.cosmic_ref_signatures ? channel.fromPath( params.cosmic_ref_signatures, checkIfExists: true).first() : channel.empty() + cosmic_indel_ref = params.indel_ref_signatures + ? channel.fromPath( params.indel_ref_signatures, checkIfExists: true).first() + : channel.empty() + + datasets3d = params.datasets3d ? channel.fromPath( params.datasets3d, checkIfExists: true).first() : channel.empty() @@ -547,8 +553,16 @@ workflow DEEPCSA{ vcf_files = MAF2VCF.out.vcf_files.flatten().collect() SIGPROMATRIXGENERATOR( - vcf_files, - ) + vcf_files) + + // --> external arg + + SIGPROMATRIXGENERATOR.out.matrix_ID83 + .map{ it -> [ [id:"all_samples"], "indels", it] } + .set{ indels_matrix } + + SIGPROFILERASSIGNMENTINDELS(indels_matrix, cosmic_indel_ref) + } // Signature Analysis if (params.profileall){