-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariantView.js
More file actions
4681 lines (3579 loc) · 154 KB
/
Copy pathVariantView.js
File metadata and controls
4681 lines (3579 loc) · 154 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
The first function that gets called. We load a lot of data at the onset.
Information from the refgene database is loaded. Information from the uniprot
database is loaded. Variant data is also loaded at this time.
*/
// Pre-load - we do a lot of data loading on load.
window.onload = function() {
// Load the Refgene KB:
g_ref_gene = loadCSV("Knowledge_Bases/refGene.csv");
// Load the Uniprot KB:
g_uni_prot = load_uniprot_file("Knowledge_Bases/uniprotIDFTREFSEQ.dat");
// This might get moved around depending on if we let users load their own files.
// Load the variants:
load_variant_data();
// The raw variant data: variant_data_gl;
parse_variant_data_into_gene_objects();
gene_selection_display();
}
/*
The parse_variant_data_into_gene_objects function takes a variant data set, sorts by gene id, and places all variants for a particular gene id into
a particular gene id object.
*/
var gene_objects;
function parse_variant_data_into_gene_objects(){
gene_objects = [];
// Do this first, and then collect the ids into gene objects
var gene_id_index = ref_seq_id_index;
var found_list = [];
for(i = 0; i < variant_data_gl.length; i++){
var found = found_list.filter(function(val) {
return (val == variant_data_gl[i][gene_id_index]);
});
if(found.length == 0){
var gene_id_variants = variant_data_gl.filter(function(val) {
return (val[gene_id_index] == variant_data_gl[i][gene_id_index]);
});
var gene_object = new Object();
gene_object.gene_name = gene_id_variants[0][gene_name_index];
gene_object.gene_id = gene_id_variants[0][gene_id_index];
var aa_coords = [];
var aa_changes = [];
var gen_coords = [];
var var_objects = []; // have an object for each variant line - have to extend this to a long line.
for(j = 0; j < gene_id_variants.length; j++){
var current_aa_coord = gene_id_variants[j][aa_change_index]; // 70 in new file
aa_changes.push(current_aa_coord);
var aa_coord = Number(current_aa_coord.match(/\d+\.?\d*/g));
aa_coords.push(aa_coord);
var current_gen_coord = Number(gene_id_variants[j][genome_coord_index]);
gen_coords.push(current_gen_coord);
// The variant object stuff is to replace above:
var var_object = new Object();
var_object.aa_coord = aa_coord;
var_object.aa_change = current_aa_coord;
var_object.gen_coord = current_gen_coord;
var_object.var_entry = gene_id_variants[j];
var_objects.push(var_object);
}
// Time to do some sorting.
var sorting_aa_indices = [];
for(j = 0; j < aa_coords.length; j++){
var list = [j,aa_coords[j]];
sorting_aa_indices.push(list);
}
sorting_aa_indices.sort(function(a,b){
return a[1] - b[1];
});
var sorted_vars = [];
var sorted_aas = [];
var sorted_aa_changes = [];
var sorted_gen_coord_by_aa = [];
for(j = 0; j < aa_coords.length; j++){
var index = sorting_aa_indices[j][0];
sorted_aas.push(aa_coords[index]);
sorted_vars.push(gene_id_variants[index]);
sorted_aa_changes.push(aa_changes[index]);
sorted_gen_coord_by_aa.push(gen_coords[index]);
}
gene_id_variants = sorted_vars;
aa_coords = sorted_aas;
aa_changes = sorted_aa_changes;
gene_object.num_variants = gene_id_variants.length;
gene_object.variants = gene_id_variants;
gene_object.aa_coords = aa_coords;
gene_object.aa_changes = aa_changes;
gene_object.gen_coords = sorted_gen_coord_by_aa;
//calculate the hotspot
var unsorted_variants = gene_object.gen_coords;
sorted_variants = unsorted_variants.sort(function(a,b){
return a - b;
});
var groups = [];
var group = 0;
for(i = 0; i < sorted_variants.length; i++){
if(i==0 && i==sorted_variants.length-1){
group = 1;
groups.push(group);
}else if(i==0){
group = 1;
}else if(i==sorted_variants.length-1){
if((sorted_variants[i] - sorted_variants[i-1]) <=20){
group = group+1;
groups.push(group);
}else{
groups.push(group);
groups.push(1);
}
}else{
if((sorted_variants[i] - sorted_variants[i-1]) <=20){
group = group+1;
}else{
groups.push(group);
group = 1;
}
}
}
// Now get the max of these groups
var max = 0;
//alert("The groups: " + groups);
for(i = 0; i < groups.length; i++){
if(groups[i] > max){
max = groups[i];
}
}
gene_object.hotspot_score = max;
var sorted_var_object = var_objects.sort(function(a,b){
return a.gen_coord - b.gen_coord;
});
gene_object.variant_objects = sorted_var_object;
gene_objects.push(gene_object);
found_list.push(gene_id_variants[0][ref_seq_id_index]);
}
}
}
/*
The showAndClearField function is called by the VariantView.html file. This
function serves to take user gene input from the search box and query the data
set.
*/
function showAndClearField(form){
var gene_name_or_id = form.inputbox.value;
getCurrGeneSelection(gene_name_or_id);
}
/*
File indices:
We set the index for the column number in the flat file where each attribute
is located. These file column indices are for the variant data file.
*/
var patient_id_index = 0;
var genome_coord_index = 1;
var ref_base_index = 2;
var var_base_index = 3;
var dbSNP_129_index = 4;
var dbSNP_135_index = 5;
var dbSNP_137_index = 6;
var cosmic_index = 7;
var variant_type_index = 8;
var aa_change_index = 9;
var gene_name_index = 10;
var ref_seq_id_index = 11;
var filtered_variants;
function remove_current_variants(){
// Remove variant lines
remove = gene_model_display.selectAll(".variant_line_summ")
.data([], String);
remove.enter().append(".variant_line_summ")
;
remove.exit().remove();
// Remove variant circles
remove = gene_model_display.selectAll(".variant_circle_summ")
.data([], String);
remove.enter().append(".variant_circle_summ")
;
remove.exit().remove();
}
/* Query gene field - we use the entered gene to search (Gene or ID or both?) */
var variant_data_gl;
var variant_data_rs;
var chromosomes;
var query_gene_variants;
/*
For queries that don't use user input from text box but gene selection buttons.
*/
function getCurrGeneSelection(selection) {
// Here we are expecting the "NM_..."
// Need to support gene name as well!
// The refseq id is at 1; the gene name is at index 12
g_id_or_name = 0;
g_queryGene_name = selection;
// This was the file format from gerben and linda - do we want it to be different?
// First check whether it's an id or not
if(g_queryGene_name.indexOf("NM_" || "NR_") != -1){
// It's a gene id
g_id_or_name = 0;
}else{
// otherwise it's probably not...
g_id_or_name = 1;
}
// Length 65
// Remove all NA's
// Find the correct gene!
// Need to get all gene objects - same gene names, different transcripts
get_gene_object();
load_ref_gene_and_uniprot();
// Add the exome coord, exome screen coordinate, and exome number to the gene object.
add_transcript_info_to_gene_object();
data_parser(); // First time we draw variants
redraw_model();
gene_selection_display();
// Now show the alternative transcript buttons at the top of the screen.
// Back to the top of the screen for a moment
gene_model_display.append("text")
.text("Alternative Transcripts:")
.attr("x", 10)
.attr("y", 20)
.attr("font-family", "sans-serif")
.attr("font-size", "18px")
.attr("fill", "#666");
// Draw them!
var x_spacer_alt_trans = 0;
var y_spacer_alt_trans = 0;
for(i = 0; i < g_all_gene_objects.length; i ++){
gene_objects[i].gene_id;
var index = [i];
gene_model_display.append("text")
.text(g_all_gene_objects[i].gene_name + " (" + g_all_gene_objects[i].gene_id + ") ")
//.text(" gene-anon" + " (trans-anon) ")
.attr("class", "alt_trans_text" + i)
.attr("x", 10 +200 + x_spacer_alt_trans)
.attr("y", 20)
.attr("font-family", "sans-serif")
.attr("font-size", "12px")
.attr("fill", "#666");
gene_model_display
.data(index)
.append("rect")
.attr("class", "alt_trans_button" + i)
.attr("x", 10 +200 +x_spacer_alt_trans)
.attr("y", 5 + y_spacer_alt_trans) // was 25 use this for exons
.attr("width", 155)
.attr("height", 20) // Was 35 use this for exons
.attr("stroke-width", 1.5)
.attr("stroke", "#F0F0F0")
.attr("fill", "#F0F0F0")
.attr("fill-opacity", 0.0)
.attr("stroke-opacity", 1.0)
.on("mouseover",function(d) {
d3.select(this).style("fill", "#ddd");
d3.select(this).style("stroke", "#000000");
d3.select(this).style("stroke-opacity",1.0);
})
.on("mouseout",function(d) {
d3.select(this).style("fill", "#F0F0F0");
d3.select(this).style("stroke", "#F0F0F0");
d3.select(this).style("stroke-opacity",0.50);
})
.on("mousedown", function()
{ // Draw the alternative transcripts
d3.select(this).style("fill", "aliceblue");
})
.on("mouseup", function(d)
{
d3.select(this).style("fill", "#F0F0F0");
d3.select(this).style("stroke", "#F0F0F0");
d3.select(this).style("stroke-opacity",0.50);
getCurrGeneSelection(g_all_gene_objects[d].gene_id);
});
x_spacer_alt_trans += 155;
}
}
/*
The get_gene_object function retrieves a gene object and its variants from
the list of gene objects and returns it.
*/
var g_all_gene_objects;
function get_gene_object(){
// Get all of them
g_all_gene_objects = [];
if(g_id_or_name == 0){
// then it's an id
for(i = 0; i < gene_objects.length; i++){
if(g_queryGene_name == gene_objects[i].gene_id){
queried_gene_object = gene_objects[i];
}
}
// Now get all that fall under a gene name:
var gene_name = queried_gene_object.gene_name;
for(i = 0; i < gene_objects.length; i++){
if(gene_name == gene_objects[i].gene_name){
g_all_gene_objects.push(gene_objects[i]);
}
}
}else{
// else it's a name
for(i = 0; i < gene_objects.length; i++){
if(g_queryGene_name == gene_objects[i].gene_name){
g_all_gene_objects.push(gene_objects[i]);
queried_gene_object = gene_objects[i];
}
}
}
}
/*
The add_transcript_info_to_gene_object retrieves information from
transcript model for display.
*/
function add_transcript_info_to_gene_object(){
var transcript_model = new Object();
refgene_entry_parsing(); // Takes care of where genome coordinates land in exons and parsing refgene entry.
get_exome_position();
queried_gene_object.sense = transcript_sense;
// Correct the exome coordinates for the screen display (left to right with the correct sense)
for(i = 0; i < queried_gene_object.variant_objects.length; i ++){
var exon_coord = 0;
if(queried_gene_object.sense == "-"){
exon_coord = exon_model_length - queried_gene_object.variant_objects[i].exome_coord;
}else{
exon_coord = queried_gene_object.variant_objects[i].exome_coord;
}
queried_gene_object.variant_objects[i].exome_coord = exon_coord;
}
}
/*
This load_variant_data function loads the tab-separated text file that contains
your variant data. To change the name of the file, edit the string value of the
global variable "variant_file_name"
*/
var variant_file_name = "demo_data_set.txt"
var whitespace_removed_gl_var;
function load_variant_data(){
var gl_file = variant_file_name;
variant_data_gl = load_gl_("data_files/" + gl_file);
// remove the first line it's a header
variant_data_gl.splice(0,1);
return 1;
}
/*
Load function associated with the above load_variant_data function.
*/
function load_gl_(file) {
if (window.XMLHttpRequest) {
// IE7+, Firefox, Chrome, Opera, Safari
var request = new XMLHttpRequest();
}else{
// code for IE6, IE5
var request = new ActiveXObject('Microsoft.XMLHTTP');
}
// load
request.open('GET', file, false);
request.send();
return parse_gl_(request.responseText);
}
/*
The parse_gl_ function splits the data into an array of lines. The flat variant
text file becomes a 2 dimensional array.
*/
function parse_gl_(data){
//replace UNIX new lines
data = data.replace (/\r\n/g, "\n");
//replace MAC new lines
data = data.replace (/\r/g, "\n");
//split into rows
var rows = data.split("\n");
// create array which will hold our data:
var gl_data = [];
// loop through all rows
for (var i = 0; i < rows.length; i++){
// this line helps to skip empty rows
if (rows[i]) {
// our columns are separated by comma
// Each line is: "Sample ID, Pos ...."
var column = rows[i].split("\t");
gl_data.push(column);
}
}
return gl_data;
}
// Loads both refgene transcript model data and protein model data
function load_ref_gene_and_uniprot(){
var success_ref_gene = load_ref_gene();
if(success_ref_gene){
// Success! We're going to query for the protein model now!
var success = load_uni_prot();
if(success == 1){
//alert("Successfully loaded transcript and protein model");
return 1;
}else{
alert("No UniProt record available");
return 0;
}
}else{
return 0;
// Do nothing
}
return 0;
}
var g_ref_gene;
var g_ref_gene_entry;
var g_id_or_name;
/*
The load_ref_gene function uses a gene id to retrieve information from refseq
entry; these can include coordinates for exons.
*/
function load_ref_gene(){
g_ref_gene_entry = retrieve_refGene_entry_ID(queried_gene_object.gene_id);
if(g_ref_gene_entry == 0){
alert("Could Not Find RefGene ID: " + g_queryGene_name + " - Please Try Again");
return 0;
}else{
return 1;
}
return 1;
}
function retrieve_refGene_entry_ID(p_id){
var matching_refgene_transcripts = [];
if(g_id_or_name == 0){
for(i = 0; i < g_ref_gene.length; i++){
if((p_id == g_ref_gene[i][1]) && (g_ref_gene[i][2].indexOf('_') == -1)){
//alert(g_ref_gene[i][2]);
matching_refgene_transcripts.push(g_ref_gene[i]);
//return g_ref_gene[i];
}else{
// Have not found it yet
}
}
}else{
for(i = 0; i < g_ref_gene.length; i++){
// HACK!
if(g_ref_gene[i].indexOf(p_id) != -1){
matching_refgene_transcripts.push(g_ref_gene[i]);
//return g_ref_gene[i];
}else{
// Have not found it yet
}
}
}
for(j = 0; j < g_all_gene_objects.length; j++){
for(i = 0; i < g_ref_gene.length; i++){
if((g_all_gene_objects[j].gene_id == g_ref_gene[i][1]) && (g_ref_gene[i][2].indexOf('_') == -1)){
g_all_gene_objects[j].transcript_info = g_ref_gene[i];
// alert(g_all_gene_objects[j].transcript_info);
matching_refgene_transcripts.push(g_ref_gene[i]);
}else{
// Have not found it yet
}
}
}
//alert(g_all_gene_objects.length);
if(matching_refgene_transcripts.length == 0){
return 0;
}else{
return matching_refgene_transcripts[0];
}
}
var g_uni_prot;
var g_uni_prot_entry;
/*
This function retrieves associated uniprot information for the refseq id and
transcript.
*/
function load_uni_prot(){
//alert("Loading UniProt Knowledge Base - Click 'Okay'");
//g_uni_prot = load_uniprot_file("Knowledge_Bases/uniprotIDFTREFSEQ.dat");
g_uni_prot_entry = retrieve_uniprot_entry(queried_gene_object.gene_id);
if(g_uni_prot_entry == 0){
alert("No UniProt Record for: " + g_queryGene_name);
return 0;
}else{
//alert("Found Protein Model");
// Wipe the rest of uniprot from memory we don't need it
// g_uni_prot = [];
return 1;
}
return 1;
}
/*
The retrieve_uniprot_entry function is a helper function for the above uniprot
retrieval function.
*/
function retrieve_uniprot_entry(p_refSeqId){
var uni_prot_length = g_uni_prot.length;
// Need a "."!
p_refSeqId += ".";
for(i = 0; i < uni_prot_length; i++){
if(g_uni_prot[i].indexOf(p_refSeqId) != -1){
// We need to keep moving up to the next ID - this will ensure we
// get the whole record
g_uni_prot_entry = []
var index = 0;
// Remember to put "E" at end of file!
while(g_uni_prot[i + index][0] != "I"){
g_uni_prot_entry.push(g_uni_prot[i + index]);
index = index + 1;
}
return g_uni_prot_entry;
}else{
// Have not found it yet
}
}
return 0;
}
function load_uniprot_file(file){
if (window.XMLHttpRequest) {
// IE7+, Firefox, Chrome, Opera, Safari
var request = new XMLHttpRequest();
}
else {
// code for IE6, IE5
var request = new ActiveXObject('Microsoft.XMLHTTP');
}
// load
request.open('GET', file, false);
request.send();
return parse_uniprot(request.responseText);
}
function parse_uniprot(data){
//replace UNIX new lines
data = data.replace (/\r\n/g, "\n");
//replace MAC new lines
data = data.replace (/\r/g, "\n");
//split into rows
var rows = data.split("\n");
// create array which will hold our data:
dataProvider = [];
// loop through all rows
for (var i = 0; i < rows.length; i++){
// this line helps to skip empty rows
if (rows[i]) {
dataProvider.push(rows[i]);
}
}
return dataProvider;
}
var g_filtered_variant_list;
var gene_display_x_offset = 110;
var gene_display_y_offset = 0;
var amino_acid_detail_x_offset = 10;
/*
Screen dimensions. These could be changed based on user preferences.
*/
var screen_width_protein_model = 675;
var screen_width_gene_model = 675;
var recurrence_hist_width = 675;
var middle_pane_top_y_spacer = 50;
// Calls the drawing methods
function redraw_model(){
remove_all();
// Background outlines, text etc...
drawPermanentStructures();
drawExonSummaryView();
drawProteinSummaryView();
generate_variant_list();
}
// Create a blank canvas to draw on again
function remove_all(){
// removal
var remove = gene_model_display.selectAll("rect")
.data([], String);
remove.enter().append("rect")
;
remove.exit().remove();
remove = gene_model_display.selectAll("text")
.data([], String);
remove.enter().append("text")
;
remove.exit().remove();
remove = gene_model_display.selectAll("line")
.data([], String);
remove.enter().append("line")
;
remove.exit().remove();
remove = gene_model_display.selectAll("circle")
.data([], String);
remove.enter().append("circle")
;
remove.exit().remove();
remove = gene_model_display.selectAll("path")
.data([], String);
remove.enter().append("path")
;
remove.exit().remove();
}
// global to hold the name of the entered data set
var dataset_name;
var currentDataset;
var g_queryGene_name;
var gene_model;
// Holds Values of the Sliders
var quality_filter;
var depth_filter;
var rawData, // the raw data from the csv file
drawingData, // Data we don't want to display (dirty or it's type is unchecked)
currentDataset, // name of the current data set. Used to track when the data set changes.
gene_model_display,
compound_list_display,
detailed_list_display,
gene_model_display; // the visualization selection
// Holding our data!
var variantData;
var refGeneData;
var uniprotData;
function loadCSV(file) {
if (window.XMLHttpRequest) {
// IE7+, Firefox, Chrome, Opera, Safari
var request = new XMLHttpRequest();
}
else {
// code for IE6, IE5
var request = new ActiveXObject('Microsoft.XMLHTTP');
}
// load
request.open('GET', file, false);
request.send();
return parseCSV(request.responseText);
}
function parseCSV(data){
//replace UNIX new lines
data = data.replace (/\r\n/g, "\n");
//replace MAC new lines
data = data.replace (/\r/g, "\n");
//split into rows
var rows = data.split("\n");
// create array which will hold our data:
dataProvider = [];
// loop through all rows
for (var i = 0; i < rows.length; i++){
// this line helps to skip empty rows
if (rows[i]) {
// our columns are separated by comma
// Each line is: "Sample ID, Pos ...."
var column = rows[i].split(",");
dataProvider.push(column);
}
}
return dataProvider;
}
var transcriptStart;
var transcriptEnd;
var codingRegStart;
var codingRegEnd;
var numberOfExons;
var length_of_splice_site;
var total_number_splices;
var exonStarts;
var exonEnds;
var geneName;
// A lot of alt transcript stuff
var numberAltTranscripts;
// There should probably be some objec that holds all the meta data for the
// the alt trans and protein models.
var exon_splicesite_screencoords,exonLengthsScreen,bp_length_model;
// Function to filter and update the visualization based on controls
function filterDrawUpdate(){
}
var signals;
var whole_chains;
var domains;
var regions;
var compbiases;
var act_sites;
var metals;
var bindings;
var lipids;
var carbohyds;
var topo_domains;
var transmembranes;
var disulfides;
var zinc_fingers;
var np_bind;
var mod_res;
// Annotation for protein
var domain_info;
var topo_info;
var trans_info;
var aa_chain_info;
var region_info;
var comp_info;
var act_info;
var metal_info;
var binding_info;
var lipid_info;
var carb_info;
var disulf_info;
var signal_info;
var zingfing_info;
var npbind_info;
var modres_info;
var length_gene_model_splices_included;
var prot_annot_info;
// Called when we load a new data set - typically all new transcripts
// populate the model
var exon_lengths;
function data_parser(){
// Reset all the globals
signals = [];
whole_chains = [];
domains = [];
regions = [];
compbiases = [];
act_sites = [];
metals = [];
bindings = [];
lipids = [];
carbohyds = [];
topo_domains = [];
transmembranes = [];
disulfides = [];
zinc_fingers = [];
np_bind = [];
mod_res = [];
// Some annotations
domain_info = [];
topo_info = [];
trans_info = [];
aa_chain_info = [];
region_info = [];
comp_info = [];
act_info = [];
metal_info = [];
binding_info = [];
lipid_info = [];
carb_info = [];
disulf_info = [];
signal_info = [];
zingfing_info = [];
npbind_info = [];
modres_info = [];
for(i = 0; i < g_uni_prot_entry.length; i++){
if(g_uni_prot_entry[i].indexOf("CHAIN") != -1){
var interval = get_uniprot_FT_interval(g_uni_prot_entry[i]);
aa_chain_info.push(g_uni_prot_entry[i].substring(30,g_uni_prot_entry[i].length));
whole_chains.push(interval);
}else if(g_uni_prot_entry[i].indexOf("DOMAIN") != -1){
var interval = get_uniprot_FT_interval(g_uni_prot_entry[i]);
domain_info.push(g_uni_prot_entry[i].substring(30,g_uni_prot_entry[i].length));
domains.push(interval);
}else if(g_uni_prot_entry[i].indexOf("REGION") != -1){
var interval = get_uniprot_FT_interval(g_uni_prot_entry[i]);
region_info.push(g_uni_prot_entry[i].substring(30,g_uni_prot_entry[i].length));
regions.push(interval);
}else if(g_uni_prot_entry[i].indexOf("COMPBIAS") != -1){
var interval = get_uniprot_FT_interval(g_uni_prot_entry[i]);
comp_info.push(g_uni_prot_entry[i].substring(30,g_uni_prot_entry[i].length));
compbiases.push(interval);
}else if(g_uni_prot_entry[i].indexOf("ACT_SITE") != -1){
var interval = get_uniprot_FT_interval(g_uni_prot_entry[i]);