3 lines
2.4 KiB
JavaScript
3 lines
2.4 KiB
JavaScript
function bruh_moment(){alert("this is a bruh moment")}const downloadToFile=(e,t,n)=>{const o=document.createElement("a");n=new Blob([e],{type:n});o.href=URL.createObjectURL(n),o.download=t,o.click(),URL.revokeObjectURL(o.href)};function get_smiles_from_element_text(e){e=`https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${document.getElementById(e).value}/property/CanonicalSMILES/JSON`;console.log(e),fetch(e).then(e=>e.json()).then(e=>{console.log("Aye, got that dub from PubChem"),document.getElementById("inputSMILES").value=e.PropertyTable.Properties[0].CanonicalSMILES}).catch(e=>{throw bruh_moment(),e})}function draw_me_like_one_of_your_french_girls(e){e.condense_abbreviations();var t=document.getElementById("draw-output"),e=e.get_svg();t.outerHTML="<div id='drawing-1'>"+e+"</div>",document.getElementById("drawing-1").children[0].setAttribute("height","100%"),document.getElementById("drawing-1").children[0].setAttribute("width","100%")}function calculate_and_disperse(e){const t=["NumUnspecifiedAtomStereoCenters","NumAliphaticHeterocycles","NumSaturatedHeterocycles","NumAromaticHeterocycles","NumAmideBonds","NumAromaticRings","NumAliphaticRings","NumSaturatedRings","NumSpiroAtoms","NumBridgeheadAtoms","NumAtomStereoCenters"];try{var n=JSON.parse(e.get_descriptors())}catch(e){alert("oo wee, failed to calculate descriptors senpai")}let o=document.getElementById("analyse_table");var r=Object.keys(n);for(let e=0;e<r.length;e++){var a,d,i,l=r[e];-1!==t.indexOf(l)||(a=(i=o.insertRow(-1)).insertCell(0),d=i.insertCell(-1),i=document.createTextNode(l),l=document.createTextNode(n[l]),a.appendChild(i),d.appendChild(l))}}function convert_me_senpai(r){var a=OpenBabelModule();a.onRuntimeInitialized=function(){var e=new a.ObConversionWrapper;try{var t=r;e.setInFormat("","smiles");var n=new a.OBMol;e.readString(n,t),e.setOutFormat("","pdbqt");var o=e.writeString(n,!1);return document.getElementById("download-pdbqt").disabled=!1,o}finally{e.delete()}}}function analyse_me_senpai(e){var t=document.getElementById(e).value,e=Module.get_mol(t);draw_me_like_one_of_your_french_girls(e),calculate_and_disperse(e),smiles_text=convert_me_senpai(t)}function download_pdbqt(){var e;e=""===document.getElementById("inputName").value?"compound.pdbqt":`${document.getElementById("inputName").value}.pdbqt`;try{downloadToFile(smiles_text,e,"chemical/x-pdbqt")}catch(e){console.error(e),bruh_moment()}}
|
|
//# sourceMappingURL=main.min.js.map
|