From fd28fe456b1b888fe28068b2b7bbac05113e3331 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Wed, 24 Jul 2024 23:42:07 +0200 Subject: [PATCH 1/7] Read params before including anything --- main.nf | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main.nf b/main.nf index 32dd637c..63146cd4 100755 --- a/main.nf +++ b/main.nf @@ -11,18 +11,6 @@ nextflow.enable.dsl = 2 -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -include { CHIPSEQ } from './workflows/chipseq' -include { PREPARE_GENOME } from './subworkflows/local/prepare_genome' -include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_chipseq_pipeline' -include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_chipseq_pipeline' -include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_chipseq_pipeline' -include { getMacsGsize } from './subworkflows/local/utils_nfcore_chipseq_pipeline' - /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GENOME PARAMETER VALUES @@ -40,6 +28,18 @@ params.gene_bed = getGenomeAttribute('gene_bed') params.blacklist = getGenomeAttribute('blacklist') params.macs_gsize = getMacsGsize(params) +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ +include { CHIPSEQ } from './workflows/chipseq' +include { PREPARE_GENOME } from './subworkflows/local/prepare_genome' +include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_chipseq_pipeline' +include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_chipseq_pipeline' +include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_chipseq_pipeline' +include { getMacsGsize } from './subworkflows/local/utils_nfcore_chipseq_pipeline' + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NAMED WORKFLOWS FOR PIPELINE From b1f7d313b7c638e71aacfc9122673058ee9d9730 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Wed, 24 Jul 2024 23:48:45 +0200 Subject: [PATCH 2/7] Move getGenomeAttribute function to main --- main.nf | 19 +++++++++++++++++++ .../utils_nfcore_chipseq_pipeline/main.nf | 16 ++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/main.nf b/main.nf index 63146cd4..cdf4f045 100755 --- a/main.nf +++ b/main.nf @@ -137,6 +137,25 @@ workflow { ) } +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + FUNCTIONS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +// +// Get attribute from genome config file e.g. fasta +// + +def getGenomeAttribute(attribute) { + if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { + if (params.genomes[ params.genome ].containsKey(attribute)) { + return params.genomes[ params.genome ][ attribute ] + } + } + return null +} + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ THE END diff --git a/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf b/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf index 37070807..c9f8bb3d 100644 --- a/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf @@ -152,14 +152,14 @@ def validateInputParameters() { // // Get attribute from genome config file e.g. fasta // -def getGenomeAttribute(attribute) { - if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { - if (params.genomes[ params.genome ].containsKey(attribute)) { - return params.genomes[ params.genome ][ attribute ] - } - } - return null -} +// def getGenomeAttribute(attribute) { +// if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { +// if (params.genomes[ params.genome ].containsKey(attribute)) { +// return params.genomes[ params.genome ][ attribute ] +// } +// } +// return null +// } // // Exit pipeline if incorrect --genome key provided From a20c464dae7648e49e2e12cc329955e8f6dc4c1e Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Wed, 24 Jul 2024 23:59:04 +0200 Subject: [PATCH 3/7] Also move getMacsGsize declaration --- main.nf | 16 +++++++++++++- .../utils_nfcore_chipseq_pipeline/main.nf | 22 +++++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/main.nf b/main.nf index cdf4f045..0079ec55 100755 --- a/main.nf +++ b/main.nf @@ -146,7 +146,6 @@ workflow { // // Get attribute from genome config file e.g. fasta // - def getGenomeAttribute(attribute) { if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { if (params.genomes[ params.genome ].containsKey(attribute)) { @@ -156,6 +155,21 @@ def getGenomeAttribute(attribute) { return null } +// +// Get macs genome size (macs_gsize) +// +def getMacsGsize(params) { + def val = null + if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { + if (params.genomes[ params.genome ].containsKey('macs_gsize')) { + if (params.genomes[ params.genome ][ 'macs_gsize' ].containsKey(params.read_length.toString())) { + val = params.genomes[ params.genome ][ 'macs_gsize' ][ params.read_length.toString() ] + } + } + } + return val +} + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ THE END diff --git a/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf b/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf index c9f8bb3d..dcdaba6c 100644 --- a/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf @@ -178,17 +178,17 @@ def genomeExistsError() { // // Get macs genome size (macs_gsize) // -def getMacsGsize(params) { - def val = null - if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { - if (params.genomes[ params.genome ].containsKey('macs_gsize')) { - if (params.genomes[ params.genome ][ 'macs_gsize' ].containsKey(params.read_length.toString())) { - val = params.genomes[ params.genome ][ 'macs_gsize' ][ params.read_length.toString() ] - } - } - } - return val -} +// def getMacsGsize(params) { +// def val = null +// if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { +// if (params.genomes[ params.genome ].containsKey('macs_gsize')) { +// if (params.genomes[ params.genome ][ 'macs_gsize' ].containsKey(params.read_length.toString())) { +// val = params.genomes[ params.genome ][ 'macs_gsize' ][ params.read_length.toString() ] +// } +// } +// } +// return val +// } // // Generate methods description for MultiQC From 50caeb9945ef4c41334961dbe1ff981848b0cfbc Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Thu, 25 Jul 2024 00:02:35 +0200 Subject: [PATCH 4/7] Remove includes --- main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.nf b/main.nf index 0079ec55..af328320 100755 --- a/main.nf +++ b/main.nf @@ -37,8 +37,8 @@ include { CHIPSEQ } from './workflows/chipseq' include { PREPARE_GENOME } from './subworkflows/local/prepare_genome' include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_chipseq_pipeline' include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_chipseq_pipeline' -include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_chipseq_pipeline' -include { getMacsGsize } from './subworkflows/local/utils_nfcore_chipseq_pipeline' +// include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_chipseq_pipeline' +// include { getMacsGsize } from './subworkflows/local/utils_nfcore_chipseq_pipeline' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From cd28cd0c92c32da5541e324eab8df8229f1a2e97 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Thu, 25 Jul 2024 10:10:54 +0200 Subject: [PATCH 5/7] Fix output of bwa index when provided as not compressed input --- subworkflows/local/prepare_genome.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/prepare_genome.nf b/subworkflows/local/prepare_genome.nf index b7878aaf..64350b6a 100644 --- a/subworkflows/local/prepare_genome.nf +++ b/subworkflows/local/prepare_genome.nf @@ -146,7 +146,7 @@ workflow PREPARE_GENOME { ch_bwa_index = UNTAR_BWA_INDEX ( [ [:], bwa_index ] ).untar ch_versions = ch_versions.mix(UNTAR_BWA_INDEX.out.versions) } else { - ch_bwa_index = file(bwa_index) + ch_bwa_index = [ [:], file(bwa_index) ] } } else { ch_bwa_index = BWA_INDEX ( ch_fasta.map { [ [:], it ] } ).index From 588a28af88107d4e74e41384a9c0e340dac8fde6 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Wed, 31 Jul 2024 10:00:40 +0200 Subject: [PATCH 6/7] Make lint happy --- subworkflows/local/prepare_genome.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/prepare_genome.nf b/subworkflows/local/prepare_genome.nf index 64350b6a..0d91f377 100644 --- a/subworkflows/local/prepare_genome.nf +++ b/subworkflows/local/prepare_genome.nf @@ -146,7 +146,7 @@ workflow PREPARE_GENOME { ch_bwa_index = UNTAR_BWA_INDEX ( [ [:], bwa_index ] ).untar ch_versions = ch_versions.mix(UNTAR_BWA_INDEX.out.versions) } else { - ch_bwa_index = [ [:], file(bwa_index) ] + ch_bwa_index = [ [:], file(bwa_index) ] } } else { ch_bwa_index = BWA_INDEX ( ch_fasta.map { [ [:], it ] } ).index From 49c405c71356110f32cb33ce9aacc9fa2fd61295 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Wed, 31 Jul 2024 10:59:17 +0200 Subject: [PATCH 7/7] Get rid of the functions in pipeline utils --- .../utils_nfcore_chipseq_pipeline/main.nf | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf b/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf index dcdaba6c..4ba55198 100644 --- a/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf @@ -149,18 +149,6 @@ def validateInputParameters() { } } -// -// Get attribute from genome config file e.g. fasta -// -// def getGenomeAttribute(attribute) { -// if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { -// if (params.genomes[ params.genome ].containsKey(attribute)) { -// return params.genomes[ params.genome ][ attribute ] -// } -// } -// return null -// } - // // Exit pipeline if incorrect --genome key provided // @@ -175,21 +163,6 @@ def genomeExistsError() { } } -// -// Get macs genome size (macs_gsize) -// -// def getMacsGsize(params) { -// def val = null -// if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { -// if (params.genomes[ params.genome ].containsKey('macs_gsize')) { -// if (params.genomes[ params.genome ][ 'macs_gsize' ].containsKey(params.read_length.toString())) { -// val = params.genomes[ params.genome ][ 'macs_gsize' ][ params.read_length.toString() ] -// } -// } -// } -// return val -// } - // // Generate methods description for MultiQC //