If I've got different entry workflows, e.g. `<http...
# nf-schema
m
If I've got different entry workflows, e.g.
<http://main.nf|main.nf>
,
<http://clean_data.nf|clean_data.nf>
,
<http://quantify_data.nf|quantify_data.nf>
, can I give different
nextflow_schema.json
for them?
m
yes you can. You can even use different schema’s for different samplesheet types
just call a separate schema when you run
samplesheetToList
in each wf
m
I understand giving the samplesheet different schema's but what about the rest of the parameters? I've got one
nextflow.config
that lists all the parameters.
<http://main.nf|main.nf>
accepts all the parameters from the
nextflow_schema.json
, the other two only need to validate against a subset of parameters and might have different ones that are required.
m
🤔 do you really need to have different schema’s then?
for example
Copy code
"anyOf": [
            {
                "required": ["id", "samplename", "organism", "aligner", "fastq_1", "fastq_2"]
            },
            {
                "required": ["id", "samplename", "genome", "aligner", "fastq_1", "fastq_2"]
            },
            {
                "required": ["id", "samplesheet", "sample_info", "flowcell"]
            }
        ]
m
So how's validation done then? For example
clean_data
doesn't use
--reference
but it's required for
quantify_data
m
the example above is for “demutliplexing” style inputs and “fastq” style inputs, both of which have different required fields
m
but your example is validating the samplesheets right? Not the config parameters, or did I get that wrong?
m
facepalm
didn’t read the question thorough enough
indeed my examples is for samplesheets
but I don’t see why it wouldn’t work for params too?
m
I'm missing a key piece of information that let's me understand how I can do that.
I think you can get quite creative
m
How do I activate those conditionals from the entry workflow?
Each of those is a different anonymous workflow block that does the validation.
m
you validate the params in
<http://main.nf|main.nf>
and let schema handle the errors, based on the json spec
and don’t bother with input validation for the sub wf’s
or am I missing smt?
m
I think so. It's three workflows, each of which call subworkflows. main does clean + quant, clean does clean only, and quant does quant only.
m
ooooh
now I get it...
I guess it’s too much work to put everything behind a single entry workflow and use the 3 workflows as a named workflow in
<http://main.nf|main.nf>
with a feature switch?
m
<http://main.nf|main.nf>
will have a feature switch as well
I'll think on it a bit more, but the idea was to also make it a bit simpler so each stage can be validated individually.
I'm heading off for Easter break. Happy Easter
m
I think I get it. Perhaps Nicolas will have some more ideas, but he’s out on a PR tour.
Happy Easter to you too 😄
n
You could validate a data object using the
validate
function
m
Thanks. I just found that my workflows weren't calling
validateParameters
and, that that function takes a schema so I'll see what I can do with that. Ideally I only want one truth per workflow so I'll fix it with conditional logic somehow.
🙌 1