-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
64 lines (50 loc) · 1.38 KB
/
main.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
nextflow.enable.dsl=2
params.kmers = '21,31'
params.reads = 'data/*fasta'
params.outdir = 'results'
kmers = Channel.of(params.kmers.split(','))
.toInteger()
reads = Channel
.fromPath(params.reads, checkIfExists: true)
.map { file -> tuple(file.baseName, file) }
kreads = reads.combine(kmers)
process jellyfish {
tag "${sample}_${kmer}"
input:
tuple val(sample), path(reads), val(kmer)
output:
tuple val(sample), path("${sample}.histo"), val(kmer)
script:
"""
if [ -f *.gz ]; then
jellyfish count -C -m $kmer -s 200M \
-t ${task.cpus} \
<(zcat $reads)
else
jellyfish count -C -m $kmer -s 200M \
-t ${task.cpus} \
$reads
fi
jellyfish histo -t ${task.cpus} mer_counts.jf > ${sample}.histo
rm mer_counts.jf
"""
}
process genomescope {
tag "${sample}_${kmer}"
publishDir params.outdir
input:
tuple val(sample), path(histo), val(kmer)
output:
path("${sample}_${kmer}")
script:
"""
mkdir -p ${sample}_${kmer}
Rscript /kmer_wd/genomescope.R $histo $kmer 150 ${sample}_${kmer} \
| tail -n +2 \
| sed \'s/Model converged //; s/ /\\n/g\' > \
${sample}_${kmer}/${sample}_${kmer}_gmodel.txt
"""
}
workflow {
genomescope(jellyfish(kreads))
}