mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-11-02 19:52:14 +08:00
Fix multiple defines/requires in several viz/* modules, and convert to es6 imports.
This commit is contained in:
@@ -1,76 +1,70 @@
|
||||
define(["viz/visualization", "libs/bbi/bigwig"], function(
|
||||
visualization,
|
||||
bigwig
|
||||
) {
|
||||
/**
|
||||
import visualization from "viz/visualization";
|
||||
import bigwig from "libs/bbi/bigwig";
|
||||
/**
|
||||
* Data manager for BBI datasets/files, including BigWig and BigBed.
|
||||
*/
|
||||
var BBIDataManager = visualization.GenomeDataManager.extend({
|
||||
/**
|
||||
var BBIDataManager = visualization.GenomeDataManager.extend({
|
||||
/**
|
||||
* Load data from server and manage data entries. Adds a Deferred to manager
|
||||
* for region; when data becomes available, replaces Deferred with data.
|
||||
* Returns the Deferred that resolves when data is available.
|
||||
*/
|
||||
load_data: function(region, mode, resolution, extra_params) {
|
||||
var deferred = $.Deferred();
|
||||
this.set_data(region, deferred);
|
||||
load_data: function(region, mode, resolution, extra_params) {
|
||||
var deferred = $.Deferred();
|
||||
this.set_data(region, deferred);
|
||||
|
||||
var url =
|
||||
Galaxy.root +
|
||||
"datasets/" +
|
||||
this.get("dataset").id +
|
||||
"/display",
|
||||
self = this;
|
||||
var promise = new $.Deferred();
|
||||
$.when(bigwig.makeBwg(url)).then(function(bb, err) {
|
||||
$.when(
|
||||
bb.readWigData(
|
||||
region.get("chrom"),
|
||||
region.get("start"),
|
||||
region.get("end")
|
||||
)
|
||||
).then(function(data) {
|
||||
// Transform data into "bigwig" format for LinePainter. "bigwig" format is an array of 2-element arrays
|
||||
// where each element is [position, score]; unlike real bigwig format, no gaps are allowed.
|
||||
var result = [],
|
||||
prev = { max: Number.MIN_VALUE };
|
||||
data.forEach(function(d) {
|
||||
// If there is a gap between prev and d, fill it with an interval with score 0.
|
||||
// This is necessary for LinePainter to draw correctly.
|
||||
if (prev.max !== d.min - 1) {
|
||||
// +1 to start after previous region.
|
||||
result.push([prev.max + 1, 0]);
|
||||
// -2 = -1 for converting from 1-based to 0-based coordinates,
|
||||
// -1 for ending before current region.
|
||||
result.push([d.min - 2, 0]);
|
||||
}
|
||||
var url =
|
||||
Galaxy.root + "datasets/" + this.get("dataset").id + "/display",
|
||||
self = this;
|
||||
var promise = new $.Deferred();
|
||||
$.when(bigwig.makeBwg(url)).then(function(bb, err) {
|
||||
$.when(
|
||||
bb.readWigData(
|
||||
region.get("chrom"),
|
||||
region.get("start"),
|
||||
region.get("end")
|
||||
)
|
||||
).then(function(data) {
|
||||
// Transform data into "bigwig" format for LinePainter. "bigwig" format is an array of 2-element arrays
|
||||
// where each element is [position, score]; unlike real bigwig format, no gaps are allowed.
|
||||
var result = [],
|
||||
prev = { max: Number.MIN_VALUE };
|
||||
data.forEach(function(d) {
|
||||
// If there is a gap between prev and d, fill it with an interval with score 0.
|
||||
// This is necessary for LinePainter to draw correctly.
|
||||
if (prev.max !== d.min - 1) {
|
||||
// +1 to start after previous region.
|
||||
result.push([prev.max + 1, 0]);
|
||||
// -2 = -1 for converting from 1-based to 0-based coordinates,
|
||||
// -1 for ending before current region.
|
||||
result.push([d.min - 2, 0]);
|
||||
}
|
||||
|
||||
// Add data point for entry start. -1 to convert from wiggle
|
||||
// 1-based coordinates to 0-based browser coordinates.
|
||||
result.push([d.min - 1, d.score]);
|
||||
// Add data point for entry start. -1 to convert from wiggle
|
||||
// 1-based coordinates to 0-based browser coordinates.
|
||||
result.push([d.min - 1, d.score]);
|
||||
|
||||
// Add data point for entry end:
|
||||
result.push([d.max, d.score]);
|
||||
// Add data point for entry end:
|
||||
result.push([d.max, d.score]);
|
||||
|
||||
prev = d;
|
||||
});
|
||||
|
||||
var entry = {
|
||||
data: result,
|
||||
region: region,
|
||||
dataset_type: "bigwig"
|
||||
};
|
||||
|
||||
self.set_data(region, entry);
|
||||
deferred.resolve(entry);
|
||||
prev = d;
|
||||
});
|
||||
|
||||
var entry = {
|
||||
data: result,
|
||||
region: region,
|
||||
dataset_type: "bigwig"
|
||||
};
|
||||
|
||||
self.set_data(region, entry);
|
||||
deferred.resolve(entry);
|
||||
});
|
||||
});
|
||||
|
||||
return deferred;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
BBIDataManager: BBIDataManager
|
||||
};
|
||||
return deferred;
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
BBIDataManager: BBIDataManager
|
||||
};
|
||||
|
||||
+1127
-1190
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1045
-1107
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,68 +1,67 @@
|
||||
define(["libs/underscore"], function(_) {
|
||||
var extend = _.extend;
|
||||
import _ from "libs/underscore";
|
||||
var extend = _.extend;
|
||||
|
||||
// HACK: LABEL_SPACING is currently duplicated between here and painters
|
||||
var LABEL_SPACING = 2,
|
||||
PACK_SPACING = 5;
|
||||
// HACK: LABEL_SPACING is currently duplicated between here and painters
|
||||
var LABEL_SPACING = 2,
|
||||
PACK_SPACING = 5;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Hold slotting information for a feature.
|
||||
*/
|
||||
var SlottedInfo = function(slot, feature) {
|
||||
this.slot = slot;
|
||||
this.feature = feature;
|
||||
};
|
||||
var SlottedInfo = function(slot, feature) {
|
||||
this.slot = slot;
|
||||
this.feature = feature;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* FeatureSlotter determines slots in which to draw features for vertical
|
||||
* packing.
|
||||
*
|
||||
* This implementation is incremental, any feature assigned a slot will be
|
||||
* retained for slotting future features.
|
||||
*/
|
||||
var FeatureSlotter = function(w_scale, mode, max_rows, measureText) {
|
||||
this.slots = {};
|
||||
this.start_end_dct = {};
|
||||
this.w_scale = w_scale;
|
||||
this.mode = mode;
|
||||
this.include_label = mode === "Pack";
|
||||
this.max_rows = max_rows;
|
||||
this.measureText = measureText;
|
||||
};
|
||||
var FeatureSlotter = function(w_scale, mode, max_rows, measureText) {
|
||||
this.slots = {};
|
||||
this.start_end_dct = {};
|
||||
this.w_scale = w_scale;
|
||||
this.mode = mode;
|
||||
this.include_label = mode === "Pack";
|
||||
this.max_rows = max_rows;
|
||||
this.measureText = measureText;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Slot a set of features, `this.slots` will be updated with slots by id, and
|
||||
* the largest slot required for the passed set of features is returned
|
||||
*/
|
||||
extend(FeatureSlotter.prototype, {
|
||||
/**
|
||||
extend(FeatureSlotter.prototype, {
|
||||
/**
|
||||
* Get drawing coordinate for a feature.
|
||||
*/
|
||||
_get_draw_coords: function(feature) {
|
||||
// Get initial draw coordinates using w_scale.
|
||||
var draw_start = Math.floor(feature[1] * this.w_scale),
|
||||
draw_end = Math.ceil(feature[2] * this.w_scale),
|
||||
f_name = feature[3],
|
||||
text_align;
|
||||
_get_draw_coords: function(feature) {
|
||||
// Get initial draw coordinates using w_scale.
|
||||
var draw_start = Math.floor(feature[1] * this.w_scale),
|
||||
draw_end = Math.ceil(feature[2] * this.w_scale),
|
||||
f_name = feature[3],
|
||||
text_align;
|
||||
|
||||
// Update start, end drawing locations to include feature name.
|
||||
// Try to put the name on the left, if not, put on right.
|
||||
if (f_name !== undefined && this.include_label) {
|
||||
// Add gap for label spacing and extra pack space padding
|
||||
// TODO: Fix constants
|
||||
var text_len =
|
||||
this.measureText(f_name).width +
|
||||
(LABEL_SPACING + PACK_SPACING);
|
||||
if (draw_start - text_len >= 0) {
|
||||
draw_start -= text_len;
|
||||
text_align = "left";
|
||||
} else {
|
||||
draw_end += text_len;
|
||||
text_align = "right";
|
||||
}
|
||||
// Update start, end drawing locations to include feature name.
|
||||
// Try to put the name on the left, if not, put on right.
|
||||
if (f_name !== undefined && this.include_label) {
|
||||
// Add gap for label spacing and extra pack space padding
|
||||
// TODO: Fix constants
|
||||
var text_len =
|
||||
this.measureText(f_name).width + (LABEL_SPACING + PACK_SPACING);
|
||||
if (draw_start - text_len >= 0) {
|
||||
draw_start -= text_len;
|
||||
text_align = "left";
|
||||
} else {
|
||||
draw_end += text_len;
|
||||
text_align = "right";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
if (slot_num < 0) {
|
||||
|
||||
TODO: this is not yet working --
|
||||
@@ -84,121 +83,116 @@ define(["libs/underscore"], function(_) {
|
||||
}
|
||||
*/
|
||||
|
||||
return [draw_start, draw_end];
|
||||
},
|
||||
return [draw_start, draw_end];
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Find the first slot such that current feature doesn't overlap any other features in that slot.
|
||||
* Returns -1 if no slot was found.
|
||||
*/
|
||||
_find_slot: function(draw_coords) {
|
||||
// TODO: Use a data structure for faster searching of available slots.
|
||||
var draw_start = draw_coords[0],
|
||||
draw_end = draw_coords[1];
|
||||
for (var slot_num = 0; slot_num <= this.max_rows; slot_num++) {
|
||||
var has_overlap = false,
|
||||
slot = this.start_end_dct[slot_num];
|
||||
if (slot !== undefined) {
|
||||
// Iterate through features already in slot to see if current feature will fit.
|
||||
for (var k = 0, k_len = slot.length; k < k_len; k++) {
|
||||
var s_e = slot[k];
|
||||
if (draw_end > s_e[0] && draw_start < s_e[1]) {
|
||||
// There is overlap
|
||||
has_overlap = true;
|
||||
break;
|
||||
}
|
||||
_find_slot: function(draw_coords) {
|
||||
// TODO: Use a data structure for faster searching of available slots.
|
||||
var draw_start = draw_coords[0],
|
||||
draw_end = draw_coords[1];
|
||||
for (var slot_num = 0; slot_num <= this.max_rows; slot_num++) {
|
||||
var has_overlap = false,
|
||||
slot = this.start_end_dct[slot_num];
|
||||
if (slot !== undefined) {
|
||||
// Iterate through features already in slot to see if current feature will fit.
|
||||
for (var k = 0, k_len = slot.length; k < k_len; k++) {
|
||||
var s_e = slot[k];
|
||||
if (draw_end > s_e[0] && draw_start < s_e[1]) {
|
||||
// There is overlap
|
||||
has_overlap = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has_overlap) {
|
||||
return slot_num;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
if (!has_overlap) {
|
||||
return slot_num;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Slot features.
|
||||
*/
|
||||
slot_features: function(features) {
|
||||
var start_end_dct = this.start_end_dct,
|
||||
undone = [],
|
||||
highest_slot = 0,
|
||||
feature,
|
||||
feature_uid;
|
||||
slot_features: function(features) {
|
||||
var start_end_dct = this.start_end_dct,
|
||||
undone = [],
|
||||
highest_slot = 0,
|
||||
feature,
|
||||
feature_uid;
|
||||
|
||||
// Loop through features to (a) find those that are not yet slotted and (b) update
|
||||
// those that are slotted if new information is availabe. For (a), features already
|
||||
// slotted (based on slotting from other tiles) will retain their current slot.
|
||||
for (var i = 0, len = features.length; i < len; i++) {
|
||||
feature = features[i];
|
||||
feature_uid = feature[0];
|
||||
var slotted_info = this.slots[feature_uid];
|
||||
// Loop through features to (a) find those that are not yet slotted and (b) update
|
||||
// those that are slotted if new information is availabe. For (a), features already
|
||||
// slotted (based on slotting from other tiles) will retain their current slot.
|
||||
for (var i = 0, len = features.length; i < len; i++) {
|
||||
feature = features[i];
|
||||
feature_uid = feature[0];
|
||||
var slotted_info = this.slots[feature_uid];
|
||||
|
||||
// Separate and handle slotted vs. unslotted features.
|
||||
if (slotted_info) {
|
||||
// Feature is slotted; if feature now has larger start/end coordinates,
|
||||
// update drawing coordinates.
|
||||
if (
|
||||
feature[1] < slotted_info.feature[1] ||
|
||||
slotted_info.feature[2] < feature[2]
|
||||
) {
|
||||
// Feature has changed (e.g. a single read now has its pair), so recalculate its
|
||||
// drawing coordinates.
|
||||
var old_draw_coords = this._get_draw_coords(
|
||||
slotted_info.feature
|
||||
),
|
||||
new_draw_coords = this._get_draw_coords(feature),
|
||||
slotted_coords = this.start_end_dct[
|
||||
slotted_info.slot
|
||||
];
|
||||
for (var k = 0; k < slotted_coords.length; k++) {
|
||||
var dc = slotted_coords[k];
|
||||
if (
|
||||
dc[0] === old_draw_coords[0] &&
|
||||
dc[1] === old_draw_coords[1]
|
||||
) {
|
||||
// Replace old drawing coordinates with new ones.
|
||||
slotted_coords[k] = new_draw_coords;
|
||||
}
|
||||
// Separate and handle slotted vs. unslotted features.
|
||||
if (slotted_info) {
|
||||
// Feature is slotted; if feature now has larger start/end coordinates,
|
||||
// update drawing coordinates.
|
||||
if (
|
||||
feature[1] < slotted_info.feature[1] ||
|
||||
slotted_info.feature[2] < feature[2]
|
||||
) {
|
||||
// Feature has changed (e.g. a single read now has its pair), so recalculate its
|
||||
// drawing coordinates.
|
||||
var old_draw_coords = this._get_draw_coords(
|
||||
slotted_info.feature
|
||||
),
|
||||
new_draw_coords = this._get_draw_coords(feature),
|
||||
slotted_coords = this.start_end_dct[slotted_info.slot];
|
||||
for (var k = 0; k < slotted_coords.length; k++) {
|
||||
var dc = slotted_coords[k];
|
||||
if (
|
||||
dc[0] === old_draw_coords[0] &&
|
||||
dc[1] === old_draw_coords[1]
|
||||
) {
|
||||
// Replace old drawing coordinates with new ones.
|
||||
slotted_coords[k] = new_draw_coords;
|
||||
}
|
||||
}
|
||||
highest_slot = Math.max(
|
||||
highest_slot,
|
||||
this.slots[feature_uid].slot
|
||||
);
|
||||
} else {
|
||||
undone.push(i);
|
||||
}
|
||||
highest_slot = Math.max(
|
||||
highest_slot,
|
||||
this.slots[feature_uid].slot
|
||||
);
|
||||
} else {
|
||||
undone.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Slot unslotted features.
|
||||
// Slot unslotted features.
|
||||
|
||||
// Do slotting.
|
||||
for (var i = 0, len = undone.length; i < len; i++) {
|
||||
feature = features[undone[i]];
|
||||
feature_uid = feature[0];
|
||||
var draw_coords = this._get_draw_coords(feature);
|
||||
|
||||
// Find slot.
|
||||
var slot_num = this._find_slot(draw_coords);
|
||||
|
||||
// Do slotting.
|
||||
for (var i = 0, len = undone.length; i < len; i++) {
|
||||
feature = features[undone[i]];
|
||||
feature_uid = feature[0];
|
||||
var draw_coords = this._get_draw_coords(feature);
|
||||
|
||||
// Find slot.
|
||||
var slot_num = this._find_slot(draw_coords);
|
||||
|
||||
// Do slotting.
|
||||
if (slot_num >= 0) {
|
||||
// Add current feature to slot.
|
||||
if (start_end_dct[slot_num] === undefined) {
|
||||
start_end_dct[slot_num] = [];
|
||||
}
|
||||
start_end_dct[slot_num].push(draw_coords);
|
||||
this.slots[feature_uid] = new SlottedInfo(
|
||||
slot_num,
|
||||
feature
|
||||
);
|
||||
highest_slot = Math.max(highest_slot, slot_num);
|
||||
if (slot_num >= 0) {
|
||||
// Add current feature to slot.
|
||||
if (start_end_dct[slot_num] === undefined) {
|
||||
start_end_dct[slot_num] = [];
|
||||
}
|
||||
start_end_dct[slot_num].push(draw_coords);
|
||||
this.slots[feature_uid] = new SlottedInfo(slot_num, feature);
|
||||
highest_slot = Math.max(highest_slot, slot_num);
|
||||
}
|
||||
}
|
||||
|
||||
// Debugging: view slots data.
|
||||
/*
|
||||
// Debugging: view slots data.
|
||||
/*
|
||||
for (var i = 0; i < MAX_FEATURE_DEPTH; i++) {
|
||||
var slot = start_end_dct[i];
|
||||
if (slot !== undefined) {
|
||||
@@ -209,11 +203,10 @@ define(["libs/underscore"], function(_) {
|
||||
}
|
||||
}
|
||||
*/
|
||||
return highest_slot + 1;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
FeatureSlotter: FeatureSlotter
|
||||
};
|
||||
return highest_slot + 1;
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
FeatureSlotter: FeatureSlotter
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,148 +1,146 @@
|
||||
define(function() {
|
||||
/**
|
||||
/**
|
||||
* Stringifies a number adding commas for digit grouping as per North America.
|
||||
*/
|
||||
function commatize(number) {
|
||||
number += ""; // Convert to string
|
||||
var rgx = /(\d+)(\d{3})/;
|
||||
while (rgx.test(number)) {
|
||||
number = number.replace(rgx, "$1" + "," + "$2");
|
||||
}
|
||||
return number;
|
||||
function commatize(number) {
|
||||
number += ""; // Convert to string
|
||||
var rgx = /(\d+)(\d{3})/;
|
||||
while (rgx.test(number)) {
|
||||
number = number.replace(rgx, "$1" + "," + "$2");
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Helper to determine if object is jQuery deferred.
|
||||
*/
|
||||
var is_deferred = function(d) {
|
||||
return "promise" in d;
|
||||
};
|
||||
var is_deferred = function(d) {
|
||||
return "promise" in d;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Implementation of a server-state based deferred. Server is repeatedly polled, and when
|
||||
* condition is met, deferred is resolved.
|
||||
*/
|
||||
var ServerStateDeferred = Backbone.Model.extend({
|
||||
defaults: {
|
||||
ajax_settings: {},
|
||||
interval: 1000,
|
||||
success_fn: function(result) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a deferred that resolves when success function returns true.
|
||||
*/
|
||||
go: function() {
|
||||
var deferred = $.Deferred(),
|
||||
self = this,
|
||||
ajax_settings = self.get("ajax_settings"),
|
||||
success_fn = self.get("success_fn"),
|
||||
interval = self.get("interval"),
|
||||
_go = function() {
|
||||
$.ajax(ajax_settings).success(function(result) {
|
||||
if (success_fn(result)) {
|
||||
// Result is good, so resolve.
|
||||
deferred.resolve(result);
|
||||
} else {
|
||||
// Result not good, try again.
|
||||
setTimeout(_go, interval);
|
||||
}
|
||||
});
|
||||
};
|
||||
_go();
|
||||
return deferred;
|
||||
var ServerStateDeferred = Backbone.Model.extend({
|
||||
defaults: {
|
||||
ajax_settings: {},
|
||||
interval: 1000,
|
||||
success_fn: function(result) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a deferred that resolves when success function returns true.
|
||||
*/
|
||||
go: function() {
|
||||
var deferred = $.Deferred(),
|
||||
self = this,
|
||||
ajax_settings = self.get("ajax_settings"),
|
||||
success_fn = self.get("success_fn"),
|
||||
interval = self.get("interval"),
|
||||
_go = function() {
|
||||
$.ajax(ajax_settings).success(function(result) {
|
||||
if (success_fn(result)) {
|
||||
// Result is good, so resolve.
|
||||
deferred.resolve(result);
|
||||
} else {
|
||||
// Result not good, try again.
|
||||
setTimeout(_go, interval);
|
||||
}
|
||||
});
|
||||
};
|
||||
_go();
|
||||
return deferred;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a random color in hexadecimal format that is sufficiently different from a single color
|
||||
* or set of colors.
|
||||
* @param colors a color or list of colors in the format '#RRGGBB'
|
||||
*/
|
||||
var get_random_color = function(colors) {
|
||||
// Default for colors is white.
|
||||
if (!colors) {
|
||||
colors = "#ffffff";
|
||||
}
|
||||
var get_random_color = function(colors) {
|
||||
// Default for colors is white.
|
||||
if (!colors) {
|
||||
colors = "#ffffff";
|
||||
}
|
||||
|
||||
// If needed, create list of colors.
|
||||
if (typeof colors === "string") {
|
||||
colors = [colors];
|
||||
}
|
||||
// If needed, create list of colors.
|
||||
if (typeof colors === "string") {
|
||||
colors = [colors];
|
||||
}
|
||||
|
||||
// Convert colors to numbers.
|
||||
for (var i = 0; i < colors.length; i++) {
|
||||
colors[i] = parseInt(colors[i].slice(1), 16);
|
||||
}
|
||||
// Convert colors to numbers.
|
||||
for (var i = 0; i < colors.length; i++) {
|
||||
colors[i] = parseInt(colors[i].slice(1), 16);
|
||||
}
|
||||
|
||||
// -- Perceived brightness and difference formulas are from
|
||||
// -- http://www.w3.org/WAI/ER/WD-AERT/#color-contrast
|
||||
// -- Perceived brightness and difference formulas are from
|
||||
// -- http://www.w3.org/WAI/ER/WD-AERT/#color-contrast
|
||||
|
||||
// Compute perceived color brightness (based on RGB-YIQ transformation):
|
||||
var brightness = function(r, g, b) {
|
||||
return (r * 299 + g * 587 + b * 114) / 1000;
|
||||
};
|
||||
// Compute perceived color brightness (based on RGB-YIQ transformation):
|
||||
var brightness = function(r, g, b) {
|
||||
return (r * 299 + g * 587 + b * 114) / 1000;
|
||||
};
|
||||
|
||||
// Compute color difference:
|
||||
var difference = function(r1, g1, b1, r2, g2, b2) {
|
||||
return (
|
||||
Math.max(r1, r2) -
|
||||
Math.min(r1, r2) +
|
||||
(Math.max(g1, g2) - Math.min(g1, g2)) +
|
||||
(Math.max(b1, b2) - Math.min(b1, b2))
|
||||
);
|
||||
};
|
||||
// Compute color difference:
|
||||
var difference = function(r1, g1, b1, r2, g2, b2) {
|
||||
return (
|
||||
Math.max(r1, r2) -
|
||||
Math.min(r1, r2) +
|
||||
(Math.max(g1, g2) - Math.min(g1, g2)) +
|
||||
(Math.max(b1, b2) - Math.min(b1, b2))
|
||||
);
|
||||
};
|
||||
|
||||
// Create new random color.
|
||||
var new_color,
|
||||
nr,
|
||||
ng,
|
||||
nb,
|
||||
other_color,
|
||||
or,
|
||||
og,
|
||||
ob,
|
||||
n_brightness,
|
||||
o_brightness,
|
||||
diff,
|
||||
ok = false,
|
||||
num_tries = 0;
|
||||
do {
|
||||
// New color is never white b/c random in [0,1)
|
||||
new_color = Math.round(Math.random() * 0xffffff);
|
||||
nr = (new_color & 0xff0000) >> 16;
|
||||
ng = (new_color & 0x00ff00) >> 8;
|
||||
nb = new_color & 0x0000ff;
|
||||
n_brightness = brightness(nr, ng, nb);
|
||||
ok = true;
|
||||
for (i = 0; i < colors.length; i++) {
|
||||
other_color = colors[i];
|
||||
or = (other_color & 0xff0000) >> 16;
|
||||
og = (other_color & 0x00ff00) >> 8;
|
||||
ob = other_color & 0x0000ff;
|
||||
o_brightness = brightness(or, og, ob);
|
||||
diff = difference(nr, ng, nb, or, og, ob);
|
||||
// These thresholds may need to be adjusted. Brightness difference range is 125;
|
||||
// color difference range is 500.
|
||||
if (Math.abs(n_brightness - o_brightness) < 40 || diff < 200) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
// Create new random color.
|
||||
var new_color,
|
||||
nr,
|
||||
ng,
|
||||
nb,
|
||||
other_color,
|
||||
or,
|
||||
og,
|
||||
ob,
|
||||
n_brightness,
|
||||
o_brightness,
|
||||
diff,
|
||||
ok = false,
|
||||
num_tries = 0;
|
||||
do {
|
||||
// New color is never white b/c random in [0,1)
|
||||
new_color = Math.round(Math.random() * 0xffffff);
|
||||
nr = (new_color & 0xff0000) >> 16;
|
||||
ng = (new_color & 0x00ff00) >> 8;
|
||||
nb = new_color & 0x0000ff;
|
||||
n_brightness = brightness(nr, ng, nb);
|
||||
ok = true;
|
||||
for (i = 0; i < colors.length; i++) {
|
||||
other_color = colors[i];
|
||||
or = (other_color & 0xff0000) >> 16;
|
||||
og = (other_color & 0x00ff00) >> 8;
|
||||
ob = other_color & 0x0000ff;
|
||||
o_brightness = brightness(or, og, ob);
|
||||
diff = difference(nr, ng, nb, or, og, ob);
|
||||
// These thresholds may need to be adjusted. Brightness difference range is 125;
|
||||
// color difference range is 500.
|
||||
if (Math.abs(n_brightness - o_brightness) < 40 || diff < 200) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
num_tries++;
|
||||
} while (!ok && num_tries <= 10);
|
||||
num_tries++;
|
||||
} while (!ok && num_tries <= 10);
|
||||
|
||||
// Add 0x1000000 to left pad number with 0s.
|
||||
return "#" + (0x1000000 + new_color).toString(16).substr(1, 6);
|
||||
};
|
||||
// Add 0x1000000 to left pad number with 0s.
|
||||
return "#" + (0x1000000 + new_color).toString(16).substr(1, 6);
|
||||
};
|
||||
|
||||
return {
|
||||
commatize: commatize,
|
||||
is_deferred: is_deferred,
|
||||
ServerStateDeferred: ServerStateDeferred,
|
||||
get_random_color: get_random_color
|
||||
};
|
||||
});
|
||||
export default {
|
||||
commatize: commatize,
|
||||
is_deferred: is_deferred,
|
||||
ServerStateDeferred: ServerStateDeferred,
|
||||
get_random_color: get_random_color
|
||||
};
|
||||
|
||||
+1020
-1076
File diff suppressed because it is too large
Load Diff
@@ -1,136 +1,133 @@
|
||||
define(["libs/underscore"], function(_) {
|
||||
/**
|
||||
import _ from "libs/underscore";
|
||||
/**
|
||||
* View for track/group header.
|
||||
*/
|
||||
var TrackHeaderView = Backbone.View.extend({
|
||||
className: "track-header",
|
||||
var TrackHeaderView = Backbone.View.extend({
|
||||
className: "track-header",
|
||||
|
||||
initialize: function() {
|
||||
// Watch and update name changes.
|
||||
this.model.config
|
||||
.get("name")
|
||||
.on("change:value", this.update_name, this);
|
||||
this.render();
|
||||
},
|
||||
initialize: function() {
|
||||
// Watch and update name changes.
|
||||
this.model.config
|
||||
.get("name")
|
||||
.on("change:value", this.update_name, this);
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.append($("<div/>").addClass(this.model.drag_handle_class));
|
||||
this.$el.append(
|
||||
$("<div/>")
|
||||
.addClass("track-name")
|
||||
.text(this.model.config.get_value("name"))
|
||||
render: function() {
|
||||
this.$el.append($("<div/>").addClass(this.model.drag_handle_class));
|
||||
this.$el.append(
|
||||
$("<div/>")
|
||||
.addClass("track-name")
|
||||
.text(this.model.config.get_value("name"))
|
||||
);
|
||||
|
||||
// Icons container.
|
||||
this.action_icons = {};
|
||||
this.render_action_icons();
|
||||
|
||||
// Suppress double clicks in header so that they do not impact viz under header.
|
||||
this.$el.dblclick(function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// Needed for floating elts in header.
|
||||
this.$el.append($("<div style='clear: both'/>"));
|
||||
},
|
||||
|
||||
update_name: function() {
|
||||
this.$el.find(".track-name").text(this.model.config.get_value("name"));
|
||||
},
|
||||
|
||||
render_action_icons: function() {
|
||||
var self = this;
|
||||
this.icons_div = $("<div/>")
|
||||
.addClass("track-icons")
|
||||
.hide()
|
||||
.appendTo(this.$el);
|
||||
_.each(this.model.action_icons_def, function(icon_dict) {
|
||||
self.add_action_icon(
|
||||
icon_dict.name,
|
||||
icon_dict.title,
|
||||
icon_dict.css_class,
|
||||
icon_dict.on_click_fn,
|
||||
icon_dict.prepend,
|
||||
icon_dict.hide
|
||||
);
|
||||
});
|
||||
|
||||
// Icons container.
|
||||
this.action_icons = {};
|
||||
this.render_action_icons();
|
||||
// Set up behavior for modes popup.
|
||||
this.set_display_modes(this.model.display_modes);
|
||||
},
|
||||
|
||||
// Suppress double clicks in header so that they do not impact viz under header.
|
||||
this.$el.dblclick(function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// Needed for floating elts in header.
|
||||
this.$el.append($("<div style='clear: both'/>"));
|
||||
},
|
||||
|
||||
update_name: function() {
|
||||
this.$el
|
||||
.find(".track-name")
|
||||
.text(this.model.config.get_value("name"));
|
||||
},
|
||||
|
||||
render_action_icons: function() {
|
||||
var self = this;
|
||||
this.icons_div = $("<div/>")
|
||||
.addClass("track-icons")
|
||||
.hide()
|
||||
.appendTo(this.$el);
|
||||
_.each(this.model.action_icons_def, function(icon_dict) {
|
||||
self.add_action_icon(
|
||||
icon_dict.name,
|
||||
icon_dict.title,
|
||||
icon_dict.css_class,
|
||||
icon_dict.on_click_fn,
|
||||
icon_dict.prepend,
|
||||
icon_dict.hide
|
||||
);
|
||||
});
|
||||
|
||||
// Set up behavior for modes popup.
|
||||
this.set_display_modes(this.model.display_modes);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add an action icon to this object. Appends icon unless prepend flag is specified.
|
||||
*/
|
||||
add_action_icon: function(
|
||||
name,
|
||||
title,
|
||||
css_class,
|
||||
on_click_fn,
|
||||
prepend,
|
||||
hide
|
||||
) {
|
||||
var self = this;
|
||||
this.action_icons[name] = $("<a/>")
|
||||
.attr("title", title)
|
||||
.addClass("icon-button")
|
||||
.addClass(css_class)
|
||||
.tooltip()
|
||||
.click(function() {
|
||||
on_click_fn(self.model);
|
||||
})
|
||||
.appendTo(this.icons_div);
|
||||
if (hide) {
|
||||
this.action_icons[name].hide();
|
||||
}
|
||||
},
|
||||
add_action_icon: function(
|
||||
name,
|
||||
title,
|
||||
css_class,
|
||||
on_click_fn,
|
||||
prepend,
|
||||
hide
|
||||
) {
|
||||
var self = this;
|
||||
this.action_icons[name] = $("<a/>")
|
||||
.attr("title", title)
|
||||
.addClass("icon-button")
|
||||
.addClass(css_class)
|
||||
.tooltip()
|
||||
.click(function() {
|
||||
on_click_fn(self.model);
|
||||
})
|
||||
.appendTo(this.icons_div);
|
||||
if (hide) {
|
||||
this.action_icons[name].hide();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set track's modes and update mode icon popup.
|
||||
*/
|
||||
set_display_modes: function(new_modes, init_mode) {
|
||||
if (!new_modes) {
|
||||
return;
|
||||
}
|
||||
|
||||
// HACK: move this out of view and into track.
|
||||
|
||||
// Set modes, init mode.
|
||||
this.model.display_modes = new_modes;
|
||||
this.model.mode =
|
||||
init_mode ||
|
||||
this.model.config.get_value("mode") ||
|
||||
this.model.display_modes[0];
|
||||
|
||||
this.action_icons.mode_icon.attr(
|
||||
"title",
|
||||
"Set display mode (now: " + this.mode + ")"
|
||||
);
|
||||
|
||||
// Setup popup menu for changing modes.
|
||||
var self = this,
|
||||
track = this.model,
|
||||
mode_mapping = {};
|
||||
for (var i = 0, len = track.display_modes.length; i < len; i++) {
|
||||
var mode = track.display_modes[i];
|
||||
mode_mapping[mode] = (function(mode) {
|
||||
return function() {
|
||||
track.change_mode(mode);
|
||||
// HACK: the popup menu messes with the track's hover event, so manually show/hide
|
||||
// icons div for now.
|
||||
//self.icons_div.show();
|
||||
//track.container_div.mouseleave(function() { track.icons_div.hide(); } );
|
||||
};
|
||||
})(mode);
|
||||
}
|
||||
|
||||
make_popupmenu(this.action_icons.mode_icon, mode_mapping);
|
||||
set_display_modes: function(new_modes, init_mode) {
|
||||
if (!new_modes) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
TrackHeaderView: TrackHeaderView
|
||||
};
|
||||
// HACK: move this out of view and into track.
|
||||
|
||||
// Set modes, init mode.
|
||||
this.model.display_modes = new_modes;
|
||||
this.model.mode =
|
||||
init_mode ||
|
||||
this.model.config.get_value("mode") ||
|
||||
this.model.display_modes[0];
|
||||
|
||||
this.action_icons.mode_icon.attr(
|
||||
"title",
|
||||
"Set display mode (now: " + this.mode + ")"
|
||||
);
|
||||
|
||||
// Setup popup menu for changing modes.
|
||||
var self = this,
|
||||
track = this.model,
|
||||
mode_mapping = {};
|
||||
for (var i = 0, len = track.display_modes.length; i < len; i++) {
|
||||
var mode = track.display_modes[i];
|
||||
mode_mapping[mode] = (function(mode) {
|
||||
return function() {
|
||||
track.change_mode(mode);
|
||||
// HACK: the popup menu messes with the track's hover event, so manually show/hide
|
||||
// icons div for now.
|
||||
//self.icons_div.show();
|
||||
//track.container_div.mouseleave(function() { track.icons_div.hide(); } );
|
||||
};
|
||||
})(mode);
|
||||
}
|
||||
|
||||
make_popupmenu(this.action_icons.mode_icon, mode_mapping);
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
TrackHeaderView: TrackHeaderView
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["viz/bbi-data-manager.js"],"names":["define","visualization","bigwig","BBIDataManager","GenomeDataManager","load_data","region","mode","extra_params","deferred","this","set_data","url","self","root","promise","when","$","Deferred","makeBwg","result","then","bb","err","data","get","prev","max","Number","MIN_VALUE","forEach","d","min","push","score","entry","dataset_type","resolve"],"mappings":"kCAAAA,QAAQ,oBAAqB,mBAAoB,SAC7CC,EACAC,GAsEA,OACIC,eAlEAA,EAAiBF,kBAAcG,QAM/BC,UAAAA,SAAWC,EAAAC,EAASD,EAATE,GACP,IAAAC,EAAIA,EAAAA,WACJC,KAAAC,SAAKA,EAASL,GAEd,IAAAM,EAKIC,OAAOC,KACPC,YACFC,KAAKd,IAAAA,WAAeU,GAClBK,WAOIJ,EAAAH,KACA,IAAAO,EAAAC,SAmCR,OAlCQD,EAAAD,KAAAd,EAAAiB,QAAIC,IAAJC,KAAA,SAAAC,EAAAC,GAAAN,EAAAD,KAEAQ,EAAAA,YACIlB,EAAAmB,IAAA,SACAnB,EAAAmB,IAAA,SACAnB,EAAAmB,IAAIC,SAEAN,KAAAA,SAAAA,GAGAA,IAAAA,KACHM,GAAAC,IAAAC,OAAAC,WATLL,EAAKM,QAAQ,SAASC,GAalBX,EAAAA,MAAaW,EAAEC,IAAM,IAErBZ,EAAAa,MAAAP,EAAAC,IAAA,EAAA,IAGAD,EAAOK,MAAPA,EAAAC,IAAA,EAAA,KAKA1B,EAAAA,MAAQA,EAAAA,IAFA,EAAAyB,EAAAG,QALRd,EAAOa,MAAMF,EAAEJ,IAAKI,EAAEG,QAY1BzB,EAAAA,IAPA,IAAI0B,GAWL1B,KAAAA,EACVH,OAAAA,EA9DL8B,aAAA,UAkEIjC,EAAAA,SAAgBA,EAAAA,GADpBM,EAAA4B,QAAAF,OAJe1B","file":"../../scripts/viz/bbi-data-manager.js","sourcesContent":["define([\"viz/visualization\", \"libs/bbi/bigwig\"], function(\n visualization,\n bigwig\n) {\n /**\n * Data manager for BBI datasets/files, including BigWig and BigBed.\n */\n var BBIDataManager = visualization.GenomeDataManager.extend({\n /**\n * Load data from server and manage data entries. Adds a Deferred to manager\n * for region; when data becomes available, replaces Deferred with data.\n * Returns the Deferred that resolves when data is available.\n */\n load_data: function(region, mode, resolution, extra_params) {\n var deferred = $.Deferred();\n this.set_data(region, deferred);\n\n var url =\n Galaxy.root +\n \"datasets/\" +\n this.get(\"dataset\").id +\n \"/display\",\n self = this;\n var promise = new $.Deferred();\n $.when(bigwig.makeBwg(url)).then(function(bb, err) {\n $.when(\n bb.readWigData(\n region.get(\"chrom\"),\n region.get(\"start\"),\n region.get(\"end\")\n )\n ).then(function(data) {\n // Transform data into \"bigwig\" format for LinePainter. \"bigwig\" format is an array of 2-element arrays\n // where each element is [position, score]; unlike real bigwig format, no gaps are allowed.\n var result = [],\n prev = { max: Number.MIN_VALUE };\n data.forEach(function(d) {\n // If there is a gap between prev and d, fill it with an interval with score 0.\n // This is necessary for LinePainter to draw correctly.\n if (prev.max !== d.min - 1) {\n // +1 to start after previous region.\n result.push([prev.max + 1, 0]);\n // -2 = -1 for converting from 1-based to 0-based coordinates,\n // -1 for ending before current region.\n result.push([d.min - 2, 0]);\n }\n\n // Add data point for entry start. -1 to convert from wiggle\n // 1-based coordinates to 0-based browser coordinates.\n result.push([d.min - 1, d.score]);\n\n // Add data point for entry end:\n result.push([d.max, d.score]);\n\n prev = d;\n });\n\n var entry = {\n data: result,\n region: region,\n dataset_type: \"bigwig\"\n };\n\n self.set_data(region, entry);\n deferred.resolve(entry);\n });\n });\n\n return deferred;\n }\n });\n\n return {\n BBIDataManager: BBIDataManager\n };\n});\n"]}
|
||||
{"version":3,"sources":["viz/bbi-data-manager.js"],"names":["BBIDataManager","_visualization2","default","GenomeDataManager","extend","load_data","region","mode","resolution","extra_params","deferred","$","Deferred","this","set_data","url","Galaxy","root","get","id","self","dataset_type","when","_bigwig2","makeBwg","then","bb","err","readWigData","data","result","Number","MIN_VALUE","d","push","prev","max","forEach","min","entry","resolve"],"mappings":"4MAKIA,EAAiBC,EAAAC,QAAcC,kBAAkBC,QAMjDC,UAAW,SAASC,EAAQC,EAAMC,EAAYC,GAC1C,IAAIC,EAAWC,EAAEC,WACjBC,KAAKC,SAASR,EAAQI,GAEtB,IAAIK,EACIC,OAAOC,KAAO,YAAcJ,KAAKK,IAAI,WAAWC,GAAK,WAdrEC,EAAAP,KAgBsB,IAAIF,EAAEC,SAqCRS,OApCZV,EAAEW,KAAKC,EAAArB,QAAOsB,QAAQT,IAAMU,KAAK,SAASC,EAAIC,GAdlD3B,EAAAA,KACA0B,EAAAE,YAgBgBtB,EAAOY,IAAI,SACXZ,EAAOY,IAAI,SACXZ,EAAOY,IAAI,SAb3Bb,KAAW,SAAAwB,GAkBC,IAAIC,KAdRf,GACWE,IAAPc,OAAcC,WAClBZ,EAAAA,QAFJ,SAAAa,GAMQP,EAAGE,MAAHK,EACI3B,IAAOY,IAMXY,EAAAI,MAAAC,EAAAC,IAAA,EAAA,IAGAP,EAAKQ,MAAQJ,EAAAK,IAAA,EAAY,KAKjBR,EAAAA,MAAAA,EAAOI,IAAMC,EAAAA,EAAKC,QAGlBN,EAAAA,MAAAA,EAAOI,IAAKD,EAACA,QAUjBE,EAAOF,IALPH,IAAAA,GASAD,KAAMC,EAPNxB,OAAAA,EACAwB,aAAOI,UAGVd,EAnBDN,SAAAR,EAAAiC,GA4BA7B,EAAS8B,QAAQD,OAJblB,gBAKPrB,eAxCDA","file":"../../scripts/viz/bbi-data-manager.js","sourcesContent":["import visualization from \"viz/visualization\";\nimport bigwig from \"libs/bbi/bigwig\";\n/**\n * Data manager for BBI datasets/files, including BigWig and BigBed.\n */\nvar BBIDataManager = visualization.GenomeDataManager.extend({\n /**\n * Load data from server and manage data entries. Adds a Deferred to manager\n * for region; when data becomes available, replaces Deferred with data.\n * Returns the Deferred that resolves when data is available.\n */\n load_data: function(region, mode, resolution, extra_params) {\n var deferred = $.Deferred();\n this.set_data(region, deferred);\n\n var url =\n Galaxy.root + \"datasets/\" + this.get(\"dataset\").id + \"/display\",\n self = this;\n var promise = new $.Deferred();\n $.when(bigwig.makeBwg(url)).then(function(bb, err) {\n $.when(\n bb.readWigData(\n region.get(\"chrom\"),\n region.get(\"start\"),\n region.get(\"end\")\n )\n ).then(function(data) {\n // Transform data into \"bigwig\" format for LinePainter. \"bigwig\" format is an array of 2-element arrays\n // where each element is [position, score]; unlike real bigwig format, no gaps are allowed.\n var result = [],\n prev = { max: Number.MIN_VALUE };\n data.forEach(function(d) {\n // If there is a gap between prev and d, fill it with an interval with score 0.\n // This is necessary for LinePainter to draw correctly.\n if (prev.max !== d.min - 1) {\n // +1 to start after previous region.\n result.push([prev.max + 1, 0]);\n // -2 = -1 for converting from 1-based to 0-based coordinates,\n // -1 for ending before current region.\n result.push([d.min - 2, 0]);\n }\n\n // Add data point for entry start. -1 to convert from wiggle\n // 1-based coordinates to 0-based browser coordinates.\n result.push([d.min - 1, d.score]);\n\n // Add data point for entry end:\n result.push([d.max, d.score]);\n\n prev = d;\n });\n\n var entry = {\n data: result,\n region: region,\n dataset_type: \"bigwig\"\n };\n\n self.set_data(region, entry);\n deferred.resolve(entry);\n });\n });\n\n return deferred;\n }\n});\n\nexport default {\n BBIDataManager: BBIDataManager\n};\n"]}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define([],function(){"use strict";define(["viz/visualization","libs/bbi/bigwig"],function(e,a){return{BBIDataManager:e.GenomeDataManager.extend({load_data:function(e,t,n,i){var r=$.Deferred();this.set_data(e,r);var s=Galaxy.root+"datasets/"+this.get("dataset").id+"/display",d=this;new $.Deferred;return $.when(a.makeBwg(s)).then(function(a,t){$.when(a.readWigData(e.get("chrom"),e.get("start"),e.get("end"))).then(function(a){var t=[],n={max:Number.MIN_VALUE};a.forEach(function(e){n.max!==e.min-1&&(t.push([n.max+1,0]),t.push([e.min-2,0])),t.push([e.min-1,e.score]),t.push([e.max,e.score]),n=e});var i={data:t,region:e,dataset_type:"bigwig"};d.set_data(e,i),r.resolve(i)})}),r}})}})});
|
||||
define(["exports","viz/visualization","libs/bbi/bigwig"],function(e,a,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(a),r=n(t),s=i.default.GenomeDataManager.extend({load_data:function(e,a,t,n){var i=$.Deferred();this.set_data(e,i);var s=Galaxy.root+"datasets/"+this.get("dataset").id+"/display",d=this;new $.Deferred;return $.when(r.default.makeBwg(s)).then(function(a,t){$.when(a.readWigData(e.get("chrom"),e.get("start"),e.get("end"))).then(function(a){var t=[],n={max:Number.MIN_VALUE};a.forEach(function(e){n.max!==e.min-1&&(t.push([n.max+1,0]),t.push([e.min-2,0])),t.push([e.min-1,e.score]),t.push([e.max,e.score]),n=e});var r={data:t,region:e,dataset_type:"bigwig"};d.set_data(e,r),i.resolve(r)})}),i}});e.default={BBIDataManager:s}});
|
||||
//# sourceMappingURL=../../maps/viz/bbi-data-manager.js.map
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define([],function(){"use strict";define(["libs/underscore"],function(t){var s=function(t,s){this.slot=t,this.feature=s},e=function(t,s,e,r){this.slots={},this.start_end_dct={},this.w_scale=t,this.mode=s,this.include_label="Pack"===s,this.max_rows=e,this.measureText=r};return(0,t.extend)(e.prototype,{_get_draw_coords:function(t){var s=Math.floor(t[1]*this.w_scale),e=Math.ceil(t[2]*this.w_scale),r=t[3];if(void 0!==r&&this.include_label){var i=this.measureText(r).width+7;s-i>=0?(s-=i,"left"):(e+=i,"right")}return[s,e]},_find_slot:function(t){for(var s=t[0],e=t[1],r=0;r<=this.max_rows;r++){var i=!1,a=this.start_end_dct[r];if(void 0!==a)for(var o=0,h=a.length;o<h;o++){var n=a[o];if(e>n[0]&&s<n[1]){i=!0;break}}if(!i)return r}return-1},slot_features:function(t){for(var e,r,i=this.start_end_dct,a=[],o=0,h=0,n=t.length;h<n;h++){r=(e=t[h])[0];var _=this.slots[r];if(_){if(e[1]<_.feature[1]||_.feature[2]<e[2])for(var d=this._get_draw_coords(_.feature),f=this._get_draw_coords(e),l=this.start_end_dct[_.slot],u=0;u<l.length;u++){var c=l[u];c[0]===d[0]&&c[1]===d[1]&&(l[u]=f)}o=Math.max(o,this.slots[r].slot)}else a.push(h)}for(var h=0,n=a.length;h<n;h++){r=(e=t[a[h]])[0];var v=this._get_draw_coords(e),w=this._find_slot(v);w>=0&&(void 0===i[w]&&(i[w]=[]),i[w].push(v),this.slots[r]=new s(w,e),o=Math.max(o,w))}return o+1}}),{FeatureSlotter:e}})});
|
||||
define(["exports","libs/underscore"],function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(t,e){this.slot=t,this.feature=e},r=function(t,e,s,r){this.slots={},this.start_end_dct={},this.w_scale=t,this.mode=e,this.include_label="Pack"===e,this.max_rows=s,this.measureText=r};(0,function(t){return t&&t.__esModule?t:{default:t}}(e).default.extend)(r.prototype,{_get_draw_coords:function(t){var e=Math.floor(t[1]*this.w_scale),s=Math.ceil(t[2]*this.w_scale),r=t[3];if(void 0!==r&&this.include_label){var i=this.measureText(r).width+7;e-i>=0?(e-=i,"left"):(s+=i,"right")}return[e,s]},_find_slot:function(t){for(var e=t[0],s=t[1],r=0;r<=this.max_rows;r++){var i=!1,a=this.start_end_dct[r];if(void 0!==a)for(var o=0,h=a.length;o<h;o++){var n=a[o];if(s>n[0]&&e<n[1]){i=!0;break}}if(!i)return r}return-1},slot_features:function(t){for(var e,r,i=this.start_end_dct,a=[],o=0,h=0,n=t.length;h<n;h++){r=(e=t[h])[0];var _=this.slots[r];if(_){if(e[1]<_.feature[1]||_.feature[2]<e[2])for(var l=this._get_draw_coords(_.feature),d=this._get_draw_coords(e),f=this.start_end_dct[_.slot],u=0;u<f.length;u++){var c=f[u];c[0]===l[0]&&c[1]===l[1]&&(f[u]=d)}o=Math.max(o,this.slots[r].slot)}else a.push(h)}for(var h=0,n=a.length;h<n;h++){r=(e=t[a[h]])[0];var v=this._get_draw_coords(e),w=this._find_slot(v);w>=0&&(void 0===i[w]&&(i[w]=[]),i[w].push(v),this.slots[r]=new s(w,e),o=Math.max(o,w))}return o+1}}),t.default={FeatureSlotter:r}});
|
||||
//# sourceMappingURL=../../../maps/viz/trackster/slotting.js.map
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define([],function(){"use strict";define(function(){return{commatize:function(e){e+="";for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e},is_deferred:function(e){return"promise"in e},ServerStateDeferred:Backbone.Model.extend({defaults:{ajax_settings:{},interval:1e3,success_fn:function(e){return!0}},go:function(){var e=$.Deferred(),t=this,n=t.get("ajax_settings"),r=t.get("success_fn"),a=t.get("interval");return function t(){$.ajax(n).success(function(n){r(n)?e.resolve(n):setTimeout(t,a)})}(),e}}),get_random_color:function(e){e||(e="#ffffff"),"string"==typeof e&&(e=[e]);for(var t=0;t<e.length;t++)e[t]=parseInt(e[t].slice(1),16);var n,r,a,i,f,o,s,u,c,d,h,m=function(e,t,n){return(299*e+587*t+114*n)/1e3},g=!1,l=0;do{for(c=m(r=(16711680&(n=Math.round(16777215*Math.random())))>>16,a=(65280&n)>>8,i=255&n),g=!0,t=0;t<e.length;t++)if(f=e[t],o=(16711680&f)>>16,s=(65280&f)>>8,u=255&f,d=m(o,s,u),h=function(e,t,n,r,a,i){return Math.max(e,r)-Math.min(e,r)+(Math.max(t,a)-Math.min(t,a))+(Math.max(n,i)-Math.min(n,i))}(r,a,i,o,s,u),Math.abs(c-d)<40||h<200){g=!1;break}l++}while(!g&&l<=10);return"#"+(16777216+n).toString(16).substr(1,6)}}})});
|
||||
define(["exports"],function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1e3,success_fn:function(e){return!0}},go:function(){var e=$.Deferred(),t=this,n=t.get("ajax_settings"),r=t.get("success_fn"),a=t.get("interval");return function t(){$.ajax(n).success(function(n){r(n)?e.resolve(n):setTimeout(t,a)})}(),e}});e.default={commatize:function(e){e+="";for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e},is_deferred:function(e){return"promise"in e},ServerStateDeferred:t,get_random_color:function(e){e||(e="#ffffff"),"string"==typeof e&&(e=[e]);for(var t=0;t<e.length;t++)e[t]=parseInt(e[t].slice(1),16);var n,r,a,i,o,f,s,u,c,d,l,h=function(e,t,n){return(299*e+587*t+114*n)/1e3},m=!1,g=0;do{for(c=h(r=(16711680&(n=Math.round(16777215*Math.random())))>>16,a=(65280&n)>>8,i=255&n),m=!0,t=0;t<e.length;t++)if(o=e[t],f=(16711680&o)>>16,s=(65280&o)>>8,u=255&o,d=h(f,s,u),l=function(e,t,n,r,a,i){return Math.max(e,r)-Math.min(e,r)+(Math.max(t,a)-Math.min(t,a))+(Math.max(n,i)-Math.min(n,i))}(r,a,i,f,s,u),Math.abs(c-d)<40||l<200){m=!1;break}g++}while(!m&&g<=10);return"#"+(16777216+n).toString(16).substr(1,6)}}});
|
||||
//# sourceMappingURL=../../../maps/viz/trackster/util.js.map
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define([],function(){"use strict";define(["libs/underscore"],function(i){return{TrackHeaderView:Backbone.View.extend({className:"track-header",initialize:function(){this.model.config.get("name").on("change:value",this.update_name,this),this.render()},render:function(){this.$el.append($("<div/>").addClass(this.model.drag_handle_class)),this.$el.append($("<div/>").addClass("track-name").text(this.model.config.get_value("name"))),this.action_icons={},this.render_action_icons(),this.$el.dblclick(function(i){i.stopPropagation()}),this.$el.append($("<div style='clear: both'/>"))},update_name:function(){this.$el.find(".track-name").text(this.model.config.get_value("name"))},render_action_icons:function(){var e=this;this.icons_div=$("<div/>").addClass("track-icons").hide().appendTo(this.$el),i.each(this.model.action_icons_def,function(i){e.add_action_icon(i.name,i.title,i.css_class,i.on_click_fn,i.prepend,i.hide)}),this.set_display_modes(this.model.display_modes)},add_action_icon:function(i,e,t,n,o,s){var d=this;this.action_icons[i]=$("<a/>").attr("title",e).addClass("icon-button").addClass(t).tooltip().click(function(){n(d.model)}).appendTo(this.icons_div),s&&this.action_icons[i].hide()},set_display_modes:function(i,e){if(i){this.model.display_modes=i,this.model.mode=e||this.model.config.get_value("mode")||this.model.display_modes[0],this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");for(var t=this.model,n={},o=0,s=t.display_modes.length;o<s;o++){var d=t.display_modes[o];n[d]=function(i){return function(){t.change_mode(i)}}(d)}make_popupmenu(this.action_icons.mode_icon,n)}}})}})});
|
||||
define(["exports","libs/underscore"],function(e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(e){return e&&e.__esModule?e:{default:e}}(i),n=Backbone.View.extend({className:"track-header",initialize:function(){this.model.config.get("name").on("change:value",this.update_name,this),this.render()},render:function(){this.$el.append($("<div/>").addClass(this.model.drag_handle_class)),this.$el.append($("<div/>").addClass("track-name").text(this.model.config.get_value("name"))),this.action_icons={},this.render_action_icons(),this.$el.dblclick(function(e){e.stopPropagation()}),this.$el.append($("<div style='clear: both'/>"))},update_name:function(){this.$el.find(".track-name").text(this.model.config.get_value("name"))},render_action_icons:function(){var e=this;this.icons_div=$("<div/>").addClass("track-icons").hide().appendTo(this.$el),t.default.each(this.model.action_icons_def,function(i){e.add_action_icon(i.name,i.title,i.css_class,i.on_click_fn,i.prepend,i.hide)}),this.set_display_modes(this.model.display_modes)},add_action_icon:function(e,i,t,n,o,s){var d=this;this.action_icons[e]=$("<a/>").attr("title",i).addClass("icon-button").addClass(t).tooltip().click(function(){n(d.model)}).appendTo(this.icons_div),s&&this.action_icons[e].hide()},set_display_modes:function(e,i){if(e){this.model.display_modes=e,this.model.mode=i||this.model.config.get_value("mode")||this.model.display_modes[0],this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");for(var t=this.model,n={},o=0,s=t.display_modes.length;o<s;o++){var d=t.display_modes[o];n[d]=function(e){return function(){t.change_mode(e)}}(d)}make_popupmenu(this.action_icons.mode_icon,n)}}});e.default={TrackHeaderView:n}});
|
||||
//# sourceMappingURL=../../maps/viz/viz_views.js.map
|
||||
|
||||
Reference in New Issue
Block a user