Created
March 22, 2018 10:16
-
-
Save viklund/f7e969346bee7c3880627e1a868814e5 to your computer and use it in GitHub Desktop.
This file contains 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
// Hack nextflow workflow that removes intermediate files generated | |
// by process A once process B is done with the files | |
inputA = Channel.from( | |
[1, file('f1')], | |
[2, file('f2')], | |
[3, file('f3')], | |
[4, file('f4')], | |
[5, file('f5')]) | |
process A { | |
tag "$id - $f" | |
input: | |
set val(id), file(f) from inputA | |
output: | |
set val(id), file("f.${id}.A") into outputA | |
script: """ | |
FILE=f.${id}.A | |
echo "A $id" > \$FILE | |
cat $f >> \$FILE | |
""" | |
} | |
outputA.into { inputB; outputAc } | |
process B { | |
tag "$id - $f" | |
input: | |
set val(id), file(f) from inputB | |
output: | |
set val(id), file("f.${id}.B") into outputB | |
publishDir "DONE" | |
script: | |
""" | |
FILE=f.${id}.B | |
echo "B $id" > \$FILE | |
cat $f >> \$FILE | |
""" | |
} | |
remover_input = outputAc.join( outputB ) | |
process Remover { | |
tag "$id - $f1 - $f2" | |
input: | |
set val(id), file(f1), file(f2) from remover_input | |
script: | |
""" | |
ORIG=\$(readlink "$f1") | |
unlink "\$ORIG" | |
""" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment