-
Notifications
You must be signed in to change notification settings - Fork 0
/
variantColor_plugin.js
111 lines (103 loc) · 6.21 KB
/
variantColor_plugin.js
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
;(function () {
class Plugin {
name = 'VariantColorPlugin'
version = '1.0'
install(pluginManager) {
pluginManager.jexl.addFunction('variantColor', f => {
if ('variant' in f && 'INFO' in f['variant'] && 'ANN' in f['variant']['INFO']) {
var ann = f['variant']['INFO']['ANN'][0].split('|')
var cons = ann[1]
if (cons.indexOf('&') > -1) {
cons = cons.substring(0,cons.indexOf('&'))
}
var color = 'peachpuff'
if(cons == 'frameshift_variant') {return '#9400D3';}
else if(cons == 'stop_lost') {return '#ff0000';}
else if(cons == '5_prime_UTR_premature_start_codon_gain_variant') {return '#7ac5cd';}
else if(cons == 'splice_acceptor_variant ') {return '#FF581A';}
else if(cons == 'protein_altering_variant') {return '#FF0080';}
else if(cons == 'coding_sequence_variant') {return '#458b00';}
else if(cons == 'stop_gained') {return '#ff0000';}
else if(cons == 'incomplete_terminal_codon_variant') {return '#ff00ff';}
else if(cons == 'transcript_ablation') {return '#ff0000';}
else if(cons == 'start_lost') {return '#ffd700';}
else if(cons == 'splice_donor_variant') {return '#FF581A';}
else if(cons == 'splice_region_variant') {return '#ff7f50';}
else if(cons == 'missense_variant') {return '#ffd700';}
else if(cons == 'inframe_deletion') {return '#ff69b4';}
else if(cons == 'inframer_insertion') {return '#ff69b4';}
else if(cons == '3_prime_UTR_variant') {return '#7ac5cd';}
else if(cons == 'synonymous_variant') {return '#76ee00';}
else if(cons == 'upstream_gene_variant') {return '#a2b5cd';}
else if(cons == 'downstream_gene_variant') {return '#a2b5cd';}
else if(cons == 'non_coding_transcript_exon_variant') {return '#32cd32';}
else if(cons == 'intron_variant') {return '#02599c';}
else if(cons == '5_prime_UTR_variant') {return '#7ac5cd';}
else if(cons == 'stop_retained_variant') {return '#76ee00';}
else if(cons == 'intergenic_variant') {return '#636363';}
else if(cons == 'non_coding_transcript_variant') {return '#32cd32';}
else if(cons == 'non_coding_exon_variant') {return '#7ac5cd';}
return color;
}
else {
return 'black'
}
})
}
configure(pluginManager) {}
}
// the plugin will be included in both the main thread and web worker, so
// install plugin to either window or self (webworker global scope)
;(typeof self !== 'undefined' ? self : window).JBrowsePluginVariantColorPlugin =
{
default: Plugin,
}
})()
/*
const Plugin = JBrowseExports['@jbrowse/core/Plugin']
export default class VariantColor extends Plugin {
name = 'VariantColorPlugin'
install(pluginManager) {
pluginManager.jexl.addFunction('variantColor', (f) => {
if (f['variant']['INFO']['ANN']) {
var ann = f['variant']['INFO']['ANN'][0].split('|')
var cons = ann[1]
if (cons.indexOf('&') > -1) {
cons = cons.substring(0,cons.indexOf('&'))
}
var color = 'peachpuff'
if(cons == 'frameshift_variant') {return '#9400D3';}
else if(cons == 'stop_lost') {return '#ff0000';}
else if(cons == '5_prime_UTR_premature_start_codon_gain_variant') {return '#7ac5cd';}
else if(cons == 'splice_acceptor_variant ') {return '#FF581A';}
else if(cons == 'protein_altering_variant') {return '#FF0080';}
else if(cons == 'coding_sequence_variant') {return '#458b00';}
else if(cons == 'stop_gained') {return '#ff0000';}
else if(cons == 'incomplete_terminal_codon_variant') {return '#ff00ff';}
else if(cons == 'transcript_ablation') {return '#ff0000';}
else if(cons == 'start_lost') {return '#ffd700';}
else if(cons == 'splice_donor_variant') {return '#FF581A';}
else if(cons == 'splice_region_variant') {return '#ff7f50';}
else if(cons == 'missense_variant') {return '#ffd700';}
else if(cons == 'inframe_deletion') {return '#ff69b4';}
else if(cons == 'inframer_insertion') {return '#ff69b4';}
else if(cons == '3_prime_UTR_variant') {return '#7ac5cd';}
else if(cons == 'synonymous_variant') {return '#76ee00';}
else if(cons == 'upstream_gene_variant') {return '#a2b5cd';}
else if(cons == 'downstream_gene_variant') {return '#a2b5cd';}
else if(cons == 'non_coding_transcript_exon_variant') {return '#32cd32';}
else if(cons == 'intron_variant') {return '#02599c';}
else if(cons == '5_prime_UTR_variant') {return '#7ac5cd';}
else if(cons == 'stop_retained_variant') {return '#76ee00';}
else if(cons == 'intergenic_variant') {return '#636363';}
else if(cons == 'non_coding_transcript_variant') {return '#32cd32';}
else if(cons == 'non_coding_exon_variant') {return '#7ac5cd';}
return color;
}
else {
return 'black'
}
})
}
}
*/