mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Update, fix ngl visualization
This commit is contained in:
@@ -1,31 +1,37 @@
|
||||
import * as ngl from "./viewer";
|
||||
|
||||
/** Get boolean as string */
|
||||
function asBoolean (value) {
|
||||
function asBoolean(value) {
|
||||
return String(value).toLowerCase() == "true";
|
||||
}
|
||||
|
||||
/* This should be part of the charts/viz standard lib */
|
||||
const slashCleanup = /(\/)+/g;
|
||||
function prefixedDownloadUrl(root, path) {
|
||||
return `${root}/${path}`.replace(slashCleanup, "/");
|
||||
}
|
||||
|
||||
window.bundleEntries = window.bundleEntries || {};
|
||||
window.bundleEntries.load = function (options) {
|
||||
var dataset = options.dataset,
|
||||
settings = options.chart.settings,
|
||||
stage = new ngl.Stage(options.target, { backgroundColor: settings.get("backcolor") }),
|
||||
representation_parameters = {},
|
||||
stage_parameters = {};
|
||||
representation_parameters = {
|
||||
const dataset = options.dataset;
|
||||
const settings = options.chart.settings;
|
||||
const stage = new ngl.Stage(options.target, { backgroundColor: settings.get("backcolor") });
|
||||
const representationParameters = {
|
||||
radius: settings.get("radius"),
|
||||
assembly: settings.get("assembly"),
|
||||
color: settings.get("colorscheme"),
|
||||
opacity: settings.get("opacity"),
|
||||
};
|
||||
stage_parameters = { ext: dataset.extension, defaultRepresentation: true };
|
||||
const safe_download_url = `${options.root}${dataset.download_url}`;
|
||||
const stageParameters = { ext: dataset.extension, defaultRepresentation: true };
|
||||
|
||||
try {
|
||||
stage.loadFile(safe_download_url, stage_parameters).then(function (component) {
|
||||
component.addRepresentation(settings.get("mode"), representation_parameters);
|
||||
options.chart.state("ok", "Chart drawn.");
|
||||
options.process.resolve();
|
||||
});
|
||||
stage
|
||||
.loadFile(prefixedDownloadUrl(options.root, dataset.download_url), stageParameters)
|
||||
.then(function (component) {
|
||||
component.addRepresentation(settings.get("mode"), representationParameters);
|
||||
options.chart.state("ok", "Chart drawn.");
|
||||
options.process.resolve();
|
||||
});
|
||||
} catch (e) {
|
||||
options.chart.state("failed", "Could not load PDB file.");
|
||||
options.process.resolve();
|
||||
|
||||
Reference in New Issue
Block a user