Conversation
| "errorMessage": "Metadata associated with the sample (metadata_1).", | ||
| "default": "", | ||
| "pattern": "^[^\\n\\t\"]+$" | ||
| "pattern": "^[^\\n\\t\"]*$" |
There was a problem hiding this comment.
When the JSON sample sheet contained entries like "", then this failed, because the + says there needs to be one or more things, but when loaded from the JSON, there can be zero.
| assert results.text.contains("junk_3,j_3,0,0,0,0,,False,The date format does not match the expected format (YYYY-MM-DD); invalid host_age_unit (0)") | ||
| assert results.text.contains("junk_4,j_4,0000-00-00,0000-00-00,0000-00-00,0000-00-00,,False,The date format does not match the expected format (YYYY-MM-DD); host_age (0000-00-00) could not be converted to a number") | ||
| assert results.text.contains("junk_5,j_5,1.0,2.0,3.0,4.0,,False,The date format does not match the expected format (YYYY-MM-DD); invalid host_age_unit (4.0)") | ||
| assert results.text.contains("junk_5,j_5,1,2,3,4,,False,The date format does not match the expected format (YYYY-MM-DD); invalid host_age_unit (4)") |
There was a problem hiding this comment.
The original data was 4, it was getting parsed in as 4.0 and output as such.
| // Nextflow plugins | ||
| plugins { | ||
| id 'nf-validation@1.1.3' // Validation of pipeline parameters and creation of an input channel from a sample sheet | ||
| id 'nf-schema@2.4.2' |
There was a problem hiding this comment.
See offline discussion or ask offline if curious for why we need this version of nf-schema, rather than the newer version.
| "exists": true, | ||
| "mimetype": "text/csv", | ||
| "pattern": "^\\S+\\.csv$", | ||
| "pattern": "^\\S+\\.json$", |
There was a problem hiding this comment.
As described in the PR description, we cannot support CSV sample sheets because the part of nf-schema that loads the data types conflicts with the part that validates for strings that look like numbers.
|
| hook_url = null | ||
| help = false | ||
| version = false | ||
| trace_report_suffix = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss')// Config options |
There was a problem hiding this comment.
These config changes were causing linting failures. It looks like the way of doing things like declaring variables has changed in more recent versions of Nextflow, so this was needed to update it.
|
|
||
| // Input data | ||
| input = 'https://raw.githubusercontent.com/phac-nml/metadatatransformation/main/assets/samplesheet.csv' | ||
| input = 'https://raw.githubusercontent.com/phac-nml/metadatatransformation/nf-schema/assets/samplesheet.json' |
There was a problem hiding this comment.
Will need to change this to main later.
Converts from nf-validation to nf-schema and from CSV sample sheets to JSON sample sheets.
Description
As a pipeline developer, I would like the metadatatransformation pipeline to be updated to use the newer nf-schema Nextflow plugin, so that we are keeping up-to-date with Nextflow standards.
Acceptance Criteria
Remarks
I needed to entirely convert from using CSV sample sheets to JSON sample sheets. The problem with CSV sample sheets seems to be that the part of nf-schema that parses and loads the sample sheet, doesn't know what data type the input is supposed to be (integer, number/float, string, etc.), then when it gets to the validator, a mismatch in data types can cause it to fail.
For example:
schema_input.json
sample sheet
error
lenientModedid not work, and the recommendation I found was to switch to using JSON inputs, because JSON encodes some data types in the sample sheet itself. For example:The fact that it's
"1.1"and not1.1encodes that the value should be interpreted as a string. It therefore loads the data from the JSON sample sheet correctly and validates.However, this will mean that the pipelines will no longer support CSV sample sheet inputs, and will be incompatible with IRIDA Next until they make changes to support this. The recommendation I found to solve this problem with data types and validation was to switch from CSV to JSON.
I also observed problems with nf-schema loading string IDs as floats, but the float precision was handled poorly, and the string was mangled.
1.7->1.7000000000000002. Having the data load in this way as a string, rather than having metadata_N support multiple input types ("type": ["string"]), might be the way to go by default, unless we have a very good reason to have non-string types in a pipeline.PR checklist
nf-core lint).nextflow run . -profile test,docker --outdir <OUTDIR>).nextflow run . -profile debug,test,docker --outdir <OUTDIR>).docs/usage.mdis updated.docs/output.mdis updated.CHANGELOG.mdis updated.README.mdis updated (including new tool citations and authors/contributors).