Skip to content

Instantly share code, notes, and snippets.

@yfarjoun
Last active February 27, 2025 04:12
Show Gist options
  • Save yfarjoun/fa523f8429b55396c77003265a22f13f to your computer and use it in GitHub Desktop.
Save yfarjoun/fa523f8429b55396c77003265a22f13f to your computer and use it in GitHub Desktop.
nextflow workflow using cvstk to convert a list of tuples to a "wide" tsv
process PIVOT_WIDER{
input: path(tsv)
output: path("wider.tsv"), emit: tsv
script:
"""
csvtk spread -t -k 2 -v 3 -H ${tsv} > wider.tsv
"""
}
workflow {
ch_rows= channel.fromList([["A","V1",1],["A","V2",2],["B","V1",3],["B","V2",4]])
.view()
.map{s,c,v->"${s}\t${c}\t${v}"}.view()
ch_narrow=ch_rows.collectFile(name:"test.tsv",newLine:true).view()
PIVOT_WIDER(ch_narrow).view()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment