From 9d157710921305181ee41adcd48aba98b25a11db Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Mon, 16 Oct 2023 22:01:26 +0200 Subject: [PATCH 1/6] Remove depecrated code due to nf-validation use --- lib/WorkflowChipseq.groovy | 14 +------------- lib/WorkflowMain.groovy | 5 ----- workflows/chipseq.nf | 29 ++++++++--------------------- 3 files changed, 9 insertions(+), 39 deletions(-) diff --git a/lib/WorkflowChipseq.groovy b/lib/WorkflowChipseq.groovy index 083f00ba..1dbd7ffc 100755 --- a/lib/WorkflowChipseq.groovy +++ b/lib/WorkflowChipseq.groovy @@ -10,14 +10,9 @@ class WorkflowChipseq { // // Check and validate parameters // - public static void initialise(params, log, valid_params) { + public static void initialise(params, log) { genomeExistsError(params, log) - - if (!params.fasta) { - Nextflow.error "Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file." - } - if (!params.gtf && !params.gff) { def error_string = "No GTF or GFF3 annotation specified! The pipeline requires at least one of these files." Nextflow.error(error_string) @@ -35,13 +30,6 @@ class WorkflowChipseq { def error_string = "Both '--read_length' and '--macs_gsize' not specified! Please specify either to infer MACS2 genome size for peak calling." Nextflow.error(error_string) } - - if (params.aligner) { - if (!valid_params['aligners'].contains(params.aligner)) { - def error_string = "Invalid option: '${params.aligner}'. Valid options for '--aligner': ${valid_params['aligners'].join(', ')}." - Nextflow.error(error_string) - } - } } // diff --git a/lib/WorkflowMain.groovy b/lib/WorkflowMain.groovy index 797926c1..8930ed6d 100755 --- a/lib/WorkflowMain.groovy +++ b/lib/WorkflowMain.groovy @@ -41,11 +41,6 @@ class WorkflowMain { // Check AWS batch settings NfcoreTemplate.awsBatch(workflow, params) - - // Check input has been provided - if (!params.input) { - Nextflow.error("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'") - } } // // Get attribute from genome config file e.g. fasta diff --git a/workflows/chipseq.nf b/workflows/chipseq.nf index db71bf0d..9c67d524 100644 --- a/workflows/chipseq.nf +++ b/workflows/chipseq.nf @@ -13,23 +13,10 @@ def summary_params = paramsSummaryMap(workflow) // Print parameter summary log to screen log.info logo + paramsSummaryLog(workflow) + citation -def valid_params = [ - aligners : [ 'bwa', 'bowtie2', 'chromap', 'star' ] -] - // Validate input parameters -WorkflowChipseq.initialise(params, log, valid_params) - -// Check input path parameters to see if they exist -def checkPathParamList = [ - params.input, params.multiqc_config, - params.fasta, - params.gtf, params.gff, params.gene_bed, - params.bwa_index, params.bowtie2_index, params.chromap_index, params.star_index, - params.blacklist, - params.bamtools_filter_pe_config, params.bamtools_filter_se_config -] -for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } } +WorkflowChipseq.initialise(params, log) + +ch_input = file(params.input) // Save AWS IGenomes file containing annotation version def anno_readme = params.genomes[ params.genome ]?.readme @@ -45,13 +32,13 @@ if (anno_readme && file(anno_readme).exists()) { */ ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true) -ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath( params.multiqc_config, checkIfExists: true ) : Channel.empty() -ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath( params.multiqc_logo, checkIfExists: true ) : Channel.empty() -ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true) +ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath( params.multiqc_config ): Channel.empty() +ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath( params.multiqc_logo ) : Channel.empty() +ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true) // JSON files required by BAMTools for alignment filtering -ch_bamtools_filter_se_config = file(params.bamtools_filter_se_config, checkIfExists: true) -ch_bamtools_filter_pe_config = file(params.bamtools_filter_pe_config, checkIfExists: true) +ch_bamtools_filter_se_config = file(params.bamtools_filter_se_config) +ch_bamtools_filter_pe_config = file(params.bamtools_filter_pe_config: true) // Header files for MultiQC ch_spp_nsc_header = file("$projectDir/assets/multiqc/spp_nsc_header.txt", checkIfExists: true) From b2cc15dd488edb6f3f18584227bd1e8cbec17613 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Mon, 16 Oct 2023 23:42:25 +0200 Subject: [PATCH 2/6] Add exists for file parameters in nextflow schema --- nextflow_schema.json | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/nextflow_schema.json b/nextflow_schema.json index 2bd97cd0..f0c63669 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -85,6 +85,7 @@ "gtf": { "type": "string", "format": "file-path", + "exists": true, "mimetype": "text/plain", "pattern": "^\\S+\\.gtf(\\.gz)?$", "description": "Path to GTF annotation file.", @@ -94,6 +95,7 @@ "gff": { "type": "string", "format": "file-path", + "exists": true, "mimetype": "text/plain", "pattern": "^\\S+\\.gff(\\.gz)?$", "fa_icon": "fas fa-code-branch", @@ -102,30 +104,36 @@ }, "bwa_index": { "type": "string", + "format": "path", + "exists": true, "description": "Path to directory or tar.gz archive for pre-built BWA index.", "fa_icon": "fas fa-bezier-curve" }, "bowtie2_index": { "type": "string", "format": "path", + "exists": true, "fa_icon": "fas fa-bezier-curve", "description": "Path to directory or tar.gz archive for pre-built Bowtie2 index." }, "chromap_index": { "type": "string", "format": "path", + "exists": true, "fa_icon": "fas fa-bezier-curve", "description": "Path to directory or tar.gz archive for pre-built Chromap index." }, "star_index": { "type": "string", "format": "path", + "exists": true, "fa_icon": "fas fa-bezier-curve", "description": "Path to directory or tar.gz archive for pre-built STAR index." }, "gene_bed": { "type": "string", "format": "file-path", + "exists": true, "mimetype": "text/plain", "pattern": "^\\S+\\.bed(\\.gz)?$", "fa_icon": "fas fa-procedures", @@ -139,6 +147,8 @@ }, "blacklist": { "type": "string", + "format": "path", + "exists": true, "description": "Path to blacklist regions in BED format, used for filtering alignments.", "help_text": "If provided, alignments that overlap with the regions in this file will be filtered out (see [ENCODE blacklists](https://sites.google.com/site/anshulkundaje/projects/blacklists)). The file should be in BED format. Blacklisted regions for *GRCh37*, *GRCh38*, *GRCm38*, *hg19*, *hg38*, *mm10* are bundled with the pipeline in the [`/assets/blacklists`](https://github.com/nf-core/chipseq/tree/master/assets/blacklists) directory, and as such will be automatically used if any of those genomes are specified with the `--genome` parameter.", "fa_icon": "fas fa-book-dead" @@ -163,7 +173,8 @@ "fa_icon": "fas fa-ban", "hidden": true, "help_text": "Do not load `igenomes.config` when running the pipeline. You may choose this option if you observe clashes between custom parameters and those supplied in `igenomes.config`." - } + }, + "required": ["fasta"] } }, "adapter_trimming_options": { @@ -254,6 +265,8 @@ }, "bamtools_filter_pe_config": { "type": "string", + "format": "path", + "exists": true, "default": "$projectDir/assets/bamtools_filter_pe.json", "hidden": true, "description": "BAMTools JSON file with custom filters for paired-end data.", @@ -261,6 +274,8 @@ }, "bamtools_filter_se_config": { "type": "string", + "format": "path", + "exists": true, "default": "$projectDir/assets/bamtools_filter_se.json", "hidden": true, "description": "BAMTools JSON file with custom filters for single-end data.", @@ -546,6 +561,8 @@ "multiqc_config": { "type": "string", "format": "file-path", + "exists": true, + "mimetype": "text/plain", "description": "Custom config file to supply to MultiQC.", "fa_icon": "fas fa-cog", "hidden": true @@ -558,6 +575,9 @@ }, "multiqc_methods_description": { "type": "string", + "format": "file-path", + "exists": true, + "mimetype": "text/plain", "description": "Custom MultiQC yaml file containing HTML including a methods description.", "fa_icon": "fas fa-cog" }, @@ -580,7 +600,7 @@ "fa_icon": "far fa-check-circle", "description": "Validation of parameters fails when an unrecognised parameter is found.", "hidden": true, - "help_text": "By default, when an unrecognised parameter is found, it returns a warinig." + "help_text": "By default, when an unrecognised parameter is found, it returns a warning." }, "validationLenientMode": { "type": "boolean", From 052523ba1703398c4c3a8eb85cb5549a9ae59d66 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Mon, 16 Oct 2023 23:44:51 +0200 Subject: [PATCH 3/6] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df6f466b..949a35c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix untar of `chromap` index when using `--chromap_index` param. - [nf-core/tools#2286](https://github.com/nf-core/tools/issues/2286) - Set default container registry outside profile scope. - [[#343](https://github.com/nf-core/chipseq/issues/343)] - Provide replicate information explicitly in samplesheet. -- Updated pipeline template to [nf-core/tools 2.10](https://github.com/nf-core/tools/releases/tag/2.10) +- Updated pipeline template to [nf-core/tools 2.10](https://github.com/nf-core/tools/releases/tag/2.10). +- [[#367](https://github.com/nf-core/chipseq/issues/367)] - Get rid of `CheckIfExists` for params paths. ### Software dependencies From f061fc8534df41f9e9c696aa66996166a2118692 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Mon, 16 Oct 2023 23:58:04 +0200 Subject: [PATCH 4/6] Fix schema --- nextflow_schema.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nextflow_schema.json b/nextflow_schema.json index f0c63669..32ff3fe8 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -10,7 +10,7 @@ "type": "object", "fa_icon": "fas fa-terminal", "description": "Define where the pipeline should find input data and save output data.", - "required": ["outdir"], + "required": ["input", "outdir"], "properties": { "input": { "type": "string", @@ -173,9 +173,9 @@ "fa_icon": "fas fa-ban", "hidden": true, "help_text": "Do not load `igenomes.config` when running the pipeline. You may choose this option if you observe clashes between custom parameters and those supplied in `igenomes.config`." - }, - "required": ["fasta"] - } + } + }, + "required": ["fasta"] }, "adapter_trimming_options": { "title": "Adapter trimming options", From 63fbe91431516e38d6d2870cece33876437aaef6 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Tue, 17 Oct 2023 00:00:03 +0200 Subject: [PATCH 5/6] Fix typo --- workflows/chipseq.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/chipseq.nf b/workflows/chipseq.nf index 9c67d524..7fce24c5 100644 --- a/workflows/chipseq.nf +++ b/workflows/chipseq.nf @@ -38,7 +38,7 @@ ch_multiqc_custom_methods_description = params.multiqc_methods_description ? fil // JSON files required by BAMTools for alignment filtering ch_bamtools_filter_se_config = file(params.bamtools_filter_se_config) -ch_bamtools_filter_pe_config = file(params.bamtools_filter_pe_config: true) +ch_bamtools_filter_pe_config = file(params.bamtools_filter_pe_config) // Header files for MultiQC ch_spp_nsc_header = file("$projectDir/assets/multiqc/spp_nsc_header.txt", checkIfExists: true) From 60ecfe4fe3ea5f0ee9e133a3e8e78b878fc78c22 Mon Sep 17 00:00:00 2001 From: JoseEspinosa Date: Tue, 17 Oct 2023 10:39:39 +0200 Subject: [PATCH 6/6] Add missing exists in schema --- nextflow_schema.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nextflow_schema.json b/nextflow_schema.json index 32ff3fe8..1cc86686 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -569,6 +569,8 @@ }, "multiqc_logo": { "type": "string", + "format": "file-path", + "exists": true, "description": "Custom logo file to supply to MultiQC. File name must also be set in the MultiQC config file", "fa_icon": "fas fa-image", "hidden": true