Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code after nf-validation adoption #368

Merged
merged 6 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 1 addition & 13 deletions lib/WorkflowChipseq.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}
}

//
Expand Down
5 changes: 0 additions & 5 deletions lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 25 additions & 3 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
Expand All @@ -164,7 +174,8 @@
"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": {
"title": "Adapter trimming options",
Expand Down Expand Up @@ -254,13 +265,17 @@
},
"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.",
"fa_icon": "fas fa-cog"
},
"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.",
Expand Down Expand Up @@ -546,18 +561,25 @@
"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
},
"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
},
"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"
},
Expand All @@ -580,7 +602,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",
Expand Down
29 changes: 8 additions & 21 deletions workflows/chipseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

// Header files for MultiQC
ch_spp_nsc_header = file("$projectDir/assets/multiqc/spp_nsc_header.txt", checkIfExists: true)
Expand Down
Loading