From ddd9f02c36f7d2e2586fbb62538a6252d0a1022b Mon Sep 17 00:00:00 2001 From: efiguerola Date: Thu, 12 Mar 2026 17:37:56 +0100 Subject: [PATCH 1/4] added code to output ID signatures in matrix generator and assignment modules of sigprofiler --- conf/modules.config | 11 +++++++++++ .../sigprofiler/assignment/cosmic_fit/main.nf | 9 ++++++--- .../sigprofiler/matrixgenerator/main.nf | 1 + nextflow.config | 1 + workflows/deepcsa.nf | 15 +++++++++++++++ 5 files changed, 34 insertions(+), 3 deletions(-) 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/workflows/deepcsa.nf b/workflows/deepcsa.nf index 32960cb9..6e031365 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' @@ -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() @@ -550,6 +556,15 @@ workflow DEEPCSA{ 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){ SIGNATURESALL(MUTPROFILEALL.out.wgs_sigprofiler, cosmic_ref, TABLE2GROUP.out.json_samples) From 46b4a0ea643799b3a5a7b0b6309c7e8755033547 Mon Sep 17 00:00:00 2001 From: efiguerola Date: Thu, 12 Mar 2026 18:01:12 +0100 Subject: [PATCH 2/4] fixed typos --- workflows/deepcsa.nf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/workflows/deepcsa.nf b/workflows/deepcsa.nf index 6e031365..44a3316a 100644 --- a/workflows/deepcsa.nf +++ b/workflows/deepcsa.nf @@ -122,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) @@ -557,13 +557,12 @@ workflow DEEPCSA{ ) --> 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){ From 996629499393c3b363b36209a0cf7c638b0ab362 Mon Sep 17 00:00:00 2001 From: efiguerola Date: Fri, 13 Mar 2026 13:09:28 +0100 Subject: [PATCH 3/4] fixed typos --- workflows/deepcsa.nf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflows/deepcsa.nf b/workflows/deepcsa.nf index 44a3316a..8a70a0ed 100644 --- a/workflows/deepcsa.nf +++ b/workflows/deepcsa.nf @@ -553,14 +553,14 @@ workflow DEEPCSA { vcf_files = MAF2VCF.out.vcf_files.flatten().collect() SIGPROMATRIXGENERATOR( - vcf_files, - ) + vcf_files) - --> external arg + // --> external arg SIGPROMATRIXGENERATOR.out.matrix_ID83 .map{ it -> [ [id:"all_samples"], "indels", it] } .set{ indels_matrix } + SIGPROFILERASSIGNMENTINDELS(indels_matrix, cosmic_indel_ref) } From 6e06a4c28c850a55ab30f8002c45c69416136ed9 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:02:04 +0100 Subject: [PATCH 4/4] Add `indel_ref_signatures` to `nextflow_schema.json` (#430) * Initial plan * Add indel_ref_signatures to nextflow_schema.json reference_datasets section Co-authored-by: efigb <154223352+efigb@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: efigb <154223352+efigb@users.noreply.github.com> --- nextflow_schema.json | 9 +++++++++ 1 file changed, 9 insertions(+) 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",