This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabundance.nf
87 lines (71 loc) · 2.27 KB
/
abundance.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env nextflow
nextflow.preview.dsl=2
/* ############################################################################
* Default parameter values.
* ############################################################################
*/
params.database_path = 'databases'
params.database = 'Standard_v2'
params.read_length = 100
params.threshold = 10
params.sequences = 'sequences'
params.outdir = 'results'
/* ############################################################################
* Define workflow processes.
* ############################################################################
*/
process kraken {
publishDir "${params.outdir}", mode:'link'
input:
tuple path(databases), val(sample), path(first_fastq), path(second_fastq)
output:
path "${sample}_classified_{1,2}.fastq", emit: classified_sequences
path "${sample}_unclassified_{1,2}.fastq", emit: unclassified_sequences
path "${sample}.k2", emit: data
path "${sample}.k2report", emit: report
"""
kraken2 \
--db "${databases.resolve(params.database)}" \
--threads ${task.cpus} \
--classified "${sample}_classified#.fastq" \
--unclassified "${sample}_unclassified#.fastq" \
--output "${sample}.k2" \
--report "${sample}.k2report" \
--report-zero-counts \
--paired \
--use-names \
--gzip-compressed \
"${first_fastq}" "${second_fastq}"
"""
}
process bracken {
publishDir "${params.outdir}", mode:'link'
input:
tuple path(databases), path(kraken_report), val(taxonomy_level)
output:
path "${kraken_report.getSimpleName()}_${taxonomy_level}.bracken", emit: report
"""
bracken \
-d "${databases.resolve(params.database)}" \
-i "${kraken_report}" \
-o "${kraken_report.getSimpleName()}_${taxonomy_level}.bracken" \
-r ${params.read_length} \
-t ${params.threshold} \
-l ${taxonomy_level}
"""
}
/* ############################################################################
* Define named workflows to be included elsewhere.
* ############################################################################
*/
workflow abundance {
take:
databases
fastq_triples
taxonomy_level
main:
kraken(databases.combine(fastq_triples))
bracken(databases.combine(kraken.out.report).combine(taxonomy_level))
emit:
bracken.out.report
}