diff --git a/ippisite/ippidb/static/js/targetcentric.js b/ippisite/ippidb/static/js/targetcentric.js index d7ad35057703e0cf64feff51fd1d8d09496b6a97..25a804e8d5ca7af41332b92fa80ff81e7be2676a 100644 --- a/ippisite/ippidb/static/js/targetcentric.js +++ b/ippisite/ippidb/static/js/targetcentric.js @@ -412,43 +412,46 @@ function loadNGL(url, callback) { scaleFactor: 2.0, cutoff: 0.02, }); - var selection_critical = ":" + chain.pdb_chain_id + " and ( " - var selection_warm = ":" + chain.pdb_chain_id + " and ( " - chain.hotspot_set.forEach(function (residue) { - if (residue.type == "critical") { - selection_critical += residue.residu_number + ", "; - } else { - selection_warm += residue.residu_number + ", "; - }; + if (chain.hotspot_set.length != 0) { + var selection_critical = ":" + chain.pdb_chain_id + " and ( " + var selection_warm = ":" + chain.pdb_chain_id + " and ( " + chain.hotspot_set.forEach(function (residue) { + if (residue.type == "critical") { + selection_critical += residue.residu_number + ", "; + } else { + selection_warm += residue.residu_number + ", "; + }; - }); - selection_critical = selection_critical.slice(0, - 2); - selection_critical = selection_critical + " )"; - selection_warm = selection_warm.slice(0, - 2); - selection_warm = selection_warm + " )"; - - var colorhotspotwarm = "#ffbd92"; - if (indexchain === 0) { - colorhotspotwarm = "#00b6e8" - } + }); + selection_critical = selection_critical.slice(0, - 2); + selection_critical = selection_critical + " )"; + selection_warm = selection_warm.slice(0, - 2); + selection_warm = selection_warm + " )"; - var colorhotspotcritical = "#ffd700"; - if (indexchain === 0) { - colorhotspotcritical = "#00b394" - } - o.addRepresentation("ball+stick", { - name: componentname + "critical", - sele: selection_critical, - color: colorhotspotcritical, - visible: false, - }); - o.addRepresentation("ball+stick", { - name: componentname + "warm", - sele: selection_warm, - color: colorhotspotwarm, - visible: false, - }); + var colorhotspotwarm = "#ffbd92"; + if (indexchain === 0) { + colorhotspotwarm = "#00b6e8" + } + + var colorhotspotcritical = "#ffd700"; + if (indexchain === 0) { + colorhotspotcritical = "#00b394" + } + + o.addRepresentation("ball+stick", { + name: componentname + "critical", + sele: selection_critical, + color: colorhotspotcritical, + visible: false, + }); + o.addRepresentation("ball+stick", { + name: componentname + "warm", + sele: selection_warm, + color: colorhotspotwarm, + visible: false, + }); + } stage.autoView(); @@ -602,29 +605,30 @@ function loadNGL(url, callback) { } }, { float: "right", margin: "3px" }, "align-middle"); - var reprHotSpotButtonCritical = createElement("input", { - type: "checkbox", - checked: false, - onchange: function (e) { - stage.getRepresentationsByName(componentname + "critical").list.forEach(function (rep) { - if (rep.parent.name === componentname) { - rep.setVisibility(e.target.checked); - }; - }); - } - }, { float: "right", margin: "3px" }, "align-middle"); - var reprHotSpotButtonWarm = createElement("input", { - type: "checkbox", - checked: false, - onchange: function (e) { - stage.getRepresentationsByName(componentname + "warm").list.forEach(function (rep) { - if (rep.parent.name === componentname) { - rep.setVisibility(e.target.checked); - }; - }); - } - }, { float: "right", margin: "3px" }, "align-middle"); - + if (chain.hotspot_set.length != 0) { + var reprHotSpotButtonCritical = createElement("input", { + type: "checkbox", + checked: false, + onchange: function (e) { + stage.getRepresentationsByName(componentname + "critical").list.forEach(function (rep) { + if (rep.parent.name === componentname) { + rep.setVisibility(e.target.checked); + }; + }); + } + }, { float: "right", margin: "3px" }, "align-middle"); + var reprHotSpotButtonWarm = createElement("input", { + type: "checkbox", + checked: false, + onchange: function (e) { + stage.getRepresentationsByName(componentname + "warm").list.forEach(function (rep) { + if (rep.parent.name === componentname) { + rep.setVisibility(e.target.checked); + }; + }); + } + }, { float: "right", margin: "3px" }, "align-middle"); + } var divdropdown = createElement("div", {}, {}, "dropdown"); var buttondorpdown = createElement("button", { @@ -638,14 +642,15 @@ function loadNGL(url, callback) { buttondorpdown.append("chain ".concat(chain.pdb_chain_id)) divdropdown.appendChild(buttondorpdown); - var spanhotspotcritical = createElement("label", {}, { display: "inline-block" }, "dropdown-item"); - spanhotspotcritical.innerHTML = "critical "; - spanhotspotcritical.appendChild(reprHotSpotButtonCritical); - - var spanhotspotwarm = createElement("label", {}, { display: "inline-block" }, "dropdown-item"); - spanhotspotwarm.innerHTML = "warm "; - spanhotspotwarm.appendChild(reprHotSpotButtonWarm); + if (chain.hotspot_set.length != 0) { + var spanhotspotcritical = createElement("label", {}, { display: "inline-block" }, "dropdown-item"); + spanhotspotcritical.innerHTML = "critical "; + spanhotspotcritical.appendChild(reprHotSpotButtonCritical); + var spanhotspotwarm = createElement("label", {}, { display: "inline-block" }, "dropdown-item"); + spanhotspotwarm.innerHTML = "warm "; + spanhotspotwarm.appendChild(reprHotSpotButtonWarm); + } var chainreprButton = createElement("div", {}, {}, "dropdown-menu", { 'aria-labelledby': componentname }); var divheader = createElement("div", {}, {}, "dropdown-header"); divheader.innerHTML = "Representations" @@ -666,13 +671,15 @@ function loadNGL(url, callback) { spansurface.appendChild(reprsurfaceButton); chainreprButton.appendChild(spansurface); - var divdividerhotspot = createElement("div", {}, {}, "dropdown-divider"); - chainreprButton.appendChild(divdividerhotspot); - var divheaderhotspot = createElement("div", {}, {}, "dropdown-header"); - divheaderhotspot.innerHTML = "Hotspots" - chainreprButton.appendChild(divheaderhotspot); - chainreprButton.appendChild(spanhotspotwarm); - chainreprButton.appendChild(spanhotspotcritical); + if (chain.hotspot_set.length != 0) { + var divdividerhotspot = createElement("div", {}, {}, "dropdown-divider"); + chainreprButton.appendChild(divdividerhotspot); + var divheaderhotspot = createElement("div", {}, {}, "dropdown-header"); + divheaderhotspot.innerHTML = "Hotspots" + chainreprButton.appendChild(divheaderhotspot); + chainreprButton.appendChild(spanhotspotwarm); + chainreprButton.appendChild(spanhotspotcritical); + } divdropdown.appendChild(chainreprButton); divmultiButtoncenter.appendChild(divdropdown);