Jim Downie
12/18/2025, 10:23 AM"hifiasm_error_correction_arguments": {
"type": "string",
"description": "Command-line arguments to pass to Hifiasm controlling read error correction only: <https://hifiasm.readthedocs.io/en/latest/parameter-reference.html#error-correction-options>",
"meta": "hifiasm_error_correction_arguments",
"default": ""
},
As part of some further pre-processing, I need to take this string, tokenize it and validate the command-line flags. However, the .tokenize() call fails because nf-schema samplesheetToList() returns this as an ArrayList rather than a string. Is this expected behaviour?Nicolas Vannieuwkerke
12/18/2025, 10:30 AMJim Downie
12/18/2025, 10:30 AMJim Downie
12/18/2025, 10:31 AMNicolas Vannieuwkerke
12/18/2025, 10:32 AMsamplesheetToList function?Jim Downie
12/18/2025, 10:33 AM.view() on the channel (I am adding everything to meta as I need a map):
[[id:baUndUnlc1.pri, long_read_dataset:baUndUnlc1, long_read_platform:pacbio_hifi, long_read_1n_coverage:[], illumina_hic_dataset:baUndUnlc1, illumina_10x_dataset:[], maternal_illumina_dataset:[], paternal_illumina_dataset:[], phased_assembly:false, trio_assembly:false, purge:true, polish:false, scaffold:true, assemble_mito:true, assemble_plastid:true, hifiasm_error_correction_arguments:-f0 --primary, hifiasm_arguments:, purging_cutoffs:[], purge_middle:false, yahs_arguments:, mitohifi_reference_species:[], mitohifi_genetic_code:[], mitohifi_reads_arguments:, mitohifi_contigs_arguments:, oatk_kmer_size:1000, oatk_coverage_cutoff:[], oatk_arguments:, oatk_mito_hmm:/c-zhou/OatkDB/raw/main/v20230921/insecta_mito.fam, oatk_plastid_hmm:/c-zhou/OatkDB/raw/main/v20230921/acrogymnospermae_pltd.fam]]
It looks like a string when printing, but if I run println meta.hifiasm_error_correction_arguments.getClass() inside a map operator I get class java.util.ArrayListJim Downie
12/18/2025, 10:34 AMNicolas Vannieuwkerke
12/18/2025, 10:34 AMJim Downie
12/18/2025, 10:35 AM- id: baUndUnlc1.pri
long_read_dataset: baUndUnlc1
long_read_platform: "pacbio_hifi"
illumina_hic_dataset: baUndUnlc1
purge: true
assemble_mito: true
assemble_plastid: true
hifiasm_error_correction_arguments: "-f0 --primary"
oatk_mito_hmm: <https://github.com/c-zhou/OatkDB/raw/main/v20230921/insecta_mito.fam>
oatk_plastid_hmm: <https://github.com/c-zhou/OatkDB/raw/main/v20230921/acrogymnospermae_pltd.fam>Nicolas Vannieuwkerke
12/18/2025, 10:36 AM- in yaml files results in a list. Can you try again with single quotes? (Not entirely sure this is the reason, but it could be?)Jim Downie
12/18/2025, 10:37 AMNicolas Vannieuwkerke
12/18/2025, 10:38 AMNicolas Vannieuwkerke
12/18/2025, 10:38 AMJim Downie
12/18/2025, 10:38 AMJim Downie
12/18/2025, 10:39 AMclass java.util.ArrayListNicolas Vannieuwkerke
12/18/2025, 10:41 AMJim Downie
12/18/2025, 10:42 AMNicolas Vannieuwkerke
12/18/2025, 10:43 AMJim Downie
12/18/2025, 10:45 AMJim Downie
12/18/2025, 10:54 AMJim Downie
12/18/2025, 10:57 AMmeta schema field. If I just return a list with no meta I correctly get this value as a StringJim Downie
12/18/2025, 10:59 AMNicolas Vannieuwkerke
12/18/2025, 12:12 PMArthur
12/19/2025, 5:39 AMnf-schema bug or related in any way to nf-schema.
It’s just how Groovy works.Jim Downie
12/19/2025, 9:03 AMchannel.of([[:]]).map { meta -> println meta } doesn’t destructure the input and pull out the map, it just returns the whole channel entry list.
So the solution in this case (I will test later) might be to either unwrap the map from the list (there is only a single map in a list in each channel), or otherwise to do something like def realmeta = meta[0] in the closure and operate on that.Arthur
12/19/2025, 9:37 AMit[0]. If you're operating on a meta map it's best practice to make a copy of it anyway.
If Groovy didn't have syntactic sugar for lists which let you access attributes of objects in the list using the dot notation, the error would be more obvious (in Python for example you'd get an attribute error)