-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_binding_residues.js
42 lines (39 loc) · 1.32 KB
/
add_binding_residues.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
"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;