Commit f3f67b72 authored by Jacob Durrant's avatar Jacob Durrant
Browse files

Update.

parent 522745ec
/**
* Webina Copyright 2019 Jacob Durrant
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// There are a few variables and functions from vina.js that I want to easily
// access from here.
var VERSION = "1.0.0"; // Replaced by compile script.
......@@ -21,15 +39,36 @@ var Webina = (function () {
WEBINA_BASE_URL: "./",
FS: window["FS"],
start: function start(vinaParams, receptorPDBQTTxt, ligandPDBQTTxt, onDone, onError, baseUrl) {
var _this = this;
// baseUrl = undefined; // For debugging.
var baseUrlMsg = "\nWEBINA\n======\n\n";
if (baseUrl !== undefined) {
if (baseUrl.slice(baseUrl.length - 1) !== "/") {
baseUrl += "/";
}
this.WEBINA_BASE_URL = baseUrl;
console.log("Webina: Using baseUrl = " + baseUrl);
baseUrlMsg += "User specified baseUrl: " + baseUrl + "\n";
}
else {
console.warn("Webina: No baseUrl specified, so using the main directory ./");
baseUrlMsg += "No baseUrl specified, so using ./\n\n";
baseUrlMsg += "Use Webina.start() to specify the baseUrl:\n";
baseUrlMsg += " function start(vinaParams, receptorPDBQTTxt, \n";
baseUrlMsg += " ligandPDBQTTxt, onDone, \n";
baseUrlMsg += " onError, baseUrl)\n";
}
baseUrlMsg += "\nExpecting files at the following locations:\n";
for (var i = 0; i < 5; i++) {
var fileName = ["Webina.min.js", "vina.html.mem",
"vina.min.js", "vina.worker.min.js",
"vina.wasm"][i];
baseUrlMsg += " " + (baseUrl === undefined ? "./" : baseUrl) + fileName + "\n";
}
baseUrlMsg += "\n";
if (baseUrl !== undefined) {
console.log(baseUrlMsg);
}
else {
console.warn(baseUrlMsg);
}
if (onError === undefined) {
onError = function () {
......@@ -72,11 +111,6 @@ var Webina = (function () {
"receptorPDBQTTxt": receptorPDBQTTxt,
"ligandPDBQTTxt": ligandPDBQTTxt
};
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.open("GET", memoryInitializer, !0), meminitXHR.responseType = "arraybuffer", meminitXHR.send(null);
if (vinaParams["receptor"] !== undefined) {
console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");
}
......@@ -106,9 +140,25 @@ var Webina = (function () {
}
}
window["WEBINA_Module"] = WEBINA_Module;
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.onloadend = function () {
if (meminitXHR.status === 404) {
var msg = "Unable to access " + memoryInitializer + ". See JavaScript console for warnings. The \"baseUrl\" variable passed to Webina is likely incorrect.";
WEBINA_Module["catchError"]({ "message": msg });
console.warn(msg);
}
else {
var script = document.createElement("script");
script.src = _this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
}
};
meminitXHR.open("GET", memoryInitializer, !0);
meminitXHR.responseType = "arraybuffer";
meminitXHR.send(null);
},
isDataURI: function (r) {
return String.prototype.startsWith ? r.startsWith(this.WEBINA_DATA_URI_PREFIX) : 0 === r.indexOf(this.WEBINA_DATA_URI_PREFIX);
......
/**
* Webina Copyright 2019 Jacob Durrant
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(a,c){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:c})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(b){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(b||"")+"_"+c++,b)}var c=0;return a}();
......@@ -5,11 +20,12 @@ $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};
$jscomp.iteratorFromArray=function(a,c){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var b=0,d={next:function(){if(b<a.length){var e=b++;return{value:c(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d};
$jscomp.polyfill=function(a,c,b,d){if(c){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in b||(b[e]={});b=b[e]}a=a[a.length-1];d=b[a];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:c})}};$jscomp.polyfill("Array.prototype.keys",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(a){return a})}},"es6","es3");var VERSION="1.0.0";console.log("Webina JavaScript Library "+VERSION);
var WEBINA_Module,decodeBase64="function"==typeof atob?atob:function(a){var c,b,d,e,f,h,g="",k=0;for(a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++))<<2|(e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++)))>>4,b=(15&e)<<4|(f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++)))>>2,d=(3&f)<<6|(h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++))),
g+=String.fromCharCode(c),64!==f&&(g+=String.fromCharCode(b)),64!==h&&(g+=String.fromCharCode(d)),k<a.length;)return g},Webina=function(){return{WEBINA_ENVIRONMENT_IS_NODE:window.WEBINA_ENVIRONMENT_IS_NODE,WEBINA_lengthBytesUTF8:window.WEBINA_lengthBytesUTF8,WEBINA_stringToUTF8Array:window.WEBINA_stringToUTF8Array,WEBINA_assert:window.WEBINA_assert,WEBINA_ASSERTIONS:1,WEBINA_DATA_URI_PREFIX:"data:application/octet-stream;base64,",WEBINA_BASE_URL:"./",FS:window.FS,start:function(a,c,b,d,e,f){void 0!==
f?("/"!==f.slice(f.length-1)&&(f+="/"),this.WEBINA_BASE_URL=f,console.log("Webina: Using baseUrl = "+f)):console.warn("Webina: No baseUrl specified, so using the main directory ./");void 0===e&&(e=function(){console.log("Webina encountered an error! Does your browser support WebAssembly?")});WEBINA_Module={preRun:[],postRun:[],stdOut:"",stdErr:"",print:function(){return function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdOut+=a+"\n"}}(),printErr:function(a){1<
arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdErr+=a+"\n"},setStatus:function(a){""===a&&void 0!==d&&(a=(new TextDecoder("utf-8")).decode(window.FS.readFile("ligand_out.pdbqt")),d(a,window.WEBINA_Module.stdOut,window.WEBINA_Module.stdErr))},onError:e,catchError:function(a){e(a)},receptorPDBQTTxt:c,ligandPDBQTTxt:b};c=this.WEBINA_BASE_URL+"vina.html.mem";c=WEBINA_Module.locateFile?WEBINA_Module.locateFile(c,""):c;WEBINA_Module.memoryInitializerRequestURL=
c;b=WEBINA_Module.memoryInitializerRequest=new XMLHttpRequest;b.open("GET",c,!0);b.responseType="arraybuffer";b.send(null);void 0!==a.receptor&&console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");void 0!==a.receptor&&console.warn("Webina does not support Vina's --ligand parameter. Instead, pass the content of the ligand file as a string to the webina.start() function.");WEBINA_Module.arguments=
["--receptor","/receptor.pdbqt","--ligand","/ligand.pdbqt"];c=Object.keys(a);b=c.length;for(f=0;f<b;f++){var h=c[f],g=a[h];WEBINA_Module.arguments.push("--"+h);"boolean"!==typeof g&&WEBINA_Module.arguments.push(String(g))}window.WEBINA_Module=WEBINA_Module;a=document.createElement("script");a.src=this.WEBINA_BASE_URL+"vina.min.js";document.body.appendChild(a)},isDataURI:function(a){return String.prototype.startsWith?a.startsWith(this.WEBINA_DATA_URI_PREFIX):0===a.indexOf(this.WEBINA_DATA_URI_PREFIX)},
var WEBINA_Module,decodeBase64="function"==typeof atob?atob:function(a){var c,b,d,e,f,m,g="",h=0;for(a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++))<<2|(e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++)))>>4,b=(15&e)<<4|(f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++)))>>2,d=(3&f)<<6|(m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++))),
g+=String.fromCharCode(c),64!==f&&(g+=String.fromCharCode(b)),64!==m&&(g+=String.fromCharCode(d)),h<a.length;)return g},Webina=function(){return{WEBINA_ENVIRONMENT_IS_NODE:window.WEBINA_ENVIRONMENT_IS_NODE,WEBINA_lengthBytesUTF8:window.WEBINA_lengthBytesUTF8,WEBINA_stringToUTF8Array:window.WEBINA_stringToUTF8Array,WEBINA_assert:window.WEBINA_assert,WEBINA_ASSERTIONS:1,WEBINA_DATA_URI_PREFIX:"data:application/octet-stream;base64,",WEBINA_BASE_URL:"./",FS:window.FS,start:function(a,c,b,d,e,f){var m=
this,g="\nWEBINA\n======\n\n";void 0!==f?("/"!==f.slice(f.length-1)&&(f+="/"),this.WEBINA_BASE_URL=f,g+="User specified baseUrl: "+f+"\n"):g+="No baseUrl specified, so using ./\n\nUse Webina.start() to specify the baseUrl:\n function start(vinaParams, receptorPDBQTTxt, \n ligandPDBQTTxt, onDone, \n onError, baseUrl)\n";g+="\nExpecting files at the following locations:\n";for(var h=0;5>h;h++)g+=" "+(void 0===f?"./":f)+["Webina.min.min.js","vina.html.mem","vina.min.min.js",
"vina.worker.min.min.js","vina.wasm"][h]+"\n";g+="\n";void 0!==f?console.log(g):console.warn(g);void 0===e&&(e=function(){console.log("Webina encountered an error! Does your browser support WebAssembly?")});WEBINA_Module={preRun:[],postRun:[],stdOut:"",stdErr:"",print:function(){return function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdOut+=a+"\n"}}(),printErr:function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdErr+=
a+"\n"},setStatus:function(a){""===a&&void 0!==d&&(a=(new TextDecoder("utf-8")).decode(window.FS.readFile("ligand_out.pdbqt")),d(a,window.WEBINA_Module.stdOut,window.WEBINA_Module.stdErr))},onError:e,catchError:function(a){e(a)},receptorPDBQTTxt:c,ligandPDBQTTxt:b};void 0!==a.receptor&&console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");void 0!==a.receptor&&console.warn("Webina does not support Vina's --ligand parameter. Instead, pass the content of the ligand file as a string to the webina.start() function.");
WEBINA_Module.arguments=["--receptor","/receptor.pdbqt","--ligand","/ligand.pdbqt"];c=Object.keys(a);b=c.length;for(h=0;h<b;h++)f=c[h],g=a[f],WEBINA_Module.arguments.push("--"+f),"boolean"!==typeof g&&WEBINA_Module.arguments.push(String(g));window.WEBINA_Module=WEBINA_Module;var k=this.WEBINA_BASE_URL+"vina.html.mem";k=WEBINA_Module.locateFile?WEBINA_Module.locateFile(k,""):k;WEBINA_Module.memoryInitializerRequestURL=k;var l=WEBINA_Module.memoryInitializerRequest=new XMLHttpRequest;l.onloadend=function(){if(404===
l.status){var a="Unable to access "+k+'. See JavaScript console for warnings. The "baseUrl" variable passed to Webina is likely incorrect.';WEBINA_Module.catchError({message:a});console.warn(a)}else a=document.createElement("script"),a.src=m.WEBINA_BASE_URL+"vina.min.js",document.body.appendChild(a)};l.open("GET",k,!0);l.responseType="arraybuffer";l.send(null)},isDataURI:function(a){return String.prototype.startsWith?a.startsWith(this.WEBINA_DATA_URI_PREFIX):0===a.indexOf(this.WEBINA_DATA_URI_PREFIX)},
intArrayFromBase64:function(a){if("boolean"==typeof this.WEBINA_ENVIRONMENT_IS_NODE&&this.WEBINA_ENVIRONMENT_IS_NODE){try{var c=Buffer.from(a,"base64")}catch(e){c=new Buffer(a,"base64")}return new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}try{var b=decodeBase64(a),d=new Uint8Array(b.length);for(a=0;a<b.length;++a)d[a]=b.charCodeAt(a);return d}catch(e){throw Error("Converting base64 string to bytes failed.");}},tryParseAsDataURI:function(a){if(this.isDataURI(a))return this.intArrayFromBase64(a.slice(this.WEBINA_DATA_URI_PREFIX.length))},
intArrayFromString:function(a,c,b){b=0<b?b:this.WEBINA_lengthBytesUTF8(a)+1;b=Array(b);a=this.WEBINA_stringToUTF8Array(a,b,0,b.length);return c&&(b.length=a),b},intArrayToString:function(a){for(var c=[],b=0;b<a.length;b++){var d=a[b];255<d&&(this.WEBINA_ASSERTIONS&&this.WEBINA_assert(!1,"Character code "+d+" ("+String.fromCharCode(d)+") at offset "+b+" not in 0x00-0xFF."),d&=255);c.push(String.fromCharCode(d))}return c.join("")}}}();
......@@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Webina</title>
<link rel="shortcut icon" href="favicon.ico"><link href="vendors.855da08c5d0a31c2e6e9.1.css" rel="stylesheet"><link href="styles.855da08c5d0a31c2e6e9.3.css" rel="stylesheet"></head>
<link rel="shortcut icon" href="favicon.ico"><link href="vendors.a60461f7d6b6cc0ca2d6.1.css" rel="stylesheet"><link href="styles.a60461f7d6b6cc0ca2d6.3.css" rel="stylesheet"></head>
<body>
<div id="app"></div>
......@@ -19,6 +19,6 @@
<script src="vue.min.js"></script>
<script src="vuex.min.js"></script>
<script src="bootstrap-vue.min.js"></script>
<script type="text/javascript" src="runtime.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="vendors.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="app.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="styles.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="styles.css.855da08c5d0a31c2e6e9.js"></script></body>
<script type="text/javascript" src="runtime.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="vendors.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="app.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="styles.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="styles.css.a60461f7d6b6cc0ca2d6.js"></script></body>
</html>
......@@ -23,3 +23,23 @@ ls dist/*.min.js | awk '{print "cat " $1 " | sed \"s/\\.js/.min.js/g\" > t; mv t
# Fix version
export WEBINA_VERSION=`cat ../Version.ts | grep VERSION | awk '{print $5}' | sed 's/"//g' | sed "s/;//g"`
grep -l "XXXXXXXXXXXXX.X" dist/* | awk '{print "cat " $1 " | sed \"s/XXXXXXXXXXXXX.X/TMPSTR/g\" > t; mv t " $1}' | sed "s/TMPSTR/${WEBINA_VERSION}/g" | bash
cd dist
echo "/**
* Webina Copyright 2019 Jacob Durrant
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/" > t
ls Webina*js | awk '{print "cat t > " $1 ".tmp; cat " $1 " >> " $1 ".tmp; mv " $1 ".tmp " $1}' | bash
rm t
cd -
/**
* Webina Copyright 2019 Jacob Durrant
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// There are a few variables and functions from vina.js that I want to easily
// access from here.
var VERSION = "1.0.0"; // Replaced by compile script.
......@@ -21,15 +39,36 @@ var Webina = (function () {
WEBINA_BASE_URL: "./",
FS: window["FS"],
start: function start(vinaParams, receptorPDBQTTxt, ligandPDBQTTxt, onDone, onError, baseUrl) {
var _this = this;
// baseUrl = undefined; // For debugging.
var baseUrlMsg = "\nWEBINA\n======\n\n";
if (baseUrl !== undefined) {
if (baseUrl.slice(baseUrl.length - 1) !== "/") {
baseUrl += "/";
}
this.WEBINA_BASE_URL = baseUrl;
console.log("Webina: Using baseUrl = " + baseUrl);
baseUrlMsg += "User specified baseUrl: " + baseUrl + "\n";
}
else {
console.warn("Webina: No baseUrl specified, so using the main directory ./");
baseUrlMsg += "No baseUrl specified, so using ./\n\n";
baseUrlMsg += "Use Webina.start() to specify the baseUrl:\n";
baseUrlMsg += " function start(vinaParams, receptorPDBQTTxt, \n";
baseUrlMsg += " ligandPDBQTTxt, onDone, \n";
baseUrlMsg += " onError, baseUrl)\n";
}
baseUrlMsg += "\nExpecting files at the following locations:\n";
for (var i = 0; i < 5; i++) {
var fileName = ["Webina.min.js", "vina.html.mem",
"vina.min.js", "vina.worker.min.js",
"vina.wasm"][i];
baseUrlMsg += " " + (baseUrl === undefined ? "./" : baseUrl) + fileName + "\n";
}
baseUrlMsg += "\n";
if (baseUrl !== undefined) {
console.log(baseUrlMsg);
}
else {
console.warn(baseUrlMsg);
}
if (onError === undefined) {
onError = function () {
......@@ -72,11 +111,6 @@ var Webina = (function () {
"receptorPDBQTTxt": receptorPDBQTTxt,
"ligandPDBQTTxt": ligandPDBQTTxt
};
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.open("GET", memoryInitializer, !0), meminitXHR.responseType = "arraybuffer", meminitXHR.send(null);
if (vinaParams["receptor"] !== undefined) {
console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");
}
......@@ -106,9 +140,25 @@ var Webina = (function () {
}
}
window["WEBINA_Module"] = WEBINA_Module;
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.onloadend = function () {
if (meminitXHR.status === 404) {
var msg = "Unable to access " + memoryInitializer + ". See JavaScript console for warnings. The \"baseUrl\" variable passed to Webina is likely incorrect.";
WEBINA_Module["catchError"]({ "message": msg });
console.warn(msg);
}
else {
var script = document.createElement("script");
script.src = _this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
}
};
meminitXHR.open("GET", memoryInitializer, !0);
meminitXHR.responseType = "arraybuffer";
meminitXHR.send(null);
},
isDataURI: function (r) {
return String.prototype.startsWith ? r.startsWith(this.WEBINA_DATA_URI_PREFIX) : 0 === r.indexOf(this.WEBINA_DATA_URI_PREFIX);
......
/**
* Webina Copyright 2019 Jacob Durrant
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(a,c){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:c})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(b){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(b||"")+"_"+c++,b)}var c=0;return a}();
......@@ -5,11 +20,12 @@ $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};
$jscomp.iteratorFromArray=function(a,c){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var b=0,d={next:function(){if(b<a.length){var e=b++;return{value:c(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d};
$jscomp.polyfill=function(a,c,b,d){if(c){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in b||(b[e]={});b=b[e]}a=a[a.length-1];d=b[a];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:c})}};$jscomp.polyfill("Array.prototype.keys",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(a){return a})}},"es6","es3");var VERSION="1.0.0";console.log("Webina JavaScript Library "+VERSION);
var WEBINA_Module,decodeBase64="function"==typeof atob?atob:function(a){var c,b,d,e,f,h,g="",k=0;for(a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++))<<2|(e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++)))>>4,b=(15&e)<<4|(f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++)))>>2,d=(3&f)<<6|(h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(k++))),
g+=String.fromCharCode(c),64!==f&&(g+=String.fromCharCode(b)),64!==h&&(g+=String.fromCharCode(d)),k<a.length;)return g},Webina=function(){return{WEBINA_ENVIRONMENT_IS_NODE:window.WEBINA_ENVIRONMENT_IS_NODE,WEBINA_lengthBytesUTF8:window.WEBINA_lengthBytesUTF8,WEBINA_stringToUTF8Array:window.WEBINA_stringToUTF8Array,WEBINA_assert:window.WEBINA_assert,WEBINA_ASSERTIONS:1,WEBINA_DATA_URI_PREFIX:"data:application/octet-stream;base64,",WEBINA_BASE_URL:"./",FS:window.FS,start:function(a,c,b,d,e,f){void 0!==
f?("/"!==f.slice(f.length-1)&&(f+="/"),this.WEBINA_BASE_URL=f,console.log("Webina: Using baseUrl = "+f)):console.warn("Webina: No baseUrl specified, so using the main directory ./");void 0===e&&(e=function(){console.log("Webina encountered an error! Does your browser support WebAssembly?")});WEBINA_Module={preRun:[],postRun:[],stdOut:"",stdErr:"",print:function(){return function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdOut+=a+"\n"}}(),printErr:function(a){1<
arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdErr+=a+"\n"},setStatus:function(a){""===a&&void 0!==d&&(a=(new TextDecoder("utf-8")).decode(window.FS.readFile("ligand_out.pdbqt")),d(a,window.WEBINA_Module.stdOut,window.WEBINA_Module.stdErr))},onError:e,catchError:function(a){e(a)},receptorPDBQTTxt:c,ligandPDBQTTxt:b};c=this.WEBINA_BASE_URL+"vina.html.mem";c=WEBINA_Module.locateFile?WEBINA_Module.locateFile(c,""):c;WEBINA_Module.memoryInitializerRequestURL=
c;b=WEBINA_Module.memoryInitializerRequest=new XMLHttpRequest;b.open("GET",c,!0);b.responseType="arraybuffer";b.send(null);void 0!==a.receptor&&console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");void 0!==a.receptor&&console.warn("Webina does not support Vina's --ligand parameter. Instead, pass the content of the ligand file as a string to the webina.start() function.");WEBINA_Module.arguments=
["--receptor","/receptor.pdbqt","--ligand","/ligand.pdbqt"];c=Object.keys(a);b=c.length;for(f=0;f<b;f++){var h=c[f],g=a[h];WEBINA_Module.arguments.push("--"+h);"boolean"!==typeof g&&WEBINA_Module.arguments.push(String(g))}window.WEBINA_Module=WEBINA_Module;a=document.createElement("script");a.src=this.WEBINA_BASE_URL+"vina.min.js";document.body.appendChild(a)},isDataURI:function(a){return String.prototype.startsWith?a.startsWith(this.WEBINA_DATA_URI_PREFIX):0===a.indexOf(this.WEBINA_DATA_URI_PREFIX)},
var WEBINA_Module,decodeBase64="function"==typeof atob?atob:function(a){var c,b,d,e,f,m,g="",h=0;for(a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++))<<2|(e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++)))>>4,b=(15&e)<<4|(f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++)))>>2,d=(3&f)<<6|(m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(h++))),
g+=String.fromCharCode(c),64!==f&&(g+=String.fromCharCode(b)),64!==m&&(g+=String.fromCharCode(d)),h<a.length;)return g},Webina=function(){return{WEBINA_ENVIRONMENT_IS_NODE:window.WEBINA_ENVIRONMENT_IS_NODE,WEBINA_lengthBytesUTF8:window.WEBINA_lengthBytesUTF8,WEBINA_stringToUTF8Array:window.WEBINA_stringToUTF8Array,WEBINA_assert:window.WEBINA_assert,WEBINA_ASSERTIONS:1,WEBINA_DATA_URI_PREFIX:"data:application/octet-stream;base64,",WEBINA_BASE_URL:"./",FS:window.FS,start:function(a,c,b,d,e,f){var m=
this,g="\nWEBINA\n======\n\n";void 0!==f?("/"!==f.slice(f.length-1)&&(f+="/"),this.WEBINA_BASE_URL=f,g+="User specified baseUrl: "+f+"\n"):g+="No baseUrl specified, so using ./\n\nUse Webina.start() to specify the baseUrl:\n function start(vinaParams, receptorPDBQTTxt, \n ligandPDBQTTxt, onDone, \n onError, baseUrl)\n";g+="\nExpecting files at the following locations:\n";for(var h=0;5>h;h++)g+=" "+(void 0===f?"./":f)+["Webina.min.min.js","vina.html.mem","vina.min.min.js",
"vina.worker.min.min.js","vina.wasm"][h]+"\n";g+="\n";void 0!==f?console.log(g):console.warn(g);void 0===e&&(e=function(){console.log("Webina encountered an error! Does your browser support WebAssembly?")});WEBINA_Module={preRun:[],postRun:[],stdOut:"",stdErr:"",print:function(){return function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdOut+=a+"\n"}}(),printErr:function(a){1<arguments.length&&(a=Array.prototype.slice.call(arguments).join(" "));window.WEBINA_Module.stdErr+=
a+"\n"},setStatus:function(a){""===a&&void 0!==d&&(a=(new TextDecoder("utf-8")).decode(window.FS.readFile("ligand_out.pdbqt")),d(a,window.WEBINA_Module.stdOut,window.WEBINA_Module.stdErr))},onError:e,catchError:function(a){e(a)},receptorPDBQTTxt:c,ligandPDBQTTxt:b};void 0!==a.receptor&&console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");void 0!==a.receptor&&console.warn("Webina does not support Vina's --ligand parameter. Instead, pass the content of the ligand file as a string to the webina.start() function.");
WEBINA_Module.arguments=["--receptor","/receptor.pdbqt","--ligand","/ligand.pdbqt"];c=Object.keys(a);b=c.length;for(h=0;h<b;h++)f=c[h],g=a[f],WEBINA_Module.arguments.push("--"+f),"boolean"!==typeof g&&WEBINA_Module.arguments.push(String(g));window.WEBINA_Module=WEBINA_Module;var k=this.WEBINA_BASE_URL+"vina.html.mem";k=WEBINA_Module.locateFile?WEBINA_Module.locateFile(k,""):k;WEBINA_Module.memoryInitializerRequestURL=k;var l=WEBINA_Module.memoryInitializerRequest=new XMLHttpRequest;l.onloadend=function(){if(404===
l.status){var a="Unable to access "+k+'. See JavaScript console for warnings. The "baseUrl" variable passed to Webina is likely incorrect.';WEBINA_Module.catchError({message:a});console.warn(a)}else a=document.createElement("script"),a.src=m.WEBINA_BASE_URL+"vina.min.js",document.body.appendChild(a)};l.open("GET",k,!0);l.responseType="arraybuffer";l.send(null)},isDataURI:function(a){return String.prototype.startsWith?a.startsWith(this.WEBINA_DATA_URI_PREFIX):0===a.indexOf(this.WEBINA_DATA_URI_PREFIX)},
intArrayFromBase64:function(a){if("boolean"==typeof this.WEBINA_ENVIRONMENT_IS_NODE&&this.WEBINA_ENVIRONMENT_IS_NODE){try{var c=Buffer.from(a,"base64")}catch(e){c=new Buffer(a,"base64")}return new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}try{var b=decodeBase64(a),d=new Uint8Array(b.length);for(a=0;a<b.length;++a)d[a]=b.charCodeAt(a);return d}catch(e){throw Error("Converting base64 string to bytes failed.");}},tryParseAsDataURI:function(a){if(this.isDataURI(a))return this.intArrayFromBase64(a.slice(this.WEBINA_DATA_URI_PREFIX.length))},
intArrayFromString:function(a,c,b){b=0<b?b:this.WEBINA_lengthBytesUTF8(a)+1;b=Array(b);a=this.WEBINA_stringToUTF8Array(a,b,0,b.length);return c&&(b.length=a),b},intArrayToString:function(a){for(var c=[],b=0;b<a.length;b++){var d=a[b];255<d&&(this.WEBINA_ASSERTIONS&&this.WEBINA_assert(!1,"Character code "+d+" ("+String.fromCharCode(d)+") at offset "+b+" not in 0x00-0xFF."),d&=255);c.push(String.fromCharCode(d))}return c.join("")}}}();
......@@ -58,15 +58,34 @@ let Webina = (function() {
FS: window["FS"],
start: function start(vinaParams: IVinaParams, receptorPDBQTTxt: string, ligandPDBQTTxt: string, onDone?: any, onError?: any, baseUrl?: string): void {
// baseUrl = undefined; // For debugging.
let baseUrlMsg = "\nWEBINA\n======\n\n";
if (baseUrl !== undefined) {
if (baseUrl.slice(baseUrl.length - 1) !== "/") {
baseUrl += "/";
}
this.WEBINA_BASE_URL = baseUrl;
console.log("Webina: Using baseUrl = " + baseUrl);
baseUrlMsg += "User specified baseUrl: " + baseUrl + "\n";
} else {
baseUrlMsg += "No baseUrl specified, so using ./\n\n";
baseUrlMsg += "Use Webina.start() to specify the baseUrl:\n";
baseUrlMsg += " function start(vinaParams, receptorPDBQTTxt, \n"
baseUrlMsg += " ligandPDBQTTxt, onDone, \n";
baseUrlMsg += " onError, baseUrl)\n";
}
baseUrlMsg += "\nExpecting files at the following locations:\n";
for (let i = 0; i < 5; i++) {
const fileName = ["Webina.min.js", "vina.html.mem",
"vina.min.js", "vina.worker.min.js",
"vina.wasm"][i];
baseUrlMsg += " " + (baseUrl === undefined ? "./" : baseUrl) + fileName + "\n";
}
baseUrlMsg += "\n";
if (baseUrl !== undefined) {
console.log(baseUrlMsg);
} else {
console.warn("Webina: No baseUrl specified, so using the main directory ./")
console.warn(baseUrlMsg);
}
if (onError === undefined) {
......@@ -118,13 +137,6 @@ let Webina = (function() {
"ligandPDBQTTxt": ligandPDBQTTxt
};
// Initialize the memory
let memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
let meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.open("GET", memoryInitializer, !0), meminitXHR.responseType = "arraybuffer", meminitXHR.send(null);
if (vinaParams["receptor"] !== undefined) {
console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");
}
......@@ -161,9 +173,27 @@ let Webina = (function() {
window["WEBINA_Module"] = WEBINA_Module;
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script)
// Initialize the memory
let memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
let meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.onloadend = () => {
if (meminitXHR.status === 404) {
let msg = "Unable to access " + memoryInitializer +". See JavaScript console for warnings. The \"baseUrl\" variable passed to Webina is likely incorrect.";
WEBINA_Module["catchError"]({"message": msg});
console.warn(msg);
} else {
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script)
}
}
meminitXHR.open("GET", memoryInitializer, !0);
meminitXHR.responseType = "arraybuffer";
meminitXHR.send(null);
},
isDataURI: function(r) {
......
......@@ -9,5 +9,41 @@ import { VERSION } from "./Version";
console.log("Webina Web App " + VERSION);
declare var ga;
VueSetup.setup();
UI.setup();
// If the url has "durrantlab" in it, contact google analytics. Logging all
// usage would be ideal for grant reporting, but some users may wish to run
// versions of webina on their own servers specifically to maintain privacy
// (e.g., in case of proprietary data). Calls to google analytics in such
// scenarios could be alarming, even though I'm only recording basic
// demographics anyway.
if (window.location.href.indexOf("durrantlab") !== -1) {
setTimeout(() => {
// Just to make sure it isn't blocking...
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date().getTime();
a = s.createElement(o);
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-144382730-1', {
'name': 'webina'
});
// UA-144382730-1 reports to pcaviz account.
ga('webina.send', {
"hitType": 'event',
"eventCategory": 'webina',
"eventAction": 'pageview',
"eventLabel": window.location.href
});
}, 0)
}
No preview for this file type
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