-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.nf
62 lines (49 loc) · 1.77 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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
include { deinterleave; clean; raw_reads_stats; clean_reads_stats; statswrapper } from './modules/bbtools'
include { metaspades; metaplasmidspades; viralverify; viralverify_db_download} from './modules/spades'
include { megahit } from './modules/megahit'
include { metabat2 } from './modules/metabat'
workflow {
Channel
.fromFilePairs( params.reads, size: (params.single_end || params.interleaved) ? 1 : 2 )
.ifEmpty { exit 1, "Cannot find any reads matching: ${params.reads}." }
.set { reads_ch }
if (params.interleaved) {
deinterleave(reads_ch)
deint_ch = deinterleave.out.reads
} else {
deint_ch = reads_ch
}
raw_reads_stats(deint_ch)
if (!params.skip_cleaning) {
clean(deint_ch)
clean_ch = clean.out.reads
clean_reads_stats(clean_ch)
} else {
clean_ch = reads_ch
}
if (params.run_metaplasmidspades && !params.single_end) {
metaplasmidspades(clean_ch)
if (params.viralverify_db == 'none') {
viralverify_db_download()
viralverify_db = viralverify_db_download.out.viralverify_db
}
else {
viralverify_db = file(params.viralverify_db, checkIfExists: true)
}
viralverify(metaplasmidspades.out.scaffolds, viralverify_db)
}
if (!params.skip_assembly){
if ((params.assembler == "metaspades") & (!params.single_end)) {
metaspades(clean_ch)
scaffolds_ch = metaspades.out.scaffolds
}
else {
megahit(clean_ch)
scaffolds_ch = megahit.out.scaffolds
}
statswrapper(scaffolds_ch.map { row -> row[1] }.collect())
metabat2(clean_ch.join(scaffolds_ch))
}
}