Fix PV Protein Viewer build

This commit is contained in:
Dannon Baker
2020-09-24 13:25:27 -04:00
parent 5341fcb9e2
commit 2b07a0b2a5
4 changed files with 25 additions and 23 deletions
+1
View File
@@ -18,6 +18,7 @@ const PLUGIN_BUILD_DIRS = [
"media_player",
"mvpapp",
"openlayers",
"pv",
];
const paths = {
@@ -10,10 +10,11 @@
"dependencies": {
"babel-preset-env": "^1.6.1",
"backbone": "^1.3.3",
"bio-pv": "^1.8.1",
"bootstrap": "^3.3.7",
"jquery": "^3.1.1",
"jquery": "^3.5.1",
"parcel-bundler": "^1.4.1",
"bio-pv": "^1.8.1"
"underscore": "^1.11.0"
},
"scripts": {
"build": "parcel build src/pv.js -d static"
+21 -16
View File
@@ -1,35 +1,40 @@
import * as pv from "bio-pv";
import _ from "underscore";
import $ from "jquery";
_.extend(window.bundleEntries || {}, {
load: function(options) {
load: function (options) {
var settings = options.chart.settings;
var viewer = pv.Viewer(document.getElementById(options.targets[0]), {
quality: settings.get('quality'),
width: 'auto',
height: 'auto',
quality: settings.get("quality"),
width: "auto",
height: "auto",
antialias: true,
outline: true
outline: true,
});
$.ajax( {
$.ajax({
url: options.dataset.download_url,
cache: true,
success: function(response) {
success: function (response) {
var structure = pv.io.pdb(response);
var viewer_options = {};
_.each(settings.attributes, function(value, key) {
viewer_options[key.replace('viewer|', '')] = value;
_.each(settings.attributes, function (value, key) {
viewer_options[key.replace("viewer|", "")] = value;
});
viewer.clear();
viewer.renderAs('protein', structure, viewer_options.mode, viewer_options);
viewer.renderAs("protein", structure, viewer_options.mode, viewer_options);
viewer.centerOn(structure);
viewer.autoZoom();
options.chart.state('ok', 'Chart drawn.');
options.chart.state("ok", "Chart drawn.");
options.process.resolve();
},
error: function() {
options.chart.state('ok', 'Failed to load pdb file.');
error: function () {
options.chart.state("ok", "Failed to load pdb file.");
options.process.resolve();
}
},
});
$(window).resize(function() { viewer.fitParent() });
}
$(window).resize(function () {
viewer.fitParent();
});
},
});
File diff suppressed because one or more lines are too long