-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
57 lines (44 loc) · 1.18 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
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BAM2FASTQ } from './modules/00_bam2fastq'
include { HLAHD } from './modules/01_hlahd'
def helpMessage() {
log.info params.help_message
}
if (params.help) {
helpMessage()
exit 0
}
// checks required inputs
if (params.input_fastqs) {
Channel
.fromPath(params.input_fastqs)
.splitCsv(header: ['name', 'fastq1', 'fastq2'], sep: "\t")
.map{ row-> tuple(row.name, file(row.fastq1), file(row.fastq2)) }
.set { input_fastqs }
} else if (params.input_bams) {
Channel
.fromPath(params.input_bams)
.splitCsv(header: ['name', 'bam'], sep: "\t")
.map{ row-> tuple(row.name, file(row.bam)) }
.set { input_bams }
} else {
exit 1, "Provide either --input_fastqs or --input_bams"
}
if (params.reference == 'hg38') {
contigs = "$baseDir/references/contigs_hla_reads_hg38.bed"
}
else if (params.reference == 'hg19') {
contigs = "$baseDir/references/contigs_hla_reads_hg19.bed"
}
else {
log.error "--reference only supports hg38 or hg19"
exit 1
}
workflow {
if (input_bams) {
BAM2FASTQ(input_bams, contigs)
input_fastqs =BAM2FASTQ.out
}
HLAHD(input_fastqs)
}