Commit 48366f48 authored by Jade Young's avatar Jade Young

Able to upload pdb files and download zip file containing output. Set hoverable not functioning.

parent 67b47c67
......@@ -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",
zip.folder("binana_files").file
("receptor.txt",
document.getElementById("receptor-txt").value
).file(
"ligand.txt",
......@@ -2722,9 +2722,9 @@ TORSDOF 11</textarea>
"binana.json",
document.getElementById("output-txt").value
);
zip.generateAsync({type:"string"}).then( // TODO: uint8array blob
function (download) {
saveAs(dowload, "binana.zip");
zip.generateAsync({type:"blob"}).then(
function (blob) {
saveAs(blob, "binana.zip");
}
);
}
......@@ -2786,18 +2786,32 @@ 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'}});
thisAtom = String(obj[interactions[choice]][i].ligandAtoms[j]);//.name?
//thisResID = String(obj[interactions[choice]][i].ligandAtoms[j].resName);
// 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}, true, function(atom,v, event) {
if(!atom.label) {
atom.label = v.addLabel(thisAtom.resName + ":" + atom, {position: atom, backgroundColor: 'pink', fontColor: 'black'});
}
},
function(atom) {
if(atom.label) {
v.removeLabel(atom.label);
delete atom.label;
}
});
}
// loop through the receptor atoms
for (var k = 0; k < obj[interactions[choice]][i].receptorAtoms.length; k++) {
......
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