added option to download pdbqt
This commit is contained in:
parent
e0637cf72e
commit
1c5d59d20a
|
@ -1,23 +1,35 @@
|
||||||
// import Popper
|
// import Popper
|
||||||
//= ../../../node_modules/popper.js/dist/umd/popper.js
|
// ../../../node_modules/popper.js/dist/umd/popper.js
|
||||||
|
|
||||||
// import required js-files Bootstrap 5
|
// import required js-files Bootstrap 5
|
||||||
//= ../../../node_modules/bootstrap/js/dist/alert.js
|
// ../../../node_modules/bootstrap/js/dist/alert.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/button.js
|
// ../../../node_modules/bootstrap/js/dist/button.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/carousel.js
|
// ../../../node_modules/bootstrap/js/dist/carousel.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/collapse.js
|
// ../../../node_modules/bootstrap/js/dist/collapse.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/dropdown.js
|
// ../../../node_modules/bootstrap/js/dist/dropdown.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/modal.js
|
// ../../../node_modules/bootstrap/js/dist/modal.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/popover.js
|
// ../../../node_modules/bootstrap/js/dist/popover.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/scrollspy.js
|
// ../../../node_modules/bootstrap/js/dist/scrollspy.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/tab.js
|
// ../../../node_modules/bootstrap/js/dist/tab.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/toast.js
|
// ../../../node_modules/bootstrap/js/dist/toast.js
|
||||||
//= ../../../node_modules/bootstrap/js/dist/tooltip.js
|
// ../../../node_modules/bootstrap/js/dist/tooltip.js
|
||||||
|
|
||||||
|
|
||||||
function bruh_moment(){
|
function bruh_moment(){
|
||||||
alert('this is a bruh moment')
|
alert('this is a bruh moment')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const downloadToFile = (content, filename, contentType) => {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
const file = new Blob([content], {type: contentType});
|
||||||
|
|
||||||
|
a.href= URL.createObjectURL(file);
|
||||||
|
a.download = filename;
|
||||||
|
a.click();
|
||||||
|
|
||||||
|
URL.revokeObjectURL(a.href);
|
||||||
|
};
|
||||||
|
|
||||||
function get_smiles_from_element_text(el_id){
|
function get_smiles_from_element_text(el_id){
|
||||||
var inputVal = document.getElementById(el_id).value;
|
var inputVal = document.getElementById(el_id).value;
|
||||||
let url = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${inputVal}/property/CanonicalSMILES/JSON`;
|
let url = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${inputVal}/property/CanonicalSMILES/JSON`;
|
||||||
|
@ -35,6 +47,7 @@ function get_smiles_from_element_text(el_id){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function draw_me_like_one_of_your_french_girls(mol){
|
function draw_me_like_one_of_your_french_girls(mol){
|
||||||
|
|
||||||
mol.condense_abbreviations();
|
mol.condense_abbreviations();
|
||||||
|
@ -65,9 +78,9 @@ function calculate_and_disperse(mol){
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
const key = keys[i];
|
const key = keys[i];
|
||||||
if(shy_values_do_not_show.indexOf(key) !== -1){
|
if(shy_values_do_not_show.indexOf(key) !== -1){
|
||||||
console.log("skipping")
|
//console.log("skipping")
|
||||||
} else{
|
} else{
|
||||||
console.log(key, descrs[key]);
|
//console.log(key, descrs[key]);
|
||||||
var newRow = tableRef.insertRow(-1);
|
var newRow = tableRef.insertRow(-1);
|
||||||
var newCell_label = newRow.insertCell(0);
|
var newCell_label = newRow.insertCell(0);
|
||||||
var newCell_value = newRow.insertCell(-1);
|
var newCell_value = newRow.insertCell(-1);
|
||||||
|
@ -78,8 +91,26 @@ function calculate_and_disperse(mol){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function convert_me_senpai(smiles) {
|
||||||
|
var OpenBabel = OpenBabelModule();
|
||||||
|
OpenBabel.onRuntimeInitialized = function() {
|
||||||
|
var conv = new OpenBabel.ObConversionWrapper();
|
||||||
|
try {
|
||||||
|
var inData = smiles;
|
||||||
|
conv.setInFormat('', 'smiles');
|
||||||
|
var mol = new OpenBabel.OBMol();
|
||||||
|
conv.readString(mol, inData);
|
||||||
|
conv.setOutFormat('', 'pdbqt');
|
||||||
|
var outData = conv.writeString(mol, false);
|
||||||
|
//console.log(outData);
|
||||||
|
document.getElementById('download-pdbqt').disabled=false;
|
||||||
|
return outData;
|
||||||
|
} finally {
|
||||||
|
conv.delete(); // free ObConversionWrapper instance
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function analyse_me_senpai(smile_pwiz) {
|
function analyse_me_senpai(smile_pwiz) {
|
||||||
|
@ -87,5 +118,21 @@ function analyse_me_senpai(smile_pwiz) {
|
||||||
var mol = Module.get_mol(smiles);
|
var mol = Module.get_mol(smiles);
|
||||||
draw_me_like_one_of_your_french_girls(mol);
|
draw_me_like_one_of_your_french_girls(mol);
|
||||||
calculate_and_disperse(mol);
|
calculate_and_disperse(mol);
|
||||||
|
smiles_text = convert_me_senpai(smiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
function download_pdbqt(){
|
||||||
|
if (document.getElementById("inputName").value === ""){
|
||||||
|
var fname = "compound.pdbqt"
|
||||||
|
} else {
|
||||||
|
var fname = `${document.getElementById("inputName").value}.pdbqt`
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//var smiles_text = convert_me_senpai(document.getElementById("inputSMILES").value)
|
||||||
|
downloadToFile(smiles_text,fname,"chemical/x-pdbqt")
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err)
|
||||||
|
bruh_moment()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,9 @@
|
||||||
<section style="padding:60px;">
|
<section style="padding:60px;">
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class='row'><h2 class="display-3">Workbench</h2></div>
|
<div class='row'>
|
||||||
|
<h2 class="display-3">Workbench</h2>
|
||||||
|
</div>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-6'>
|
<div class='col-md-6'>
|
||||||
<!--<canvas id="draw-canvas-2" class="w-100"></canvas>-->
|
<!--<canvas id="draw-canvas-2" class="w-100"></canvas>-->
|
||||||
|
@ -20,7 +22,12 @@
|
||||||
<tr><td scope="row">CrippenMR</td><td id='CrippenMR'>-</td></tr>
|
<tr><td scope="row">CrippenMR</td><td id='CrippenMR'>-</td></tr>
|
||||||
<tr><td scope="row">CrippenClogP</td><td id='CrippenClogP'>-</td></tr>-->
|
<tr><td scope="row">CrippenClogP</td><td id='CrippenClogP'>-</td></tr>-->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div>
|
||||||
</div></section>
|
<div class="row">
|
||||||
|
<button class="btn btn-primary" type="button" onclick="download_pdbqt()" id="download-pdbqt" disabled>Download PDBQT</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
|
@ -1,2 +1,6 @@
|
||||||
<script src="./js/RDKit_minimal.js"></script>
|
<script>
|
||||||
|
var smiles_text = 'bruh'
|
||||||
|
</script>
|
||||||
|
<script src="./js/RDKit_minimal.min.js"></script>
|
||||||
|
<script src="./js/openbabel.min.js"></script>
|
||||||
<script src="./js/main.min.js"></script>
|
<script src="./js/main.min.js"></script>
|
|
@ -5,7 +5,7 @@ var path = {
|
||||||
build: {
|
build: {
|
||||||
html: 'assets/build/',
|
html: 'assets/build/',
|
||||||
js: 'assets/build/js/',
|
js: 'assets/build/js/',
|
||||||
wasm: 'assets/build/js',
|
wasm: 'assets/build/js/',
|
||||||
css: 'assets/build/css/',
|
css: 'assets/build/css/',
|
||||||
img: 'assets/build/img/',
|
img: 'assets/build/img/',
|
||||||
fonts: 'assets/build/fonts/'
|
fonts: 'assets/build/fonts/'
|
||||||
|
@ -16,7 +16,7 @@ var path = {
|
||||||
style: 'assets/src/style/main.scss',
|
style: 'assets/src/style/main.scss',
|
||||||
img: 'assets/src/img/**/*.*',
|
img: 'assets/src/img/**/*.*',
|
||||||
fonts: 'assets/src/fonts/**/*.*',
|
fonts: 'assets/src/fonts/**/*.*',
|
||||||
wasm: 'assets/src/js/*.wasm'
|
wasm: 'assets/src/js/*.*'
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
html: 'assets/src/**/*.html',
|
html: 'assets/src/**/*.html',
|
||||||
|
|
Loading…
Reference in New Issue