Niklas Schandry
07/02/2026, 9:19 AMmashehu
07/02/2026, 9:20 AMNiklas Schandry
07/02/2026, 9:25 AM.splitCsvNiklas Schandry
07/02/2026, 9:26 AMmashehu
07/02/2026, 9:26 AMNicolas Vannieuwkerke
07/02/2026, 9:30 AMNiklas Schandry
07/02/2026, 9:48 AMNicolas Vannieuwkerke
07/02/2026, 10:43 AMsamplesheetToList function that validates and converts a samplesheet to a listNicolas Vannieuwkerke
07/02/2026, 10:43 AMNiklas Schandry
07/02/2026, 10:50 AMsamplesheetToMap ?Nicolas Vannieuwkerke
07/02/2026, 10:51 AMNiklas Schandry
07/02/2026, 10:52 AMIt is the order of fields in the sample sheet JSON schema which defines the order of items in the channel returned by, not the order of fields in the sample sheet file.samplesheetToList()
Niklas Schandry
07/02/2026, 10:53 AMNicolas Vannieuwkerke
07/02/2026, 10:53 AMNiklas Schandry
07/02/2026, 10:54 AMNiklas Schandry
07/02/2026, 10:54 AMNicolas Vannieuwkerke
07/02/2026, 10:54 AMsamplesheetToRecords function to support record types in the future so that might be useful for you thenNicolas Vannieuwkerke
07/02/2026, 10:55 AMNiklas Schandry
07/02/2026, 10:55 AMNicolas Vannieuwkerke
07/02/2026, 10:56 AMNiklas Schandry
07/02/2026, 10:57 AMnextflow_schema.json as a basis, and add the meta fields?Nicolas Vannieuwkerke
07/02/2026, 10:57 AMNiklas Schandry
07/02/2026, 11:20 AM"shortread_F": {
"type": "string",
"description": "Path to forward short reads",
"meta": ["shortread_F"]
}
and then later try:
file(meta.shortread_F)
I get:
Unknown method invocation `getFileSystem` on ArrayList type
Is there an easy way to solve that?Niklas Schandry
07/02/2026, 11:23 AMmeta.shortread_F[0] seems to workNicolas Vannieuwkerke
07/02/2026, 11:24 AM"format": "file-path". This error usually means that the file has not been given via the samplesheet and that it defaults to [] which is the default value if something is missing.
It would also help if you could show me the output of the functionNiklas Schandry
07/02/2026, 11:24 AMNiklas Schandry
07/02/2026, 11:24 AM[] probablyNicolas Vannieuwkerke
07/02/2026, 11:24 AM"default": <default-value>Niklas Schandry
07/02/2026, 11:27 AMIt would also help if you could show me the output of the functionYou mean the function that fails?
if (!file(row.shortread_F).exists()) {
exit(1, "ERROR: shortread_F fastq file does not exist!\n${row.shortread_F}")
}Nicolas Vannieuwkerke
07/02/2026, 11:28 AMsamplesheetToList sorry I should have been more clearNiklas Schandry
07/02/2026, 11:31 AMParsed samplesheet: [meta:[id:[null], group:[null], ontreads:[[]], hifireads:[[]], strategy:[single], assembler:[hifiasm], assembler_ont:[[]], assembler_hifi:[hifiasm], assembly_scaffolding_order:[ont_on_hifi], assembler_ont_args:[[]], assembler_h
ifi_args:[[]], hifiasm_args:[[]], flye_args:[[]], polish:[null], ont_collect:[[]], ont_adapters:[[]], ont_fastplong_args:[[]], jellyfish:[[]], jellyfish_k:[null], jellyfish_size:[200M], hifi_adapters:[[]], hifi_fastplong_args:[[]], medaka_model:[[
]], scaffold_longstitch:[[]], scaffold_links:[[]], scaffold_ragtag:[[]], scaffold_hic:[false], use_ref:[[]], hic_aligner:[bwa-mem2], hic_F:[[]], hic_R:[null], hic_trim:[[]], genome_size:[[]], ref_fasta:[[]], ref_gff:[[]], flye_mode:[--nano-hq], as
sembly:[[]], ref_map_bam:[[]], assembly_map_bam:[[]], qc_reads:ont, qc_reads_path:[[]], quast:[[]], busco:[[]], busco_lineage:[auto_euk], busco_db:[[]], meryl_k:[21], merqury:[false], lift_annotations:[false], shortread_F:[[]], shortread_R:[[]], p
aired:[[]], use_short_reads:[[]], shortread_trim:[[]]]]
I think I need to default to null , or anything else that will evaluate to false with ?Niklas Schandry
07/02/2026, 11:31 AMnull (that was a different problem, solved)Niklas Schandry
07/02/2026, 11:34 AM"default": "${params.paramname}" ?Nicolas Vannieuwkerke
07/02/2026, 11:35 AMmeta.key = meta.get("key", params.paramname}Niklas Schandry
07/02/2026, 11:37 AM.map{ it -> [meta:[key: it.meta.key ?: params.key ]]}Nicolas Vannieuwkerke
07/02/2026, 11:38 AMNiklas Schandry
07/02/2026, 11:39 AMNiklas Schandry
07/02/2026, 11:39 AMnull defaultsNicolas Vannieuwkerke
07/02/2026, 11:39 AM[] is also considered false in groovy so that's fineNiklas Schandry
07/02/2026, 11:40 AMNicolas Vannieuwkerke
07/02/2026, 11:40 AMNiklas Schandry
07/02/2026, 11:40 AM[[]] in the dumped output above should have a valueNiklas Schandry
07/02/2026, 11:40 AMmeta-mapNicolas Vannieuwkerke
07/02/2026, 11:41 AMNiklas Schandry
07/02/2026, 11:41 AMNiklas Schandry
07/02/2026, 11:42 AMNiklas Schandry
07/02/2026, 11:43 AMnull defaults while we were talking, so if those do not match the output earlier, that is whyNicolas Vannieuwkerke
07/02/2026, 11:43 AMNiklas Schandry
07/02/2026, 11:44 AMNicolas Vannieuwkerke
07/02/2026, 11:45 AMNicolas Vannieuwkerke
07/02/2026, 11:45 AMNiklas Schandry
07/02/2026, 11:46 AMch_samplesheet = channel.fromList(samplesheetToList(params.input, "assets/schema_input.json"))Niklas Schandry
07/02/2026, 11:47 AMfromPath.splitCsvNicolas Vannieuwkerke
07/02/2026, 11:48 AMNiklas Schandry
07/02/2026, 11:52 AMNicolas Vannieuwkerke
07/02/2026, 11:52 AMNicolas Vannieuwkerke
07/02/2026, 11:53 AMNiklas Schandry
07/02/2026, 11:54 AMNicolas Vannieuwkerke
07/02/2026, 11:56 AMNiklas Schandry
07/02/2026, 11:56 AMmeta.key , if it does not come via the samplesheet give it the value of params.keyNiklas Schandry
07/02/2026, 11:56 AMNicolas Vannieuwkerke
07/02/2026, 11:57 AMNiklas Schandry
07/02/2026, 11:57 AMNicolas Vannieuwkerke
07/02/2026, 11:57 AMNiklas Schandry
07/02/2026, 12:02 PMNiklas Schandry
07/02/2026, 12:10 PMNicolas Vannieuwkerke
07/02/2026, 12:10 PMsamplesheetToList is correct, I'll dig a bit deeper 😛Niklas Schandry
07/02/2026, 12:11 PMNicolas Vannieuwkerke
07/02/2026, 12:12 PMsamplesheetToList creates a list with one value (the meta map) so your it is actually List[meta] instead of just meta. You need to fetch it from it like that.Nicolas Vannieuwkerke
07/02/2026, 12:14 PMit = [ [ id: 'test'], [ id:'test2' ] ] would return ["test", "test2"] if you tried it.idNicolas Vannieuwkerke
07/02/2026, 12:16 PMinput_ch.map { it ->
def meta = it[0]
return meta.collectEntries { key, val -> [ key, val ?: params.get(key) ] }
}
This will populate all empty values with their parameter default 🙂Nicolas Vannieuwkerke
07/02/2026, 12:16 PMNiklas Schandry
07/02/2026, 12:18 PMNiklas Schandry
07/02/2026, 12:20 PMNiklas Schandry
07/02/2026, 12:20 PMNicolas Vannieuwkerke
07/02/2026, 12:21 PMcollectEntries method 😉Niklas Schandry
07/02/2026, 12:21 PMNicolas Vannieuwkerke
07/02/2026, 12:24 PM