-
Notifications
You must be signed in to change notification settings - Fork 1
/
importSamplesToGenomicDBs.nf
53 lines (42 loc) · 1.53 KB
/
importSamplesToGenomicDBs.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
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include {
getGvcfFiles;
getGenomicsdbWorkspaces;
getPedFile;
combineGvcfs;
getVcfGenomicIntervals;
getGenomicIntervalList;
genotypeGvcfs;
createGenomicsDbPerInterval;
updateGenomicsDbPerInterval;
callVariantsFromGenomicsDB;
glnexusJointCaller;
convertBcfToVcf;
} from "${projectDir}/modules/variantCallingPipeline.nf"
workflow {
println "\nGENOTYPE GVCF\n"
gvcfList = getGvcfFiles().toList()
if(params.joint_caller == "gatk") {
if(params.interval == "NULL") {
genomicInterval = getVcfGenomicIntervals(gvcfList).flatten()
}
else {
genomicInterval = getGenomicIntervalList().flatten()
}
if(params.update == true) {
workspace = getGenomicsdbWorkspaces().map { wrkspc -> tuple(wrkspc.simpleName, wrkspc) }
genomicInterval
.map { interval -> tuple(interval.simpleName + "_${params.output_prefix}-workspace", interval) }
.join(workspace)
.map {workspaceName, interval, workspace -> tuple(workspaceName, interval, workspace)}
.set { workspace_interval }
updateGenomicsDbPerInterval(workspace_interval, gvcfList)
} else {
genomicsDB = createGenomicsDbPerInterval(genomicInterval, gvcfList)
}
} else {
error: println "\nERROR: Joint caller must be 'gatk'\n"
}
}
workflow.onComplete { println "\nDone! Check results in ${params.output_dir}\n" }