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

test out validation plugin #1059

Merged
merged 38 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2af34ea
test out validation plugin
FriederikeHanssen Jun 2, 2023
b8e69b3
update nf-validation version
mirpedrol Jun 9, 2023
3db8941
validate params and print help in main.nf
mirpedrol Jun 9, 2023
ddbe1dd
remove unused code from WorkflowMain
mirpedrol Jun 9, 2023
18c77b0
remove NfcoreSchema.groovy
mirpedrol Jun 9, 2023
ce46bb3
update nf-validation params names
mirpedrol Jun 9, 2023
d579c0b
back to creating input channel with extract_csv
mirpedrol Jun 9, 2023
26ecf2a
Merge branch 'dev' of https://github.com/nf-core/sarek into nf_valida…
mirpedrol Jun 21, 2023
1e5811a
start implementing fromSamplesheet (not working yet)
mirpedrol Jun 21, 2023
e31337e
counting number of samples working
mirpedrol Jun 21, 2023
2141736
push current changes to ask for doubts
mirpedrol Jun 21, 2023
d1471b3
modify channel from samplesheet to mimic input_sample channel
mirpedrol Jun 23, 2023
8c187a4
delete extract_csv
mirpedrol Jun 23, 2023
23f7a1e
lane is required when fastq_1
mirpedrol Jul 5, 2023
3c9534d
Merge branch 'dev' of https://github.com/nf-core/sarek into nf_valida…
mirpedrol Jul 5, 2023
8b2028a
update error messages in sample and patient
mirpedrol Jul 5, 2023
544abcc
fix map.lane variable doesn't exist
mirpedrol Jul 5, 2023
d463684
Update default command
mirpedrol Jul 7, 2023
1f291c7
add --outdir to default command
mirpedrol Jul 7, 2023
4c9c5a1
Merge branch 'dev' of https://github.com/nf-core/sarek into nf_valida…
mirpedrol Jul 7, 2023
a9a5050
input can be a file or a boolean
mirpedrol Jul 7, 2023
2e108a7
add the input schema to nextflow_schema.json
mirpedrol Jul 7, 2023
f72c0fa
add new hidden param input_restart
mirpedrol Jul 7, 2023
793c92a
don't return the input path with retrieveInput() to avoid performing …
mirpedrol Jul 7, 2023
76d5c41
Apply suggestions from code review
mirpedrol Jul 11, 2023
a3b753e
change sample name to sample ID
mirpedrol Jul 11, 2023
852c3e5
Merge branch 'dev' of https://github.com/nf-core/sarek into nf_valida…
mirpedrol Jul 11, 2023
95afdba
fix retrieveInput and remove duplicated plugin declaration
mirpedrol Jul 11, 2023
91afc06
add --input='' to tests
mirpedrol Jul 11, 2023
2c86b0e
don't obtain input_restart if build_only_index is true
mirpedrol Jul 11, 2023
4a17a14
--input can be false and it is validated
mirpedrol Jul 12, 2023
acfaacb
run prettier
mirpedrol Jul 12, 2023
c18ea12
don't do extra checks in samplesheet if params.build_only_index is true
mirpedrol Jul 12, 2023
6e3bb60
Apply suggestions from code review
mirpedrol Jul 13, 2023
adb2e71
Update workflows/sarek.nf
FriederikeHanssen Aug 2, 2023
3aa0835
Update nextflow_schema.json
FriederikeHanssen Aug 2, 2023
043e260
add julia to contributors and update changelog
FriederikeHanssen Aug 2, 2023
7ac16f8
Merge branch 'dev' into nf_validation
FriederikeHanssen Aug 2, 2023
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
76 changes: 44 additions & 32 deletions assets/schema_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
"patient": {
"type": "string",
"pattern": "^\\S+$",
"errorMessage": "ID name must be provided and cannot contain spaces"
"errorMessage": "Patient name must be provided and cannot contain spaces",
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
"meta": ["patient"]
},
"sample": {
"type": "string",
"pattern": "^\\S+$",
"errorMessage": "Sample name must be provided and cannot contain spaces"
"errorMessage": "Sample name must be provided and cannot contain spaces",
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
"meta": ["sample"]
},
"sex": {
"errorMessage": "Sex cannot contain spaces",
"meta": ["sex"],
"default": "NA",
"anyOf": [
{
"type": "string",
Expand All @@ -31,30 +35,19 @@
]
},
"status": {
"errorMessage": "Status can only be 0 or 1",
"anyOf": [
{
"type": "string",
"pattern": "^(0|1)*$"
},
{
"type": "string",
"maxLength": 0
}
]
"type": "integer",
"errorMessage": "Status can only be 0 or 1. Defaults to 0, if none is supplied.",
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
"meta": ["status"],
"default": 0,
"minimum": 0,
"maximum": 1
},
"lane": {
"errorMessage": "Lane cannot contain spaces",
"anyOf": [
{
"type": "string",
"pattern": "^\\S+$"
},
{
"type": "string",
"maxLength": 0
}
]
"type": "string",
"pattern": "^\\S+$",
"unique": ["patient", "sample"],
"dependentRequired": ["fastq_1"],
"meta": ["lane"]
},
"fastq_1": {
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
"errorMessage": "FastQ file for reads 1 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'",
Expand All @@ -67,7 +60,9 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"fastq_2": {
"errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'",
Expand All @@ -80,7 +75,9 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"table": {
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
"errorMessage": "Recalibration table cannot contain spaces and must have extension '.table'",
Expand All @@ -93,7 +90,9 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"cram": {
"errorMessage": "CRAM file cannot contain spaces and must have extension '.cram'",
Expand All @@ -106,7 +105,9 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"crai": {
"errorMessage": "CRAM index file cannot contain spaces and must have extension '.crai'",
Expand All @@ -119,7 +120,9 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"bam": {
"errorMessage": "BAM file cannot contain spaces and must have extension '.bam'",
Expand All @@ -132,7 +135,9 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"bai": {
"errorMessage": "BAM index file cannot contain spaces and must have extension '.bai'",
Expand All @@ -145,7 +150,9 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"vcf": {
"errorMessage": "VCF file for reads 1 cannot contain spaces and must have extension '.vcf' or '.vcf.gz'",
Expand All @@ -158,7 +165,12 @@
"type": "string",
"maxLength": 0
}
]
],
"format": "file-path",
"exists": true
},
"variantcaller": {
"type": "string"
}
},
"required": ["patient", "sample"]
Expand Down
10 changes: 9 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ params.vep_genome = WorkflowMain.getGenomeAttribute(params, 'vep_geno
params.vep_species = WorkflowMain.getGenomeAttribute(params, 'vep_species')
params.vep_version = WorkflowMain.getGenomeAttribute(params, 'vep_version')

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ALTERNATIVE INPUT FILE ON RESTART
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

params.input_restart = WorkflowSarek.retrieveInput(params, log)
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VALIDATE & PRINT PARAMETER SUMMARY
Expand All @@ -74,7 +82,7 @@ include { validateParameters; paramsHelp } from 'plugin/nf-validation'
if (params.help) {
def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs)
def citation = '\n' + WorkflowMain.citation(workflow) + '\n'
def String command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GRCh37 -profile docker"
def String command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GATK.GRCh38 -profile docker --outdir results"
log.info logo + paramsHelp(command) + citation + NfcoreTemplate.dashedLine(params.monochrome_logs)
System.exit(0)
}
Expand Down
4 changes: 4 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,7 @@ def check_max(obj, type) {
}
}
}

plugins {
id '[email protected]'
}
26 changes: 21 additions & 5 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,32 @@
"required": ["step", "outdir"],
"properties": {
"input": {
"description": "Path to comma-separated file containing information about the samples in the experiment.",
"help_text": "A design file with information about the samples in your experiment. Use this parameter to specify the location of the input files. It has to be a comma-separated file with a header row. See [usage docs](https://nf-co.re/sarek/usage#input).\n\nIf no input file is specified, sarek will attempt to locate one in the `{outdir}` directory.",
FriederikeHanssen marked this conversation as resolved.
Show resolved Hide resolved
"fa_icon": "fas fa-file-csv",
"schema": "assets/schema_input.json",
"anyOf": [
{
"type": "string",
"format": "file-path",
"exists": true,
"mimetype": "text/csv",
"pattern": "^\\S+\\.csv$"
},
{
"type": "string",
"maxLength": 0
}
]
},
"input_restart": {
"type": "string",
"format": "file-path",
"exists": true,
"mimetype": "text/csv",
"pattern": "^\\S+\\.csv$",
"description": "Path to comma-separated file containing information about the samples in the experiment.",
"help_text": "A design file with information about the samples in your experiment. Use this parameter to specify the location of the input files. It has to be a comma-separated file with a header row. See [usage docs](https://nf-co.re/sarek/usage#input).\n\nIf no input file is specified, sarek will attempt to locate one in the `{outdir}` directory.",
"fa_icon": "fas fa-file-csv"
"hidden": true,
"schema": "assets/schema_input.json"
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
},
"step": {
"type": "string",
Expand Down Expand Up @@ -987,15 +1005,13 @@
"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."
},
"validationLenientMode": {
"type": "boolean",
"fa_icon": "far fa-check-circle",
"description": "Validation of parameters in lenient more.",
"default": false,
"hidden": true,
"help_text": "Allows string values that are parseable as numbers or booleans. For further information see [JSONSchema docs](https://github.com/everit-org/json-schema#lenient-mode)."
},
Expand Down
4 changes: 2 additions & 2 deletions tests/test_samplesheet_validation_spaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
- sample_with_space
- validation_checks
exit_code: 1
stdout:
stderr:
contains:
- "Invalid value in csv file. Values for 'patient' and 'sample' can not contain space"
- "Sample name must be provided and cannot contain spaces"
Loading