Commit 78b4b3ed authored by Jacob Durrant's avatar Jacob Durrant

WIP: visualizing hbonds

parent 8439f49c
......@@ -2710,10 +2710,10 @@ TORSDOF 11</textarea>
<script>
//import JSZip from 'jszip';
function downloadFiles(){
var zip = new JSZip();
zip.folder("binana_files").file
("receptor.txt",
("receptor.txt",
document.getElementById("receptor-txt").value
).file(
"ligand.txt",
......@@ -2722,7 +2722,7 @@ TORSDOF 11</textarea>
"binana.json",
document.getElementById("output-txt").value
);
zip.generateAsync({type:"blob"}).then(
zip.generateAsync({type:"blob"}).then(
function (blob) {
saveAs(blob, "binana.zip");
}
......@@ -2776,8 +2776,8 @@ TORSDOF 11</textarea>
viewer.setViewStyle({style:"outline"});
//var receptor = viewer.addModel(pdbtxt, "pdb");
//var ligand = viewer.addModel(ligtxt, "pdb");
receptor = viewer.addModel(pdbqtToPdb(pdbtxt), "pdb");
ligand = viewer.addModel(pdbqtToPdb(ligtxt), "pdb");
receptor = viewer.addModel(pdbqtToPdb(pdbtxt), "pdb", {keepH: true});
ligand = viewer.addModel(pdbqtToPdb(ligtxt), "pdb", {keepH: true});
receptor.setStyle({},{stick: {color: 'red'}});
ligand.setStyle({}, {sphere: {color: 'green'}});
......@@ -2786,19 +2786,19 @@ TORSDOF 11</textarea>
viewer.zoom(1.2,1000);
//highlight(json_obj, viewer, receptor, ligand);
}
// sets the atoms involved in the interaction to a different color
function highlight(obj, v, r, l, choice) {
// make an array for the interactions
var interactions = Object.keys(obj);
// loop through the interactions
for (var i = 0; i < obj[interactions[choice]].length; i++){
// loop through the ligand atoms
for (var j = 0; j < obj[interactions[choice]][i].ligandAtoms.length; j++) {
// change the color for the atom
l.setStyle({atom: obj[interactions[choice]][i].ligandAtoms[j].atomName, serial: obj[interactions[choice]][i].ligandAtoms[j].atomIndex, resi: obj[interactions[choice]][i].ligandAtoms[j].resID}, {sphere: {color:'white'}});
// set hoverable
l.setHoverable(
{atom: obj[interactions[choice]][i].ligandAtoms[j].atomName, serial: obj[interactions[choice]][i].ligandAtoms[j].atomIndex, resi: obj[interactions[choice]][i].ligandAtoms[j].resID},
......@@ -2814,7 +2814,7 @@ TORSDOF 11</textarea>
delete atom.label;
}
});
}
//debugger;
// loop through the receptor atoms
......@@ -2839,12 +2839,48 @@ TORSDOF 11</textarea>
}
);
}
if (interactions[choice] === "hydrogenBonds") {
// loop through the interactions
let hBondHeavyAtomPairs = [];
for (var i = 0; i < obj[interactions[choice]].length; i++){
let hBondHeavyAtomPair = [];
let interaction = obj[interactions[choice]][i];
for (var k = 0; k < obj[interactions[choice]][i].receptorAtoms.length; k++) {
let receptorAtom = v.selectedAtoms({
atom: obj[interactions[choice]][i].receptorAtoms[k].atomName,
serial: obj[interactions[choice]][i].receptorAtoms[k].atomIndex,
resi: obj[interactions[choice]][i].receptorAtoms[k].resID
})[0];
if (receptorAtom.elem !== "H") {
hBondHeavyAtomPair.push(receptorAtom);
}
}
for (var k = 0; k < obj[interactions[choice]][i].ligandAtoms.length; k++) {
let ligandAtom = v.selectedAtoms({
atom: obj[interactions[choice]][i].ligandAtoms[k].atomName,
serial: obj[interactions[choice]][i].ligandAtoms[k].atomIndex,
resi: obj[interactions[choice]][i].ligandAtoms[k].resID
})[0];
if (ligandAtom.elem !== "H") {
hBondHeavyAtomPair.push(ligandAtom);
}
}
hBondHeavyAtomPairs.push(hBondHeavyAtomPair);
}
console.log(hBondHeavyAtomPairs);
}
// add "bonds" between atoms
// need coordinates
// if choice == 2 || choice == 7 (hydrogen bond or salt bridge)....
// COORDINATES BELOW ARE TAKEN FROM THE PDB FILES
v.addCylinder({dashed:true,
v.addCylinder({dashed:true,
start:{x:37.793,y:14.733,z:13.206},
end:{x:40.573,y:14.911,z:12.597},
radius:0.10,
......
Markdown is supported
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