-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
88 lines (71 loc) · 2.3 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* Input parameters */
nextflow.enable.dsl = 2
params.dir = "$baseDir/reads/"
params.pattern = "_R{1,2}.fastq.gz"
def reads = params.dir + "/*" + params.pattern
def db = params.dbdir + "/" + params.db
params.outdir = "$baseDir/uflow"
params.its = false
params.its_region = "ITS1"
params.forward = "CTTGGTCATTTAGAGGAAGTAA"
params.reverse = "GCTGCGTTCTTCATCGATGC"
params.skip_uncross = false
// prints to the screen and to the log
log.info """
GMH Amplicon Analysis (version 1.3)
===================================
input reads : ${reads}
database : ${db}
outdir : ${params.outdir}
primers : ${params.forward}:${params.reverse}
specs : ${params.max_cpus} cores, ${params.max_memory} GB memory
"""
.stripIndent()
/*
check reference path exists
*/
def dbPath = file(db, checkIfExists: true)
/* Modules */
include { CUTADAPT; ITSX; MERGE; RELABEL; FASTP; FILT; DEREP; UNOISE; } from './modules/amplicon'
include { OTUTABLE; JOINTAB; NORM; ADDTAX; UNCROSS; TABSTATS; OCTAVE; ALPHA; BETA; TRIM } from './modules/otutab'
include { TAX } from './modules/dadaist'
reads = Channel
.fromFilePairs(reads, checkIfExists: true)
workflow CLEAN {
take:
reads
fwd_primer
rev_primer
main:
// Takes FASTQ Pe, returns FASTQ Pe
FASTP(reads)
RELABEL(FASTP.out.reads)
CUTADAPT(RELABEL.out, fwd_primer, rev_primer )
emit:
CUTADAPT.out
}
workflow {
// Discard samples not passing the min reads filter
CLEAN(reads, params.forward, params.reverse)
if (params.its == true) {
READS = ITSX(CLEAN.out, params.its_region)
} else {
READS = MERGE(CLEAN.out)
}
FILT(READS)
DEREP(FILT.out.map{it -> it[1]}.collect())
UNOISE(DEREP.out)
TAX(UNOISE.out, dbPath)
OTUTABLE(READS, UNOISE.out)
JOINTAB(OTUTABLE.out.map{it -> it[1]}.collect())
UNCROSS(JOINTAB.out, params.skip_uncross)
TRIM(UNCROSS.out.table)
TABSTATS(TRIM.out)
ALPHA(TRIM.out)
BETA(TRIM.out)
OCTAVE(TRIM.out, UNOISE.out)
NORM(TRIM.out)
ADDTAX(NORM.out, TAX.out, UNOISE.out)
//TRACKFILES(FASTP.out.json.mix( KRAKEN2_HOST.out.txt, CONTAMLOG ).collect() )
//MULTIQC( FASTP.out.json.mix( KRAKEN2_REPORT.out, TRACKFILES.out ).collect() )
}