generated from AustralianBioCommons/Nextflow_DSL2_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
117 lines (83 loc) · 3.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
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
#!/usr/bin/env nextflow
// To use DSL-2 will need to include this
nextflow.enable.dsl=2
// Import processes to be run in the workflow
include { extractRegion } from './modules/Extract.nf'
include { indexVCF } from './modules/Index.nf'
include { htmlReport } from './modules/Report.nf'
// Declare parameters
params.chr = false
params.start = false
params.stop = false
params.sample = false
params.vcf = false
params.bam = false
params.outDir = "./Report"
// Print a header for your pipeline
log.info """\
=======================================================================================
I G V R E P O R T - N F
=======================================================================================
Created by the Sydney Informatics Hub, University of Sydney
Find documentation and more info @ https://github.com/Sydney-Informatics-Hub/IGVreport-nf
Log issues @ https://github.com/Sydney-Informatics-Hub/IGVreport-nf/issues
=======================================================================================
Workflow run parameters
=======================================================================================
sample : ${params.sample}
chr : ${params.chr}
start bp : ${params.start}
end bp : ${params.stop}
bam file : ${params.bam}
vcf file : ${params.vcf}
outDir : ${params.outDir}
workDir : ${workflow.workDir}
=======================================================================================
"""
// Help function
def helpMessage() {
log.info"""
Usage: nextflow run main.nf --sample <sample> --vcf <vcf> --bam <bam> --chr <chr> --start <start> --stop <stop>
Required Arguments:
--sample The name of the sample being processed.
Required to name report.
--vcf Full path to the vcf file being processed.
VCF must be gzipped and indexed.
--bam Full path to the bam file being used to
generate the report.
--chr Chromosome name, should include the 'chr'
prefix.
--start The start base position of the region of
interest.
--stop The ending base position of the
Optional Arguments:
--outDir Specify path to output directory.
""".stripIndent()
}
// Main workflow structure. Include some input/runtime tests here.
workflow {
if ( params.help || params.bam == false || params.vcf == false || params.chr == false || params.start == false || params.stop == false ){
helpMessage()
exit 1
} else {
// Extract region from the input vcf
extractRegion(params.vcf)
// Index the subset vcf created by extractRegion()
indexVCF(extractRegion.out.subsetVCF)
// Create html report from subset vcf and input bam
htmlReport(extractRegion.out.subsetVCF, indexVCF.out.indexVCF, params.bam)
}}
workflow.onComplete {
summary = """
=======================================================================================
Workflow execution summary
=======================================================================================
Duration : ${workflow.duration}
Success : ${workflow.success}
workDir : ${workflow.workDir}
Exit status : ${workflow.exitStatus}
outDir : ${params.outDir}
=======================================================================================
"""
println summary
}