Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ class NfcoreSchema {
* whether the given paremeters adhere to the specificiations
*/
/* groovylint-disable-next-line UnusedPrivateMethodParameter */
private static ArrayList validateParameters(params, jsonSchema, log) {
private static void validateParameters(params, jsonSchema, log) {
def has_error = false
//=====================================================================//
// Check for nextflow core params and unexpected params
def json = new File(jsonSchema).text
def Map schemaParams = (Map) new JsonSlurper().parseText(json).get('definitions')
def specifiedParamKeys = params.keySet()
def nf_params = [
// Options for base `nextflow` command
'bg',
Expand Down Expand Up @@ -105,7 +104,7 @@ class NfcoreSchema {
}
}

for (specifiedParam in specifiedParamKeys) {
for (specifiedParam in params.keySet()) {
// nextflow params
if (nf_params.contains(specifiedParam)) {
log.error "ERROR: You used a core Nextflow option with two hyphens: '--${specifiedParam}'. Please resubmit with '-${specifiedParam}'"
Expand Down Expand Up @@ -144,26 +143,21 @@ class NfcoreSchema {
}

// Check for unexpected parameters
// Getting this message a lot for parameters that you *do* expect?
// You can make a csv list of expected params not in the schema with 'params.schema_ignore_params'
// for example, in your institutional config
if (unexpectedParams.size() > 0) {
Map colors = log_colours(params.monochrome_logs)
println ''
def warn_msg = 'Found unexpected parameters:'
for (unexpectedParam in unexpectedParams) {
warn_msg = warn_msg + "\n* --${unexpectedParam}: ${paramsJSON[unexpectedParam].toString()}"
warn_msg = warn_msg + "\n* --${unexpectedParam}: ${params[unexpectedParam].toString()}"
}
log.warn warn_msg
log.info "- ${colors.dim}(Hide this message with 'params.schema_ignore_params')${colors.reset} -"
log.info "- ${colors.dim}Ignore this warning: params.schema_ignore_params = \"${unexpectedParams.join(',')}\" ${colors.reset}"
println ''
}

if (has_error) {
System.exit(1)
}

return unexpectedParams
}

// Loop over nested exceptions and print the causingException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ if (params.help) {
////////////////////////////////////////////////////
/* -- VALIDATE PARAMETERS -- */
////////////////////////////////////////////////////+
def unexpectedParams = []
if (params.validate_params) {
unexpectedParams = NfcoreSchema.validateParameters(params, json_schema, log)
NfcoreSchema.validateParameters(params, json_schema, log)
}

////////////////////////////////////////////////////
Expand Down Expand Up @@ -365,10 +364,8 @@ workflow.onComplete {
}

workflow.onError {
// Print unexpected parameters
for (p in unexpectedParams) {
log.warn "Unexpected parameter: ${p}"
}
// Print unexpected parameters - easiest is to just rerun validation
NfcoreSchema.validateParameters(params, json_schema, log)
}

def checkHostname() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ params {
// TODO nf-core: Specify your pipeline's command line flags
genome = false
input = null
input_paths = null
single_end = false
outdir = './results'
publish_dir_mode = 'copy'
Expand All @@ -34,7 +35,7 @@ params {
config_profile_contact = false
config_profile_url = false
validate_params = true
schema_ignore_params = 'genomes'
schema_ignore_params = 'genomes,input_paths'

// Defaults only, expecting to be overwritten
max_memory = 128.GB
Expand All @@ -58,13 +59,13 @@ try {
}

profiles {
conda {
conda {
docker.enabled = false
singularity.enabled = false
podman.enabled = false
shifter.enabled = false
charliecloud = false
process.conda = "$projectDir/environment.yml"
process.conda = "$projectDir/environment.yml"
}
debug { process.beforeScript = 'echo $HOSTNAME' }
docker {
Expand Down Expand Up @@ -101,7 +102,7 @@ profiles {
shifter.enabled = true
charliecloud.enabled = false
}
charliecloud {
charliecloud {
singularity.enabled = false
docker.enabled = false
podman.enabled = false
Expand Down