Created
July 28, 2021 17:00
-
-
Save SamStudio8/4320e63ad22743b9da967e452054909c to your computer and use it in GitHub Desktop.
Revisions
-
SamStudio8 created this gist
Jul 28, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ #!/usr/bin/env nextflow params.testdir = "/cephfs/covid/software/sam/nf-test/" params.fofn_single = [params.testdir, 'samples.csv'].join('/') single_manifest_ch = Channel .fromPath(params.fofn_single) // open say, a CSV .splitCsv(header:true) // split text stream into CSV records .map { row-> file(row.path) } // coerce the record and return a file for each line .collect() // emit all items as one process echo_fofn_single { input: file '*.txt' from single_manifest_ch output: publishDir path: "${params.testdir}", pattern: "out", mode: "copy", overwrite: true file "out" script: """ cat *.txt > out """ } params.fofn_group = [params.testdir, 'grouped_samples.tsv'].join('/') group_manifest_ch = Channel .fromPath(params.fofn_group) .splitCsv(header:true, sep:'\t') .map { row-> tuple(row.group, file(row.path)) } // coerce the record into a (group, file) tuple .groupTuple() // return tuples of (group, [file1, ...fileN]) process echo_fofn_group { input: tuple(group, file(files)) from group_manifest_ch output: publishDir path: "${params.testdir}", pattern: "g*out", mode: "copy", overwrite: true file "g${group}.out" script: """ cat ${files} > g${group}.out """ } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ hello 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ world 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ hoot 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ meow 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ bang 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ hello world 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ hoot meow 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ bang 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ group path 1 /cephfs/covid/software/sam/nf-test/file1.txt 1 /cephfs/covid/software/sam/nf-test/file2.txt 2 /cephfs/covid/software/sam/nf-test/file3.txt 2 /cephfs/covid/software/sam/nf-test/file4.txt 3 /cephfs/covid/software/sam/nf-test/file5.txt 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ hello world 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ path /cephfs/covid/software/sam/nf-test/file1.txt /cephfs/covid/software/sam/nf-test/file2.txt