Niklas Schandry
10/01/2026, 8:47 AMchannel.fromList(samplesheetToList(params.input, "assets/schema_input.json"))
/*
This is a somewhat crucial step, where the samplesheet and params are used to determine per-sample parameters.
This has been greatly simplified thanks to @nvnieuwk
*/
.map { it ->
def meta = it[0]
// Populate everything that has no value with the value from params
return meta.collectEntries { key, val -> key == "group" ? [ key, val ] : [ key, val ?: params.get(key) ] }
}
1. However, I also set defaults in schema_inputs . As I understand, this probably breaks what I want to do, and I should rather remove the defaults from the schema, to ensure that this actually falls back to params? To do this: should I remove defaults? Will I still receive an entry if there is no default and it was not in the samplesheet? Should I set defaults to null ?
2. Something about this that has been bothering me for a while is: I assume that if a user were to set a param.something = true and in the samplesheet would provide something as false, this would actually override the per-sample value false with the param value true, because val ?: params.get(key) would get it from params, since the condition is false. Is there some established pattern to handle this?Niklas Schandry
10/01/2026, 9:06 AMschema_input to a dummy value, e.g. "default_dummy" and perform checks based on that?
return meta.collectEntries { key, val -> key == "group" ? [ key, val ] : [ key, val == "default_dummy" ? params.get(key) : val ]Niklas Schandry
10/01/2026, 9:16 AMdefault: "${param.paramname}" ? Is that correct @Nicolas Vannieuwkerke?Nicolas Vannieuwkerke
10/01/2026, 11:01 AM[] if they are missing, you could also set the default to null if you'd prefer that for your logicNiklas Schandry
10/01/2026, 12:48 PMsamplesheetToList(params.input, "assets/schema_input.json") with a value of [], if it is listed in the schema, but not part of the actual samplesheet?Nicolas Vannieuwkerke
10/01/2026, 12:53 PMNicolas Vannieuwkerke
10/01/2026, 12:53 PM