Skip to content

Commit

Permalink
Merge pull request #312 from JoseEspinosa/updates
Browse files Browse the repository at this point in the history
Get rid of checkIfExists for params paths
  • Loading branch information
JoseEspinosa authored Jul 19, 2023
2 parents a2f7bc0 + c999339 commit 143f02c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 45 deletions.
13 changes: 1 addition & 12 deletions lib/WorkflowAtacseq.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ class WorkflowAtacseq {
//
// 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) {
log.error "No GTF or GFF3 annotation specified! The pipeline requires at least one of these files."
System.exit(1)
Expand All @@ -35,12 +30,6 @@ class WorkflowAtacseq {
log.error "Both '--read_length' and '--macs_gsize' not specified! Please specify either to infer MACS2 genome size for peak calling."
System.exit(1)
}
if (params.aligner) {
if (!valid_params['aligners'].contains(params.aligner)) {
log.error "Invalid option: '${params.aligner}'. Valid options for '--aligner': ${valid_params['aligners'].join(', ')}."
System.exit(1)
}
}
}

//
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'")
}
}

//
Expand Down
28 changes: 22 additions & 6 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"gtf": {
"type": "string",
"format": "file-path",
"exists": true,
"mimetype": "text/plain",
"pattern": "^\\S+\\.gtf(\\.gz)?$",
"description": "Path to GTF annotation file.",
Expand All @@ -100,6 +101,7 @@
"gff": {
"type": "string",
"format": "file-path",
"exists": true,
"mimetype": "text/plain",
"pattern": "^\\S+\\.gff(\\.gz)?$",
"fa_icon": "fas fa-code-branch",
Expand All @@ -108,30 +110,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 @@ -140,6 +148,7 @@
"tss_bed": {
"type": "string",
"format": "file-path",
"exists": true,
"mimetype": "text/plain",
"pattern": "^\\S+\\.bed(\\.gz)?$",
"fa_icon": "fas fa-procedures",
Expand All @@ -153,6 +162,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 [`blacklists`](../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 Down Expand Up @@ -196,7 +207,8 @@
"help_text": "By default takes the value of the mito_name parameter, if set. However, some plants and algae have chloroplast genomes in addition to a mitochondrial genome and thus mito_name can have values as multiple names that are separated by a | symbol that will break ataqv, in these cases this parameter can be used to overwrite these values.",
"fa_icon": "fas fa-signature"
}
}
},
"required": ["fasta"]
},
"adapter_trimming_options": {
"title": "Adapter trimming options",
Expand Down Expand Up @@ -299,13 +311,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 @@ -539,14 +555,12 @@
"type": "boolean",
"description": "Display help text.",
"fa_icon": "fas fa-question-circle",
"default": false,
"hidden": true
},
"version": {
"type": "boolean",
"description": "Display version and exit.",
"fa_icon": "fas fa-question-circle",
"default": false,
"hidden": true
},
"publish_dir_mode": {
Expand Down Expand Up @@ -577,7 +591,6 @@
"type": "boolean",
"description": "Send plain-text email instead of HTML.",
"fa_icon": "fas fa-remove-format",
"default": false,
"hidden": true
},
"max_multiqc_email_size": {
Expand All @@ -592,7 +605,6 @@
"type": "boolean",
"description": "Do not use coloured log outputs.",
"fa_icon": "fas fa-palette",
"default": false,
"hidden": true
},
"hook_url": {
Expand All @@ -605,6 +617,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
Expand All @@ -617,6 +631,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"
},
Expand All @@ -639,7 +656,6 @@
"type": "boolean",
"fa_icon": "far fa-check-circle",
"description": "Validation of parameters fails when an unrecognised parameter is found.",
"default": false,
"hidden": true,
"help_text": "By default, when an unrecognised parameter is found, it returns a warinig."
},
Expand Down
29 changes: 7 additions & 22 deletions workflows/atacseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,11 @@ 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
WorkflowAtacseq.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.tss_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) } }
WorkflowAtacseq.initialise(params, log)

// Check mandatory parameters
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }
ch_input = file(params.input)

// Check ataqv_mito_reference parameter
ataqv_mito_reference = params.ataqv_mito_reference
Expand All @@ -47,14 +32,14 @@ if (!params.ataqv_mito_reference && params.mito_name) {
*/

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_multiqc_merged_library_peak_count_header = file("$projectDir/assets/multiqc/merged_library_peak_count_header.txt", checkIfExists: true)
Expand Down

0 comments on commit 143f02c

Please sign in to comment.