-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulate_metagenomes.nf
50 lines (42 loc) · 1.51 KB
/
simulate_metagenomes.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env nextflow
// vim: syntax=groovy expandtab
/****************************************
* CTMR metagenome simulation and
* sequencing depth estimation pipeline
* ------------------------------------
* Copyright (c) Authors 2017
* Authors:
* Fredrik Boulund <[email protected]>
* Luisa Hugerth <[email protected]>
****************************************/
Channel
.fromFilePairs(params.input_reads)
.ifEmpty{ exit 1, "Found no reference metagenome to subsample, did you specify --input_reads? I got: '${params.input_reads}'"}
.set {
input_reads
}
process simulate_metagenome {
tag "$sample_type"
publishDir "${params.outdir}/simulated_metagenomes", mode: 'move'
input:
set pair_id, file(reads) from input_reads
output:
file "${sample_type}_10000000reads_{1,2,3}rep_{1,2}.fastq.gz"
file "${sample_type}_1000000reads_{1,2,3}rep_{1,2}.fastq.gz"
file "${sample_type}_100000reads_{1,2,3}rep_{1,2}.fastq.gz"
file "${sample_type}_10000reads_{1,2,3}rep_{1,2}.fastq.gz"
file "${sample_type}_1000reads_{1,2,3}rep_{1,2}.fastq.gz"
script:
sample_type = reads[0].baseName.split('_')[0]
"""
for level in 10000000 1000000 100000 10000 1000; do
for replicate in 1 2 3; do
reformat.sh \
in1=${reads[0]} \
in2=${reads[1]} \
out=${sample_type}_\${level}reads_\${replicate}rep_#.fastq.gz \
samplereadstarget=\${level}
done
done
"""
}