-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.nf
More file actions
60 lines (52 loc) · 2.13 KB
/
main.nf
File metadata and controls
60 lines (52 loc) · 2.13 KB
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
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nf-caddsv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
nextflow.enable.dsl = 2
include { CADDSV } from './subworkflows/local/caddsv/main'
workflow {
/*
* Validate required params
*/
if( !params.input ) error "Missing required parameter: --input"
if( !params.annotations_dir ) error "Missing required parameter: --annotations_dir"
if( !params.models_dir ) error "Missing required parameter: --models_dir"
/*
* Input channel:
* - If CSV: expects columns `sample` and `bed`
* - Else: assume it is a BED file path
*/
ch_sv_bed = params.input.toString().endsWith('.csv')
? Channel
.fromPath(params.input, checkIfExists: true)
.splitCsv(header: true)
.map { row ->
def meta = [id: row.sample]
def bed = file(row.bed, checkIfExists: true)
tuple(meta, bed)
}
: Channel
.fromPath(params.input, checkIfExists: true)
.map { bed ->
def meta = [id: bed.baseName.replaceAll(/\\.bed\$/, '')]
tuple(meta, bed)
}
// Reference channels
ch_annotations = Channel.fromPath(params.annotations_dir, checkIfExists: true, type: 'dir').first()
ch_models = Channel.fromPath(params.models_dir, checkIfExists: true, type: 'dir').first()
ch_scripts = Channel.fromPath("${projectDir}/bin", checkIfExists: true, type: 'dir').first()
ch_genome = Channel.fromPath("${projectDir}/assets/caddsv/hg38.genome", checkIfExists: true).first()
// annotation header expected by score step
ch_header = params.annotations_dir
? Channel.fromPath("${params.annotations_dir}/header.txt", checkIfExists: true).first()
: Channel.fromPath("${projectDir}/assets/caddsv/annotation_header.txt", checkIfExists: true).first()
CADDSV(
ch_sv_bed,
ch_annotations,
ch_models,
ch_scripts,
ch_genome
)
}