-
Notifications
You must be signed in to change notification settings - Fork 7
/
UnifiedGenotyper.scala
96 lines (70 loc) · 3.39 KB
/
UnifiedGenotyper.scala
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
package org.broadinstitute.sting.queue.qscripts
import org.broadinstitute.sting.queue.QScript
import org.broadinstitute.sting.queue.extensions.gatk._
import org.broadinstitute.sting.gatk.walkers.genotyper.GenotypeLikelihoodsCalculationModel
class VariantCaller extends QScript {
// Create an alias 'qscript' to be able to access variables in the VariantCaller.
// 'qscript' is now the same as 'VariantCaller.this'
qscript =>
// Required arguments. All initialized to empty values.
@Input(doc="The reference file for the bam files.", shortName="R", required=true)
var referenceFile: File = _
@Input(doc="One or more bam files.", shortName="I")
var bamFiles: List[File] = Nil
@Input(doc="Output core filename.", shortName="O", required=true)
var out: File = _
@Argument(doc="Maxmem.", shortName="mem", required=true)
var maxMem: Int = _
@Argument(doc="Number of cpu threads per data thread", shortName="nct", required=true)
var numCPUThreads: Int = _
@Argument(doc="Number of scatters", shortName="nsc", required=true)
var numScatters: Int = _
@Argument(doc="Genotype likelihoods calculation model to employ (SNP, INDEL or BOTH)", shortName="glm", required=true)
var glm: String = _
@Argument(doc="Make reference calls", shortName="rc", required=false)
var refcalls: String = _
@Argument(doc="Minimum phred-scaled confidence to call variants", shortName="stand_call_conf", required=true)
var standCallConf: Int = _ //30 //default: best-practices value
@Argument(doc="Minimum phred-scaled confidence to emit variants", shortName="stand_emit_conf", required=true)
var standEmitConf: Int = _ //10 //default: best-practices value
// The following arguments are all optional.
@Input(doc="An optional file with known SNP sites.", shortName="D", required=false)
var dbsnpFile: File = _
@Input(doc="An optional file with targets intervals.", shortName="L", required=false)
var targetFile: File = _
@Argument(doc="Amount of padding (in bp) to add to each interval", shortName="ip", required=false)
var intervalPadding: Int = 0
def script() {
val unifiedGenotyper = new UnifiedGenotyper
// All required input
unifiedGenotyper.input_file = bamFiles
unifiedGenotyper.reference_sequence = referenceFile
unifiedGenotyper.scatterCount = numScatters
unifiedGenotyper.memoryLimit = maxMem
unifiedGenotyper.num_cpu_threads_per_data_thread = numCPUThreads
unifiedGenotyper.stand_emit_conf = standEmitConf
unifiedGenotyper.stand_call_conf = standCallConf
unifiedGenotyper.out = qscript.out + ".raw_variants.vcf"
if(refcalls == "yes"){
unifiedGenotyper.output_mode = org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyperEngine.OUTPUT_MODE.EMIT_ALL_CONFIDENT_SITES
}
//SNP INDEL or BOTH
if (glm == "SNP") {
unifiedGenotyper.genotype_likelihoods_model = GenotypeLikelihoodsCalculationModel.Model.SNP
} else if (glm == "INDEL") {
unifiedGenotyper.genotype_likelihoods_model = GenotypeLikelihoodsCalculationModel.Model.INDEL
} else if (glm == "BOTH") {
unifiedGenotyper.genotype_likelihoods_model = GenotypeLikelihoodsCalculationModel.Model.BOTH
}
// Optional input
if (dbsnpFile != null) {
unifiedGenotyper.D = dbsnpFile
}
if (targetFile != null) {
unifiedGenotyper.L :+= targetFile
unifiedGenotyper.ip = intervalPadding
}
//add function to queue
add(unifiedGenotyper)
}
}