Commit 2d23971f authored by Jacob Durrant's avatar Jacob Durrant

Update to README.md, convert can handle large PDBs, etc.

parent ac53df75
......@@ -128,9 +128,8 @@ Parameters" tab. This tab includes several subsections that are useful for
setting up a Webina run.
__Input PDBQT Files.__ The "Input (PDBQT) Files" subsection allows the user to
select their receptor and ligand files. As is the case with command-line Vina,
these files must be in the PDBQT format. The user can also optionally specify
a known-pose PDB or PDBQT ligand file. This file includes the ligand in its
select their receptor and ligand files. The user can also optionally specify a
known-pose PDB or PDBQT ligand file. This file includes the ligand in its
experimentally determined, correct bound pose (e.g., per X-ray crystallography
or NMR). The known-pose file plays no role in the docking calculation; rather,
it serves as a positive-control reference for evaluating Webina-predicted
......@@ -186,9 +185,9 @@ will wish to adjust these parameters to avoid impacting the performance of
other programs and browser tabs.
__Advanced Parameters.__ The "Advanced Parameters" subsection allows users to
specify any of the many additional parameters that are also available via
command-line Vina. In our experience, it is rarely necessary to adjust these
parameters, so they are hidden by default.
specify many additional parameters that are also available via command-line
Vina. In our experience, it is rarely necessary to adjust these parameters, so
they are hidden by default.
__Run Vina from Command Line.__ The "Run Vina from Command Line" subsection
aims to help Vina users who wish to use the Webina web app to setup their
......@@ -235,8 +234,8 @@ Webina output files. An associated "Download" button allows users to easily
save those files.
__Run Vina from Command Line.__ Similar to the "Input Parameters" tab, the
"Output" Tab also includes a "Run Vina from Command Line" Subsection. This
section makes it easy for users to reproduce Webina's results using
"Output" tab also includes a "Run Vina from Command Line" subsection. This
subsection makes it easy for users to reproduce Webina's results using
stand-alone Vina. It also reminds users what parameters they selected to
generate the displayed Webina output.
......@@ -257,10 +256,16 @@ these instructions:
1. Download the `webina.zip` file
2. Uncompress the file: `unzip webina.zip`
3. Change to the new `webina/` directory: `cd webina`
4. Start a local server. Python provides one out of the box: `python -m
SimpleHTTPServer 8000`
5. Access the server from your web-browser: `http://localhost:8000/` or
perhaps `http://0.0.0.0:8000/`
4. Start a local server.
* You can use `Node.js` and `npm`:
* `npm install -g http-server`
* `http-server`
* [With some
coding](https://curiousprog.com/2018/10/08/serving-webassembly-files-with-a-development-web-server/),
you can also use Python 2.7's built-in server:
* `python -m SimpleHTTPServer 8000`
5. Access the server from your web-browser (e.g., `http://localhost:8000/`,
`http://0.0.0.0:8000/`, etc.)
Running Webina on other operating systems (e.g., Windows) should be similar.
......
......@@ -10,7 +10,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.6bf864e0e87d872d56ba.css" rel="stylesheet"><link href="styles.6bf864e0e87d872d56ba.css" rel="stylesheet"></head>
<link rel="shortcut icon" href="favicon.ico"><link href="vendors.e79089af6fca69f502b9.css" rel="stylesheet"><link href="styles.css.e79089af6fca69f502b9.css" rel="stylesheet"></head>
<body>
<div id="app"></div>
......@@ -24,6 +24,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.6bf864e0e87d872d56ba.js"></script><script type="text/javascript" src="vendors.6bf864e0e87d872d56ba.js"></script><script type="text/javascript" src="app.6bf864e0e87d872d56ba.js"></script><script type="text/javascript" src="styles.6bf864e0e87d872d56ba.js"></script><script type="text/javascript" src="styles.css.6bf864e0e87d872d56ba.js"></script></body>
<script type="text/javascript" src="runtime.e79089af6fca69f502b9.js"></script><script type="text/javascript" src="vendors.e79089af6fca69f502b9.js"></script><script type="text/javascript" src="app.e79089af6fca69f502b9.js"></script><script type="text/javascript" src="styles.css.e79089af6fca69f502b9.js"></script></body>
</html>
......@@ -110,45 +110,15 @@
<a href="#description-of-use" id="description-of-use" style="color: inherit; text-decoration: none;">
<h2>Description of Use</h2>
</a>
<a href="#pdbqtconvert-web-app" id="pdbqtconvert-web-app" style="color: inherit; text-decoration: none;">
<h3>PDBQTConvert Web App</h3>
</a>
<p>We created the PDBQTConvert web app to better accomodate novice users. Like
Vina, the Webina library accepts receptor/ligand input files only in the PDBQT
format, a PDB-like format that additionally includes atom types and partial
atomic charges. As described in the &quot;Webina and Vina Benchmarks&quot; section
below, a number of command-line and other programs are available for
converting receptor/ligand input files from popular formats (e.g., PDB, SDF,
etc.) to PDBQT. But PDBQTConvert provides an easier way to prepare these files
using a Bootstrap4-powered GUI in the browser. We distribute the PDBQTConvert
app alongside Webina, but as an entirely separate program. Unlike the Webina
library/app codebase, the PDBQTConvert app is GPLv2 licensed, not Apache-2.0.</p>
<p>PDBQTConvert uses the <a href="https://github.com/partridgejiang/cheminfo-to-web/tree/master/OpenBabel/OpenBabel-js">OpenBabel JS
library</a>
to convert receptor and ligand input files from many common formats (i.e.,
CAN, ENT, MCIF, MDL, MMCIF, MOL, MOL2, PDB, PQR, SD, SDF, SMI, SMILES, and
XYZ) to the Webina-compatible PDBQT format. The app can optionally include
branches and torsion trees, as required to indicate which ligand bonds should
be considered rotatable during Webina/Vina docking.</p>
<p>A second option instructs PDBQTConvert to add hydrogen atoms per a
user-specified pH. This feature is particularly useful because PDB receptor
structures derived via X-ray crystallography often lack the resolution
required to place hydrogen atoms, and many popular ligand formats (e.g.,
SMILES strings) do not enumerate explicit hydrogen atoms. And yet Webina/Vina
docking does require that receptor/ligand PDBQT files include polar hydrogen
atoms.</p>
<p>A third option instructs PDBQTConvert to generate 3D coordinates for the input
molecule. Many popular ligand formats (e.g., SMILES strings, flat SDF files,
etc.) do not include 3D atomic coordinates, but Webina/Vina docking requires
fully 3D models.</p>
<a href="#receptorligand-pdbqt-input-files" id="receptorligand-pdbqt-input-files" style="color: inherit; text-decoration: none;">
<h3>Receptor/Ligand PDBQT Input Files</h3>
</a>
<p>As is the case with command-line Vina, Webina accepts input receptor and
ligand files in the PDBQT format. The latest version of the Webina app
interfaces with the PDBQTConvert app (included in the git repository) to
convert these files from other formats (e.g., PDB) to PDBQT. But some advanced
users may wish to provide their own PDBQT files. Such users include:</p>
optionally interfaces with the PDBQTConvert app (included in the git
repository) to convert these files from other formats (e.g., PDB) to PDBQT.
But some advanced users may wish to provide their own PDBQT files. Such users
include:</p>
<ul>
<li>Users who wish to have more fine-grained control over the input. For
example, users who wish to specify protonation states, ring-conformational
......@@ -180,7 +150,7 @@
my_receptor.pdbqt</code></li>
</ul>
<a href="#preparing-the-ligand-pdbqt-file" id="preparing-the-ligand-pdbqt-file" style="color: inherit; text-decoration: none;">
<h5>Preparing the Ligand PDBQT File</h5>
<h4>Preparing the Ligand PDBQT File</h4>
</a>
<p>We recommend the following steps for those who wish to provide their own
ligand PDBQT files:</p>
......@@ -251,7 +221,7 @@ ligand.pdbqt</code></li>
<li>If users specify receptor/ligand input files that are not in the required
PDBQT format, the Webina web app will optionally attempt to convert them to
PDBQT using the PDBQTConvert app. Interactions between the Webina and
PDBQTConvert apps occur at &quot;arms length&quot; via an iframe.</li>
PDBQTConvert apps occur at &quot;arm&#39;s length&quot; via an iframe.</li>
<li>If users&#39; receptor files include non-protein residues that might interfere
with docking (e.g., a co-crystallized ligand), they can remove all
non-protein atoms.</li>
......@@ -352,10 +322,22 @@ ligand.pdbqt</code></li>
<li>Download the <code>webina.zip</code> file</li>
<li>Uncompress the file: <code>unzip webina.zip</code></li>
<li>Change to the new <code>webina/</code> directory: <code>cd webina</code></li>
<li>Start a local server. Python provides one out of the box: <code>python -m
SimpleHTTPServer 8000</code></li>
<li>Access the server from your web-browser: <code>http://localhost:8000/</code> or
perhaps <code>http://0.0.0.0:8000/</code></li>
<li>Start a local server.<ul>
<li>You can use <code>Node.js</code> and <code>npm</code>:<ul>
<li><code>npm install -g http-server</code></li>
<li><code>http-server</code></li>
</ul>
</li>
<li><a href="https://curiousprog.com/2018/10/08/serving-webassembly-files-with-a-development-web-server/">With some
coding</a>,
you can also use Python 2.7&#39;s built-in server:<ul>
<li><code>python -m SimpleHTTPServer 8000</code></li>
</ul>
</li>
</ul>
</li>
<li>Access the server from your web-browser (e.g., <code>http://localhost:8000/</code>,
<code>http://0.0.0.0:8000/</code>, etc.)</li>
</ol>
<p>Running Webina on other operating systems (e.g., Windows) should be similar.</p>
<a href="#compiling-the-webina-web-app" id="compiling-the-webina-web-app" style="color: inherit; text-decoration: none;">
......
......@@ -59,7 +59,19 @@ let computedFunctions = {
/** An object containing the vue-component methods functions. */
let methodsFunctions = {
"beginConvert"(e) {
/**
* Begin to convert the file to PDBQT.
* @param {*} e The click event.
* @param {number=1} currentPDBOptimizationLevel To what extent the PDB
* file should be
* optimized (to keep size
* low for converting).
* @param {string=""} successMsg The message to display
* to the user on success
* (if any).
* @returns void
*/
"beginConvert"(e, currentPDBOptimizationLevel=1, successMsg=""): void {
let frameWindow = document.getElementById("convert-frame")["contentWindow"];
frameWindow["startSpinner"]();
let content: string = this.$store.state["convertFile"];
......@@ -67,6 +79,10 @@ let methodsFunctions = {
content = content.substr(0, content.length - 1);
}
if (this["currentExt"].toUpperCase() === "PDB") {
successMsg += this.pdbOptimization(currentPDBOptimizationLevel);
}
if (this["currentType"]!=="ligand") {
// If it's not a ligand, there's no need to generate 3D
// coordinates.
......@@ -103,9 +119,22 @@ let methodsFunctions = {
// Update the filename to end in pdbqt.
let newFilename = Utils.replaceExt(this.$store.state[this["currentType"] + "FileName"], "converted.pdbqt");
this.$store.commit("updateFileName", { type: this["currentType"], filename: newFilename });
if (successMsg !== "") {
this["$bvModal"]["msgBoxOk"]("To convert your file, Webina had to make the following modifications: " + successMsg, {
"title": "Warning: File Too Big!",
});
}
}).catch((msg) => {
// The conversion failed. But if it's a PDB file, it might be
// worth trying to optimize it further.
if (currentPDBOptimizationLevel <= 3) {
this["beginConvert"](e, currentPDBOptimizationLevel + 1, successMsg);
return;
}
this["$refs"]["convert-modal"].hide();
this["$bvModal"]["msgBoxOk"]("Could not convert your file. Are you sure it is a properly formatted " + this["currentExt"] + " file?", {
this["$bvModal"]["msgBoxOk"]("Could not convert your file. Are you sure it is a properly formatted " + this["currentExt"] + " file? If so, it may be too large to convert in the browser.", {
"title": "Error Converting File!",
});
this.$store.commit("setVar", {
......@@ -119,7 +148,52 @@ let methodsFunctions = {
e.preventDefault();
},
"cancelPressed"() {
/**
* PDB files are very common, yet openbabel.js cannot convert them if they
* are too large. Here we make efforts to "optimize" the PDB file to
* maximize the changes that openbabel.js will succeed.
* @param {number} level The optimization level.
* @returns string A message to show the user re. any modifications made
* to the PDB file.
*/
pdbOptimization(level: number): string {
let pdbTxt = this.$store.state["convertFile"];
let msg = "";
switch (level) {
case 1:
// Always run this optimization. Just removes lines that don't
// start with ATOM and HETATM.
pdbTxt = pdbTxt.split("\n").filter(l => l.slice(0, 5) === "ATOM " || l.slice(0, 7) === "HETATM ").join("\n");
break;
case 2:
// Try removing everything but protein atoms.
pdbTxt = Utils.keepOnlyProteinAtoms(pdbTxt);
msg += " (1) Discard non-protein atoms."
break;
case 3:
// Keep only the first chain.
let chain = pdbTxt.slice(21,22);
pdbTxt = pdbTxt.split("\n").filter(l => l.slice(21,22) === chain).join("\n");
msg += " (1) Keep only the first chain (chain " + chain + ").";
break;
}
this.$store.commit("setVar", {
name: "convertFile",
val: pdbTxt
});
return msg;
},
/**
* The cancel button is pressed.
* @returns void
*/
"cancelPressed"(): void {
// Not sure the below is really necessary, but let's just make
// sure.
this.$store.commit("setVar", {
......@@ -134,7 +208,12 @@ let methodsFunctions = {
this.$store.commit("updateFileName", { type: this["currentType"], filename: "" });
},
"reloadIFrame"() {
/**
* Reload the iframe containing the PDBConvert app.
* @returns void
*/
"reloadIFrame"(): void {
document.getElementById("convert-frame")["src"] = "./pdbqt_convert/index.html?startBlank";
}
}
......
......@@ -186,25 +186,7 @@ let methodsFunctions = {
* @returns void
*/
"onShowKeepProteinOnlyClick"(e: any): void {
let proteinResidues = [
"ALA", "ARG", "ASH", "ASN", "ASP", "ASX", "CYM", "CYS", "CYX",
"GLH", "GLN", "GLU", "GLX", "GLY", "HID", "HIE", "HIP", "HIS",
"HSD", "HSE", "HSP", "ILE", "LEU", "LYN", "LYS", "MET", "MSE",
"PHE", "PRO", "SER", "THR", "TRP", "TYR", "VAL"
];
let lines: string[] = this.$store.state["receptorContents"].split("\n");
let l = lines.length;
let linesToKeep = "";
for (let i = 0; i < l; i++) {
if ((lines[i].substr(0, 5) !== "ATOM ") && (lines[i].substr(0, 7) !== "HETATM ")) {
// Not an atom line.
continue;
}
if (proteinResidues.indexOf(lines[i].substr(17,3)) !== -1) {
linesToKeep += lines[i] + "\n";
}
}
let linesToKeep = Utils.keepOnlyProteinAtoms(this.$store.state["receptorContents"]);
this.$store.commit("setVar", {
name: "receptorContents",
......
......@@ -80,3 +80,32 @@ export function replaceExt(filename: string, newExt: string): string {
}
return filename + "." + newExt;
}
/**
* Given some PDB text, keep only those lines that describe protein atoms.
* @param {string} pdbTxt The original PDB text.
* @returns string the PDB text containing only the protein atoms.
*/
export function keepOnlyProteinAtoms(pdbTxt: string): string {
let proteinResidues = [
"ALA", "ARG", "ASH", "ASN", "ASP", "ASX", "CYM", "CYS", "CYX",
"GLH", "GLN", "GLU", "GLX", "GLY", "HID", "HIE", "HIP", "HIS",
"HSD", "HSE", "HSP", "ILE", "LEU", "LYN", "LYS", "MET", "MSE",
"PHE", "PRO", "SER", "THR", "TRP", "TYR", "VAL"
];
let lines: string[] = pdbTxt.split("\n");
let l = lines.length;
let linesToKeep = "";
for (let i = 0; i < l; i++) {
if ((lines[i].substr(0, 5) !== "ATOM ") && (lines[i].substr(0, 7) !== "HETATM ")) {
// Not an atom line.
continue;
}
if (proteinResidues.indexOf(lines[i].substr(17,3)) !== -1) {
linesToKeep += lines[i] + "\n";
}
}
return linesToKeep;
}
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