```// example.csv // sample,path1,path2 sample1,/p...
# help
a
Copy code
// example.csv //
sample,path1,path2
sample1,/path/to/sample1.bam,/path/to/sample1.bam
sample2,/path/to/sample2.bam,/path/to/sample2.bam
sample3,/path/to/sample3.bam,/path/to/sample3.bam
// end example.csv //

// workflow //
workflow {
	Channel
		.fromPath(params.input)
		.splitCsv(header: true, sep: ",")
		.set{ch_input}

	ch_input
	| collectFile(name: "valid_samplesheet.csv", newLine: true, keepHeader: true)
	| view

}

// end workflow //

// error //
ERROR ~ Not a valid file collector argument [java.util.LinkedHashMap]: [sample:sample3, path1:/path/to/sample3.bam, path2:/path/to/sample3.bam]
// end error //
Hey all, I've been racking my brain over what is a seemingly simple issue for some reason. Essentially, I am trying to read a samplesheet into a channel, then collect the updated contents into a new file. Am I missing something in this conversion?
m
Use
map
to turn the `Map`'s into
Strings
again
a
Copy code
ch_input
	| map{row -> row.collectEntries { k, v -> [(k): v.toString()] } }
	| collectFile(name: "samplesheet.csv", keepHeader: true, newLine:true)

// error //
ERROR ~ Not a valid file collector argument [java.util.LinkedHashMap]: [sample:sample3, path1:/path/to/sample3.bam, path2:/path/to/sample3.bam]
I gave that a go, but ran into the same issue; thinking it may be easier just to rethink my strategy for this particular step
m
[(k): v.toString()]
this object is still a Map. It needs to be a string
"k,v"
or something.
a
Ah, alright I'll look into this a bit further; ty!