added option to download pdbqt
This commit is contained in:
parent
e0637cf72e
commit
1c5d59d20a
|
@ -1,23 +1,35 @@
|
|||
// import Popper
|
||||
//= ../../../node_modules/popper.js/dist/umd/popper.js
|
||||
// ../../../node_modules/popper.js/dist/umd/popper.js
|
||||
|
||||
// import required js-files Bootstrap 5
|
||||
//= ../../../node_modules/bootstrap/js/dist/alert.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/button.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/carousel.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/collapse.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/dropdown.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/modal.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/popover.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/scrollspy.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/tab.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/toast.js
|
||||
//= ../../../node_modules/bootstrap/js/dist/tooltip.js
|
||||
// ../../../node_modules/bootstrap/js/dist/alert.js
|
||||
// ../../../node_modules/bootstrap/js/dist/button.js
|
||||
// ../../../node_modules/bootstrap/js/dist/carousel.js
|
||||
// ../../../node_modules/bootstrap/js/dist/collapse.js
|
||||
// ../../../node_modules/bootstrap/js/dist/dropdown.js
|
||||
// ../../../node_modules/bootstrap/js/dist/modal.js
|
||||
// ../../../node_modules/bootstrap/js/dist/popover.js
|
||||
// ../../../node_modules/bootstrap/js/dist/scrollspy.js
|
||||
// ../../../node_modules/bootstrap/js/dist/tab.js
|
||||
// ../../../node_modules/bootstrap/js/dist/toast.js
|
||||
// ../../../node_modules/bootstrap/js/dist/tooltip.js
|
||||
|
||||
|
||||
function 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){
|
||||
var inputVal = document.getElementById(el_id).value;
|
||||
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){
|
||||
|
||||
mol.condense_abbreviations();
|
||||
|
@ -65,9 +78,9 @@ function calculate_and_disperse(mol){
|
|||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
if(shy_values_do_not_show.indexOf(key) !== -1){
|
||||
console.log("skipping")
|
||||
//console.log("skipping")
|
||||
} else{
|
||||
console.log(key, descrs[key]);
|
||||
//console.log(key, descrs[key]);
|
||||
var newRow = tableRef.insertRow(-1);
|
||||
var newCell_label = newRow.insertCell(0);
|
||||
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) {
|
||||
|
@ -87,5 +118,21 @@ function analyse_me_senpai(smile_pwiz) {
|
|||
var mol = Module.get_mol(smiles);
|
||||
draw_me_like_one_of_your_french_girls(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,26 +1,33 @@
|
|||
<section style="padding:60px;">
|
||||
<div class='container'>
|
||||
<div class="grid">
|
||||
<div class='row'><h2 class="display-3">Workbench</h2></div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<!--<canvas id="draw-canvas-2" class="w-100"></canvas>-->
|
||||
<div id='draw-output'></div>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-4 table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Property</th>
|
||||
<th scope="col">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='analyse_table'>
|
||||
<!--<tr><td scope="row">Exact M.W.</td><td id="exactmw">-</td></tr>
|
||||
<div class='container'>
|
||||
<div class="grid">
|
||||
<div class='row'>
|
||||
<h2 class="display-3">Workbench</h2>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<!--<canvas id="draw-canvas-2" class="w-100"></canvas>-->
|
||||
<div id='draw-output'></div>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-4 table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Property</th>
|
||||
<th scope="col">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='analyse_table'>
|
||||
<!--<tr><td scope="row">Exact M.W.</td><td id="exactmw">-</td></tr>
|
||||
<tr><td scope="row">CrippenMR</td><td id='CrippenMR'>-</td></tr>
|
||||
<tr><td scope="row">CrippenClogP</td><td id='CrippenClogP'>-</td></tr>-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div></div>
|
||||
</div></section>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
|
@ -5,7 +5,7 @@ var path = {
|
|||
build: {
|
||||
html: 'assets/build/',
|
||||
js: 'assets/build/js/',
|
||||
wasm: 'assets/build/js',
|
||||
wasm: 'assets/build/js/',
|
||||
css: 'assets/build/css/',
|
||||
img: 'assets/build/img/',
|
||||
fonts: 'assets/build/fonts/'
|
||||
|
@ -16,7 +16,7 @@ var path = {
|
|||
style: 'assets/src/style/main.scss',
|
||||
img: 'assets/src/img/**/*.*',
|
||||
fonts: 'assets/src/fonts/**/*.*',
|
||||
wasm: 'assets/src/js/*.wasm'
|
||||
wasm: 'assets/src/js/*.*'
|
||||
},
|
||||
watch: {
|
||||
html: 'assets/src/**/*.html',
|
||||
|
|
Loading…
Reference in New Issue