--
You received this message because you are subscribed to the Google Groups "Nextflow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/nextflow.
For more options, visit https://groups.google.com/d/optout.
No, you cannot do that. What you are trying to do is the default behaviour a process output channel, therefore I'm not understanding the reason of this piece of code.p
On Thu, Mar 1, 2018 at 9:27 PM, <daniel...@gladstone.ucsf.edu> wrote:
Hi,
I'm writing to ask if the following syntax is okay for waiting for a process to finish and then creating a channel with its output dir:
```
midas_species_dir_channel = Channel.create()
midas_species_output_4_merge.subscribe onComplete: {
midas_species_dir_channel = Channel
.fromPath(midas_species_dir, type: 'dir')
.ifEmpty { exit 1, "MIDAS species output was not found in: ${midas_species_dir}" }
}
```
The prior process' output is the `midas_species_output_4_merge` channel, and the next process' input is `midas_species_dir_channel`
Thanks for your help!
Dan.
--
You received this message because you are subscribed to the Google Groups "Nextflow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+unsubscribe@googlegroups.com.
params.samples_list = ['Sample1', 'Sample2', 'Sample3', 'Sample4']
Channel.from( params.samples_list ).into { samples_list; samples_list2 }
samples_list2.subscribe {
println "[samples_list2] ${it}"
}
process make_txt {
tag { "${sample_ID}" }
executor "local"
echo true
input:
val(sample_ID) from samples_list
output:
file "${sample_ID}.txt" into samples_files, samples_files2
script:
"""
echo "[make_txt] ${sample_ID}"
echo "[make_txt] ${sample_ID}" > "${sample_ID}.txt"
"""
}
process make_dir {
echo true
stageInMode "copy"
input:
file("*") from samples_files.collect()
output:
file("samples_dir") into samples_dir
script:
"""
echo "[make_dir]"
pwd
for item in *; do
mkdir -p samples_dir
mv "\${item}" samples_dir/
done
tree
"""
}
process use_dir {
echo true
input:
file(dir) from samples_dir
script:
"""
echo "[use_dir]"
pwd
tree "${dir}/"
"""
}
N E X T F L O W ~ version 0.27.2
Launching `dir-process.nf` [fervent_shockley] - revision: c665ca0bff
[samples_list2] Sample1
[samples_list2] Sample2
[samples_list2] Sample3
[samples_list2] Sample4
[warm up] executor > local
[fa/c76e67] Submitted process > make_txt (Sample1)
[1c/c18c3c] Submitted process > make_txt (Sample4)
[85/5b4639] Submitted process > make_txt (Sample3)
[d7/01f809] Submitted process > make_txt (Sample2)
[make_txt] Sample4
[make_txt] Sample3
[make_txt] Sample2
[make_txt] Sample1
[24/2e0e2c] Submitted process > make_dir
[make_dir]
/Users/kellys04/projects/nextflow-samplesheet-demo/work/24/2e0e2ca4a9357fe480375588bd89bd
.
`-- samples_dir
|-- Sample1.txt
|-- Sample2.txt
|-- Sample3.txt
`-- Sample4.txt
1 directory, 4 files
[5e/0d5c8f] Submitted process > use_dir
[use_dir]
/Users/kellys04/projects/nextflow-samplesheet-demo/work/5e/0d5c8f63b126ac452bd3973a1574f0
samples_dir/
|-- Sample1.txt
|-- Sample2.txt
|-- Sample3.txt
`-- Sample4.txt
0 directories, 4 files
The middle process isn’t needed, and preparing the samples_dir with mv can be done without the loop. See below:
params.samples_list = ['Sample1', 'Sample2', 'Sample3', 'Sample4']
Channel.from( params.samples_list ).into { samples_list; samples_list2 }
samples_list2.subscribe {
println "[samples_list2] ${it}"
}
process make_txt {
tag { "${sample_ID}" }
executor "local"
echo true
input:
val(sample_ID) from samples_list
output:
file "${sample_ID}.txt" into samples_files
script:
"""
echo "[make_txt] ${sample_ID}"
echo "[make_txt] ${sample_ID}" > "${sample_ID}.txt"
"""
}
process make_use_dir {
echo true
input:
file("results_list") from samples_files.collect()
output:
file("samples_dir") into samples_dir
script:
"""
echo "[make_dir]"
pwd
mkdir -p samples_dir
mv ${results_list} samples_dir/
tree
echo "[use_dir]"
ls samples_dir
"""
}