-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.nf
118 lines (99 loc) · 3.84 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env nextflow
/*
========================================================================================
REVICA
========================================================================================
Github Repo:
https://github.com/asereewit/revica
Author:
Jaydee Sereewit <aseree@uw.edu>
Alex L Greninger <agrening@uw.edu>
UW Medicine | Virology
Department of Laboratory Medicine and Pathology
University of Washington
LICENSE: GNU
----------------------------------------------------------------------------------------
*/
// if INPUT not set
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }
//
// SUBWORKFLOWS
//
include { INPUT_CHECK } from './subworkflows/input_check'
include { FASTQ_TRIM_FASTP_FASTQC } from './subworkflows/fastq_trim_fastp_fastqc'
include { REFERENCE_PREP } from './subworkflows/reference_prep'
include { CONSENSUS_ASSEMBLY } from './subworkflows/consensus_assembly'
//
// MODULES
//
include { SEQTK_SAMPLE } from './modules/seqtk_sample'
include { SUMMARY } from './modules/summary'
include { KRAKEN2 } from './modules/kraken2'
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
/* */
/* RUN THE WORKFLOW */
/* */
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
log.info " "
log.info " _|_|_| _|_|_|_| _| _| _|_|_| _|_|_| _|_| "
log.info " _| _| _| _| _| _| _| _| _| "
log.info " _|_|_| _|_|_| _| _| _| _| _|_|_|_| "
log.info " _| _| _| _| _| _| _| _| _| "
log.info " _| _| _|_|_|_| _| _|_|_| _|_|_| _| _| "
log.info " "
workflow {
INPUT_CHECK (
ch_input
)
FASTQ_TRIM_FASTP_FASTQC (
INPUT_CHECK.out.reads,
params.adapter_fasta,
params.save_trimmed_fail,
params.save_merged,
params.skip_fastp,
params.skip_fastqc
)
ch_sample_input = FASTQ_TRIM_FASTP_FASTQC.out.reads
if (params.run_kraken2) {
KRAKEN2 (
FASTQ_TRIM_FASTP_FASTQC.out.reads,
file(params.kraken2_db),
params.kraken2_variants_host_filter || params.kraken2_assembly_host_filter,
params.kraken2_variants_host_filter || params.kraken2_assembly_host_filter
)
if (params.kraken2_variants_host_filter) {
ch_sample_input = KRAKEN2.out.unclassified_reads_fastq
}
}
if (params.sample) {
SEQTK_SAMPLE (
ch_sample_input,
params.sample
)
ch_ref_prep_input = SEQTK_SAMPLE.out.reads
} else {
ch_ref_prep_input = ch_sample_input
}
if (!params.skip_consensus) {
REFERENCE_PREP (
ch_ref_prep_input,
file(params.db)
)
CONSENSUS_ASSEMBLY (
REFERENCE_PREP.out.reads,
REFERENCE_PREP.out.ref,
)
FASTQ_TRIM_FASTP_FASTQC.out.trim_log
.combine(CONSENSUS_ASSEMBLY.out.consensus
.join(CONSENSUS_ASSEMBLY.out.bam, by: [0,1]), by: 0)
.map { meta, trim_log, ref_info, consensus, bam, bai -> [ meta, ref_info, trim_log, consensus, bam, bai ] }
.set { ch_summary_in }
SUMMARY (
ch_summary_in
)
SUMMARY.out.summary
.collectFile(storeDir: "${params.output}", name:"${params.run_name}_summary.tsv", keepHeader: true, sort: true)
}
}