VariantEffectPredictor.scala 10.5 KB
Newer Older
Sander Bollen's avatar
Sander Bollen committed
1
2
3
4
5
6
7
8
9
package nl.lumc.sasc.biopet.extensions

import java.io.File

import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Output, Input }

/**
Peter van 't Hof's avatar
Peter van 't Hof committed
10
 * Extension for VariantEffectPredictor
Sander Bollen's avatar
Sander Bollen committed
11
12
13
14
15
 * Created by ahbbollen on 15-1-15.
 */
class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFunction {

  executable = config("exe", submodule = "perl", default = "perl")
16
  var vep_script: String = config("vep_script")
Sander Bollen's avatar
Sander Bollen committed
17
18

  @Input(doc = "input VCF", required = true)
19
  var input: File = null
Sander Bollen's avatar
Sander Bollen committed
20
21

  @Output(doc = "output file", required = true)
22
  var output: File = null
Sander Bollen's avatar
Sander Bollen committed
23
24
25
26
27

  override val versionRegex = """version (\d*)""".r
  override def versionCommand = executable + " " + vep_script + " --help"

  //Boolean vars
Sander Bollen's avatar
Sander Bollen committed
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
  var v: Boolean = config("v", default = true)
  var q: Boolean = config("q", default = false)
  var offline: Boolean = config("offline", default = false)
  var no_progress: Boolean = config("no_progress", default = false)
  var everything: Boolean = config("everything", default = true)
  var force: Boolean = config("force", default = false)
  var no_stats: Boolean = config("no_stats", default = false)
  var stats_text: Boolean = config("stats_text", default = false)
  var html: Boolean = config("html", default = false)
  var cache: Boolean = config("cache", default = false)
  var humdiv: Boolean = config("humdiv", default = false)
  var regulatory: Boolean = config("regulatory", default = false)
  var cell_type: Boolean = config("cell_type", default = false)
  var phased: Boolean = config("phased", default = false)
  var allele_number: Boolean = config("allele_number", default = false)
  var numbers: Boolean = config("numbers", default = false)
  var domains: Boolean = config("domains", default = false)
  var no_escape: Boolean = config("no_escape", default = false)
  var hgvs: Boolean = config("hgvs", default = false)
  var protein: Boolean = config("protein", default = false)
  var symbol: Boolean = config("symbol", default = false)
  var ccds: Boolean = config("ccds", default = false)
  var uniprot: Boolean = config("uniprot", default = false)
  var tsl: Boolean = config("tsl", default = false)
  var canonical: Boolean = config("canonical", default = false)
  var biotype: Boolean = config("biotype", default = false)
  var xref_refseq: Boolean = config("xref_refseq", default = false)
  var check_existing: Boolean = config("check_existing", default = false)
  var check_alleles: Boolean = config("check_alleles", default = false)
  var check_svs: Boolean = config("svs", default = false)
  var gmaf: Boolean = config("gmaf", default = false)
  var maf_1kg: Boolean = config("maf_1kg", default = false)
  var maf_esp: Boolean = config("maf_esp", default = false)
  var old_map: Boolean = config("old_maf", default = false)
  var pubmed: Boolean = config("pubmed", default = false)
  var failed: Boolean = config("failed", default = false)
Sander Bollen's avatar
Sander Bollen committed
64
  var vcf: Boolean = config("vcf", default = true)
Sander Bollen's avatar
Sander Bollen committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  var json: Boolean = config("json", default = false)
  var gvf: Boolean = config("gvf", default = false)
  var check_ref: Boolean = config("check_ref", default = false)
  var coding_only: Boolean = config("coding_only", default = false)
  var no_intergenic: Boolean = config("no_intergenic", default = false)
  var pick: Boolean = config("pick", default = false)
  var pick_allele: Boolean = config("pick_allele", default = false)
  var flag_pick: Boolean = config("flag_pick", default = false)
  var flag_pick_allele: Boolean = config("flag_pick_allele", default = false)
  var per_gene: Boolean = config("per_gene", default = false)
  var most_severe: Boolean = config("most_severe", default = false)
  var summary: Boolean = config("summary", default = false)
  var filter_common: Boolean = config("filter_common", default = false)
  var check_frequency: Boolean = config("check_frequency", default = false)
  var allow_non_variant: Boolean = config("allow_non_variant", default = false)
  var database: Boolean = config("database", default = false)
  var genomes: Boolean = config("genomes", default = false)
  var gencode_basic: Boolean = config("gencode_basic", default = false)
  var refseq: Boolean = config("refseq", default = false)
  var merged: Boolean = config("merged", default = false)
  var all_refseq: Boolean = config("all_refseq", default = false)
  var lrg: Boolean = config("lrg", default = false)
  var no_whole_genome: Boolean = config("no_whole_genome", default = false)
  var skip_db_check: Boolean = config("skip_db_check", default = false)
Sander Bollen's avatar
Sander Bollen committed
89
90

  // Textual args
Sander Bollen's avatar
Sander Bollen committed
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
118
119
  var vep_config: Option[String] = config("config")
  var species: Option[String] = config("species")
  var assembly: Option[String] = config("assembly")
  var format: Option[String] = config("format")
  var dir: Option[String] = config("dir")
  var dir_cache: Option[String] = config("dir_cache")
  var dir_plugins: Option[String] = config("dir_plugins")
  var fasta: Option[String] = config("fasta")
  var sift: Option[String] = config("sift")
  var polyphen: Option[String] = config("polyphen")
  var custom: Option[String] = config("custom")
  var plugin: List[String] = config("plugin", default = Nil)
  var individual: Option[String] = config("individual")
  var fields: Option[String] = config("fields")
  var convert: Option[String] = config("convert")
  var terms: Option[String] = config("terms")
  var chr: Option[String] = config("chr")
  var pick_order: Option[String] = config("pick_order")
  var freq_pop: Option[String] = config("check_pop")
  var freq_gt_lt: Option[String] = config("freq_gt_lt")
  var freq_filter: Option[String] = config("freq_filter")
  var filter: Option[String] = config("filter")
  var host: Option[String] = config("host")
  var user: Option[String] = config("user")
  var password: Option[String] = config("password")
  var registry: Option[String] = config("registry")
  var build: Option[String] = config("build")
  var compress: Option[String] = config("compress")
  var cache_region_size: Option[String] = config("cache_region_size")
Sander Bollen's avatar
Sander Bollen committed
120
121

  // Numeric args
122
  override val defaultThreads: Int = config("fork", default = 2)
Sander Bollen's avatar
Sander Bollen committed
123
124
125
126
127
128
  var cache_version: Option[Int] = config("cache_version")
  var freq_freq: Option[Float] = config("freq_freq")
  var port: Option[Int] = config("port")
  var db_version: Option[Int] = config("db_version")
  var buffer_size: Option[Int] = config("buffer_size")

129
130
  override def beforeGraph: Unit = {
    super.beforeGraph
131
132
    if (!cache && !database) {
      throw new IllegalArgumentException("Must supply either cache or database")
Sander Bollen's avatar
Sander Bollen committed
133
    } else if (cache && dir.isEmpty) {
134
135
136
137
      throw new IllegalArgumentException("Must supply dir to cache")
    }
  }

Peter van 't Hof's avatar
Peter van 't Hof committed
138
  /** Returns command to execute */
Sander Bollen's avatar
Sander Bollen committed
139
140
141
142
143
144
  def cmdLine = required(executable) +
    required(vep_script) +
    required("-i", input) +
    required("-o", output) +
    conditional(v, "-v") +
    conditional(q, "-q") +
145
    conditional(offline, "--offline") +
Sander Bollen's avatar
Sander Bollen committed
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
    conditional(no_progress, "--no_progress") +
    conditional(everything, "--everything") +
    conditional(force, "--force_overwrite") +
    conditional(no_stats, "--no_stats") +
    conditional(stats_text, "--stats_text") +
    conditional(html, "--html") +
    conditional(cache, "--cache") +
    conditional(humdiv, "--humdiv") +
    conditional(regulatory, "--regulatory") +
    conditional(cell_type, "--cel_type") +
    conditional(phased, "--phased") +
    conditional(allele_number, "--allele_number") +
    conditional(numbers, "--numbers") +
    conditional(domains, "--domains") +
    conditional(no_escape, "--no_escape") +
    conditional(hgvs, "--hgvs") +
    conditional(protein, "--protein") +
    conditional(symbol, "--symbol") +
    conditional(ccds, "--ccds") +
    conditional(uniprot, "--uniprot") +
    conditional(tsl, "--tsl") +
    conditional(canonical, "--canonical") +
    conditional(biotype, "--biotype") +
    conditional(xref_refseq, "--xref_refseq") +
    conditional(check_existing, "--check_existing") +
    conditional(check_alleles, "--check_alleles") +
    conditional(check_svs, "--check_svs") +
    conditional(gmaf, "--gmaf") +
    conditional(maf_1kg, "--maf_1kg") +
    conditional(maf_esp, "--maf_esp") +
    conditional(pubmed, "--pubmed") +
    conditional(failed, "--failed") +
    conditional(vcf, "--vcf") +
    conditional(json, "--json") +
    conditional(gvf, "--gvf") +
    conditional(check_ref, "--check_ref") +
    conditional(coding_only, "--coding_only") +
    conditional(no_intergenic, "--no_intergenic") +
    conditional(pick, "--pick") +
    conditional(pick_allele, "--pick_allele") +
    conditional(flag_pick, "--flag_pick") +
    conditional(flag_pick_allele, "--flag_pick_allele") +
    conditional(per_gene, "--per_gene") +
    conditional(most_severe, "--most_severe") +
    conditional(summary, "--summary") +
    conditional(filter_common, "--filter_common") +
    conditional(check_frequency, "--check_frequency") +
    conditional(allow_non_variant, "--allow_non_variant") +
    conditional(database, "--database") +
    conditional(genomes, "--genomes") +
    conditional(gencode_basic, "--gencode_basic") +
    conditional(refseq, "--refseq") +
    conditional(merged, "--merged") +
    conditional(all_refseq, "--all_refseq") +
    conditional(lrg, "--lrg") +
    conditional(no_whole_genome, "--no_whole_genome") +
    conditional(skip_db_check, "--skip_db_check") +
    optional("--config", vep_config) +
    optional("--species", species) +
    optional("--assembly", assembly) +
    optional("--format", format) +
    optional("--dir", dir) +
    optional("--dir_cache", dir_cache) +
    optional("--dir_plugins", dir_plugins) +
    optional("--fasta", fasta) +
    optional("--sift", sift) +
    optional("--polyphen", polyphen) +
    optional("--custom", custom) +
    repeat("--plugin", plugin) +
    optional("--individual", individual) +
    optional("--fields", fields) +
    optional("--convert", convert) +
    optional("--terms", terms) +
    optional("--chr", chr) +
    optional("--pick_order", pick_order) +
    optional("--freq_pop", freq_pop) +
    optional("--freq_gt_lt", freq_gt_lt) +
    optional("--freq_filter", freq_filter) +
    optional("--filter", filter) +
    optional("--host", host) +
    optional("--user", user) +
    optional("--password", password) +
    optional("--registry", registry) +
    optional("--build", build) +
    optional("--compress", compress) +
    optional("--cache_region_size", cache_region_size) +
232
    optional("--fork", threads) +
Sander Bollen's avatar
Sander Bollen committed
233
234
235
236
237
238
239
    optional("--cache_version", cache_version) +
    optional("--freq_freq", freq_freq) +
    optional("--port", port) +
    optional("--db_version", db_version) +
    optional("--buffer_size", buffer_size)

}