-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.nf
61 lines (49 loc) · 2.66 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
nextflow.enable.dsl = 2
include { EXPORT_RAW_GENOMES } from "./modules/export_raw_genomes/export_raw_genomes.nf"
include { FASTQC as FASTQC_ORIGINAL } from "./modules/fastqc/fastqc.nf" addParams(resultsDir: "${params.outdir}/fastqc/original")
include { FASTQC as FASTQC_TRIMMED } from "./modules/fastqc/fastqc.nf" addParams(resultsDir: "${params.outdir}/fastqc/trimmed")
include { MTBSEQ_PER_SAMPLE } from "./modules/mtbseq/mtbseq_per_sample.nf"
include { MTBSEQ_COHORT } from "./modules/mtbseq/mtbseq_cohort.nf"
include { MULTIQC as MULTIQC_ORIGINAL } from "./modules/multiqc/multiqc.nf" addParams(resultsDir: "${params.outdir}/multiqc/original")
include { MULTIQC as MULTIQC_TRIMMED } from "./modules/multiqc/multiqc.nf" addParams(resultsDir: "${params.outdir}/multiqc/trimmed")
include { PROKKA } from "./modules/prokka/prokka.nf"
include { RD_ANALYZER } from "./modules/rd_analyzer/rd_analyzer.nf"
include { SPADES } from "./modules/spades/spades.nf"
include { SPOTYPING } from "./modules/spotyping/spotyping.nf"
include { TBPROFILER_COLLATE } from "./modules/tbprofiler/collate.nf"
include { TBPROFILER_PROFILE } from "./modules/tbprofiler/profile.nf"
include { TRIMMOMATIC } from "./modules/trimmomatic/trimmomatic.nf"
workflow {
// Data Input
if (params.input_type == "reads") {
input_ch = Channel.fromFilePairs(params.reads,checkIfExists: true)}
if (params.input_type == "sra") {
input_ch = Channel.fromSRA(params.genome_ids, cache: true, apiKey: params.api_key)}
//Export Genomes
EXPORT_RAW_GENOMES(input_ch)
// Quality control
FASTQC_ORIGINAL(input_ch)
MULTIQC_ORIGINAL(FASTQC_ORIGINAL.out.flatten().collect())
TRIMMOMATIC(input_ch)
FASTQC_TRIMMED(TRIMMOMATIC.out.trimmed_reads)
MULTIQC_TRIMMED(FASTQC_TRIMMED.out.flatten().collect())
// Analysis
// TODO: Rewrite this using a sub-workflow
MTBSEQ_PER_SAMPLE(TRIMMOMATIC.out.trimmed_reads,params.gatkjar,params.USER)
samples_tsv_file = MTBSEQ_PER_SAMPLE.out[0]
.collect()
.flatten().map { n -> "$n" + "\t" + "${params.mtbseq_library_name}" + "\n" }
.collectFile(name: 'samples.tsv', newLine: false, storeDir: "${params.outdir}/mtbseq/cohort")
MTBSEQ_COHORT(
samples_tsv_file,
MTBSEQ_PER_SAMPLE.out[2].collect(),
MTBSEQ_PER_SAMPLE.out[3].collect(),
params.gatkjar,
params.USER)
SPADES(TRIMMOMATIC.out.trimmed_reads)
SPOTYPING(TRIMMOMATIC.out.trimmed_reads)
TBPROFILER_PROFILE(TRIMMOMATIC.out.trimmed_reads)
TBPROFILER_COLLATE(TBPROFILER_PROFILE.out[1].flatten().collect())
PROKKA(SPADES.out.prokka_contigs,params.reference)
RD_ANALYZER(TRIMMOMATIC.out.trimmed_reads)
}