Skip to content

Commit

Permalink
add option to ignore cli params
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyliu1326 committed Apr 19, 2024
1 parent 364c95d commit 3706973
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/NfcoreSchema.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ class NfcoreSchema {
has_error = true
}
// unexpected params
//def params_ignore = params.schema_ignore_params.split(',') + 'schema_ignore_params'
def params_ignore = params.schema_ignore_params.split(',') + 'schema_ignore_params'
def expectedParamsLowerCase = expectedParams.collect{ it.replace("-", "").toLowerCase() }
def specifiedParamLowerCase = specifiedParam.replace("-", "").toLowerCase()
def isCamelCaseBug = (specifiedParam.contains("-") && !expectedParams.contains(specifiedParam) && expectedParamsLowerCase.contains(specifiedParamLowerCase))
//if (!expectedParams.contains(specifiedParam) && !params_ignore.contains(specifiedParam) && !isCamelCaseBug) {
if (!expectedParams.contains(specifiedParam) && !isCamelCaseBug) {
if (!expectedParams.contains(specifiedParam) && !params_ignore.contains(specifiedParam) && !isCamelCaseBug) {
// if (!expectedParams.contains(specifiedParam) && !isCamelCaseBug) {
// Temporarily remove camelCase/camel-case params #1035
def unexpectedParamsLowerCase = unexpectedParams.collect{ it.replace("-", "").toLowerCase()}
if (!unexpectedParamsLowerCase.contains(specifiedParamLowerCase)){
Expand All @@ -142,7 +142,7 @@ class NfcoreSchema {
JSONObject raw_schema = new JSONObject(new JSONTokener(input_stream))

// Remove anything that's in params.schema_ignore_params
// raw_schema = removeIgnoredParams(raw_schema, params)
raw_schema = removeIgnoredParams(raw_schema, params)

Schema schema = SchemaLoader.load(raw_schema)

Expand Down
2 changes: 1 addition & 1 deletion lib/NfcoreTemplate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class NfcoreTemplate {
${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset}
${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset}
${colors.green}`._,._,\'${colors.reset}
${colors.purple} ${workflow.manifest.name} v${workflow.manifest.version}${colors.reset}
${colors.purple} ${workflow.manifest.name} ${workflow.manifest.version}${colors.reset}
${dashedLine(monochrome_logs)}
""".stripIndent()
)
Expand Down
2 changes: 1 addition & 1 deletion lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class WorkflowMain {

// Print pipeline version if --version is invoked
if (params.version) {
log.info "${workflow.manifest.name} v${workflow.manifest.version}"
log.info "${workflow.manifest.name} ${workflow.manifest.version}"
System.exit(0)
}

Expand Down
3 changes: 3 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ params {

// msa options
run_msa = false

// ignore params
schema_ignore_params = 'client_fields'
}

process {
Expand Down
9 changes: 7 additions & 2 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"fa_icon": "fas fa-terminal",
"description": "Define where the pipeline should find input data and save output data.",
"required": [
"input",
"reference",
"primers",
"input"
"primers"
],
"properties": {
"input": {
Expand Down Expand Up @@ -164,6 +164,11 @@
"type": "string",
"description": "Slurm account name (required for -profile slurm)"
},
"schema_ignore_params": {
"type": "string",
"default": "client_fields",
"description": "Parameters to ignore during schema validation. Multiple values can be supplied using comma as the delimiter"
},
"help": {
"type": "boolean",
"description": "Display help text.",
Expand Down

0 comments on commit 3706973

Please sign in to comment.