-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextendProtVista.bundle.js
2045 lines (1828 loc) · 68 KB
/
extendProtVista.bundle.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
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
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";
var add_asa_residues = function (_n){
var asa_res = null;
if( !imported_flag && top.asa_residues ){
var n_model = top.n_model_main_frame-1;
if(_n)n_model = _n-1;
var asa_res = ["RESIDUE_ASA",[]];
var n = 1;
for(var i = 0;i<__alignment.uniprotLength+1;i++){
var __f = { type: "VARIANT", pos: i, variants: [] };
asa_res[1].push(__f);
n++;
}
var chain = JSON.parse( getParameterByName('alignment') )['chain'];
if(top.asa_residues[n_model][chain]){
var n = 0;
top.asa_residues[n_model][chain].forEach(function(i){
var r = parseInt(i[1]*255);
if(r>255)r=255;
var b = 255-r;
if(b<0)b = 0;
var color = 'rgb('+r+',0,'+b+')';
var rasa = parseFloat(i[1]*100).toFixed(2);
if(asa_res[1][ parseInt(i[0]) ]){
asa_res[1][ parseInt(i[0]) ].variants = [{ color:color,
alternativeSequence:'',
type:'measure',
begin: i[0],
end: i[0],
score:i[1],
internalId:'asa_'+n,
description:'<b style=\"color:grey;\">Relative accessible surface area</b><br/>Residue accesibility '+rasa+'%'
}];
}
n++;
});
}
}
return asa_res;
};
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
module.exports = add_asa_residues;
},{}],2:[function(require,module,exports){
"use strict";
var add_binding_residues = function(_n){
var b_res = null;
if( !imported_flag && top.binding_residues && top.binding_residues[0] > 0 ){
var n_model = top.n_model_main_frame;
if(_n) n_model = _n;
b_res = ["INTERACTING_RESIDUES",[]];
var n = 1;
for(var i = 0;i<top.binding_residues[0];i++){
var __f = {begin:(-100-1*i),end:(-100-1*i),internalId:'bs_'+n,type:'INTERACTING_RESIDUES',description:'<b style=\"color:grey;\">Binding Site</b><br/>Region that interacts with other proteins in the complex'};
b_res[1].push(__f)
n++;
}
var chain = JSON.parse( getParameterByName('alignment') )['chain'];
var n = 0;
if(top.binding_residues[n_model][chain]){
top.binding_residues[n_model][chain].forEach(function(i){
b_res[1][n].begin = i.begin;
b_res[1][n].end = i.end;
n++;
});
}else{
b_res = null;
}
}
return b_res;
};
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
module.exports = add_binding_residues;
},{}],3:[function(require,module,exports){
"use strict";
var add_biomuta = function(__d){
var d = __d[0][1];
var n = 1;
if(__external_data['biomuta']){
__external_data['biomuta'].forEach(function(i){
if( !d[ i['start'] ] ) return;
var __aux = jQuery.grep(d[ i['start'] ]['variants'],function(j){ return(j['alternativeSequence']==i['variation']) });
var __mut = __aux[0];
if( __mut ){
if(__mut.sourceType=="large_scale_study") __mut["color"] = "#FF0000";
if(!__mut['association'])__mut['association']=[];
var __src = __mut['association'];
var __pubmed = i['evidence'][0]['references'][0].substr(7);
var __name = i['disease'];
if(i['disease'].indexOf("/")>-1){
__name = i['disease'].substr(i['disease'].indexOf("/")+2).split(" \[")[0]
}
__name = __name.charAt(0).toUpperCase() + __name.slice(1);
var __polyphen = " - "+i['polyphen'].replace("possibly","probably");
var __aux = jQuery.grep(__src,function(k){return(k['name']==__name)});
var url = 'http://www.ncbi.nlm.nih.gov/pubmed/'+__pubmed;
var link_name = __pubmed;
if(__pubmed == "null"){
url = "https://hive.biochemistry.gwu.edu/biomuta/proteinview/"+__accession;
link_name = __accession;
}
if(__aux.length==0 && __pubmed.indexOf(';')<0 ) __src.push({
disease:true,
name:__name,
xrefs:[{id:link_name,name:'BioMuta DB'+__polyphen,url:url}]
});
if(__mut['association'].length == 0) __mut['association'] = null;
}else{
variants_extended = true;
var __new_mut = {
internalId:"bm_"+n,
type: "VARIANT",
sourceType:"large_scale_study",
wildType: i['original'],
alternativeSequence:i['variation'],
begin:i['start'],
end:i['start'],
association:[],
color:"#FF0000"
};
var __src = __new_mut['association'];
var __pubmed = i['evidence'][0]['references'][0].substr(7);
var __name = i['disease'];
if(i['disease'].indexOf("/")>-1){
__name = i['disease'].substr(i['disease'].indexOf("/")+2).split(" \[")[0]
}
__name = __name.charAt(0).toUpperCase() + __name.slice(1);
var __polyphen = " - "+i['polyphen'].replace("possibly","probably");
var __aux = jQuery.grep(__src,function(k){return(k['name']==__name)});
var url = 'http://www.ncbi.nlm.nih.gov/pubmed/'+__pubmed;
var link_name = __pubmed;
if(__pubmed == "null"){
url = "https://hive.biochemistry.gwu.edu/biomuta/proteinview/"+__accession;
link_name = __accession;
}
if(__aux.length==0 && __pubmed.indexOf(';')<0 ) __src.push({
disease:true,
name:__name,
xrefs:[{id:link_name,name:'BioMuta DB'+__polyphen,url:url}]
});
if( __pubmed.indexOf(';')<0 ) d[ i['start'] ]['variants'].push( __new_mut );
n++;
}
});
}
};
module.exports = add_biomuta;
},{}],4:[function(require,module,exports){
"use strict";
var add_coverage = function(d){
var n = 1;
if(__external_data['coverage'] && __external_data['coverage']['Structure coverage']){
var __coverage = ["STRUCTURE_COVERAGE",[]]
__external_data['coverage']['Structure coverage'].forEach(function(i){
__coverage[1].push({begin:i['start'],end:i['end'],description:'Sequence segment covered by the structure',internalId:'coverage_'+n,type:'region'});
n++;
});
d.push( __coverage );
}
};
module.exports = add_coverage;
},{}],5:[function(require,module,exports){
"use strict";
var add_dbptm = function(d){
var n = 1;
if(__external_data['dbptm']){
var __ptm = ["PTM",[]];
var __ptm_flag = 1;
d.forEach(function(i){
if(i[0]=="PTM"){
__ptm = i;
__ptm_flag = 0;
}
});
__external_data['dbptm'].forEach(function(i){
var __aux = jQuery.grep(__ptm[1],function(e){ return (e.begin == i['start'] && e.end == i['end']); });
if( __aux.length > 0 ){
var __flag = null;
__aux.forEach(function(j){
var i_t = i['type'].toLowerCase();
var j_t = j['description'].toLowerCase();
if(
( i_t == j_t ) ||
( i_t.indexOf("phospho")>-1 && j_t.indexOf("phospho")>-1 ) ||
( i_t.indexOf("nitros")>-1 && j_t.indexOf("nitros")>-1 ) ||
( i_t.indexOf("palmi")>-1 && j_t.indexOf("palmi")>-1 ) ||
( i_t.indexOf("methyl")>-1 && j_t.indexOf("methyl")>-1 ) ||
( i_t.indexOf("ubiquit")>-1 && j_t.indexOf("ubiquit")>-1 ) ||
( i_t.indexOf("acetyl")>-1 && j_t.indexOf("acetyl")>-1 ) ||
( i_t.indexOf("glyco")>-1 && j_t.indexOf("glcnac")>-1 ) ||
( i_t.indexOf("sumo")>-1 && j_t.indexOf("sumo")>-1 )||
( (i_t.indexOf("prenyl")>-1 || i_t.indexOf("farnesyl")>-1) && (j_t.indexOf("prenyl")>-1 || j_t.indexOf("farnesyl")>-1) )
){
__flag = j;
}
});
if(__flag){
var __aux = jQuery.grep(__ptm[1],function(e){ return (e.begin == i['start'] && e.end == i['end']); });
if( ! __flag['evidences'] ) __flag['evidences']={};
if( ! __flag['evidences']['ECO:0000269'] ) __flag['evidences']['ECO:0000269']=[];
var __evs = __flag['evidences']['ECO:0000269'];
var pubmed_ids = i['evidences'].split(";");
pubmed_ids.forEach(function(ii){
var __ids = jQuery.grep(__evs,function(e){ return ( ii == e['id'] ); });
if(__ids.length == 0) __evs.push({
id:ii,
name:'PubMed',
url:'http://www.ncbi.nlm.nih.gov/pubmed/'+ii,
alternativeUrl:'http://europepmc.org/abstract/MED/'+ii
});
});
}else{
var __d = {
begin:i['start'],
end:i['end'],
description:i['type'],
internalId:'dbptm_'+n,
type:'MOD_RES',
evidences:{
'ECO:0000269':[]
}
};
var __evs = __d['evidences']['ECO:0000269'];
var pubmed_ids = i['evidences'].split(";");
pubmed_ids.forEach(function(ii){
var __ids = jQuery.grep(__evs,function(e){ return ( ii == e['id'] ); });
if(__ids.length == 0) {
__d['evidences']['ECO:0000269'].push({
id:i['evidences'],
name:'PubMed',
url:'http://www.ncbi.nlm.nih.gov/pubmed/'+i['evidences'],
alternativeUrl:'http://europepmc.org/abstract/MED/'+i['evidences']
});
}
});
__ptm[1].push(
__d
);
n++;
}
}else{
var __d = {
begin:i['start'],
end:i['end'],
description:i['type'],
internalId:'dbptm_'+n,
type:'MOD_RES',
evidences:{
'ECO:0000269':[]
}
};
var __evs = __d['evidences']['ECO:0000269'];
var pubmed_ids = i['evidences'].split(";");
pubmed_ids.forEach(function(ii){
var __ids = jQuery.grep(__evs,function(e){ return ( ii == e['id'] ); });
if(__ids.length == 0) __d['evidences']['ECO:0000269'].push({
id:i['evidences'],
name:'PubMed',
url:'http://www.ncbi.nlm.nih.gov/pubmed/'+i['evidences'],
alternativeUrl:'http://europepmc.org/abstract/MED/'+i['evidences']
});
});
__ptm[1].push(
__d
);
n++;
}
});
if(__ptm_flag)d.push( __ptm );
}
};
module.exports = add_dbptm;
},{}],6:[function(require,module,exports){
"use strict";
var add_dsysmap = function (data,d){
data.forEach(function(i){
if( !d[ i['start'] ] ) return;
var _aux = jQuery.grep(d[ i['start']] ['variants'],function(j){ return(j['alternativeSequence']==i['variation']) });
var _mut = _aux[0];
if( _mut ){
if(_mut.sourceType=="large_scale_study") _mut["color"] = "#FF0000";
if(!_mut['association'])_mut['association']=[];
var _src = _mut['association'];
var _name = i['disease']['text'];
_src.push({
disease:true,
name:_name,
xrefs:[{id:__accession,name:'dSysMap DB',url:'http://dsysmap.irbbarcelona.org/results.php?type=proteins&neigh=0&value='+__accession}]
});
}
});
};
module.exports = add_dsysmap;
},{}],7:[function(require,module,exports){
"use strict;"
var add_elmdb = function(data){
var n = 1;
var _elm = [];
data.forEach(function(i){
var _description = 'Short linear motif ('+i['description'][0]['Regex']+')';
var _ext_des = {};
i['interactions'].forEach(function(j){
var key = '<b>Interactor:</b> '+j['interactorDomain']+' <b>Domain:</b> '+j['Domain'];
if(j['StartDomain'] != 'None' && j['StopDomain'] != 'None'){
key += ' <b>Start:</b> '+j['StartDomain']+' <b>End:</b> '+j['StopDomain']+'<br/>';
}else{
key += '<br/>'
}
_ext_des[key] = true;
});
var _ext = Object.keys(_ext_des);
if(_ext.length>0)_description = _description+'<br/>'+_ext.join("");
var _f = {begin:i['Start'],end:i['End'],description:_description,internalId:'elm_'+n,type:'region',evidences:
{
"Imported information":[{url:'http://elm.eu.org/elms/'+i['ELMIdentifier'],id:i['ELMIdentifier'],name:'Imported from ELM'}]
}
}
_f['evidences']['ECO:0000269'] = [];
i['References'].split(" ").forEach(function(j){
_f['evidences']['ECO:0000269'].push({
id:j,
name:'PubMed',url:'http://www.ncbi.nlm.nih.gov/pubmed/'+j,
alternativeUrl:'http://europepmc.org/abstract/MED/'+j
});
});
_f['type'] = 'LINEAR_MOTIF'
_elm.push(_f);
n++;
});
return _elm;
};
module.exports = add_elmdb;
},{}],8:[function(require,module,exports){
"use strict";
var uniprot_link = {
'DOMAINS_AND_SITES':'family_and_domains',
'MOLECULE_PROCESSING':'ptm_processing',
'DOMAIN':'domainsAnno_section',
'REGION':'Region_section',
'BINDING':'sitesAnno_section',
'PROPEP':'peptides_section',
'CHAIN':'peptides_section',
'CARBOHYD':'aaMod_section',
'DISULFID':'aaMod_section',
'MOD_RES':'aaMod_section',
'CROSSLNK':'aaMod_section',
'LIPID':'aaMod_section',
'CONFLICT':'Sequence_conflict_section',
'NP_BIND':'regionAnno_section',
'MOTIF':'Motif_section',
'REPEAT':'domainsAnno_section',
'METAL':'sitesAnno_section',
'DNA_BIND':'regionAnno_section',
'SITE':'Site_section',
'SIGNAL':'sitesAnno_section',
'ACT_SITE':'sitesAnno_section'
};
var add_evidences = function(d){
d.forEach(function(i){
i[1].forEach(function(j){
if( !('evidences' in j) ){
//console.log( j['type']+"=>"+uniprot_link[ j['type'] ]);
j['evidences'] = {"Imported information":[{url:'http://www.uniprot.org/uniprot/'+__accession+'#'+uniprot_link[ j['type'] ],id:__accession,name:'Imported from UniProt'}]};
}else{
for(var k in j['evidences']){
j['evidences'][k].forEach(function(l){
//console.log( j['type']+"=>"+uniprot_link[ j['type'] ]);
if( l == undefined ){
j['evidences'][k] = [{url:'http://www.uniprot.org/uniprot/'+__accession+'#'+uniprot_link[ j['type'] ],id:__accession,name:'Imported from UniProt'}];
}
});
}
}
});
});
};
module.exports = add_evidences;
},{}],9:[function(require,module,exports){
"use strict";
var add_iedb = function(d){
var n = 1;
var m = 0;
if(__external_data['iedb']){
var count = {}
var __epitopes = ["EPITOPES",[]];
var type = "LINEAR_EPITOPE";
var tag = 0;
__external_data['iedb'].forEach(function(i){
for(var j=i['start'];j<=i['end'];j++){
if(j in count){
count[j]++;
}else{
count[j]=1;
}
if(count[j]>m)m=count[j];
}
__epitopes[1].push({color:'#83BE00',type:type,begin:i['start'],end:i['end'],description:'Linear epitope',internalId:'iedb_'+n,evidences:
{
"Imported information":[{url:'http://www.iedb.org/epitope/'+i['evidence'],id:i['evidence'],name:'Imported from IEDB'}]
}
});
n++;
if(m>3){
m = 0;
count = {};
tag++;
type = "LINEAR_EPITOPE_"+tag;
}
});
d.push( __epitopes );
}
};
module.exports = add_iedb;
},{}],10:[function(require,module,exports){
"use strict";
var add_interpro = function (data){
var n = 1;
var _interpro = [];
data.forEach(function(i){
var k = i['description']['name'];
var _description = '<b>'+k+'</b>';
var _ext = '';
if( i['description']['go'] ){
_ext = '<b style="color:grey;">GO terms</b><br/>'
i['description']['go'].forEach(function(j){
var r = j.split(' ; ');
var go = r[0].replace("GO:","");
go = go[0].toUpperCase() + go.slice(1);
_ext += "<a href=\"http://amigo.geneontology.org/amigo/term/"+r[1]+"\" target=\"_blank\">"+go+"</a><br/>";
});
}
if( _ext.length > 0 ) _description += '<br/>'+_ext;
var _f = {begin:i['start'],end:i['end'],description:_description,internalId:'interpro_'+n,type:'INTERPRO_DOMAIN',evidences:
{
"Imported information":[{url:'https://www.ebi.ac.uk/interpro/protein/'+__accession,id:__accession,name:'Imported from InterPro'}]
}
}
_interpro.push(_f);
n++;
});
return _interpro;
};
module.exports = add_interpro;
},{}],11:[function(require,module,exports){
"use strict";
var add_mobi = function(_data, dom_sites){
var data = _data['disorder'];
var n = 1;
var _disorder = [];
var _lips = []
var _flag = false;
for(var i in data){
var _type = i.toUpperCase();
data[i].forEach(function(j){
var _des = "";
if(j['method']!="full")_des = " - Inferred from "+j['method'];
_disorder.push({type:_type,begin:j['start'],end:j['end'],description:'Disordered region'+_des,internalId:'mobi_'+n,evidences:
{
"Imported information":[{url:'http://mobidb.bio.unipd.it/entries/'+__accession, id:__accession, name:'Imported from MobyDB'}]
}
});
n++;
_flag = true;
});
}
var data = _data['lips'];
for(var i in data){
var sub_type = i.toUpperCase();
data[i].forEach(function(j){
var new_flag = true;
/*dom_sites.forEach(function(d){
if( d['type']=="LINEAR_MOTIF" && parseInt(d["begin"]) == j["start"] && parseInt(d["end"]) == j["end"]){
new_flag = false;
}
});*/
if(new_flag){
_lips.push({type:"LINEAR_INTERACTING_PEPTIDE",begin:j['start'],end:j['end'],description:'Interacting peptide region',internalId:'mobi_'+n, evidences:
{
"Imported information":[{url:'http://mobidb.bio.unipd.it/entries/'+__accession, id:__accession, name:'Imported from MobyDB'}]
}
});
n++;
_flag = true;
}
});
}
var data = _data['lips'];
return [_disorder,_lips];
};
module.exports = add_mobi;
},{}],12:[function(require,module,exports){
"use strict";
var highlight_all = require('./highlight_all');
var add_highlight_all = highlight_all.add_highlight_all;
var add_molprobity = function(){
var $LOG = { 'protein':{}, 'gene':{}, 'interaction:':{} };
if(top.$LOG){
$LOG = top.$LOG;
}
var alignment = JSON.parse(getParameterByName("alignment"));
var pdb = alignment['pdb'];
if(!pdb){
console.log("%c /compute/molprobity/<PDB> PDB code is null", 'color:red;');
$LOG.protein['molprobity'] = {
'description':'Computing ASA and binding sites data',
'command':'GET '+interface_url,
'status':'error',
'error': '/compute/molprobity/<PDB> PDB code is null',
'cost':'NA'
};
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']--;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
return;
}
var path = null;
if('path' in alignment){
path = alignment['path'];
}
if( top.$COMPUTED_FEATURES[pdb] && top.$COMPUTED_FEATURES[pdb]['molprobity'] ){
var n_model = top.n_model_main_frame-1;
var chain = JSON.parse( getParameterByName('alignment') )['chain'];
if( top.$COMPUTED_FEATURES[pdb]['molprobity'] ){
var data = [];
var rama = top.$COMPUTED_FEATURES[pdb]['molprobity']['rama'][n_model][chain]
if(rama && rama.length >0) data = data.concat(rama);
var omega = top.$COMPUTED_FEATURES[pdb]['molprobity']['omega'][n_model][chain]
if(omega && omega.length >0) data = data.concat(omega);
var rota= top.$COMPUTED_FEATURES[pdb]['molprobity']['rota'][n_model][chain]
if(rota && rota.length >0) data = data.concat(rota);
if(data && data.length >0){
var molprobity = ["MOLPROBITY",data];
feature_viewer.drawCategories([molprobity],feature_viewer);
feature_viewer.data.push(molprobity);
add_highlight_all();
}
}
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']--;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
}else{
var url = "/compute/molprobity/"+pdb;
if(path){
url = "/compute/molprobity/"+path;
}
$LOG.protein['molprobity'] = {
'description':'Computing ASA and binding sites data',
'command':'GET '+url,
'status':'running'
};
url = encodeURI(url);
console.log("%c Loading "+url, 'color:#c60;');
var t1 = performance.now();
var recursive_get = function(){
$j.ajax({
url: url,
dataType: 'json',
success: function(data){
if(data['status']=='complete'){
if(!top.$COMPUTED_FEATURES[pdb]) top.$COMPUTED_FEATURES[pdb] = {};
top.$COMPUTED_FEATURES[pdb]['molprobity'] = data;
var n_model = top.n_model_main_frame-1;
var chain = JSON.parse( getParameterByName('alignment') )['chain'];
var data =[];
var rama = top.$COMPUTED_FEATURES[pdb]['molprobity']['rama'][n_model][chain]
if(rama && rama.length >0) data = data.concat(rama);
var omega = top.$COMPUTED_FEATURES[pdb]['molprobity']['omega'][n_model][chain]
if(omega && omega.length >0) data = data.concat(omega);
var rota= top.$COMPUTED_FEATURES[pdb]['molprobity']['rota'][n_model][chain]
if(rota && rota.length >0) data = data.concat(rota);
if(data && data.length >0){
var molprobity = ["MOLPROBITY",data];
try{
feature_viewer.drawCategories([molprobity],feature_viewer);
feature_viewer.data.push(molprobity);
add_highlight_all();
$LOG.protein['molprobity']['status'] = 'success';
}catch(err){
console.log(err);
$LOG.protein['molprobity']['status'] = 'error';
}
}
var t2 = performance.now();
var time_ = (t2-t1)/1000;
$LOG.protein['molprobity']['cost'] = time_.toString().substring(0,4);
console.log("%c Finished "+url+" "+time_.toString().substring(0,4)+"s", 'color:green;');
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']--;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
}else if(data['status']=='error'){
$LOG.protein['molprobity']['status'] = 'error';
var t2 = performance.now();
var time_ = (t2-t1)/1000;
$LOG.protein['molprobity']['cost'] = time_.toString().substring(0,4);
console.log("%c Finished "+url+" "+time_.toString().substring(0,4)+"s", 'color:red;');
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']--;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
}else{
setTimeout(function(){ recursive_get(); }, 5000);
}
},
error: function(){
$LOG.protein['molprobity']['status'] = 'error';
var t2 = performance.now();
var time_ = (t2-t1)/1000;
$LOG.protein['molprobity']['cost'] = time_.toString().substring(0,4);
console.log("%c Finished "+url+" "+time_.toString().substring(0,4)+"s", 'color:red;');
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']--;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
}
});
}
recursive_get();
}
};
function remove_loading_icon(){
$j("#annotations_loading_icon").remove();
}
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
module.exports = add_molprobity;
},{"./highlight_all":27}],13:[function(require,module,exports){
"use strict";
var add_pdb_redo = new function(){
var self = this;
self.load = function(data){
return data;
};
self.save = function(data,pdb_chain,global_external_pdb_chain){
var pdb = pdb_chain.slice(0, -2);
var ch = pdb_chain.substr(pdb_chain.length - 1);
if( !(pdb+":"+ch in global_external_pdb_chain) )global_external_pdb_chain[pdb+":"+ch]={};
global_external_pdb_chain[pdb+":"+ch]['pdb_redo'] = data[ch];
return global_external_pdb_chain[pdb_chain]['pdb_redo'];
};
};
module.exports = add_pdb_redo;
},{}],14:[function(require,module,exports){
"use strict";
var add_pfam = function(data){
var n = 1;
var _pfam = [];
data.forEach(function(i){
var _description = '<b>'+i['info']['description']+'</b>';
_description += '<br/><b style="color:grey;">Family</b>: '+i['acc']
var _ext = '';
for(var k in i['info']['go']){
_ext += '<b style="color:grey;">'+k[0].toUpperCase() + k.slice(1)+'</b>: ';
i['info']['go'][k].forEach(function(j){
_ext += j+', ';
});
_ext = _ext.slice(0, -2)+'<br/>';
}
if( _ext.length > 0 ) _description += '<br/>'+_ext;
var _f = {begin:i['start'],end:i['end'],description:_description,internalId:'pfam_'+n,type:'PFAM_DOMAIN',evidences:
{
"Imported information":[{url:'http://pfam.xfam.org/protein/'+__accession,id:__accession,name:'Imported from Pfam'}]
}
}
_pfam.push(_f);
n++;
});
return _pfam;
};
module.exports = add_pfam;
},{}],15:[function(require,module,exports){
"use strict";
var add_phosphosite = function(d){
var n = 1;
if(__external_data['phosphosite']){
var __ptm = ["PTM",[]];
var __sites = ["DOMAINS_AND_SITES",[]];
var __ptm_flag = 1;
var __sites_flag = 1;
d.forEach(function(i){
if(i[0]=="PTM"){
__ptm = i;
__ptm_flag = 0;
}
if(i[0]=="DOMAINS_AND_SITES"){
__sites = i;
__sites_flag = 0;
}
});
__external_data['phosphosite'].forEach(function(i){
if( i['subtype'] == "Regulatory site" || i['subtype'] == "Sustrate-Kinase interaction" || i['subtype'] == "Diseases-associated site" ){
var __aux = i['description'].split(";;");
var __description = "<b style=\"color:grey;\">"+i['subtype']+"</b> <br>";
__aux.forEach(function(k){
var __r = k.split(":");
if( __r[1] && __r[1].length>1 )__description += "<b style=\"color:grey;\">"+ __r[0]+"</b>: "+__r[1].replace("("," (")+". <br>";
});
__description.substring(0, __description.length - 4);
var __label = 'SITE';
if(i['subtype'] == "Sustrate-Kinase interaction"){
__label = 'BINDING';
}
var __aux = jQuery.grep(__sites[1],function(e){ return (e.begin == i['start'] && e.end == i['end']); });
if( __aux.length > 0 ){
__aux[0]['description'] += "<hr/>"+__description;
var __evd = [];
try{
var import_inf = __aux[0]['evidences']['Imported information'];
__evd = jQuery.grep(import_inf,function(e){return (e["name"].indexOf("PhosphoSitePlus")!=-1);});
}catch(err){
if(!'evidences' in __aux[0]){
__aux[0]['evidences'] = {};
__aux[0]['evidences']['Imported information']=[];
}else{
__aux[0]['evidences']['Imported information']=[];
}
console.log(err);
}
if(__evd.length == 0){
__aux[0]['evidences']["Imported information"].push({
url:'http://www.phosphosite.org/uniprotAccAction.do?id='+__accession,id:__accession,name:'Imported from PhosphoSitePlus'
});
}
}else{
__sites[1].push({begin:i['start'],end:i['end'],description:__description,internalId:'ppsp_'+n,type:__label,evidences:
{
"Imported information":[{url:'http://www.phosphosite.org/uniprotAccAction.do?id='+__accession,id:__accession,name:'Imported from PhosphoSitePlus'}]
}
});
}
n++;
}else{
var __aux = jQuery.grep(__ptm[1],function(e){ return (e.begin == i['start'] && e.end == i['end']); });
if( __aux.length > 0 ){
var __flag = null;
__aux.forEach(function(j){
var i_t = i['subtype'].toLowerCase();
var j_t = j['description'].toLowerCase();
if( (i_t == j_t) ||
(i_t.indexOf("phospho")>-1 && j_t.indexOf("phospho")>-1)||
(i_t.indexOf("glcnac")>-1 && j_t.indexOf("glcnac")>-1)||
(i_t.indexOf("nitros")>-1 && j_t.indexOf("nitros")>-1)||
(i_t.indexOf("palmi")>-1 && j_t.indexOf("palmi")>-1)||
(i_t.indexOf("methyl")>-1 && j_t.indexOf("methyl")>-1)||
(i_t.indexOf("ubiquit")>-1 && j_t.indexOf("ubiquit")>-1)||
(i_t.indexOf("acetyl")>-1 && j_t.indexOf("acetyl")>-1)||
(i_t.indexOf("glyco")>-1 && j_t.indexOf("glcnac")>-1)||
(i_t.indexOf("sumo")>-1 && j_t.indexOf("sumo")>-1)||
((i_t.indexOf("prenyl")>-1 || i_t.indexOf("farnesyl")>-1) && (j_t.indexOf("prenyl")>-1 || j_t.indexOf("farnesyl")>-1))
){
__flag = j;
}
});
if(__flag){
var __aux = jQuery.grep(__ptm[1],function(e){ return (e.begin == i['start'] && e.end == i['end']); });
if( ! __flag['evidences']) __flag['evidences'] = {};
if( ! __flag['evidences']["Imported information"] ) __flag['evidences']["Imported information"]=[];
__flag['evidences']["Imported information"].push(
{url:'http://www.phosphosite.org/uniprotAccAction.do?id='+__accession,id:__accession,name:'Imported from PhosphoSitePlus'}
);
}else{
__ptm[1].push({begin:i['start'],end:i['end'],description:i['subtype'],internalId:'ppsp_'+n,type:'MOD_RES',evidences:
{
"Imported information":[{url:'http://www.phosphosite.org/uniprotAccAction.do?id='+__accession,id:__accession,name:'Imported from PhosphoSitePlus'}]
}
});
n++;
}
}else{
__ptm[1].push({begin:i['start'],end:i['end'],description:i['subtype'],internalId:'ppsp_'+n,type:'MOD_RES',evidences:
{
"Imported information":[{url:'http://www.phosphosite.org/uniprotAccAction.do?id='+__accession,id:__accession,name:'Imported from PhosphoSitePlus'}]
}
});
n++;
}
}
});
if(__ptm_flag)d.push( __ptm );
if(__sites_flag)d.push( __sites );
}
};
module.exports = add_phosphosite;
},{}],16:[function(require,module,exports){
"use strict";
var add_asa_residues = require('./add_asa_residues');
var add_binding_residues = require('./add_binding_residues');
var highlight_all = require('./highlight_all');
var add_molprobity = require('./add_molprobity');
var add_highlight_all = highlight_all.add_highlight_all;
var add_psa_interface = function(){
var $LOG = { 'protein':{}, 'gene':{}, 'interaction:':{} };
if(top.$LOG){
$LOG = top.$LOG;
}
var alignment = JSON.parse(getParameterByName("alignment"));
var pdb = alignment['pdb'];
if(!pdb){
console.log("%c /compute/biopython/interface/<PDB> PDB code is null", 'color:red;');
$LOG.protein['psa'] = {
'description':'Computing ASA and binding sites data',
'command':'GET '+interface_url,
'status':'error',
'error': '/compute/biopython/interface/<PDB> PDB code is null',
'cost':'NA'
};
console.log("%c /compute/molprobity/<PDB> PDB code is null", 'color:red;');
$LOG.protein['molprobity'] = {
'description':'Computing ASA and binding sites data',
'command':'GET '+interface_url,
'status':'error',
'error': '/compute/molprobity/<PDB> PDB code is null',
'cost':'NA'
};
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']-=2;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
return;
}
var path = null;
if('path' in alignment){
path = alignment['path'];
}
if( top.$COMPUTED_FEATURES[pdb] ){
top.binding_residues = top.$COMPUTED_FEATURES[pdb]['binding_residues'];
top.asa_residues = top.$COMPUTED_FEATURES[pdb]['asa_residues'];
var asa = add_asa_residues();
var bs = add_binding_residues();
if(bs){
feature_viewer.drawCategories([asa,bs],feature_viewer);
feature_viewer.data.push(asa);
feature_viewer.data.push(bs);
}else{
feature_viewer.drawCategories([asa],feature_viewer);
feature_viewer.data.push(asa);
}
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']--;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
add_highlight_all();
if( top.$COMPUTED_FEATURES[pdb]['molprobity'] ){
add_molprobity();
}else{
if("n_sources" in $LOG.protein){
$LOG.protein['n_sources']--;
if($LOG.protein['n_sources']==0)remove_loading_icon();
}
}
}else{
var interface_url = "/compute/biopython/interface/"+pdb;
$LOG.protein['psa'] = {
'description':'Computing ASA and binding sites data',
'command':'GET '+interface_url,
'status':'running'
};
if(path){
interface_url = "/compute/biopython/interface/"+path+"/"+pdb.replace(/\./g,"__");
}
interface_url = encodeURI(interface_url);
console.log("%c Loading "+interface_url, 'color:#c60;');
var t1 = performance.now();
$j.ajax({
url: interface_url,
dataType: 'json',
success: function(data){
if(!top.$COMPUTED_FEATURES[pdb])top.$COMPUTED_FEATURES[pdb] = {};
if("error" in data){
top.binding_residues = null;
top.asa_residues = null;
$LOG.protein['psa']['status'] = 'error';
var t2 = performance.now();
var time_ = (t2-t1)/1000;
console.log("%c Finished "+interface_url+" "+time_.toString().substring(0,4)+"s", 'color:red;');
return;
}
top.binding_residues = data['interface'];
top.$COMPUTED_FEATURES[pdb]['binding_residues'] = top.binding_residues;
top.asa_residues = data['asa'];
top.$COMPUTED_FEATURES[pdb]['asa_residues'] = top.asa_residues;
top.rri_residues = data['rri'];
top.$COMPUTED_FEATURES[pdb]['rri'] = data['rri'];
var asa = add_asa_residues();
var bs = add_binding_residues();
if(bs){