Skip to content

Support patternProperties for data/samplesheet validation #164

@aringeri

Description

@aringeri

Hi,

I would like to validate a csv file that has dynamic columns that are generated based on some sample identifier.

Example CSV file (input.csv):

fieldA, sample1, sample2, sample3,
rowA, 1, 2, 3,
rowB, 4, 5, 6

In JSON schema, I cannot use the regular items.properties to describe these columns because they can change between runs.
Instead I am using the items.patternProperties to validate fields based on regex match (csv_schema.json):

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "my title",
    "type": "array",
    "items": {
        "type": "object",
        "patternProperties": {
            "^sample": {
                "type": "integer"
            }
        },
        "properties" : {
            "fieldA" : {
                ...
            }
        }
    }
}

When using the samplesheetToList function I get warnings that these columns are unidentified:

WARN: Found the following unidentified headers in testfile.csv:
	- sample1
	- ...

I think that nf-core should either:

  • treat these fields in the patternProperties as defined
  • or add an option to disable the warning for unidentified headers

Also, I think this issue is somewhat related to: #126

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions