mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge remote-tracking branch 'upstream/release_20.09' into dev
This commit is contained in:
+17
-9
@@ -1,7 +1,7 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const del = require("del");
|
||||
const { src, dest, series, parallel } = require("gulp");
|
||||
const { src, dest, series, parallel, watch } = require("gulp");
|
||||
const child_process = require("child_process");
|
||||
const glob = require("glob");
|
||||
|
||||
@@ -10,14 +10,17 @@ const glob = require("glob");
|
||||
* un-built visualizations in the repository; for performance and
|
||||
* simplicity just add them one at a time until we upgrade older viz's.
|
||||
*/
|
||||
const PLUGIN_BUILD_DIRS = [
|
||||
const PLUGIN_BUILD_IDS = [
|
||||
"annotate_image",
|
||||
"chiraviz",
|
||||
"editor",
|
||||
"heatmap/heatmap_default",
|
||||
"hyphyvision",
|
||||
"media_player",
|
||||
"mvpapp",
|
||||
"ngl",
|
||||
"openlayers",
|
||||
"pv",
|
||||
];
|
||||
|
||||
const paths = {
|
||||
@@ -26,7 +29,7 @@ const paths = {
|
||||
"../config/plugins/{visualizations,interactive_environments}/*/static/**/*",
|
||||
"../config/plugins/{visualizations,interactive_environments}/*/*/static/**/*",
|
||||
],
|
||||
plugin_build_dirs: [`../config/plugins/visualizations/{${PLUGIN_BUILD_DIRS.join(",")}}/package.json`],
|
||||
plugin_build_modules: [`../config/plugins/visualizations/{${PLUGIN_BUILD_IDS.join(",")}}/package.json`],
|
||||
lib_locs: {
|
||||
// This is a stepping stone towards having all this staged
|
||||
// automatically. Eventually, this dictionary and staging step will
|
||||
@@ -73,10 +76,10 @@ function stagePlugins() {
|
||||
|
||||
function buildPlugins(callback) {
|
||||
/*
|
||||
* Walk plugin_build_dirs glob and attempt to build modules.
|
||||
* Walk plugin_build_modules glob and attempt to build modules.
|
||||
* */
|
||||
paths.plugin_build_dirs.map((build_dir) => {
|
||||
glob(build_dir, {}, (er, files) => {
|
||||
paths.plugin_build_modules.map((build_module) => {
|
||||
glob(build_module, {}, (er, files) => {
|
||||
files.map((file) => {
|
||||
let skip_build = false;
|
||||
const f = path.join(process.cwd(), file).slice(0, -12);
|
||||
@@ -120,10 +123,15 @@ function cleanPlugins() {
|
||||
return del(["../static/plugins/{visualizations,interactive_environments}/*"], { force: true });
|
||||
}
|
||||
|
||||
client = parallel(fonts, stageLibs);
|
||||
plugins = series(buildPlugins, cleanPlugins, stagePlugins);
|
||||
const client = parallel(fonts, stageLibs);
|
||||
const plugins = series(buildPlugins, cleanPlugins, stagePlugins);
|
||||
|
||||
function watchPlugins() {
|
||||
const BUILD_PLUGIN_WATCH_GLOB = [`../config/plugins/visualizations/{${PLUGIN_BUILD_IDS.join(",")}}/**/*`];
|
||||
watch(BUILD_PLUGIN_WATCH_GLOB, { queue: false }, plugins);
|
||||
}
|
||||
|
||||
module.exports.client = client;
|
||||
module.exports.plugins = plugins;
|
||||
|
||||
module.exports.watchPlugins = watchPlugins;
|
||||
module.exports.default = parallel(client, plugins);
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@
|
||||
"duplicate-package-checker-webpack-plugin": "^3.0.0",
|
||||
"eslint": "^7.7.0",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"expose-loader": "^0.7.5",
|
||||
"expose-loader": "^1.0.0",
|
||||
"file-loader": "^6.0.0",
|
||||
"gulp": "^4.0.2",
|
||||
"ignore-loader": "^0.1.2",
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
* will handle initializations for components individually.
|
||||
*/
|
||||
|
||||
/* jquery and _ are exposed via expose-loader while several external plugins rely on these */
|
||||
import $ from "jquery";
|
||||
import "bootstrap";
|
||||
import _ from "expose-loader?exposes[]=_&exposes[]=underscore!underscore"; // eslint-disable-line no-unused-vars
|
||||
|
||||
export { getGalaxyInstance, setGalaxyInstance } from "app";
|
||||
import { TracksterUIView } from "viz/trackster";
|
||||
export { TracksterUI } from "viz/trackster";
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
<span class="mr-1">{{ buttonText }}</span>
|
||||
</b-button>
|
||||
</div>
|
||||
<div class="py-2" v-else-if="query">
|
||||
<b-badge v-if="query.length < 3" class="w-100">Search string too short!</b-badge>
|
||||
<b-badge v-else class="w-100">No results found!</b-badge>
|
||||
<div class="py-2" v-else-if="queryTooShort">
|
||||
<b-badge class="w-100">Search string too short!</b-badge>
|
||||
</div>
|
||||
<div class="py-2" v-else-if="queryFinished">
|
||||
<b-badge class="w-100">No results found!</b-badge>
|
||||
</div>
|
||||
</div>
|
||||
<div class="unified-panel-body">
|
||||
@@ -70,6 +72,7 @@ export default {
|
||||
query: null,
|
||||
results: null,
|
||||
queryFilter: null,
|
||||
queryPending: false,
|
||||
showSections: false,
|
||||
buttonText: "",
|
||||
buttonIcon: "",
|
||||
@@ -90,6 +93,12 @@ export default {
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
queryTooShort() {
|
||||
return this.query && this.query.length < 3;
|
||||
},
|
||||
queryFinished() {
|
||||
return this.query && this.queryPending != true;
|
||||
},
|
||||
sections() {
|
||||
if (this.showSections) {
|
||||
return filterToolSections(this.toolbox, this.results);
|
||||
@@ -124,11 +133,13 @@ export default {
|
||||
methods: {
|
||||
onQuery(query) {
|
||||
this.query = query;
|
||||
this.queryPending = true;
|
||||
},
|
||||
onResults(results) {
|
||||
this.results = results;
|
||||
this.queryFilter = this.hasResults ? this.query : null;
|
||||
this.setButtonText();
|
||||
this.queryPending = false;
|
||||
},
|
||||
onFavorites(term) {
|
||||
this.query = term;
|
||||
|
||||
+10
-12
@@ -88,11 +88,9 @@ module.exports = (env = {}, argv = {}) => {
|
||||
use: [
|
||||
{
|
||||
loader: "expose-loader",
|
||||
options: "jQuery",
|
||||
},
|
||||
{
|
||||
loader: "expose-loader",
|
||||
options: "$",
|
||||
options: {
|
||||
exposes: ["jQuery", "$"],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -101,11 +99,9 @@ module.exports = (env = {}, argv = {}) => {
|
||||
use: [
|
||||
{
|
||||
loader: "expose-loader",
|
||||
options: "_",
|
||||
},
|
||||
{
|
||||
loader: "expose-loader",
|
||||
options: "underscore",
|
||||
options: {
|
||||
exposes: ["underscore", "_"],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -128,7 +124,9 @@ module.exports = (env = {}, argv = {}) => {
|
||||
use: [
|
||||
{
|
||||
loader: "expose-loader",
|
||||
options: "bundleEntries",
|
||||
options: {
|
||||
exposes: "bundleEntries",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -137,7 +135,7 @@ module.exports = (env = {}, argv = {}) => {
|
||||
use: [
|
||||
{
|
||||
loader: "expose-loader",
|
||||
options: "config",
|
||||
options: { exposes: "config" },
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
+7
-4
@@ -5655,10 +5655,13 @@ expect@^26.4.2:
|
||||
jest-message-util "^26.3.0"
|
||||
jest-regex-util "^26.0.0"
|
||||
|
||||
expose-loader@^0.7.5:
|
||||
version "0.7.5"
|
||||
resolved "https://registry.yarnpkg.com/expose-loader/-/expose-loader-0.7.5.tgz#e29ea2d9aeeed3254a3faa1b35f502db9f9c3f6f"
|
||||
integrity sha512-iPowgKUZkTPX5PznYsmifVj9Bob0w2wTHVkt/eYNPSzyebkUgIedmskf/kcfEIWpiWjg3JRjnW+a17XypySMuw==
|
||||
expose-loader@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/expose-loader/-/expose-loader-1.0.0.tgz#1676dde8fce6662584e17f8531e24d2afe8dae11"
|
||||
integrity sha512-xgt47+pEQrlCyCoO09cMKWf5qiurK6qMtvjUPm8+Uso5WwkNHeD47P0Zb3R9Kvk5zUcJWLax95xaaXDJCmoNjw==
|
||||
dependencies:
|
||||
loader-utils "^2.0.0"
|
||||
schema-utils "^2.6.6"
|
||||
|
||||
express@^4.17.1:
|
||||
version "4.17.1"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<import>../../heatmap_default/config/heatmap_shared.xml</import>
|
||||
</macros>
|
||||
<description>Applies hierarchical clustering to a matrix using R. The data has to be provided in 3-column format. The result is displayed as clustered heatmap.</description>
|
||||
<entry_point entry_point_type="chart" src="../../heatmap_default/static/script.js" load="heatmap_cluster"/>
|
||||
<entry_point entry_point_type="chart" src="../../heatmap_default/static/dist/script.js" load="heatmap_cluster"/>
|
||||
<expand macro="shared"/>
|
||||
<specs>
|
||||
<tag>svg</tag>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<import>heatmap_shared.xml</import>
|
||||
</macros>
|
||||
<description>Renders a heatmap from matrix data provided in 3-column format (x, y, observation).</description>
|
||||
<entry_point entry_point_type="chart" src="script.js" load="heatmap_default"/>
|
||||
<entry_point entry_point_type="chart" src="dist/script.js" load="heatmap_default"/>
|
||||
<expand macro="shared"/>
|
||||
<specs>
|
||||
<tag>svg</tag>
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
"license": "AFL-3.0",
|
||||
"dependencies": {
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"backbone": "^1.3.3",
|
||||
"backbone": "^1.4.0",
|
||||
"bootstrap": "^3.3.7",
|
||||
"d3": "3",
|
||||
"jquery": "^3.1.1",
|
||||
"parcel-bundler": "^1.4.1"
|
||||
"jquery": "^3.5.1",
|
||||
"parcel-bundler": "^1.4.1",
|
||||
"underscore": "^1.11.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "parcel build src/script.js -d static"
|
||||
"build": "parcel build src/script.js -d static/dist"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import _ from "underscore";
|
||||
import $ from "jquery";
|
||||
import * as d3 from "d3";
|
||||
import Backbone from "backbone";
|
||||
import Colors from "./colorsets";
|
||||
|
||||
/* global Backbone */
|
||||
/* global _ */
|
||||
/* global $ */
|
||||
|
||||
var Series = window.bundleEntries.chartUtilities.Series;
|
||||
var Datasets = window.bundleEntries.chartUtilities.Datasets;
|
||||
var Jobs = window.bundleEntries.chartUtilities.Jobs;
|
||||
@@ -15,12 +14,12 @@ var CommonWrapper = Backbone.View.extend({
|
||||
top: 40,
|
||||
right: 70,
|
||||
bottom: 70,
|
||||
left: 70
|
||||
left: 70,
|
||||
},
|
||||
style: {
|
||||
"font-weight": "normal",
|
||||
"font-family": "Verdana",
|
||||
"font-size": 12
|
||||
"font-size": 12,
|
||||
},
|
||||
legend: {
|
||||
width: 15,
|
||||
@@ -28,15 +27,15 @@ var CommonWrapper = Backbone.View.extend({
|
||||
style: {
|
||||
"font-weight": "normal",
|
||||
"font-family": "Verdana",
|
||||
"font-size": 11
|
||||
"font-size": 11,
|
||||
},
|
||||
limit: 7
|
||||
limit: 7,
|
||||
},
|
||||
background_color: "#FFFFFF",
|
||||
debug_color: "#FFFFFF"
|
||||
debug_color: "#FFFFFF",
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
this.chart = options.chart;
|
||||
this.canvas_id = options.canvas_id;
|
||||
@@ -55,26 +54,17 @@ var CommonWrapper = Backbone.View.extend({
|
||||
this.yScale = d3.scale.linear().domain([0, this.categories.array.y.length]);
|
||||
|
||||
// color scale
|
||||
this.zMin = d3.min(this.data, function(d) {
|
||||
this.zMin = d3.min(this.data, function (d) {
|
||||
return d.z;
|
||||
});
|
||||
this.zMax = d3.max(this.data, function(d) {
|
||||
this.zMax = d3.max(this.data, function (d) {
|
||||
return d.z;
|
||||
});
|
||||
this.zScale = d3.scale
|
||||
.quantize()
|
||||
.domain([this.zMin, this.zMax])
|
||||
.range(this.color_set);
|
||||
this.zScale = d3.scale.quantize().domain([this.zMin, this.zMax]).range(this.color_set);
|
||||
|
||||
// create axis
|
||||
this.xAxis = d3.svg
|
||||
.axis()
|
||||
.scale(this.xScale)
|
||||
.orient("bottom");
|
||||
this.yAxis = d3.svg
|
||||
.axis()
|
||||
.scale(this.yScale)
|
||||
.orient("left");
|
||||
this.xAxis = d3.svg.axis().scale(this.xScale).orient("bottom");
|
||||
this.yAxis = d3.svg.axis().scale(this.yScale).orient("left");
|
||||
|
||||
// make categories
|
||||
this._makeTickFormat("x");
|
||||
@@ -89,22 +79,22 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.style("opacity", 0);
|
||||
|
||||
// refresh on window resize
|
||||
$(window).on("resize", function() {
|
||||
$(window).on("resize", function () {
|
||||
self.redraw();
|
||||
});
|
||||
this.redraw();
|
||||
Series.addZoom({
|
||||
xAxis: this.xAxis,
|
||||
yAxis: this.yAxis,
|
||||
redraw: function() {
|
||||
redraw: function () {
|
||||
self.redraw();
|
||||
},
|
||||
svg: d3.select("#" + this.canvas_id)
|
||||
svg: d3.select("#" + this.canvas_id),
|
||||
});
|
||||
},
|
||||
|
||||
/** Redraw */
|
||||
redraw: function() {
|
||||
redraw: function () {
|
||||
// get/reset container
|
||||
var container = $("#" + this.canvas_id);
|
||||
container.empty();
|
||||
@@ -157,7 +147,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/** Build boxes */
|
||||
_buildBoxes: function() {
|
||||
_buildBoxes: function () {
|
||||
var self = this;
|
||||
var height = this.height;
|
||||
var width = this.width;
|
||||
@@ -172,15 +162,10 @@ var CommonWrapper = Backbone.View.extend({
|
||||
}
|
||||
|
||||
// set background color
|
||||
svg
|
||||
.append("rect")
|
||||
.attr("width", width)
|
||||
.attr("height", height)
|
||||
.attr("fill", this.options.background_color);
|
||||
svg.append("rect").attr("width", width).attr("height", height).attr("fill", this.options.background_color);
|
||||
|
||||
// clip path
|
||||
svg
|
||||
.append("clipPath")
|
||||
svg.append("clipPath")
|
||||
.attr("id", "clip")
|
||||
.append("rect")
|
||||
.attr("x", 0)
|
||||
@@ -192,13 +177,10 @@ var CommonWrapper = Backbone.View.extend({
|
||||
var chartBody = svg.append("g").attr("clip-path", "url(#clip)");
|
||||
|
||||
// add boxes to chart area
|
||||
var boxes = chartBody.selectAll("box-group").data(this.data, function(d, i) {
|
||||
var boxes = chartBody.selectAll("box-group").data(this.data, function (d, i) {
|
||||
return d.x + "\0" + d.y;
|
||||
});
|
||||
var gEnter = boxes
|
||||
.enter()
|
||||
.append("g")
|
||||
.attr("class", "box-group");
|
||||
var gEnter = boxes.enter().append("g").attr("class", "box-group");
|
||||
gEnter.append("rect").attr("class", "heat-box");
|
||||
boxes
|
||||
.selectAll("rect")
|
||||
@@ -212,7 +194,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
// add tooltip events
|
||||
boxes
|
||||
.selectAll("rect")
|
||||
.on("dblclick", function(d) {
|
||||
.on("dblclick", function (d) {
|
||||
var url = self.chart.settings.get("url_template").trim();
|
||||
if (url) {
|
||||
d3.event.stopPropagation();
|
||||
@@ -222,7 +204,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
window.open(url.replace("__LABEL__", yLabel));
|
||||
}
|
||||
})
|
||||
.on("mouseover", function(d) {
|
||||
.on("mouseover", function (d) {
|
||||
var matrix = this.getScreenCTM().translate(+this.getAttribute("cx"), +this.getAttribute("cy"));
|
||||
self.tooltip.style("opacity", 0.9);
|
||||
self.tooltip
|
||||
@@ -230,7 +212,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.style("left", window.pageXOffset + matrix.e + 15 + "px")
|
||||
.style("top", window.pageYOffset + matrix.f - 30 + "px");
|
||||
})
|
||||
.on("mouseout", function(d) {
|
||||
.on("mouseout", function (d) {
|
||||
self.tooltip.style("opacity", 0);
|
||||
});
|
||||
|
||||
@@ -242,7 +224,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/** Build x axis */
|
||||
_buildX: function() {
|
||||
_buildX: function () {
|
||||
var height = this.height;
|
||||
var width = this.width;
|
||||
var margin = this.options.margin;
|
||||
@@ -264,15 +246,14 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.selectAll("text")
|
||||
.style(this.options.style)
|
||||
.style({ "font-size": xFontSize + "px" })
|
||||
.attr("transform", function(d) {
|
||||
.attr("transform", function (d) {
|
||||
var y = -this.getBBox().height - 15;
|
||||
var x = -xFontSize + boxWidth / 2;
|
||||
return "rotate(-90)translate(" + y + "," + x + ")";
|
||||
});
|
||||
|
||||
// set background color
|
||||
svg
|
||||
.append("rect")
|
||||
svg.append("rect")
|
||||
.attr("width", width)
|
||||
.attr("height", font_size + 3)
|
||||
.attr("y", height + margin.bottom - font_size - 3)
|
||||
@@ -285,7 +266,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.attr("class", "x label")
|
||||
.style(this.options.style)
|
||||
.text(this.chart.settings.get("x_axis_label"))
|
||||
.attr("transform", function(d) {
|
||||
.attr("transform", function (d) {
|
||||
var y = height + margin.bottom - font_size / 3;
|
||||
var x = (width - this.getBBox().width) / 2;
|
||||
return "translate(" + x + "," + y + ")";
|
||||
@@ -298,7 +279,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.style(this.options.style)
|
||||
.style({ "font-size": 1.1 * font_size })
|
||||
.text(this.group.key)
|
||||
.attr("transform", function(d) {
|
||||
.attr("transform", function (d) {
|
||||
var y = -margin.top / 2;
|
||||
var x = (width - this.getBBox().width) / 2;
|
||||
return "translate(" + x + "," + y + ")";
|
||||
@@ -306,7 +287,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/** Build y axis */
|
||||
_buildY: function() {
|
||||
_buildY: function () {
|
||||
var height = this.height;
|
||||
var margin = this.options.margin;
|
||||
var svg = this.svg;
|
||||
@@ -314,11 +295,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
var boxHeight = this.boxHeight;
|
||||
|
||||
// draw y axis
|
||||
this.gyAxis = svg
|
||||
.append("g")
|
||||
.attr("class", "y axis")
|
||||
.style("stroke-width", 1)
|
||||
.call(this.yAxis);
|
||||
this.gyAxis = svg.append("g").attr("class", "y axis").style("stroke-width", 1).call(this.yAxis);
|
||||
|
||||
// fix text
|
||||
var yFontSize = Math.min(boxHeight, font_size);
|
||||
@@ -329,8 +306,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.attr("y", -boxHeight / 2);
|
||||
|
||||
// set background color
|
||||
svg
|
||||
.append("rect")
|
||||
svg.append("rect")
|
||||
.attr("width", font_size)
|
||||
.attr("height", height)
|
||||
.attr("x", -margin.left)
|
||||
@@ -343,7 +319,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.attr("class", "y label")
|
||||
.style(this.options.style)
|
||||
.text(this.chart.settings.get("y_axis_label"))
|
||||
.attr("transform", function(d) {
|
||||
.attr("transform", function (d) {
|
||||
var x = -margin.left + font_size - 2;
|
||||
var y = -(height + this.getBBox().width) / 2;
|
||||
return "rotate(-90)translate(" + y + "," + x + ")";
|
||||
@@ -351,7 +327,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/** Build legend */
|
||||
_buildLegend: function() {
|
||||
_buildLegend: function () {
|
||||
var self = this;
|
||||
var height = this.height;
|
||||
var width = this.width;
|
||||
@@ -361,9 +337,9 @@ var CommonWrapper = Backbone.View.extend({
|
||||
var legendSize = this.options.legend.size;
|
||||
var legendWidth = this.options.legend.width;
|
||||
var legendElements = this.zScale.range().length;
|
||||
var legendElementHeight = Math.max(legendSize * height / legendElements, font_size);
|
||||
var legendHeight = legendElements * legendElementHeight / 2;
|
||||
var data = d3.range(this.zMin, this.zMax, 2 * (this.zMax - this.zMin) / legendElements).reverse();
|
||||
var legendElementHeight = Math.max((legendSize * height) / legendElements, font_size);
|
||||
var legendHeight = (legendElements * legendElementHeight) / 2;
|
||||
var data = d3.range(this.zMin, this.zMax, (2 * (this.zMax - this.zMin)) / legendElements).reverse();
|
||||
if (data.length < 2) {
|
||||
return;
|
||||
}
|
||||
@@ -373,7 +349,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.enter()
|
||||
.append("g")
|
||||
.attr("class", "legend")
|
||||
.attr("transform", function(d, i) {
|
||||
.attr("transform", function (d, i) {
|
||||
var x = width + 10;
|
||||
var y = (height - legendHeight) / 2 + i * legendElementHeight;
|
||||
return "translate(" + x + "," + y + ")";
|
||||
@@ -382,17 +358,17 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.append("rect")
|
||||
.attr("width", legendWidth)
|
||||
.attr("height", legendElementHeight)
|
||||
.style("fill", function(z) {
|
||||
.style("fill", function (z) {
|
||||
return self.zScale(z);
|
||||
});
|
||||
legend
|
||||
.append("text")
|
||||
.attr("x", legendWidth + 4)
|
||||
.attr("y", function() {
|
||||
.attr("y", function () {
|
||||
return (legendElementHeight + this.getBBox().height) / 2;
|
||||
})
|
||||
.style(this.options.legend.style)
|
||||
.text(function(d) {
|
||||
.text(function (d) {
|
||||
return String(d).length > limit ? String(d).substr(0, limit - 2) + ".." : String(d);
|
||||
});
|
||||
this.svg
|
||||
@@ -400,7 +376,7 @@ var CommonWrapper = Backbone.View.extend({
|
||||
.style(this.options.legend.style)
|
||||
.style({ "font-size": 9, "font-weight": "bold" })
|
||||
.text("Legend")
|
||||
.attr("transform", function(d, i) {
|
||||
.attr("transform", function (d, i) {
|
||||
var x = width + (margin.right - this.getBBox().width) / 2;
|
||||
var y = (height - legendHeight) / 2 - 10;
|
||||
return "translate(" + x + "," + y + ")";
|
||||
@@ -408,30 +384,30 @@ var CommonWrapper = Backbone.View.extend({
|
||||
},
|
||||
|
||||
/** Create axes formatting */
|
||||
_makeTickFormat: function(id) {
|
||||
_makeTickFormat: function (id) {
|
||||
var settings = this.chart.settings;
|
||||
var self = this;
|
||||
Series.makeTickFormat({
|
||||
categories: self.categories.array[id],
|
||||
type: settings.get(id + "_axis_type|type"),
|
||||
precision: settings.get(id + "_axis_type|precision"),
|
||||
formatter: function(formatter) {
|
||||
formatter: function (formatter) {
|
||||
if (formatter) {
|
||||
self[id + "Axis"].tickFormat(function(value) {
|
||||
self[id + "Axis"].tickFormat(function (value) {
|
||||
return formatter(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/** Handle error */
|
||||
_handleError: function(err) {
|
||||
_handleError: function (err) {
|
||||
this.chart.state("failed", err);
|
||||
},
|
||||
|
||||
/** Main template */
|
||||
_templateTooltip: function(d) {
|
||||
_templateTooltip: function (d) {
|
||||
var x = this.categories.array.x[d.x];
|
||||
var y = this.categories.array.y[d.y];
|
||||
var z = d.z;
|
||||
@@ -457,55 +433,55 @@ var CommonWrapper = Backbone.View.extend({
|
||||
"</tr>" +
|
||||
"</table>"
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
_.extend(window.bundleEntries || {}, {
|
||||
heatmap_default: function(options) {
|
||||
options.render = function(canvas_id, groups) {
|
||||
heatmap_default: function (options) {
|
||||
options.render = function (canvas_id, groups) {
|
||||
new CommonWrapper({
|
||||
chart: options.chart,
|
||||
canvas_id: canvas_id,
|
||||
groups: groups
|
||||
groups: groups,
|
||||
});
|
||||
return true;
|
||||
};
|
||||
Datasets.requestPanels(options);
|
||||
},
|
||||
heatmap_cluster: function(options) {
|
||||
heatmap_cluster: function (options) {
|
||||
Jobs.request(
|
||||
options.chart,
|
||||
Jobs.requestCharts(options.chart, "heatmap"),
|
||||
function(dataset) {
|
||||
function (dataset) {
|
||||
var dataset_groups = new Backbone.Collection();
|
||||
options.chart.groups.each(function(group, index) {
|
||||
options.chart.groups.each(function (group, index) {
|
||||
dataset_groups.add({
|
||||
__data_columns: {
|
||||
x: { is_label: true },
|
||||
y: { is_label: true },
|
||||
z: { is_numeric: true }
|
||||
z: { is_numeric: true },
|
||||
},
|
||||
x: index++,
|
||||
y: index++,
|
||||
z: index++,
|
||||
key: group.get("key")
|
||||
key: group.get("key"),
|
||||
});
|
||||
});
|
||||
options.dataset_id = dataset.id;
|
||||
options.dataset_groups = dataset_groups;
|
||||
options.render = function(canvas_id, groups) {
|
||||
options.render = function (canvas_id, groups) {
|
||||
new CommonWrapper({
|
||||
chart: options.chart,
|
||||
canvas_id: canvas_id,
|
||||
groups: groups
|
||||
groups: groups,
|
||||
});
|
||||
return true;
|
||||
};
|
||||
Datasets.requestPanels(options);
|
||||
},
|
||||
function() {
|
||||
function () {
|
||||
options.process.reject();
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@
|
||||
<params>
|
||||
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
|
||||
</params>
|
||||
<entry_point entry_point_type="chart" src="ngl.js"/>
|
||||
<entry_point entry_point_type="chart" src="dist/ngl.js"/>
|
||||
<settings>
|
||||
<input>
|
||||
<label>Quality</label>
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
"ngl": "^0.10.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "parcel build src/ngl.js -d static"
|
||||
"build": "parcel build src/ngl.js -d static/dist"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
import * as ngl from "./viewer";
|
||||
_.extend(window.bundleEntries || {}, {
|
||||
load: function(options) {
|
||||
var dataset = options.dataset,
|
||||
settings = options.chart.settings,
|
||||
stage = new ngl.Stage(options.targets[0], {backgroundColor: settings.get('backcolor')}),
|
||||
viewer_options = {},
|
||||
representation_parameters = {},
|
||||
stage_parameters = {};
|
||||
representation_parameters = {
|
||||
radius: settings.get('radius'),
|
||||
scale: settings.get('scale'),
|
||||
assembly: settings.get('assembly'),
|
||||
color: settings.get('colorscheme'),
|
||||
opacity: settings.get('opacity')
|
||||
};
|
||||
stage_parameters = {ext: dataset.extension, defaultRepresentation: true};
|
||||
try {
|
||||
stage.loadFile(dataset.download_url, stage_parameters).then(function(component) {
|
||||
component.addRepresentation(settings.get('mode'), representation_parameters);
|
||||
options.chart.state('ok', 'Chart drawn.');
|
||||
options.process.resolve();
|
||||
} );
|
||||
} catch(e) {
|
||||
options.chart.state('failed', 'Could not load PDB file.');
|
||||
|
||||
window.bundleEntries = window.bundleEntries || {};
|
||||
window.bundleEntries.load = function (options) {
|
||||
var dataset = options.dataset,
|
||||
settings = options.chart.settings,
|
||||
stage = new ngl.Stage(options.targets[0], { backgroundColor: settings.get("backcolor") }),
|
||||
viewer_options = {},
|
||||
representation_parameters = {},
|
||||
stage_parameters = {};
|
||||
representation_parameters = {
|
||||
radius: settings.get("radius"),
|
||||
scale: settings.get("scale"),
|
||||
assembly: settings.get("assembly"),
|
||||
color: settings.get("colorscheme"),
|
||||
opacity: settings.get("opacity"),
|
||||
};
|
||||
stage_parameters = { ext: dataset.extension, defaultRepresentation: true };
|
||||
try {
|
||||
stage.loadFile(dataset.download_url, stage_parameters).then(function (component) {
|
||||
component.addRepresentation(settings.get("mode"), representation_parameters);
|
||||
options.chart.state("ok", "Chart drawn.");
|
||||
options.process.resolve();
|
||||
}
|
||||
stage.setQuality(settings.get('quality' ) );
|
||||
if (settings.get('spin') === true || settings.get('spin') === 'true') {
|
||||
stage.setSpin([0, 1, 0], 0.01);
|
||||
}
|
||||
// Re-renders the molecule view when window is resized
|
||||
$(window).resize(function() {stage.viewer.handleResize()});
|
||||
});
|
||||
} catch (e) {
|
||||
options.chart.state("failed", "Could not load PDB file.");
|
||||
options.process.resolve();
|
||||
}
|
||||
});
|
||||
stage.setQuality(settings.get("quality"));
|
||||
if (settings.get("spin") === true || settings.get("spin") === "true") {
|
||||
stage.setSpin([0, 1, 0], 0.01);
|
||||
}
|
||||
// Re-renders the molecule view when window is resized
|
||||
window.onresize = function () {
|
||||
viewer.fitParent();
|
||||
};
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@
|
||||
<params>
|
||||
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
|
||||
</params>
|
||||
<entry_point entry_point_type="chart" src="pv.js"/>
|
||||
<entry_point entry_point_type="chart" src="dist/pv.js"/>
|
||||
<settings>
|
||||
<input>
|
||||
<label>Quality</label>
|
||||
|
||||
@@ -8,14 +8,10 @@
|
||||
],
|
||||
"license": "AFL-3.0",
|
||||
"dependencies": {
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"backbone": "^1.3.3",
|
||||
"bootstrap": "^3.3.7",
|
||||
"jquery": "^3.1.1",
|
||||
"parcel-bundler": "^1.4.1",
|
||||
"bio-pv": "^1.8.1"
|
||||
"bio-pv": "^1.8.1",
|
||||
"parcel-bundler": "^1.12.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "parcel build src/pv.js -d static"
|
||||
"build": "parcel build src/pv.js -d static/dist"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
import * as pv from "bio-pv";
|
||||
_.extend(window.bundleEntries || {}, {
|
||||
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',
|
||||
antialias: true,
|
||||
outline: true
|
||||
});
|
||||
$.ajax( {
|
||||
url: options.dataset.download_url,
|
||||
cache: true,
|
||||
success: function(response) {
|
||||
var structure = pv.io.pdb(response);
|
||||
var viewer_options = {};
|
||||
_.each(settings.attributes, function(value, key) {
|
||||
viewer_options[key.replace('viewer|', '')] = value;
|
||||
});
|
||||
viewer.clear();
|
||||
viewer.renderAs('protein', structure, viewer_options.mode, viewer_options);
|
||||
viewer.centerOn(structure);
|
||||
viewer.autoZoom();
|
||||
options.chart.state('ok', 'Chart drawn.');
|
||||
options.process.resolve();
|
||||
},
|
||||
error: function() {
|
||||
options.chart.state('ok', 'Failed to load pdb file.');
|
||||
options.process.resolve();
|
||||
|
||||
window.bundleEntries = window.bundleEntries || {};
|
||||
window.bundleEntries.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",
|
||||
antialias: true,
|
||||
outline: true,
|
||||
});
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", options.dataset.download_url);
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
var structure = pv.io.pdb(xhr.response);
|
||||
var viewer_options = {};
|
||||
for (const [key, value] of Object.entries(settings.attributes)) {
|
||||
viewer_options[key.replace("viewer|", "")] = value;
|
||||
}
|
||||
});
|
||||
$(window).resize(function() { viewer.fitParent() });
|
||||
}
|
||||
});
|
||||
viewer.clear();
|
||||
viewer.renderAs("protein", structure, viewer_options.mode, viewer_options);
|
||||
viewer.centerOn(structure);
|
||||
viewer.autoZoom();
|
||||
options.chart.state("ok", "Chart drawn.");
|
||||
options.process.resolve();
|
||||
} else {
|
||||
options.chart.state("ok", "Failed to load pdb file.");
|
||||
options.process.resolve();
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
window.onresize = function () {
|
||||
viewer.fitParent();
|
||||
};
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -271,84 +271,78 @@ class Data(metaclass=DataMeta):
|
||||
messagetype = "error"
|
||||
return error, msg, messagetype
|
||||
|
||||
def _archive_composite_dataset(self, trans, data=None, **kwd):
|
||||
def _archive_composite_dataset(self, trans, data, do_action='zip'):
|
||||
# save a composite object into a compressed archive for downloading
|
||||
params = util.Params(kwd)
|
||||
outfname = data.name[0:150]
|
||||
outfname = ''.join(c in FILENAME_VALID_CHARS and c or '_' for c in outfname)
|
||||
if params.do_action is None:
|
||||
params.do_action = 'zip' # default
|
||||
msg = util.restore_text(params.get('msg', ''))
|
||||
if not data:
|
||||
msg = "You must select at least one dataset"
|
||||
else:
|
||||
error = False
|
||||
try:
|
||||
if params.do_action == 'zip':
|
||||
# Can't use mkstemp - the file must not exist first
|
||||
tmpd = tempfile.mkdtemp(dir=trans.app.config.new_file_path, prefix='gx_composite_archive_')
|
||||
util.umask_fix_perms(tmpd, trans.app.config.umask, 0o777, trans.app.config.gid)
|
||||
tmpf = os.path.join(tmpd, 'library_download.' + params.do_action)
|
||||
archive = zipfile.ZipFile(tmpf, 'w', zipfile.ZIP_DEFLATED, True)
|
||||
error = False
|
||||
msg = ''
|
||||
try:
|
||||
if do_action == 'zip':
|
||||
# Can't use mkstemp - the file must not exist first
|
||||
tmpd = tempfile.mkdtemp(dir=trans.app.config.new_file_path, prefix='gx_composite_archive_')
|
||||
util.umask_fix_perms(tmpd, trans.app.config.umask, 0o777, trans.app.config.gid)
|
||||
tmpf = os.path.join(tmpd, 'library_download.' + do_action)
|
||||
archive = zipfile.ZipFile(tmpf, 'w', zipfile.ZIP_DEFLATED, True)
|
||||
|
||||
def zipfile_add(fpath, arcname):
|
||||
encoded_arcname = arcname.encode('CP437')
|
||||
try:
|
||||
archive.write(fpath, encoded_arcname)
|
||||
except TypeError:
|
||||
# Despite documenting the need for CP437 encoded arcname,
|
||||
# python 3 actually needs this to be a unicode string ...
|
||||
# https://bugs.python.org/issue24110
|
||||
archive.write(fpath, arcname)
|
||||
def zipfile_add(fpath, arcname):
|
||||
encoded_arcname = arcname.encode('CP437')
|
||||
try:
|
||||
archive.write(fpath, encoded_arcname)
|
||||
except TypeError:
|
||||
# Despite documenting the need for CP437 encoded arcname,
|
||||
# python 3 actually needs this to be a unicode string ...
|
||||
# https://bugs.python.org/issue24110
|
||||
archive.write(fpath, arcname)
|
||||
|
||||
archive.add = zipfile_add
|
||||
archive.add = zipfile_add
|
||||
|
||||
elif params.do_action == 'tgz':
|
||||
archive = util.streamball.StreamBall('w|gz')
|
||||
elif params.do_action == 'tbz':
|
||||
archive = util.streamball.StreamBall('w|bz2')
|
||||
except (OSError, zipfile.BadZipFile):
|
||||
error = True
|
||||
log.exception("Unable to create archive for download")
|
||||
msg = "Unable to create archive for %s for download, please report this error" % outfname
|
||||
elif do_action == 'tgz':
|
||||
archive = util.streamball.StreamBall('w|gz')
|
||||
elif do_action == 'tbz':
|
||||
archive = util.streamball.StreamBall('w|bz2')
|
||||
except (OSError, zipfile.BadZipFile):
|
||||
error = True
|
||||
log.exception("Unable to create archive for download")
|
||||
msg = "Unable to create archive for %s for download, please report this error" % outfname
|
||||
if not error:
|
||||
ext = data.extension
|
||||
path = data.file_name
|
||||
efp = data.extra_files_path
|
||||
# Add any central file to the archive,
|
||||
|
||||
display_name = os.path.splitext(outfname)[0]
|
||||
if not display_name.endswith(ext):
|
||||
display_name = '{}_{}'.format(display_name, ext)
|
||||
|
||||
error, msg = self._archive_main_file(archive, display_name, path)[:2]
|
||||
if not error:
|
||||
ext = data.extension
|
||||
path = data.file_name
|
||||
efp = data.extra_files_path
|
||||
# Add any central file to the archive,
|
||||
|
||||
display_name = os.path.splitext(outfname)[0]
|
||||
if not display_name.endswith(ext):
|
||||
display_name = '{}_{}'.format(display_name, ext)
|
||||
|
||||
error, msg = self._archive_main_file(archive, display_name, path)[:2]
|
||||
if not error:
|
||||
# Add any child files to the archive,
|
||||
for fpath, rpath in self.__archive_extra_files_path(extra_files_path=efp):
|
||||
try:
|
||||
archive.add(fpath, rpath)
|
||||
except OSError:
|
||||
error = True
|
||||
log.exception("Unable to add %s to temporary library download archive", rpath)
|
||||
msg = "Unable to create archive for download, please report this error"
|
||||
continue
|
||||
if not error:
|
||||
if params.do_action == 'zip':
|
||||
archive.close()
|
||||
tmpfh = open(tmpf, 'rb')
|
||||
# CANNOT clean up - unlink/rmdir was always failing because file handle retained to return - must rely on a cron job to clean up tmp
|
||||
trans.response.set_content_type("application/x-zip-compressed")
|
||||
trans.response.headers["Content-Disposition"] = 'attachment; filename="%s.zip"' % outfname
|
||||
return tmpfh
|
||||
else:
|
||||
trans.response.set_content_type("application/x-tar")
|
||||
outext = 'tgz'
|
||||
if params.do_action == 'tbz':
|
||||
outext = 'tbz'
|
||||
trans.response.headers["Content-Disposition"] = 'attachment; filename="{}.{}"'.format(outfname, outext)
|
||||
archive.wsgi_status = trans.response.wsgi_status()
|
||||
archive.wsgi_headeritems = trans.response.wsgi_headeritems()
|
||||
return archive.stream
|
||||
# Add any child files to the archive,
|
||||
for fpath, rpath in self.__archive_extra_files_path(extra_files_path=efp):
|
||||
try:
|
||||
archive.add(fpath, rpath)
|
||||
except OSError:
|
||||
error = True
|
||||
log.exception("Unable to add %s to temporary library download archive", rpath)
|
||||
msg = "Unable to create archive for download, please report this error"
|
||||
continue
|
||||
if not error:
|
||||
if do_action == 'zip':
|
||||
archive.close()
|
||||
tmpfh = open(tmpf, 'rb')
|
||||
# CANNOT clean up - unlink/rmdir was always failing because file handle retained to return - must rely on a cron job to clean up tmp
|
||||
trans.response.set_content_type("application/x-zip-compressed")
|
||||
trans.response.headers["Content-Disposition"] = 'attachment; filename="%s.zip"' % outfname
|
||||
return tmpfh
|
||||
else:
|
||||
trans.response.set_content_type("application/x-tar")
|
||||
outext = 'tgz'
|
||||
if do_action == 'tbz':
|
||||
outext = 'tbz'
|
||||
trans.response.headers["Content-Disposition"] = 'attachment; filename="{}.{}"'.format(outfname, outext)
|
||||
archive.wsgi_status = trans.response.wsgi_status()
|
||||
archive.wsgi_headeritems = trans.response.wsgi_headeritems()
|
||||
return archive.stream
|
||||
return trans.show_error_message(msg)
|
||||
|
||||
def __archive_extra_files_path(self, extra_files_path):
|
||||
@@ -451,7 +445,7 @@ class Data(metaclass=DataMeta):
|
||||
from galaxy import datatypes # DBTODO REMOVE THIS AT REFACTOR
|
||||
if to_ext or isinstance(data.datatype, datatypes.binary.Binary): # Saving the file, or binary file
|
||||
if data.extension in composite_extensions:
|
||||
return self._archive_composite_dataset(trans, data, **kwd)
|
||||
return self._archive_composite_dataset(trans, data, do_action=kwd.get('do_action'))
|
||||
else:
|
||||
trans.response.headers['Content-Length'] = int(os.stat(data.file_name).st_size)
|
||||
filename = self._download_filename(data, to_ext, hdca=kwd.get("hdca", None), element_identifier=kwd.get("element_identifier", None))
|
||||
|
||||
@@ -1089,7 +1089,7 @@ class Wiggle(Tabular, _RemoteCallMixin):
|
||||
span = 1
|
||||
step = None
|
||||
with open(dataset.file_name) as fh:
|
||||
for line in util.iter_readline_count(fh, VIEWPORT_READLINE_BUFFER_SIZE):
|
||||
for line in util.iter_start_of_line(fh, VIEWPORT_READLINE_BUFFER_SIZE):
|
||||
try:
|
||||
if line.startswith("browser"):
|
||||
chr_info = line.rstrip('\n\r').split()[-1]
|
||||
|
||||
@@ -128,7 +128,7 @@ class Mp3(Audio):
|
||||
return 'mp3' in metadata['format_name'].split(',')
|
||||
|
||||
|
||||
class Wav(Binary):
|
||||
class Wav(Audio):
|
||||
"""Class that reads WAV audio file
|
||||
>>> from galaxy.datatypes.sniff import sniff_with_cls
|
||||
>>> sniff_with_cls(Wav, 'hello.wav')
|
||||
|
||||
@@ -35,11 +35,17 @@
|
||||
|
||||
## load the frame manager
|
||||
<script type="text/javascript">
|
||||
config.addInitialization(function(galaxy, config) {
|
||||
console.log("galaxy.masthead.mako", "initialize masthead");
|
||||
let options = ${h.dumps(masthead_config)};
|
||||
let container = document.getElementById("masthead");
|
||||
window.bundleEntries.initMasthead(options, container);
|
||||
});
|
||||
if (window.self === window.top) {
|
||||
config.addInitialization(function (galaxy, config) {
|
||||
console.log("galaxy.masthead.mako", "initialize masthead");
|
||||
let options = ${h.dumps(masthead_config)};
|
||||
const container = document.getElementById("masthead");
|
||||
window.bundleEntries.initMasthead(options, container);
|
||||
});
|
||||
} else {
|
||||
console.log("galaxy.masthead.mako", "Detected embedding, not initializing masthead");
|
||||
const container = document.getElementById("masthead");
|
||||
container.parentNode.removeChild(container);
|
||||
}
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
Reference in New Issue
Block a user