Skip to content
Snippets Groups Projects
Commit 641bad57 authored by Fabien  MAREUIL's avatar Fabien MAREUIL
Browse files

bug fix remove hotspot when no hotspot

parent 2989c40e
No related branches found
No related tags found
2 merge requests!54merge with master,!53Clean code
Pipeline #113842 failed with stages
in 11 minutes and 12 seconds
...@@ -412,43 +412,46 @@ function loadNGL(url, callback) { ...@@ -412,43 +412,46 @@ function loadNGL(url, callback) {
scaleFactor: 2.0, scaleFactor: 2.0,
cutoff: 0.02, cutoff: 0.02,
}); });
var selection_critical = ":" + chain.pdb_chain_id + " and ( " if (chain.hotspot_set.length != 0) {
var selection_warm = ":" + chain.pdb_chain_id + " and ( " var selection_critical = ":" + chain.pdb_chain_id + " and ( "
chain.hotspot_set.forEach(function (residue) { var selection_warm = ":" + chain.pdb_chain_id + " and ( "
if (residue.type == "critical") { chain.hotspot_set.forEach(function (residue) {
selection_critical += residue.residu_number + ", "; if (residue.type == "critical") {
} else { selection_critical += residue.residu_number + ", ";
selection_warm += residue.residu_number + ", "; } else {
}; selection_warm += residue.residu_number + ", ";
};
}); });
selection_critical = selection_critical.slice(0, - 2); selection_critical = selection_critical.slice(0, - 2);
selection_critical = selection_critical + " )"; selection_critical = selection_critical + " )";
selection_warm = selection_warm.slice(0, - 2); selection_warm = selection_warm.slice(0, - 2);
selection_warm = selection_warm + " )"; selection_warm = selection_warm + " )";
var colorhotspotwarm = "#ffbd92";
if (indexchain === 0) {
colorhotspotwarm = "#00b6e8"
}
var colorhotspotcritical = "#ffd700";
if (indexchain === 0) {
colorhotspotcritical = "#00b394"
}
o.addRepresentation("ball+stick", { var colorhotspotwarm = "#ffbd92";
name: componentname + "critical", if (indexchain === 0) {
sele: selection_critical, colorhotspotwarm = "#00b6e8"
color: colorhotspotcritical, }
visible: false,
}); var colorhotspotcritical = "#ffd700";
o.addRepresentation("ball+stick", { if (indexchain === 0) {
name: componentname + "warm", colorhotspotcritical = "#00b394"
sele: selection_warm, }
color: colorhotspotwarm,
visible: false, 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(); stage.autoView();
...@@ -602,29 +605,30 @@ function loadNGL(url, callback) { ...@@ -602,29 +605,30 @@ function loadNGL(url, callback) {
} }
}, { float: "right", margin: "3px" }, "align-middle"); }, { float: "right", margin: "3px" }, "align-middle");
var reprHotSpotButtonCritical = createElement("input", { if (chain.hotspot_set.length != 0) {
type: "checkbox", var reprHotSpotButtonCritical = createElement("input", {
checked: false, type: "checkbox",
onchange: function (e) { checked: false,
stage.getRepresentationsByName(componentname + "critical").list.forEach(function (rep) { onchange: function (e) {
if (rep.parent.name === componentname) { stage.getRepresentationsByName(componentname + "critical").list.forEach(function (rep) {
rep.setVisibility(e.target.checked); if (rep.parent.name === componentname) {
}; rep.setVisibility(e.target.checked);
}); };
} });
}, { float: "right", margin: "3px" }, "align-middle"); }
var reprHotSpotButtonWarm = createElement("input", { }, { float: "right", margin: "3px" }, "align-middle");
type: "checkbox", var reprHotSpotButtonWarm = createElement("input", {
checked: false, type: "checkbox",
onchange: function (e) { checked: false,
stage.getRepresentationsByName(componentname + "warm").list.forEach(function (rep) { onchange: function (e) {
if (rep.parent.name === componentname) { stage.getRepresentationsByName(componentname + "warm").list.forEach(function (rep) {
rep.setVisibility(e.target.checked); if (rep.parent.name === componentname) {
}; rep.setVisibility(e.target.checked);
}); };
} });
}, { float: "right", margin: "3px" }, "align-middle"); }
}, { float: "right", margin: "3px" }, "align-middle");
}
var divdropdown = createElement("div", {}, {}, "dropdown"); var divdropdown = createElement("div", {}, {}, "dropdown");
var buttondorpdown = createElement("button", { var buttondorpdown = createElement("button", {
...@@ -638,14 +642,15 @@ function loadNGL(url, callback) { ...@@ -638,14 +642,15 @@ function loadNGL(url, callback) {
buttondorpdown.append("chain ".concat(chain.pdb_chain_id)) buttondorpdown.append("chain ".concat(chain.pdb_chain_id))
divdropdown.appendChild(buttondorpdown); divdropdown.appendChild(buttondorpdown);
var spanhotspotcritical = createElement("label", {}, { display: "inline-block" }, "dropdown-item"); if (chain.hotspot_set.length != 0) {
spanhotspotcritical.innerHTML = "critical "; var spanhotspotcritical = createElement("label", {}, { display: "inline-block" }, "dropdown-item");
spanhotspotcritical.appendChild(reprHotSpotButtonCritical); spanhotspotcritical.innerHTML = "critical ";
spanhotspotcritical.appendChild(reprHotSpotButtonCritical);
var spanhotspotwarm = createElement("label", {}, { display: "inline-block" }, "dropdown-item");
spanhotspotwarm.innerHTML = "warm ";
spanhotspotwarm.appendChild(reprHotSpotButtonWarm);
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 chainreprButton = createElement("div", {}, {}, "dropdown-menu", { 'aria-labelledby': componentname });
var divheader = createElement("div", {}, {}, "dropdown-header"); var divheader = createElement("div", {}, {}, "dropdown-header");
divheader.innerHTML = "Representations" divheader.innerHTML = "Representations"
...@@ -666,13 +671,15 @@ function loadNGL(url, callback) { ...@@ -666,13 +671,15 @@ function loadNGL(url, callback) {
spansurface.appendChild(reprsurfaceButton); spansurface.appendChild(reprsurfaceButton);
chainreprButton.appendChild(spansurface); chainreprButton.appendChild(spansurface);
var divdividerhotspot = createElement("div", {}, {}, "dropdown-divider"); if (chain.hotspot_set.length != 0) {
chainreprButton.appendChild(divdividerhotspot); var divdividerhotspot = createElement("div", {}, {}, "dropdown-divider");
var divheaderhotspot = createElement("div", {}, {}, "dropdown-header"); chainreprButton.appendChild(divdividerhotspot);
divheaderhotspot.innerHTML = "Hotspots" var divheaderhotspot = createElement("div", {}, {}, "dropdown-header");
chainreprButton.appendChild(divheaderhotspot); divheaderhotspot.innerHTML = "Hotspots"
chainreprButton.appendChild(spanhotspotwarm); chainreprButton.appendChild(divheaderhotspot);
chainreprButton.appendChild(spanhotspotcritical); chainreprButton.appendChild(spanhotspotwarm);
chainreprButton.appendChild(spanhotspotcritical);
}
divdropdown.appendChild(chainreprButton); divdropdown.appendChild(chainreprButton);
divmultiButtoncenter.appendChild(divdropdown); divmultiButtoncenter.appendChild(divdropdown);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment