Last active
          February 27, 2025 04:12 
        
      - 
      
- 
        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
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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