From 15288f910ef3891d9afea29198e1da5a424dd836 Mon Sep 17 00:00:00 2001 From: rhassaine Date: Tue, 28 Jan 2025 16:52:20 +0000 Subject: [PATCH] Included @scwatts's suggestions for using existing functions to extract cancer_type information from info column in samplesheet --- lib/Utils.groovy | 15 +++++---------- modules/local/orange/main.nf | 5 +---- subworkflows/local/orange_reporting/main.nf | 3 ++- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/Utils.groovy b/lib/Utils.groovy index f3b9d655..4935598a 100644 --- a/lib/Utils.groovy +++ b/lib/Utils.groovy @@ -92,11 +92,12 @@ class Utils { info_data[info_field_enum] = v } - } + // Added cancer type to metamap + if (info_data.containsKey(Constants.InfoField.CANCER_TYPE)) { + meta[Constants.InfoField.CANCER_TYPE] = info_data[Constants.InfoField.CANCER_TYPE] + log.info "Added cancer type to meta: ${meta[Constants.InfoField.CANCER_TYPE]}" + } - // Process - if (info_data.containsKey(Constants.InfoField.CANCER_TYPE)) { - meta[Constants.InfoField.CANCER_TYPE] = info_data[Constants.InfoField.CANCER_TYPE] } // Handle inputs appropriately @@ -405,12 +406,6 @@ class Utils { return meta.getOrDefault([Constants.SampleType.NORMAL, Constants.SequenceType.DNA], [:]) } - // New method to return the doid of the cancer_type provided by user - static public getCancerType(meta) { - return meta.getOrDefault(Constants.InfoField.CANCER_TYPE, null) - } - - // Sample names static public getTumorDnaSampleName(meta) { return getTumorDnaSample(meta)['sample_id'] diff --git a/modules/local/orange/main.nf b/modules/local/orange/main.nf index 5eefd464..f580b3e6 100644 --- a/modules/local/orange/main.nf +++ b/modules/local/orange/main.nf @@ -51,10 +51,7 @@ process ORANGE { def isofox_gene_distribution_arg = isofox_gene_distribution ? "-isofox_gene_distribution ${isofox_gene_distribution}" : '' def isofox_alt_sj_arg = isofox_alt_sj ? "-isofox_alt_sj_cohort ${isofox_alt_sj}" : '' - // def doid_arg = meta.cancer_type ? "-primary_tumor_doids \"${meta.cancer_type}\"" : "-primary_tumor_doids 162" - // log.info "${meta}" - def doid_arg = meta.containsKey("cancer_type") ? meta.cancer_type : "162" - // log.info "Primary tumor DOID: ${doid_arg}" + def doid_arg = meta.cancer_type ?: "162" """ echo "${pipeline_version_str}" > pipeline_version.txt diff --git a/subworkflows/local/orange_reporting/main.nf b/subworkflows/local/orange_reporting/main.nf index 4443f1d0..55834ace 100644 --- a/subworkflows/local/orange_reporting/main.nf +++ b/subworkflows/local/orange_reporting/main.nf @@ -179,7 +179,8 @@ workflow ORANGE_REPORTING { key: meta.group_id, id: meta.group_id, tumor_id: Utils.getTumorDnaSampleName(meta), - cancer_type: Utils.getCancerType(meta), + // cancer_type: Utils.getCancerType(meta), + cancer_type: meta[Constants.InfoField.CANCER_TYPE], ] def inputs_selected = inputs.clone()