Skip to content

Commit

Permalink
Cleanup in galaxy/scripts/viz, lints cleanly with one exception that …
Browse files Browse the repository at this point in the history
…I do not understand.
  • Loading branch information
dannon committed Jan 15, 2019
1 parent aede1ab commit 756ff01
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
1 change: 0 additions & 1 deletion client/galaxy/scripts/viz/bbi-data-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var BBIDataManager = visualization.GenomeDataManager.extend({
var url = `${getAppRoot()}datasets/${this.get("dataset").id}/display`;

var self = this;
var promise = new $.Deferred();
$.when(bigwig.makeBwg(url)).then((bb, err) => {
$.when(bb.readWigData(region.get("chrom"), region.get("start"), region.get("end"))).then(data => {
// Transform data into "bigwig" format for LinePainter. "bigwig" format is an array of 2-element arrays
Expand Down
12 changes: 5 additions & 7 deletions client/galaxy/scripts/viz/phyloviz.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import * as d3 from "libs/d3";
import visualization_mod from "viz/visualization";
import { Dataset } from "mvc/dataset/data";
import mod_icon_btn from "mvc/ui/icon-button";
import { show_message, hide_modal } from "layout/modal";

/**
* Base class of any menus that takes in user interaction. Contains checking methods.
*/
Expand Down Expand Up @@ -271,7 +273,7 @@ var PhyloTree = visualization_mod.Visualization.extend({
toggleAll: function(d) {
if (d.children && d.children.length !== 0) {
d.children.forEach(this.toggleAll);
toggle(d);
this.toggle(d);
}
},

Expand Down Expand Up @@ -361,7 +363,6 @@ var PhylovizLayoutBase = Backbone.View.extend({
* AND possibly when the tree is edited.
*/
updateAndRender: function(source) {
var vis = d3.select(".vis");
var self = this;
source = source || self.model.root;

Expand All @@ -375,9 +376,6 @@ var PhylovizLayoutBase = Backbone.View.extend({
*/
renderLinks: function(source) {
var self = this;
var diagonal = self.diagonal;
var duration = self.duration;
var layoutMode = self.layoutMode;
var link = self.vis.selectAll("g.completeLink").data(self.tree.links(self.nodes), d => d.target.id);

var calcalateLinePos = d => {
Expand Down Expand Up @@ -409,7 +407,7 @@ var PhylovizLayoutBase = Backbone.View.extend({
return `M ${d.pos0} L ${d.pos1} L ${d.pos2}`;
});

var linkExit = link.exit().remove();
link.exit().remove();
},

// User Interaction methods below
Expand Down Expand Up @@ -671,7 +669,7 @@ export var PhylovizView = Backbone.View.extend({
$("#title").text(`Phylogenetic Tree from ${self.phyloTree.get("title")}:`);

// -- Create Linear view instance --
var linearView = new PhylovizLinearView(self.layoutOptions);
new PhylovizLinearView(self.layoutOptions);
},

/**
Expand Down
10 changes: 5 additions & 5 deletions client/galaxy/scripts/viz/sweepster.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import tools from "mvc/tool/tools";
import { Dataset } from "mvc/dataset/data";
import config from "utils/config";
import mod_icon_btn from "mvc/ui/icon-button";
import { make_popupmenu } from "ui/popupmenu";
import { show_modal, hide_modal } from "layout/modal";

/**
* A collection of tool input settings. Object is useful for keeping a list of settings
Expand Down Expand Up @@ -116,7 +118,6 @@ var ToolParameterTree = Backbone.Model.extend({
create_tree_data = (params_samples, index) => {
var param_samples = params_samples[index],
param = param_samples.param,
param_label = param.get("label"),
settings = param_samples.samples;

// Create leaves when last parameter setting is reached.
Expand Down Expand Up @@ -408,7 +409,7 @@ var SweepsterTrackView = Backbone.View.extend({
});
var self = this;

var run_on_dataset_button = $("<button/>")
$("<button/>")
.appendTo(settings_div)
.text("Run on complete dataset")
.click(() => {
Expand Down Expand Up @@ -507,7 +508,6 @@ var ToolInputValOrSweepView = Backbone.View.extend({

render: function() {
var input = this.model;
var type = input.get("type");
var single_input_row = this.$el.find(".form-row-input");
var sweep_inputs_row = null;

Expand Down Expand Up @@ -606,7 +606,7 @@ var ToolParameterTreeDesignView = Backbone.View.extend({
.find(".form-row")
.not(".form-actions")
.each(function(i) {
var input_view = new ToolInputValOrSweepView({
new ToolInputValOrSweepView({
model: inputs.at(i),
tool_row: $(this)
});
Expand Down Expand Up @@ -671,7 +671,7 @@ var ToolParameterTreeView = Backbone.View.extend({
.attr("transform", "translate(40, 20)");

// Draw links.
var link = vis
vis
.selectAll("path.link")
.data(cluster.links(nodes))
.enter()
Expand Down
13 changes: 8 additions & 5 deletions client/galaxy/scripts/viz/trackster/filters.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import $ from "jquery";
import _l from "utils/localization";
import _ from "libs/underscore";
var extend = _.extend;
import { getGalaxyInstance } from "app";

/**
* Filters that enable users to show/hide data points dynamically.
Expand All @@ -15,7 +16,7 @@ var Filter = function(obj_dict) {
this.tool_exp_name = obj_dict.tool_exp_name;
};

extend(Filter.prototype, {
_.extend(Filter.prototype, {
/**
* Convert filter to dictionary.
*/
Expand Down Expand Up @@ -259,13 +260,14 @@ var NumberFilter = function(obj_dict) {
// Add to clear floating layout.
$("<div style='clear: both;'/>").appendTo(filter.parent_div);
};
extend(NumberFilter.prototype, {

_.extend(NumberFilter.prototype, {
/**
* Convert filter to dictionary.
*/
to_dict: function() {
var obj_dict = Filter.prototype.to_dict.call(this);
return extend(obj_dict, {
return _.extend(obj_dict, {
type: "number",
min: this.min,
max: this.max,
Expand Down Expand Up @@ -503,7 +505,7 @@ var FiltersManager = function(track, obj_dict) {
}
};

extend(FiltersManager.prototype, {
_.extend(FiltersManager.prototype, {
// HTML manipulation and inspection.
show: function() {
this.parent_div.show();
Expand Down Expand Up @@ -655,6 +657,7 @@ extend(FiltersManager.prototype, {

// DBTODO: This will never work, run_tool_url doesn't exist?
$.getJSON(run_tool_url, url_params, response => {
let Galaxy = getGalaxyInstance();
if (response.error) {
// General error.
Galaxy.modal.show({
Expand Down
3 changes: 3 additions & 0 deletions client/galaxy/scripts/viz/trackster/util.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import $ from "jquery";
import Backbone from "backbone";

/**
* Stringifies a number adding commas for digit grouping as per North America.
*/
Expand Down
2 changes: 2 additions & 0 deletions client/galaxy/scripts/viz/visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import util_mod from "viz/trackster/util";
import config_mod from "utils/config";
import GridView from "mvc/grid/grid-view";
import Tabs from "mvc/ui/ui-tabs";
import { getGalaxyInstance } from "app";

/**
* Mixin for returning custom JSON representation from toJSON. Class attribute to_json_keys defines a set of attributes
Expand Down Expand Up @@ -72,6 +73,7 @@ var select_datasets = (filters, success_fn) => {
});

// modal
let Galaxy = getGalaxyInstance();
Galaxy.modal.show({
title: _l("Select datasets for new tracks"),
body: tabs.$el,
Expand Down

0 comments on commit 756ff01

Please sign in to comment.