galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
June 2014
- 1 participants
- 233 discussions
commit/galaxy-central: dannon: Correct tools handling of tool.handle_input -- this doesn't always return a successful job.
by commits-noreply@bitbucket.org 11 Jun '14
by commits-noreply@bitbucket.org 11 Jun '14
11 Jun '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6b6c0b985ef3/
Changeset: 6b6c0b985ef3
User: dannon
Date: 2014-06-11 17:39:21
Summary: Correct tools handling of tool.handle_input -- this doesn't always return a successful job.
Affected #: 1 file
diff -r 2f21305e92783303c6254c66678a0d44365f7770 -r 6b6c0b985ef35056b773197354afe83b07d88afa lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -156,7 +156,7 @@
output_dict[ 'output_name' ] = output_name
outputs.append( trans.security.encode_dict_ids( output_dict ) )
- for job in vars[ 'jobs' ]:
+ for job in vars.get('jobs', []):
rval[ 'jobs' ].append( self.encode_all_ids( trans, job.to_dict( view='collection' ), recursive=True ) )
for output_name, collection_instance in vars.get( 'implicit_collections', {} ).iteritems():
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ef56567006a4/
Changeset: ef56567006a4
Branch: stable
User: natefoo
Date: 2014-06-11 16:12:54
Summary: Updated tag latest_2014.06.02 for changeset f7dd0060c296
Affected #: 1 file
diff -r f7dd0060c2966f2b9c66c5ac739d0e5a9a31faa0 -r ef56567006a42ecfaee303b22f4f379a759c03b8 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -9,5 +9,4 @@
9e53251b0b7e93b9563008a2b112f2e815a04bbc release_2014.04.14
68a8b0397947c732b28207d465d3f3c4e2a7a8a0 latest_2014.04.14
7e257c7b10badb65772b1528cb61d58175a42e47 release_2014.06.02
-7e257c7b10badb65772b1528cb61d58175a42e47 latest_2014.06.02
-fb68af9a775a956fcc397b22d16f2119401d926d latest_2014.06.02
+f7dd0060c2966f2b9c66c5ac739d0e5a9a31faa0 latest_2014.06.02
https://bitbucket.org/galaxy/galaxy-central/commits/2f21305e9278/
Changeset: 2f21305e9278
User: natefoo
Date: 2014-06-11 16:26:37
Summary: Merge stable.
Affected #: 1 file
diff -r a2e6ccecce9d018d9b5ec24d2fc87deab3c74a9a -r 2f21305e92783303c6254c66678a0d44365f7770 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -9,5 +9,4 @@
9e53251b0b7e93b9563008a2b112f2e815a04bbc release_2014.04.14
68a8b0397947c732b28207d465d3f3c4e2a7a8a0 latest_2014.04.14
7e257c7b10badb65772b1528cb61d58175a42e47 release_2014.06.02
-7e257c7b10badb65772b1528cb61d58175a42e47 latest_2014.06.02
-fb68af9a775a956fcc397b22d16f2119401d926d latest_2014.06.02
+f7dd0060c2966f2b9c66c5ac739d0e5a9a31faa0 latest_2014.06.02
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a2e6ccecce9d/
Changeset: a2e6ccecce9d
User: dannon
Date: 2014-06-11 16:20:53
Summary: Merge stable.
Affected #: 0 files
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Charts: Add progress notification
by commits-noreply@bitbucket.org 11 Jun '14
by commits-noreply@bitbucket.org 11 Jun '14
11 Jun '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/0fc231c66f8d/
Changeset: 0fc231c66f8d
User: guerler
Date: 2014-06-11 12:59:41
Summary: Charts: Add progress notification
Affected #: 5 files
diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/app.css
--- a/config/plugins/visualizations/charts/static/app.css
+++ b/config/plugins/visualizations/charts/static/app.css
@@ -48,6 +48,7 @@
margin-left: 5px;
top: -1px;
font-size: 1.0em;
+ display: inline-block;
}
.charts-viewport .icon {
diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/charts/tools.js
--- a/config/plugins/visualizations/charts/static/charts/tools.js
+++ b/config/plugins/visualizations/charts/static/charts/tools.js
@@ -4,6 +4,9 @@
// render
function panelHelper (options)
{
+ // link this
+ var self = this;
+
// require parameters
var process_id = options.process_id;
var chart = options.chart;
@@ -15,9 +18,8 @@
// get request size from chart
request_dictionary.query_limit = chart.definition.query_limit;
- // request data
- var self = this;
- app.datasets.request(request_dictionary, function() {
+ // define success function
+ request_dictionary.success = function() {
try {
// check if this chart has multiple panels
if (!chart.definition.use_panels && chart.settings.get('use_panels') !== 'true') {
@@ -52,7 +54,15 @@
// unregister process
chart.deferred.done(process_id);
}
- });
+ };
+
+ // add progress
+ request_dictionary.progress = function(percentage) {
+ chart.state('wait', 'Loading data...' + percentage + '%');
+ };
+
+ // request data
+ app.datasets.request(request_dictionary);
};
// get domain boundaries value
diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/library/datasets.js
--- a/config/plugins/visualizations/charts/static/library/datasets.js
+++ b/config/plugins/visualizations/charts/static/library/datasets.js
@@ -21,18 +21,23 @@
},
// request handler
- request: function(request_dictionary, success, error) {
+ request: function(request_dictionary) {
if (request_dictionary.groups) {
- this._get_blocks(request_dictionary, success, error);
+ this._get_blocks(request_dictionary);
} else {
- this._get_dataset(request_dictionary.id, success, error)
+ this._get_dataset(request_dictionary.id, request_dictionary.success, request_dictionary.error)
}
},
// multiple request handler
- _get_blocks: function(request_dictionary, success, error) {
+ _get_blocks: function(request_dictionary) {
+ // get callbacks
+ var success = request_dictionary.success;
+ var progress = request_dictionary.progress;
+
// query block size
- var query_size = this.app.config.get('query_limit');
+ var query_size = this.app.config.get('query_limit');
+ var query_timeout = this.app.config.get('query_timeout');
// set range
var query_start = request_dictionary.start || 0;
@@ -51,9 +56,12 @@
// get query dictionary template
var query_dictionary_template = $.extend(true, {}, request_dictionary);
+ // reset query counter
+ var query_counter = 0;
+
// fetch blocks
var self = this;
- function fetch_blocks (query, success, error) {
+ function fetch_blocks (query) {
self._get(query, function() {
// copy values from query into request_dictionary
var done = false;
@@ -78,10 +86,16 @@
}
// check if for remaining queries
- if (--query_number > 0 && !done) {
+ if (++query_counter < query_number && !done) {
+ // report progress
+ if (progress) {
+ progress(parseInt((query_counter / query_number) * 100));
+ }
+
+ // next query
var start = query.start + query_size;
query = $.extend(true, query_dictionary_template, {start: start});
- fetch_blocks(query, success, error);
+ fetch_blocks(query);
} else {
success();
}
@@ -94,7 +108,7 @@
// get dataset meta data
this._get_dataset(request_dictionary.id, function() {
- fetch_blocks(query, success, error);
+ fetch_blocks(query);
});
},
@@ -197,12 +211,12 @@
// convert
_fill_from_cache: function(request_dictionary) {
- // log
- console.debug('Datasets::_fill_from_cache() - Filling request from cache.');
-
// identify start of request
var start = request_dictionary.start;
+ // log
+ console.debug('Datasets::_fill_from_cache() - Filling request from cache at ' + start + '.');
+
// identify end of request
var limit = 0;
for (var i in request_dictionary.groups) {
diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/views/group.js
--- a/config/plugins/visualizations/charts/static/views/group.js
+++ b/config/plugins/visualizations/charts/static/views/group.js
@@ -110,19 +110,25 @@
// register process
var process_id = this.chart.deferred.register();
+ // request dictionary
+ var request_dictionary = {
+ id : dataset_id,
+ success : function(dataset) {
+ // update select fields
+ for (var id in select_list) {
+ self._addRow(id, dataset, select_list, chart_definition.columns[id])
+ }
+
+ // loading
+ self.chart.state('ok', 'Metadata initialized...');
+
+ // unregister
+ self.chart.deferred.done(process_id);
+ }
+ };
+
// get dataset
- this.app.datasets.request({id : dataset_id}, function(dataset) {
- // update select fields
- for (var id in select_list) {
- self._addRow(id, dataset, select_list, chart_definition.columns[id])
- }
-
- // loading
- self.chart.state('ok', 'Metadata initialized...');
-
- // unregister
- self.chart.deferred.done(process_id);
- });
+ this.app.datasets.request(request_dictionary);
},
// add row
diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/views/viewport.js
--- a/config/plugins/visualizations/charts/static/views/viewport.js
+++ b/config/plugins/visualizations/charts/static/views/viewport.js
@@ -50,7 +50,7 @@
// show info
$info.show();
$info.find('#text').html(self.chart.get('state_info'));
-
+
// check status
var state = self.chart.get('state');
switch (state) {
@@ -274,7 +274,7 @@
_template: function() {
return '<div class="charts-viewport">' +
'<div id="info" class="info">' +
- '<span id="icon" class="icon" />' +
+ '<span id="icon" class="icon"/>' +
'<span id="text" class="text" />' +
'</div>' +
'</div>';
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Charts: Allow individual chart types to set request limits
by commits-noreply@bitbucket.org 11 Jun '14
by commits-noreply@bitbucket.org 11 Jun '14
11 Jun '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/b62ff72c0d87/
Changeset: b62ff72c0d87
User: guerler
Date: 2014-06-11 11:52:01
Summary: Charts: Allow individual chart types to set request limits
Affected #: 4 files
diff -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d config/plugins/visualizations/charts/static/charts/jqplot/common/config.js
--- a/config/plugins/visualizations/charts/static/charts/jqplot/common/config.js
+++ b/config/plugins/visualizations/charts/static/charts/jqplot/common/config.js
@@ -6,6 +6,7 @@
library : 'JqPlot',
tag : 'div',
keywords : 'default medium',
+ query_limit : 10000,
settings : {
separator_label : {
title : 'X axis',
diff -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d config/plugins/visualizations/charts/static/charts/nvd3/common/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/common/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/common/config.js
@@ -6,6 +6,7 @@
library : 'NVD3',
tag : 'svg',
keywords : 'small',
+ query_limit : 500,
settings : {
separator_label : {
title : 'X axis',
diff -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d config/plugins/visualizations/charts/static/charts/tools.js
--- a/config/plugins/visualizations/charts/static/charts/tools.js
+++ b/config/plugins/visualizations/charts/static/charts/tools.js
@@ -12,6 +12,9 @@
var canvas = options.canvas;
var app = options.app;
+ // get request size from chart
+ request_dictionary.query_limit = chart.definition.query_limit;
+
// request data
var self = this;
app.datasets.request(request_dictionary, function() {
diff -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d config/plugins/visualizations/charts/static/library/datasets.js
--- a/config/plugins/visualizations/charts/static/library/datasets.js
+++ b/config/plugins/visualizations/charts/static/library/datasets.js
@@ -20,21 +20,84 @@
this.options = Utils.merge(options, this.optionsDefault);
},
- // wait
+ // request handler
request: function(request_dictionary, success, error) {
- // link this
- var self = this;
-
- // check if column data is requested
if (request_dictionary.groups) {
- this._get_dataset(request_dictionary.id, function() {
- self._get(request_dictionary, success);
- });
+ this._get_blocks(request_dictionary, success, error);
} else {
this._get_dataset(request_dictionary.id, success, error)
}
},
+ // multiple request handler
+ _get_blocks: function(request_dictionary, success, error) {
+ // query block size
+ var query_size = this.app.config.get('query_limit');
+
+ // set range
+ var query_start = request_dictionary.start || 0;
+ var query_end = query_start + request_dictionary.query_limit || query_start + this.app.config.get('query_limit');
+
+ // get query limit
+ var query_range = Math.abs(query_end - query_start);
+ if (query_range <= 0) {
+ console.debug('FAILED - Datasets::request() - Invalid query range.');
+ return;
+ }
+
+ // get number of required queries
+ var query_number = Math.ceil(query_range / query_size) || 1;
+
+ // get query dictionary template
+ var query_dictionary_template = $.extend(true, {}, request_dictionary);
+
+ // fetch blocks
+ var self = this;
+ function fetch_blocks (query, success, error) {
+ self._get(query, function() {
+ // copy values from query into request_dictionary
+ var done = false;
+ for (var group_index in request_dictionary.groups) {
+ // get source/destination
+ destination_group = request_dictionary.groups[group_index];
+ source_group = query.groups[group_index];
+
+ // check if value fields already exist
+ if (!destination_group.values) {
+ destination_group.values = [];
+ }
+
+ // concat values
+ destination_group.values = destination_group.values.concat(source_group.values);
+
+ // validate
+ if (source_group.values.length == 0) {
+ done = true;
+ break;
+ }
+ }
+
+ // check if for remaining queries
+ if (--query_number > 0 && !done) {
+ var start = query.start + query_size;
+ query = $.extend(true, query_dictionary_template, {start: start});
+ fetch_blocks(query, success, error);
+ } else {
+ success();
+ }
+ });
+
+ };
+
+ // prepare query
+ var query = $.extend(true, query_dictionary_template, {start: query_start});
+
+ // get dataset meta data
+ this._get_dataset(request_dictionary.id, function() {
+ fetch_blocks(query, success, error);
+ });
+ },
+
// get dataset
_get_dataset: function(id, success, error) {
// check if dataset is available from cache
@@ -62,18 +125,14 @@
// get block id
_block_id: function (options, column) {
- return options.id + '_' + options.start + '_' + options.end + '_' + column;
+ return options.id + '_' + options.start + '_' + options.start + this.app.config.get('query_limit') + '_' + column;
},
// fills request dictionary with data from cache/response
_get: function(request_dictionary, callback) {
- // set start/end
- if (!request_dictionary.start) {
- request_dictionary.start = 0;
- }
- if (!request_dictionary.end) {
- request_dictionary.end = this.app.config.get('query_limit');
- }
+ // set start
+ request_dictionary.start = request_dictionary.start || 0;
+
// get column indices
var column_list = [];
var column_map = {};
@@ -99,7 +158,7 @@
}
}
- // check length
+ // check length of blocks not available in cache
if (column_list.length == 0) {
// fill dictionary from cache
this._fill_from_cache(request_dictionary);
@@ -115,7 +174,6 @@
var dataset_request = {
dataset_id : request_dictionary.id,
start : request_dictionary.start,
- end : request_dictionary.end,
columns : column_list
}
@@ -161,7 +219,7 @@
// check length
if (limit == 0) {
- console.debug('FAILED - Datasets::_fill_from_cache() - Invalid range.');
+ console.debug('Datasets::_fill_from_cache() - Reached data range limit.');
}
// initialize group values
@@ -230,17 +288,13 @@
var offset = dataset_request.start ? dataset_request.start : 0;
// set limit
- var limit = Math.abs(dataset_request.end - dataset_request.start);
- var query_limit = this.app.config.get('query_limit');
- if (!limit || limit > query_limit) {
- limit = query_limit;
- }
+ var limit = this.app.config.get('query_limit');
// check length
var n_columns = 0;
if (dataset_request.columns) {
n_columns = dataset_request.columns.length;
- console.debug('Datasets::_fetch() - Fetching ' + n_columns + ' column(s)');
+ console.debug('Datasets::_fetch() - Fetching ' + n_columns + ' column(s) at ' + offset + '.');
}
if (n_columns == 0) {
console.debug('Datasets::_fetch() - No columns requested');
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Charts: Improve axes labeling, formatting options and chart interaction
by commits-noreply@bitbucket.org 11 Jun '14
by commits-noreply@bitbucket.org 11 Jun '14
11 Jun '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/66cfcaf35801/
Changeset: 66cfcaf35801
User: guerler
Date: 2014-06-11 08:30:52
Summary: Charts: Improve axes labeling, formatting options and chart interaction
Affected #: 22 files
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/jqplot/bar/config.js
--- a/config/plugins/visualizations/charts/static/charts/jqplot/bar/config.js
+++ b/config/plugins/visualizations/charts/static/charts/jqplot/bar/config.js
@@ -7,7 +7,8 @@
x : {
title : 'Values for x-axis',
is_label : true,
- is_auto : true
+ is_auto : true,
+ is_unique : true
},
y : {
title : 'Values for y-axis',
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/jqplot/boxplot/wrapper.js
--- a/config/plugins/visualizations/charts/static/charts/jqplot/boxplot/wrapper.js
+++ b/config/plugins/visualizations/charts/static/charts/jqplot/boxplot/wrapper.js
@@ -1,5 +1,5 @@
// dependencies
-define(['plugin/charts/jqplot/common/wrapper'], function(Plot) {
+define(['plugin/charts/jqplot/common/wrapper', 'plugin/charts/tools'], function(Plot, Tools) {
// widget
return Backbone.View.extend(
@@ -19,8 +19,7 @@
group.columns = null;
group.columns = {
x: {
- index: index++,
- is_numeric: true
+ index : index++
}
}
}
@@ -30,66 +29,67 @@
process_id : process_id,
chart : chart,
request_dictionary : request_dictionary,
- makeConfig : function(plot_config){
+ makeConfig : function(plot_config, groups){
+ var boundary = Tools.getDomains(groups, 'x');
$.extend(true, plot_config, {
seriesDefaults: {
renderer: $.jqplot.OHLCRenderer,
rendererOptions : {
- candleStick : true
+ candleStick : true,
+ fillUpBody : true,
+ fillDownBody : true
+ }
+ },
+ axes : {
+ xaxis: {
+ pad: 1.2
+ },
+ yaxis: {
+ min: boundary.x.min,
+ max: boundary.x.max
}
}
});
},
makeSeries : function (groups) {
+ /* example data
+ var catOHLC = [
+ [0, 138.7, 139.68, 135.18, 135.4],
+ [1, 143.46, 144.66, 139.79, 140.02],
+ [2, 140.67, 143.56, 132.88, 142.44],
+ [3, 136.01, 139.5, 134.53, 139.48]
+ ];
+ return [catOHLC];
+ */
+
// plot data
var plot_data = [];
// check group length
- if (groups.length == 0 && groups[0].values.length == 0) {
- return;
+ if (groups.length == 0 || groups[0].values.length < 5) {
+ chart.state('failed', 'Boxplot data could not be found.');
+ return [plot_data];
}
- // reset data/categories
- var data = [];
-
- /*/ loop through data groups
- for (var key in request_dictionary.groups) {
+ // loop through data groups
+ for (var group_index in request_dictionary.groups) {
// get group
- var group = request_dictionary.groups[key];
-
+ var group = request_dictionary.groups[group_index];
+
// format chart data
var point = [];
- point.push(group.key);
- for (var key in [0, 1, 3, 4]) {
- point.push(group.values[key].x);
+ point.push(parseInt(group_index));
+ var indeces = [2, 4, 0, 1];
+ for (var key in indeces) {
+ point.push(group.values[indeces[key]].x);
}
-
+
// add to data
- data.push (point);
- }*/
-
- /*/ loop through data groups
- for (var key in groups) {
- var group = groups[key];
- var point = [];
- for (var value_index in group.values) {
- point.push(group.values[value_index].x);
- }
plot_data.push (point);
}
// return
return [plot_data];
-
- var catOHLC = [[1, 138.7, 139.68, 135.18, 135.4],
- [2, 143.46, 144.66, 139.79, 140.02],
- [3, 140.67, 143.56, 132.88, 142.44],
- [4, 136.01, 139.5, 134.53, 139.48],
- [5, 443.82, 144.56, 136.04, 136.97],
- [6, 136.47, 146.4, 136, 144.67],
- [7, 124.76, 135.9, 124.55, 135.81],
- [8, 223.73, 129.31, 121.57, 122.5]];
- return [catOHLC];*/
}
});
}
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/jqplot/common/plot-config.js
--- a/config/plugins/visualizations/charts/static/charts/jqplot/common/plot-config.js
+++ b/config/plugins/visualizations/charts/static/charts/jqplot/common/plot-config.js
@@ -7,6 +7,7 @@
// get chart settings
var settings = chart.settings;
var plot_config = {
+ enablePlugins: true,
seriesColors: function() {
var colors = [];
var colorScale = d3.scale.category20();
@@ -61,30 +62,11 @@
// is specified for each series.
series: [],
- // Show the legend and put it outside the grid, but inside the
- // plot container, shrinking the grid to accomodate the legend.
- // A value of "outside" would not shrink the grid and allow
- // the legend to overflow the container.
- legend: {
- renderer : $.jqplot.EnhancedLegendRenderer,
- show : chart.settings.get('show_legend') == 'true',
- placement : 'outsideGrid',
- location : 'n',
- rendererOptions: {
- textColor : '#000000',
- fontSize : '12pt',
- border : 'none',
- shadowAlpha : 1,
- background : 'rgba(255, 255, 255, 0.9)',
- fontFamily : 'Arial',
- numberRows : 1
- }
- },
-
axesDefaults: {
labelRenderer : $.jqplot.CanvasAxisLabelRenderer,
labelOptions: {
- fontSize : '12pt'
+ fontSize : '12pt',
+ textColor : '#000000'
},
tickRenderer : $.jqplot.CanvasAxisTickRenderer ,
tickOptions: {
@@ -108,6 +90,7 @@
// not touch, the grid boundaries. 1.2 is the default padding.
yaxis: {
label : chart.settings.get('y_axis_label'),
+ tickOptions : {},
pad : 0
//tickOptions : {formatString: '$%d'},
//padding : 1.2,
@@ -116,7 +99,7 @@
},
grid: {
- background : '#FFFFFF', // CSS color spec for background color of grid.
+ background : '#FFFFFF',
borderWidth : 0,
shadow : false
},
@@ -124,11 +107,38 @@
cursor: {
show : true,
zoom : true,
- showTooltip : true,
+ showTooltip : false,
style : 'pointer'
+ },
+ highlighter: {
+ show : true,
+ showMarker : false,
+ tooltipAxes : 'xy'
}
};
+ // Show the legend and put it outside the grid, but inside the
+ // plot container, shrinking the grid to accomodate the legend.
+ // A value of "outside" would not shrink the grid and allow
+ // the legend to overflow the container.
+ if (chart.settings.get('show_legend') == 'true') {
+ plot_config.legend = {
+ renderer : $.jqplot.EnhancedLegendRenderer,
+ show : true,
+ placement : 'outsideGrid',
+ location : 'n',
+ rendererOptions: {
+ textColor : '#000000',
+ fontSize : '12pt',
+ border : 'none',
+ shadowAlpha : 1,
+ background : 'rgba(255, 255, 255, 0.9)',
+ fontFamily : 'Arial',
+ numberRows : 1
+ }
+ };
+ }
+
// callback
return plot_config;
};
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/jqplot/common/wrapper.js
--- a/config/plugins/visualizations/charts/static/charts/jqplot/common/wrapper.js
+++ b/config/plugins/visualizations/charts/static/charts/jqplot/common/wrapper.js
@@ -37,35 +37,41 @@
// draw all data into a single canvas
render: function(groups, el_canvas) {
- // set chart settings
- var chart = this.options.chart;
- var makeConfig = this.options.makeConfig;
- var makeSeries = this.options.makeSeries;
+ // get parameters
+ var chart = this.options.chart;
+ var makeCategories = this.options.makeCategories;
+ var makeSeries = this.options.makeSeries;
+ var makeConfig = this.options.makeConfig;
// create configuration
var plot_config = configmaker(chart);
var plot_data = []
-
- // identify categories
- this._makeCategories(chart, groups, plot_config, true);
-
- // reset data
- if (makeSeries) {
- plot_data = makeSeries(groups);
- } else {
- plot_data = Tools.makeSeries(groups);
- }
-
+
// draw plot
try {
// canvas
var canvas = el_canvas[0];
+
+ // make custom categories call
+ this._makeAxes(plot_config, groups, chart.settings);
- // make custom wrapper callback
+ // make custom series call
+ if (makeSeries) {
+ plot_data = makeSeries(groups);
+ } else {
+ plot_data = Tools.makeSeries(groups);
+ }
+
+ // make custom config call
if (makeConfig) {
- makeConfig(plot_config);
+ makeConfig(plot_config, groups);
}
-
+
+ // check chart state
+ if (chart.get('state') == 'failed') {
+ return false;
+ }
+
// Draw graph with default options, overwriting with passed options
function drawGraph (opts) {
el_canvas.empty();
@@ -89,53 +95,54 @@
}
},
- // create categories
- _makeCategories: function(chart, groups, plot_config) {
-
- // check length
- if (groups.length == 0) {
- return;
+ // create axes formatting
+ _makeAxes: function(plot_config, groups, settings) {
+ // result
+ var makeCategories = this.options.makeCategories;
+ var categories;
+ if (makeCategories) {
+ categories = makeCategories(groups, plot_config);
+ } else {
+ categories = Tools.makeCategories(groups);
}
-
- // result
- var result = Tools.makeCategories(chart, groups);
-
- /*/ add categories to plot configuration
- for (var key in result.array) {
- var axis = key + 'axis';
- if (plot_config.axes[axis]) {
- plot_config.axes[axis].ticks = result.array[key];
+
+ // make axis
+ function makeAxis (id) {
+ var axis = plot_config.axes[id + 'axis'].tickOptions;
+ var type = settings.get(id + '_axis_type');
+ var tick = settings.get(id + '_axis_tick');
+ var is_category = categories.array[id];
+
+ // hide axis
+ if (type == 'hide') {
+ axis.formatter = function(format, value) { return '' };
+ return;
}
- }*/
-
- // add x tick formatter
- function axisTickFormatter (axis_char, plot_axis, axis_type, axis_tick) {
- // get chart definition from first group
- var chart_definition = groups[0];
- /*if (axis_type != 'auto' && axis_type !== undefined) {
- plot_axis.tickOptions.formatter = function(format, value) {
- if (axis_type == 'hide') {
- return '';
- }
- var format = d3.format(axis_tick + axis_type);
- return format(v);
+ // format values/labels
+ if (type == 'auto') {
+ if (is_category) {
+ axis.formatter = function(format, value) {
+ return categories.array[id][value] || '';
+ };
}
- } else {*/
- if (chart_definition.columns[axis_char] && chart_definition.columns[axis_char].is_label) {
- plot_axis.tickOptions.formatter = function(format, value) {
- if (result.array[axis_char] !== undefined &&
- result.array[axis_char][value] !== undefined) {
- return result.array[axis_char][value];
- } else {
- return '';
- }
+ } else {
+ var formatter = d3.format(tick + type);
+ if (is_category) {
+ axis.formatter = function(format, value) {
+ return formatter(categories.array[id][value]);
+ };
+ } else {
+ axis.formatter = function(format, value) {
+ return formatter(value);
}
}
- //}
- }
- //axisTickFormatter ('x', plot_config.axes.xaxis, chart.settings.get('x_axis_type'), chart.settings.get('x_axis_tick'));
- //axisTickFormatter ('y', plot_config.axes.yaxis, chart.settings.get('y_axis_type'), chart.settings.get('y_axis_tick'));
+ }
+ };
+
+ // make axes
+ makeAxis('x');
+ makeAxis('y');
},
// handle error
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/jqplot/line/config.js
--- a/config/plugins/visualizations/charts/static/charts/jqplot/line/config.js
+++ b/config/plugins/visualizations/charts/static/charts/jqplot/line/config.js
@@ -7,7 +7,8 @@
x : {
title : 'Values for x-axis',
is_label : true,
- is_auto : true
+ is_auto : true,
+ is_unique : true
},
y : {
title : 'Values for y-axis',
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/bar/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/bar/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/bar/config.js
@@ -7,10 +7,11 @@
x : {
title : 'Values for x-axis',
is_label : true,
- is_auto : true
+ is_auto : true,
+ is_unique : true
},
y : {
- title : 'Values for y-axis',
+ title : 'Values for y-axis',
is_numeric : true
}
}
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/bar_horizontal/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/bar_horizontal/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/bar_horizontal/config.js
@@ -4,21 +4,22 @@
title : 'Horizontal',
category : 'Bar diagrams',
keywords : 'default small',
+ settings : {
+ x_axis_type : {
+ init : 'hide'
+ }
+ },
columns : {
x : {
title : 'Values for x-axis',
is_label : true,
- is_auto : true
+ is_auto : true,
+ is_unique : true
},
y : {
title : 'Values for y-axis',
is_numeric : true
}
- },
- settings : {
- x_axis_type : {
- init : 'hide'
- }
}
});
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/bar_horizontal_stacked/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/bar_horizontal_stacked/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/bar_horizontal_stacked/config.js
@@ -10,8 +10,14 @@
}
},
columns : {
+ x : {
+ title : 'Values for x-axis',
+ is_label : true,
+ is_auto : true,
+ is_unique : true
+ },
y : {
- title : 'Values for y-axis',
+ title : 'Values for y-axis',
is_numeric : true
}
}
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/bar_stacked/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/bar_stacked/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/bar_stacked/config.js
@@ -5,8 +5,14 @@
category : 'Bar diagrams',
keywords : 'default small',
columns : {
+ x : {
+ title : 'Values for x-axis',
+ is_label : true,
+ is_auto : true,
+ is_unique : true
+ },
y : {
- title : 'Values for y-axis',
+ title : 'Values for y-axis',
is_numeric : true
}
}
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/common/wrapper.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/common/wrapper.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/common/wrapper.js
@@ -39,15 +39,9 @@
var self = this;
nv.addGraph(function() {
try {
- // x axis
- self._axis(d3chart.xAxis, chart.settings.get('x_axis_type'), chart.settings.get('x_axis_tick'));
-
// x axis label
d3chart.xAxis.axisLabel(chart.settings.get('x_axis_label'));
- // y axis
- self._axis(d3chart.yAxis, chart.settings.get('y_axis_type'), chart.settings.get('y_axis_tick'));
-
// y axis label
d3chart.yAxis.axisLabel(chart.settings.get('y_axis_label'))
.axisLabelDistance(30);
@@ -60,14 +54,14 @@
d3chart.showLegend(chart.settings.get('show_legend') == 'true');
}
+ // make categories
+ self._makeAxes(d3chart, groups, chart.settings);
+
// custom callback
if (makeConfig) {
makeConfig(d3chart);
}
- // make categories
- self._makeCategories(chart, groups, d3chart);
-
// hide min/max values
d3chart.xAxis.showMaxMin(false);
d3chart.yAxis.showMaxMin(chart.definition.showmaxmin);
@@ -94,6 +88,11 @@
// add zoom handler
_addZoom: function(nvd3_model, svg, zoom_mode) {
+ // clip edges
+ if (nvd3_model.clipEdge) {
+ nvd3_model.clipEdge(true);
+ }
+
// get canvas dimensions
var width = parseInt(svg.style('width'));
var height = parseInt(svg.style('height'));
@@ -109,63 +108,97 @@
var y = d3.scale.linear()
.domain(y_domain)
.range([height, 0]);
-
+
+ // min/max boundaries
+ var x_boundary = nvd3_model.xScale().domain().slice();
+ var y_boundary = nvd3_model.yScale().domain().slice();
+
+ // create d3 zoom handler
+ var d3zoom = d3.behavior.zoom();
+
+ // fix domain
+ function fixDomain(domain, boundary) {
+ domain[0] = Math.max(domain[0], boundary[0]);
+ domain[1] = Math.min(domain[1], boundary[1]);
+ return domain;
+ };
+
// zoom event handler
function zoomed() {
if (zoom_mode == 'axis') {
- nvd3_model.xDomain(x.domain());
- nvd3_model.yDomain(y.domain());
+ nvd3_model.xDomain(fixDomain(x.domain(), x_boundary));
+ nvd3_model.yDomain(fixDomain(y.domain(), y_boundary));
nvd3_model.update();
} else {
var translate = d3.event.translate;
svg.select('.nvd3').attr("transform", "translate(" + translate + ") scale(" + d3.event.scale + ")");
}
- }
+ };
- // clip edges
- if (nvd3_model.clipEdge) {
- nvd3_model.clipEdge(true);
- }
-
- // d3 zoom wrapper
- var d3zoom = d3.behavior.zoom()
- .x(x)
- .y(y)
- .scaleExtent([1, 10])
- .on("zoom", zoomed);
+ // zoom event handler
+ function unzoomed() {
+ if (zoom_mode == 'axis') {
+ nvd3_model.xDomain(x_boundary);
+ nvd3_model.yDomain(y_boundary);
+ nvd3_model.update();
+ d3zoom.scale(1);
+ d3zoom.translate([0,0]);
+ } else {
+ var translate = d3.event.translate;
+ svg.select('.nvd3').attr("transform", "translate([0,0]) scale(1)");
+ }
+ };
+
+ // initialize wrapper
+ d3zoom.x(x)
+ .y(y)
+ .scaleExtent([1, 10])
+ .on("zoom", zoomed);
// add handler
- svg.call(d3zoom);
+ svg.call(d3zoom).on("dblclick.zoom", unzoomed);
},
- // create categories
- _makeCategories: function(chart, groups, d3chart) {
+ // create axes formatting
+ _makeAxes: function(d3chart, groups, settings) {
// result
- var result = Tools.makeCategories(chart, groups);
+ var categories = Tools.makeCategories(groups);
- // add categories to flot configuration
- for (var key in result.array) {
- var axis = key + 'Axis';
- if (d3chart[axis]) {
- var a = result.array[key];
- d3chart[axis].tickFormat(function(value) {
- return a[value];
- });
+ // make axis
+ function makeAxis (id) {
+ var axis = d3chart[id + 'Axis'];
+ var type = settings.get(id + '_axis_type');
+ var tick = settings.get(id + '_axis_tick');
+ var is_category = categories.array[id];
+
+ // hide axis
+ if (type == 'hide') {
+ axis.tickFormat(function() { return '' });
+ return;
}
- }
- },
+
+ // format values/labels
+ if (type == 'auto') {
+ if (is_category) {
+ axis.tickFormat(function(value) {
+ return categories.array[id][value]
+ });
+ }
+ } else {
+ var formatter = d3.format(tick + type);
+ if (is_category) {
+ axis.tickFormat(function(value) {
+ return formatter(categories.array[id][value]);
+ });
+ } else {
+ axis.tickFormat(formatter);
+ }
+ }
+ };
- // make axis
- _axis: function(axis, type, tick) {
- switch (type) {
- case 'hide':
- axis.tickFormat(function() { return '' });
- break;
- case 'auto':
- break;
- default:
- axis.tickFormat(d3.format(tick + type));
- }
+ // make axes
+ makeAxis('x');
+ makeAxis('y');
},
// handle error
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/histogram/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/histogram/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/histogram/config.js
@@ -1,6 +1,5 @@
define(['plugin/charts/nvd3/common/config'], function(nvd3_config) {
-
return $.extend(true, {}, nvd3_config, {
title : 'Histogram',
category : 'Data processing (requires \'charts\' tool from Toolshed)',
@@ -8,7 +7,7 @@
keywords : 'small medium large',
columns : {
y : {
- title : 'Observations',
+ title : 'Observations',
is_numeric : true
}
},
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/histogram/wrapper.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/histogram/wrapper.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/histogram/wrapper.js
@@ -2,8 +2,7 @@
define(['plugin/charts/nvd3/common/wrapper'], function(NVD3) {
// widget
-return Backbone.View.extend(
-{
+return Backbone.View.extend({
// initialize
initialize: function(app, options) {
this.app = app;
@@ -11,18 +10,18 @@
},
// render
- draw : function(process_id, chart, request_dictionary)
- {
+ draw : function(process_id, chart, request_dictionary){
// configure request
var index = 1;
for (var i in request_dictionary.groups) {
var group = request_dictionary.groups[i];
group.columns = {
x: {
- index: 0
+ index : 0,
+ is_numeric : true
},
y: {
- index: index++
+ index : index++
}
}
}
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/line/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/line/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/line/config.js
@@ -8,10 +8,11 @@
x : {
title : 'Values for x-axis',
is_label : true,
- is_auto : true
+ is_auto : true,
+ is_unique : true
},
y : {
- title : 'Values for y-axis',
+ title : 'Values for y-axis',
is_numeric : true
}
}
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/line_focus/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/line_focus/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/line_focus/config.js
@@ -8,7 +8,8 @@
x : {
title : 'Values for x-axis',
is_label : true,
- is_auto : true
+ is_auto : true,
+ is_unique : true
},
y : {
title : 'Values for y-axis',
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/stackedarea/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/stackedarea/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/stackedarea/config.js
@@ -9,7 +9,8 @@
x : {
title : 'Values for x-axis',
is_label : true,
- is_auto : true
+ is_auto : true,
+ is_unique : true
},
y : {
title : 'Values for y-axis',
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/stackedarea_full/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/stackedarea_full/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/stackedarea_full/config.js
@@ -6,6 +6,12 @@
category : 'Area charts',
keywords : 'default small',
columns : {
+ x : {
+ title : 'Values for x-axis',
+ is_label : true,
+ is_auto : true,
+ is_unique : true
+ },
y : {
title : 'Values for y-axis',
is_numeric : true
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/nvd3/stackedarea_stream/config.js
--- a/config/plugins/visualizations/charts/static/charts/nvd3/stackedarea_stream/config.js
+++ b/config/plugins/visualizations/charts/static/charts/nvd3/stackedarea_stream/config.js
@@ -7,6 +7,12 @@
keywords : 'default small',
showmaxmin : true,
columns : {
+ x : {
+ title : 'Values for x-axis',
+ is_label : true,
+ is_auto : true,
+ is_unique : true
+ },
y : {
title : 'Values for y-axis',
is_numeric : true
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/tools.js
--- a/config/plugins/visualizations/charts/static/charts/tools.js
+++ b/config/plugins/visualizations/charts/static/charts/tools.js
@@ -81,15 +81,15 @@
return result;
};
-// series maker
-function makeSeries(groups, order) {
+// default series maker
+function makeSeries(groups, keys) {
// plot data
var plot_data = [];
// loop through data groups
- for (var key in groups) {
+ for (var group_index in groups) {
// get group
- var group = groups[key];
+ var group = groups[group_index];
// reset data
var data = [];
@@ -98,9 +98,9 @@
for (var value_index in group.values) {
// parse data
var point = [];
- if (order) {
- for (var order_index in order) {
- var column_index = order[order_index];
+ if (keys) {
+ for (var key_index in keys) {
+ var column_index = keys[key_index];
point.push(group.values[value_index][column_index]);
}
} else {
@@ -122,8 +122,50 @@
return plot_data;
};
-// category maker
-function makeCategories(chart, groups, with_index) {
+// default category maker
+function makeCategories(groups, with_index) {
+ // hashkeys, arrays and counter for labeled columns
+ var array = {};
+
+ // identify label columns
+ var chart_definition = groups[0];
+ for (var key in chart_definition.columns) {
+ var column_def = chart_definition.columns[key];
+ if (column_def.is_label) {
+ array[key] = [];
+ }
+ }
+
+ // collect string labels in array
+ if (groups && groups[0]) {
+ var group = groups[0];
+ for (var j in group.values) {
+ var value_dict = group.values[j];
+ for (var key in array) {
+ array[key].push (String(value_dict[key]));
+ }
+ }
+ }
+
+ // index all values contained in label columns (for all groups)
+ for (var i in groups) {
+ var group = groups[i];
+ for (var j in group.values) {
+ var value_dict = group.values[j];
+ for (var key in array) {
+ value_dict[key] = parseInt(j)
+ }
+ }
+ }
+
+ // return dictionary
+ return {
+ array : array
+ }
+};
+
+// category make for unique category labels
+function makeCategoriesUnique(groups, with_index) {
// hashkeys, arrays and counter for labeled columns
var categories = {};
var array = {};
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/charts/types.js
--- a/config/plugins/visualizations/charts/static/charts/types.js
+++ b/config/plugins/visualizations/charts/static/charts/types.js
@@ -56,7 +56,7 @@
'nvd3_histogram_discrete' : nvd3_histogram_discrete,
'jqplot_line' : jqplot_line,
'jqplot_scatter' : jqplot_scatter,
- //'jqplot_boxplot' : jqplot_boxplot
+ 'jqplot_boxplot' : jqplot_boxplot
}
});
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/plugins/jqplot/jquery.jqplot.css
--- a/config/plugins/visualizations/charts/static/plugins/jqplot/jquery.jqplot.css
+++ b/config/plugins/visualizations/charts/static/plugins/jqplot/jquery.jqplot.css
@@ -1,1 +1,261 @@
-.jqplot-target{position:relative;color:#666;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:1em}.jqplot-axis{font-size:.75em}.jqplot-xaxis{margin-top:10px}.jqplot-x2axis{margin-bottom:10px}.jqplot-yaxis{margin-right:10px}.jqplot-y2axis,.jqplot-y3axis,.jqplot-y4axis,.jqplot-y5axis,.jqplot-y6axis,.jqplot-y7axis,.jqplot-y8axis,.jqplot-y9axis,.jqplot-yMidAxis{margin-left:10px;margin-right:10px}.jqplot-axis-tick,.jqplot-xaxis-tick,.jqplot-yaxis-tick,.jqplot-x2axis-tick,.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick,.jqplot-yMidAxis-tick{position:absolute;white-space:pre}.jqplot-xaxis-tick{top:0;left:15px;vertical-align:top}.jqplot-x2axis-tick{bottom:0;left:15px;vertical-align:bottom}.jqplot-yaxis-tick{right:0;top:15px;text-align:right}.jqplot-yaxis-tick.jqplot-breakTick{right:-20px;margin-right:0;padding:1px 5px 1px 5px;z-index:2;font-size:1.5em}.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick{left:0;top:15px;text-align:left}.jqplot-yMidAxis-tick{text-align:center;white-space:nowrap}.jqplot-xaxis-label{margin-top:10px;font-size:11pt;position:absolute}.jqplot-x2axis-label{margin-bottom:10px;font-size:11pt;position:absolute}.jqplot-yaxis-label{margin-right:10px;font-size:11pt;position:absolute}.jqplot-yMidAxis-label{font-size:11pt;position:absolute}.jqplot-y2axis-label,.jqplot-y3axis-label,.jqplot-y4axis-label,.jqplot-y5axis-label,.jqplot-y6axis-label,.jqplot-y7axis-label,.jqplot-y8axis-label,.jqplot-y9axis-label{font-size:11pt;margin-left:10px;position:absolute}.jqplot-meterGauge-tick{font-size:.75em;color:#999}.jqplot-meterGauge-label{font-size:1em;color:#999}table.jqplot-table-legend{margin-top:12px;margin-bottom:12px;margin-left:12px;margin-right:12px}table.jqplot-table-legend,table.jqplot-cursor-legend{background-color:rgba(255,255,255,0.6);border:1px solid #ccc;position:absolute;font-size:.75em}td.jqplot-table-legend{vertical-align:middle}td.jqplot-seriesToggle:hover,td.jqplot-seriesToggle:active{cursor:pointer}.jqplot-table-legend .jqplot-series-hidden{text-decoration:line-through}div.jqplot-table-legend-swatch-outline{border:1px solid #ccc;padding:1px}div.jqplot-table-legend-swatch{width:0;height:0;border-top-width:5px;border-bottom-width:5px;border-left-width:6px;border-right-width:6px;border-top-style:solid;border-bottom-style:solid;border-left-style:solid;border-right-style:solid}.jqplot-title{top:0;left:0;padding-bottom:.5em;font-size:1.2em}table.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em}.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-highlighter-tooltip,.jqplot-canvasOverlay-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-point-label{font-size:.75em;z-index:2}td.jqplot-cursor-legend-swatch{vertical-align:middle;text-align:center}div.jqplot-cursor-legend-swatch{width:1.2em;height:.7em}.jqplot-error{text-align:center}.jqplot-error-message{position:relative;top:46%;display:inline-block}div.jqplot-bubble-label{font-size:.8em;padding-left:2px;padding-right:2px;color:rgb(20%,20%,20%)}div.jqplot-bubble-label.jqplot-bubble-label-highlight{background:rgba(90%,90%,90%,0.7)}div.jqplot-noData-container{text-align:center;background-color:rgba(96%,96%,96%,0.3)}
\ No newline at end of file
+/*rules for the plot target div. These will be cascaded down to all plot elements according to css rules*/
+.jqplot-target {
+ position: relative;
+ color: #666666;
+ font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+ font-size: 1em;
+/* height: 300px;
+ width: 400px;*/
+}
+
+/*rules applied to all axes*/
+.jqplot-axis {
+ font-size: 0.75em;
+}
+
+.jqplot-xaxis {
+ margin-top: 10px;
+}
+
+.jqplot-x2axis {
+ margin-bottom: 10px;
+}
+
+.jqplot-yaxis {
+ margin-right: 10px;
+}
+
+.jqplot-y2axis, .jqplot-y3axis, .jqplot-y4axis, .jqplot-y5axis, .jqplot-y6axis, .jqplot-y7axis, .jqplot-y8axis, .jqplot-y9axis, .jqplot-yMidAxis {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+/*rules applied to all axis tick divs*/
+.jqplot-axis-tick, .jqplot-xaxis-tick, .jqplot-yaxis-tick, .jqplot-x2axis-tick, .jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick, .jqplot-yMidAxis-tick {
+ position: absolute;
+ white-space: pre;
+}
+
+
+.jqplot-xaxis-tick {
+ top: 0px;
+ /* initial position untill tick is drawn in proper place */
+ left: 15px;
+/* padding-top: 10px;*/
+ vertical-align: top;
+}
+
+.jqplot-x2axis-tick {
+ bottom: 0px;
+ /* initial position untill tick is drawn in proper place */
+ left: 15px;
+/* padding-bottom: 10px;*/
+ vertical-align: bottom;
+}
+
+.jqplot-yaxis-tick {
+ right: 0px;
+ /* initial position untill tick is drawn in proper place */
+ top: 15px;
+/* padding-right: 10px;*/
+ text-align: right;
+}
+
+.jqplot-yaxis-tick.jqplot-breakTick {
+ right: -20px;
+ margin-right: 0px;
+ padding:1px 5px 1px 5px;
+/* background-color: white;*/
+ z-index: 2;
+ font-size: 1.5em;
+}
+
+.jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick {
+ left: 0px;
+ /* initial position untill tick is drawn in proper place */
+ top: 15px;
+/* padding-left: 10px;*/
+/* padding-right: 15px;*/
+ text-align: left;
+}
+
+.jqplot-yMidAxis-tick {
+ text-align: center;
+ white-space: nowrap;
+}
+
+.jqplot-xaxis-label {
+ margin-top: 10px;
+ font-size: 11pt;
+ position: absolute;
+}
+
+.jqplot-x2axis-label {
+ margin-bottom: 10px;
+ font-size: 11pt;
+ position: absolute;
+}
+
+.jqplot-yaxis-label {
+ margin-right: 10px;
+/* text-align: center;*/
+ font-size: 11pt;
+ position: absolute;
+}
+
+.jqplot-yMidAxis-label {
+ font-size: 11pt;
+ position: absolute;
+}
+
+.jqplot-y2axis-label, .jqplot-y3axis-label, .jqplot-y4axis-label, .jqplot-y5axis-label, .jqplot-y6axis-label, .jqplot-y7axis-label, .jqplot-y8axis-label, .jqplot-y9axis-label {
+/* text-align: center;*/
+ font-size: 11pt;
+ margin-left: 10px;
+ position: absolute;
+}
+
+.jqplot-meterGauge-tick {
+ font-size: 0.75em;
+ color: #999999;
+}
+
+.jqplot-meterGauge-label {
+ font-size: 1em;
+ color: #999999;
+}
+
+table.jqplot-table-legend {
+ margin-top: 12px;
+ margin-bottom: 12px;
+ margin-left: 12px;
+ margin-right: 12px;
+}
+
+table.jqplot-table-legend, table.jqplot-cursor-legend {
+ background-color: rgba(255,255,255,0.6);
+ border: 1px solid #cccccc;
+ position: absolute;
+ font-size: 0.75em;
+}
+
+td.jqplot-table-legend {
+ vertical-align:middle;
+}
+
+/*
+These rules could be used instead of assigning
+element styles and relying on js object properties.
+*/
+
+/*
+td.jqplot-table-legend-swatch {
+ padding-top: 0.5em;
+ text-align: center;
+}
+
+tr.jqplot-table-legend:first td.jqplot-table-legend-swatch {
+ padding-top: 0px;
+}
+*/
+
+td.jqplot-seriesToggle:hover, td.jqplot-seriesToggle:active {
+ cursor: pointer;
+}
+
+.jqplot-table-legend .jqplot-series-hidden {
+ text-decoration: line-through;
+}
+
+div.jqplot-table-legend-swatch-outline {
+ border: 1px solid #cccccc;
+ padding:1px;
+}
+
+div.jqplot-table-legend-swatch {
+ width:0px;
+ height:0px;
+ border-top-width: 5px;
+ border-bottom-width: 5px;
+ border-left-width: 6px;
+ border-right-width: 6px;
+ border-top-style: solid;
+ border-bottom-style: solid;
+ border-left-style: solid;
+ border-right-style: solid;
+}
+
+.jqplot-title {
+ top: 0px;
+ left: 0px;
+ padding-bottom: 0.5em;
+ font-size: 1.2em;
+}
+
+table.jqplot-cursor-tooltip {
+ border: 1px solid #cccccc;
+ font-size: 0.75em;
+}
+
+
+.jqplot-cursor-tooltip {
+ border: 1px solid #cccccc;
+ font-size: 0.75em;
+ white-space: nowrap;
+ background: rgba(208,208,208,0.5);
+ padding: 1px;
+}
+
+.jqplot-highlighter-tooltip, .jqplot-canvasOverlay-tooltip {
+ border: 1px solid #cccccc;
+ font-size: 1.2em;
+ font-weight: bold;
+ white-space: nowrap;
+ background: rgba(235,235,235,1);
+ padding: 1px;
+ border-radius: 5px;
+}
+
+.jqplot-point-label {
+ font-size: 0.75em;
+ z-index: 2;
+}
+
+td.jqplot-cursor-legend-swatch {
+ vertical-align: middle;
+ text-align: center;
+}
+
+div.jqplot-cursor-legend-swatch {
+ width: 1.2em;
+ height: 0.7em;
+}
+
+.jqplot-error {
+/* Styles added to the plot target container when there is an error go here.*/
+ text-align: center;
+}
+
+.jqplot-error-message {
+/* Styling of the custom error message div goes here.*/
+ position: relative;
+ top: 46%;
+ display: inline-block;
+}
+
+div.jqplot-bubble-label {
+ font-size: 0.8em;
+/* background: rgba(90%, 90%, 90%, 0.15);*/
+ padding-left: 2px;
+ padding-right: 2px;
+ color: rgb(20%, 20%, 20%);
+}
+
+div.jqplot-bubble-label.jqplot-bubble-label-highlight {
+ background: rgba(90%, 90%, 90%, 0.7);
+}
+
+div.jqplot-noData-container {
+ text-align: center;
+ background-color: rgba(96%, 96%, 96%, 0.3);
+}
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/views/editor.js
--- a/config/plugins/visualizations/charts/static/views/editor.js
+++ b/config/plugins/visualizations/charts/static/views/editor.js
@@ -266,7 +266,7 @@
_resetChart: function() {
// reset chart details
this.chart.set('id', Utils.uuid());
- this.chart.set('type', 'highcharts_bar');
+ this.chart.set('type', 'nvd3_bar');
this.chart.set('dataset_id', this.app.options.config.dataset_id);
this.chart.set('title', 'New Chart');
diff -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 -r 66cfcaf35801b8c80491743807ca4d491bfb42e6 config/plugins/visualizations/charts/static/views/group.js
--- a/config/plugins/visualizations/charts/static/views/group.js
+++ b/config/plugins/visualizations/charts/static/views/group.js
@@ -134,6 +134,7 @@
var is_label = column_definition.is_label;
var is_auto = column_definition.is_auto;
var is_numeric = column_definition.is_numeric;
+ var is_unique = column_definition.is_unique;
// configure columns
var columns = [];
@@ -184,11 +185,31 @@
// update model value
this.group.set(id, first);
}
- select.value(this.group.get(id));
+
+ // set initial value
+ if (is_unique) {
+ select.value(this.chart.groups.first().get(id));
+ } else {
+ select.value(this.group.get(id));
+ }
+
+ // link group with select field
+ this.group.on('change:' + id, function(){
+ select.value(self.group.get(id));
+ });
// link select field with group
select.setOnChange(function(value) {
- self.group.set(id, value);
+ // update model value
+ if (is_unique) {
+ // update all groups
+ self.chart.groups.each(function(group) {
+ group.set(id, value);
+ });
+ } else {
+ // only change this group
+ self.group.set(id, value);
+ }
self.chart.set('modified', true);
});
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Set tabular CHUNK_SIZE to ~10kb
by commits-noreply@bitbucket.org 10 Jun '14
by commits-noreply@bitbucket.org 10 Jun '14
10 Jun '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c52cb1f827d4/
Changeset: c52cb1f827d4
User: dannon
Date: 2014-06-11 01:24:00
Summary: Set tabular CHUNK_SIZE to ~10kb
Affected #: 1 file
diff -r e2b761a9b1d6d41db71b28df8b62862c7c300eba -r c52cb1f827d49f0f0ee2c1c97d3626dd1b2cc348 lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -25,7 +25,7 @@
# All tabular data is chunkable.
CHUNKABLE = True
- CHUNK_SIZE = 1000
+ CHUNK_SIZE = 10000
"""Add metadata elements"""
MetadataElement( name="comment_lines", default=0, desc="Number of comment lines", readonly=False, optional=True, no_value=0 )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f4238cf96afd/
Changeset: f4238cf96afd
User: dannon
Date: 2014-06-10 22:38:51
Summary: Prevent rendering of sometimes sometimes empty lines in tabular display.
Affected #: 1 file
diff -r 9a905e98e1550314cf821a99c2adc1b00a4eed83 -r f4238cf96afdc8bf649a660d91b10ecf3f785ef6 static/scripts/mvc/data.js
--- a/static/scripts/mvc/data.js
+++ b/static/scripts/mvc/data.js
@@ -253,7 +253,9 @@
_renderChunk: function(chunk) {
var data_table = this.$el.find('table');
_.each(chunk.ck_data.split('\n'), function(line, index) {
- data_table.append(this._renderRow(line));
+ if (line !== ''){
+ data_table.append(this._renderRow(line));
+ }
}, this);
}
});
https://bitbucket.org/galaxy/galaxy-central/commits/2e532a275285/
Changeset: 2e532a275285
User: dannon
Date: 2014-06-10 22:39:39
Summary: Pack scripts
Affected #: 1 file
diff -r f4238cf96afdc8bf649a660d91b10ecf3f785ef6 -r 2e532a2752859580c96b47f5fe0b86550846ec95 static/scripts/packed/mvc/data.js
--- a/static/scripts/packed/mvc/data.js
+++ b/static/scripts/packed/mvc/data.js
@@ -1,1 +1,1 @@
-define(["mvc/ui/ui-modal","mvc/ui/ui-frames"],function(j,i){var g=Backbone.Model.extend({});var b=Backbone.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this._set_metadata();this.on("change",this._set_metadata,this)},_set_metadata:function(){var m=new g();_.each(_.keys(this.attributes),function(n){if(n.indexOf("metadata_")===0){var o=n.split("metadata_")[1];m.set(o,this.attributes[n]);delete this.attributes[n]}},this);this.set("metadata",m,{silent:true})},get_metadata:function(m){return this.attributes.metadata.get(m)},urlRoot:galaxy_config.root+"api/datasets"});var h=b.extend({defaults:_.extend({},b.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(m){b.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0);this.attributes.chunk_url=galaxy_config.root+"dataset/display?dataset_id="+this.id;this.attributes.url_viz=galaxy_config.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof){return null}var m=this,n=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:m.attributes.chunk_index++}).success(function(o){var p;if(o.ck_data!==""){p=o}else{m.attributes.at_eof=true;p=null}n.resolve(p)});return n}});var e=Backbone.Collection.extend({model:b});var a=Backbone.View.extend({initialize:function(m){this.row_count=0;this.header_color="#AAA";this.dark_row_color="#DDD";new d({model:m.model,$el:this.$el})},render:function(){var s=$("<div/>").attr("id","loading_indicator");this.$el.append(s);var q=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(q);var m=this.model.get_metadata("column_names"),r=$("<tr/>").css("background-color",this.header_color).appendTo(q);if(m){r.append("<th>"+m.join("</th><th>")+"</th>")}var o=this,n=this.model.get("first_data_chunk");if(n){this._renderChunk(n)}else{$.when(o.model.get_next_chunk()).then(function(t){o._renderChunk(t)})}var p=false;this.scroll_elt.scroll(function(){if(!p&&o.scrolled_to_bottom()){p=true;s.show();$.when(o.model.get_next_chunk()).then(function(t){if(t){o._renderChunk(t);p=false}s.hide()})}})},scrolled_to_bottom:function(){return false},_renderCell:function(p,m,q){var n=$("<td>").text(p);var o=this.model.get_metadata("column_types");if(q!==undefined){n.attr("colspan",q).addClass("stringalign")}else{if(o){if(m<o.length){if(o[m]==="str"||o[m]==="list"){n.addClass("stringalign")}}}}return n},_renderRow:function(m){var n=m.split("\t"),p=$("<tr>"),o=this.model.get_metadata("columns");if(this.row_count%2!==0){p.css("background-color",this.dark_row_color)}if(n.length===o){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this)}else{if(n.length>o){_.each(n.slice(0,o-1),function(r,q){p.append(this._renderCell(r,q))},this);p.append(this._renderCell(n.slice(o-1).join("\t"),o-1))}else{if(o>5&&n.length===o-1){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this);p.append($("<td>"))}else{p.append(this._renderCell(m,0,o))}}}this.row_count++;return p},_renderChunk:function(m){var n=this.$el.find("table");_.each(m.ck_data.split("\n"),function(o,p){n.append(this._renderRow(o))},this)}});var f=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);scroll_elt=_.find(this.$el.parents(),function(n){return $(n).css("overflow")==="auto"});if(!scroll_elt){scroll_elt=window}this.scroll_elt=$(scroll_elt)},scrolled_to_bottom:function(){return(this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0)}});var l=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:this.options.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}});var d=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(o){var r=parent.Galaxy;if(r&&r.modal){this.modal=r.modal}if(r&&r.frame){this.frame=r.frame}if(!this.modal||!this.frame){return}var n=o.model;var q=n.get("metadata");if(!n.get("data_type")){return}this.data_type=n.get("data_type");if(this.data_type=="bed"){if(q.get("chromCol")&&q.get("startCol")&&q.get("endCol")){this.col.chrom=q.get("chromCol")-1;this.col.start=q.get("startCol")-1;this.col.end=q.get("endCol")-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.");return}}if(this.data_type=="vcf"){function p(t,u){for(var s=0;s<u.length;s++){if(u[s].match(t)){return s}}return -1}this.col.chrom=p("Chrom",q.get("column_names"));this.col.start=p("Pos",q.get("column_names"));this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.");return}}if(this.col.chrom===undefined){return}if(n.id){this.dataset_id=n.id}else{console.log("TabularButtonTrackster : Dataset identification is missing.");return}if(n.get("url_viz")){this.url_viz=n.get("url_viz")}else{console.log("TabularButtonTrackster : Url for visualization controller is missing.");return}if(n.get("genome_build")){this.genome_build=n.get("genome_build")}var m=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.setElement(o.$el);this.$el.append(m.render().$el);this.hide()},events:{"mouseover tr":"show",mouseleave:"hide"},show:function(r){function q(w){return !isNaN(parseFloat(w))&&isFinite(w)}if(this.col.chrom===null){return}var v=$(r.target).parent();var s=v.children().eq(this.col.chrom).html();var m=v.children().eq(this.col.start).html();var o=this.col.end?v.children().eq(this.col.end).html():m;if(!s.match("^#")&&s!==""&&q(m)){var u={dataset_id:this.dataset_id,gene_region:s+":"+m+"-"+o};var p=v.offset();var n=p.left-10;var t=p.top-$(window).scrollTop()+3;$("#btn_viz").css({position:"fixed",top:t+"px",left:n+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,u,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},hide:function(){this.$el.find("#btn_viz").hide()},create_trackster_action:function(m,p,o){var n=this;return function(){var q={};if(o){q["f-dbkey"]=o}$.ajax({url:m+"/list_tracks?"+$.param(q),dataType:"html",error:function(){n.modal.show({title:"Something went wrong!",body:"Unfortunately we could not add this dataset to the track browser. Please try again or contact us.",buttons:{Cancel:function(){n.modal.hide()}}})},success:function(r){n.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.modal.hide()},"View in saved visualization":function(){n.modal.show({title:"Add Data to Saved Visualization",body:r,buttons:{Cancel:function(){n.modal.hide()},"Add to visualization":function(){n.modal.hide();n.modal.$el.find("input[name=id]:checked").each(function(){var s=$(this).val();p.id=s;n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})})}}})},"View in new visualization":function(){n.modal.hide();n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})}}})}});return false}}});var k=function(p,n,q,m){var o=new n({model:new p(q)});o.render();if(m){m.append(o.$el)}return o};var c=function(o){if(!o.model){o.model=new h(o.dataset_config)}var n=o.parent_elt;var p=o.embedded;delete o.embedded;delete o.parent_elt;delete o.dataset_config;var m=(p?new l(o):new f(o));m.render();if(n){n.append(m.$el)}return m};return{Dataset:b,TabularDataset:h,DatasetCollection:e,TabularDatasetChunkedView:a,createTabularDatasetChunkedView:c}});
\ No newline at end of file
+define(["mvc/ui/ui-modal","mvc/ui/ui-frames"],function(j,i){var g=Backbone.Model.extend({});var b=Backbone.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this._set_metadata();this.on("change",this._set_metadata,this)},_set_metadata:function(){var m=new g();_.each(_.keys(this.attributes),function(n){if(n.indexOf("metadata_")===0){var o=n.split("metadata_")[1];m.set(o,this.attributes[n]);delete this.attributes[n]}},this);this.set("metadata",m,{silent:true})},get_metadata:function(m){return this.attributes.metadata.get(m)},urlRoot:galaxy_config.root+"api/datasets"});var h=b.extend({defaults:_.extend({},b.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(m){b.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0);this.attributes.chunk_url=galaxy_config.root+"dataset/display?dataset_id="+this.id;this.attributes.url_viz=galaxy_config.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof){return null}var m=this,n=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:m.attributes.chunk_index++}).success(function(o){var p;if(o.ck_data!==""){p=o}else{m.attributes.at_eof=true;p=null}n.resolve(p)});return n}});var e=Backbone.Collection.extend({model:b});var a=Backbone.View.extend({initialize:function(m){this.row_count=0;this.header_color="#AAA";this.dark_row_color="#DDD";new d({model:m.model,$el:this.$el})},render:function(){var s=$("<div/>").attr("id","loading_indicator");this.$el.append(s);var q=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(q);var m=this.model.get_metadata("column_names"),r=$("<tr/>").css("background-color",this.header_color).appendTo(q);if(m){r.append("<th>"+m.join("</th><th>")+"</th>")}var o=this,n=this.model.get("first_data_chunk");if(n){this._renderChunk(n)}else{$.when(o.model.get_next_chunk()).then(function(t){o._renderChunk(t)})}var p=false;this.scroll_elt.scroll(function(){if(!p&&o.scrolled_to_bottom()){p=true;s.show();$.when(o.model.get_next_chunk()).then(function(t){if(t){o._renderChunk(t);p=false}s.hide()})}})},scrolled_to_bottom:function(){return false},_renderCell:function(p,m,q){var n=$("<td>").text(p);var o=this.model.get_metadata("column_types");if(q!==undefined){n.attr("colspan",q).addClass("stringalign")}else{if(o){if(m<o.length){if(o[m]==="str"||o[m]==="list"){n.addClass("stringalign")}}}}return n},_renderRow:function(m){var n=m.split("\t"),p=$("<tr>"),o=this.model.get_metadata("columns");if(this.row_count%2!==0){p.css("background-color",this.dark_row_color)}if(n.length===o){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this)}else{if(n.length>o){_.each(n.slice(0,o-1),function(r,q){p.append(this._renderCell(r,q))},this);p.append(this._renderCell(n.slice(o-1).join("\t"),o-1))}else{if(o>5&&n.length===o-1){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this);p.append($("<td>"))}else{p.append(this._renderCell(m,0,o))}}}this.row_count++;return p},_renderChunk:function(m){var n=this.$el.find("table");_.each(m.ck_data.split("\n"),function(o,p){if(o!==""){n.append(this._renderRow(o))}},this)}});var f=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);scroll_elt=_.find(this.$el.parents(),function(n){return $(n).css("overflow")==="auto"});if(!scroll_elt){scroll_elt=window}this.scroll_elt=$(scroll_elt)},scrolled_to_bottom:function(){return(this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0)}});var l=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:this.options.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}});var d=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(o){var r=parent.Galaxy;if(r&&r.modal){this.modal=r.modal}if(r&&r.frame){this.frame=r.frame}if(!this.modal||!this.frame){return}var n=o.model;var q=n.get("metadata");if(!n.get("data_type")){return}this.data_type=n.get("data_type");if(this.data_type=="bed"){if(q.get("chromCol")&&q.get("startCol")&&q.get("endCol")){this.col.chrom=q.get("chromCol")-1;this.col.start=q.get("startCol")-1;this.col.end=q.get("endCol")-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.");return}}if(this.data_type=="vcf"){function p(t,u){for(var s=0;s<u.length;s++){if(u[s].match(t)){return s}}return -1}this.col.chrom=p("Chrom",q.get("column_names"));this.col.start=p("Pos",q.get("column_names"));this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.");return}}if(this.col.chrom===undefined){return}if(n.id){this.dataset_id=n.id}else{console.log("TabularButtonTrackster : Dataset identification is missing.");return}if(n.get("url_viz")){this.url_viz=n.get("url_viz")}else{console.log("TabularButtonTrackster : Url for visualization controller is missing.");return}if(n.get("genome_build")){this.genome_build=n.get("genome_build")}var m=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.setElement(o.$el);this.$el.append(m.render().$el);this.hide()},events:{"mouseover tr":"show",mouseleave:"hide"},show:function(r){function q(w){return !isNaN(parseFloat(w))&&isFinite(w)}if(this.col.chrom===null){return}var v=$(r.target).parent();var s=v.children().eq(this.col.chrom).html();var m=v.children().eq(this.col.start).html();var o=this.col.end?v.children().eq(this.col.end).html():m;if(!s.match("^#")&&s!==""&&q(m)){var u={dataset_id:this.dataset_id,gene_region:s+":"+m+"-"+o};var p=v.offset();var n=p.left-10;var t=p.top-$(window).scrollTop()+3;$("#btn_viz").css({position:"fixed",top:t+"px",left:n+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,u,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},hide:function(){this.$el.find("#btn_viz").hide()},create_trackster_action:function(m,p,o){var n=this;return function(){var q={};if(o){q["f-dbkey"]=o}$.ajax({url:m+"/list_tracks?"+$.param(q),dataType:"html",error:function(){n.modal.show({title:"Something went wrong!",body:"Unfortunately we could not add this dataset to the track browser. Please try again or contact us.",buttons:{Cancel:function(){n.modal.hide()}}})},success:function(r){n.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.modal.hide()},"View in saved visualization":function(){n.modal.show({title:"Add Data to Saved Visualization",body:r,buttons:{Cancel:function(){n.modal.hide()},"Add to visualization":function(){n.modal.hide();n.modal.$el.find("input[name=id]:checked").each(function(){var s=$(this).val();p.id=s;n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})})}}})},"View in new visualization":function(){n.modal.hide();n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})}}})}});return false}}});var k=function(p,n,q,m){var o=new n({model:new p(q)});o.render();if(m){m.append(o.$el)}return o};var c=function(o){if(!o.model){o.model=new h(o.dataset_config)}var n=o.parent_elt;var p=o.embedded;delete o.embedded;delete o.parent_elt;delete o.dataset_config;var m=(p?new l(o):new f(o));m.render();if(n){n.append(m.$el)}return m};return{Dataset:b,TabularDataset:h,DatasetCollection:e,TabularDatasetChunkedView:a,createTabularDatasetChunkedView:c}});
\ No newline at end of file
https://bitbucket.org/galaxy/galaxy-central/commits/a8c5c0241015/
Changeset: a8c5c0241015
User: dannon
Date: 2014-06-10 22:41:26
Summary: Tabular view -- automatically populate full height page. This handles situations like reported by pjacock where the scroll bars never appear for particularly 'wide' datasets.
Affected #: 1 file
diff -r 2e532a2752859580c96b47f5fe0b86550846ec95 -r a8c5c02410159295c94b602d44cae2d4549ec7c9 static/scripts/mvc/data.js
--- a/static/scripts/mvc/data.js
+++ b/static/scripts/mvc/data.js
@@ -122,6 +122,7 @@
initialize: function(options) {
// Row count for rendering.
this.row_count = 0;
+ this.loading_chunk = false;
// CSS colors used in table.
this.header_color = '#AAA';
@@ -134,10 +135,32 @@
});
},
+ expand_to_container: function(){
+ if (this.$el.height() < this.scroll_elt.height()){
+ this.attempt_to_fetch();
+ }
+ },
+
+ attempt_to_fetch: function( func ){
+ var self = this;
+ if ( !this.loading_chunk && this.scrolled_to_bottom() ) {
+ this.loading_chunk = true;
+ this.loading_indicator.show();
+ $.when(self.model.get_next_chunk()).then(function(result) {
+ if (result) {
+ self._renderChunk(result);
+ self.loading_chunk = false;
+ }
+ self.loading_indicator.hide();
+ self.expand_to_container();
+ });
+ }
+ },
+
render: function() {
// Add loading indicator.
- var loading_indicator = $('<div/>').attr('id', 'loading_indicator');
- this.$el.append(loading_indicator);
+ this.loading_indicator = $('<div/>').attr('id', 'loading_indicator');
+ this.$el.append(this.loading_indicator);
// Add data table and header.
var data_table = $('<table/>').attr({
@@ -167,23 +190,9 @@
// -- Show new chunks during scrolling. --
- // Flag to ensure that only one chunk is loaded at a time.
- var loading_chunk = false;
-
// Set up chunk loading when scrolling using the scrolling element.
- this.scroll_elt.scroll(function() {
- // If not already loading a chunk and have scrolled to the bottom of this element, get next chunk.
- if ( !loading_chunk && self.scrolled_to_bottom() ) {
- loading_chunk = true;
- loading_indicator.show();
- $.when(self.model.get_next_chunk()).then(function(result) {
- if (result) {
- self._renderChunk(result);
- loading_chunk = false;
- }
- loading_indicator.hide();
- });
- }
+ this.scroll_elt.scroll(function(){
+ self.attempt_to_fetch();
});
},
@@ -641,6 +650,10 @@
if (parent_elt) {
parent_elt.append(view.$el);
+ // If we're sticking this in another element, once it's appended check
+ // to make sure we've filled enough space.
+ // Without this, the scroll elements don't work.
+ view.expand_to_container();
}
return view;
https://bitbucket.org/galaxy/galaxy-central/commits/e2b761a9b1d6/
Changeset: e2b761a9b1d6
User: dannon
Date: 2014-06-10 22:41:53
Summary: Pack scripts.
Affected #: 2 files
diff -r a8c5c02410159295c94b602d44cae2d4549ec7c9 -r e2b761a9b1d6d41db71b28df8b62862c7c300eba lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -25,7 +25,7 @@
# All tabular data is chunkable.
CHUNKABLE = True
- CHUNK_SIZE = 50000
+ CHUNK_SIZE = 1000
"""Add metadata elements"""
MetadataElement( name="comment_lines", default=0, desc="Number of comment lines", readonly=False, optional=True, no_value=0 )
diff -r a8c5c02410159295c94b602d44cae2d4549ec7c9 -r e2b761a9b1d6d41db71b28df8b62862c7c300eba static/scripts/packed/mvc/data.js
--- a/static/scripts/packed/mvc/data.js
+++ b/static/scripts/packed/mvc/data.js
@@ -1,1 +1,1 @@
-define(["mvc/ui/ui-modal","mvc/ui/ui-frames"],function(j,i){var g=Backbone.Model.extend({});var b=Backbone.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this._set_metadata();this.on("change",this._set_metadata,this)},_set_metadata:function(){var m=new g();_.each(_.keys(this.attributes),function(n){if(n.indexOf("metadata_")===0){var o=n.split("metadata_")[1];m.set(o,this.attributes[n]);delete this.attributes[n]}},this);this.set("metadata",m,{silent:true})},get_metadata:function(m){return this.attributes.metadata.get(m)},urlRoot:galaxy_config.root+"api/datasets"});var h=b.extend({defaults:_.extend({},b.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(m){b.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0);this.attributes.chunk_url=galaxy_config.root+"dataset/display?dataset_id="+this.id;this.attributes.url_viz=galaxy_config.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof){return null}var m=this,n=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:m.attributes.chunk_index++}).success(function(o){var p;if(o.ck_data!==""){p=o}else{m.attributes.at_eof=true;p=null}n.resolve(p)});return n}});var e=Backbone.Collection.extend({model:b});var a=Backbone.View.extend({initialize:function(m){this.row_count=0;this.header_color="#AAA";this.dark_row_color="#DDD";new d({model:m.model,$el:this.$el})},render:function(){var s=$("<div/>").attr("id","loading_indicator");this.$el.append(s);var q=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(q);var m=this.model.get_metadata("column_names"),r=$("<tr/>").css("background-color",this.header_color).appendTo(q);if(m){r.append("<th>"+m.join("</th><th>")+"</th>")}var o=this,n=this.model.get("first_data_chunk");if(n){this._renderChunk(n)}else{$.when(o.model.get_next_chunk()).then(function(t){o._renderChunk(t)})}var p=false;this.scroll_elt.scroll(function(){if(!p&&o.scrolled_to_bottom()){p=true;s.show();$.when(o.model.get_next_chunk()).then(function(t){if(t){o._renderChunk(t);p=false}s.hide()})}})},scrolled_to_bottom:function(){return false},_renderCell:function(p,m,q){var n=$("<td>").text(p);var o=this.model.get_metadata("column_types");if(q!==undefined){n.attr("colspan",q).addClass("stringalign")}else{if(o){if(m<o.length){if(o[m]==="str"||o[m]==="list"){n.addClass("stringalign")}}}}return n},_renderRow:function(m){var n=m.split("\t"),p=$("<tr>"),o=this.model.get_metadata("columns");if(this.row_count%2!==0){p.css("background-color",this.dark_row_color)}if(n.length===o){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this)}else{if(n.length>o){_.each(n.slice(0,o-1),function(r,q){p.append(this._renderCell(r,q))},this);p.append(this._renderCell(n.slice(o-1).join("\t"),o-1))}else{if(o>5&&n.length===o-1){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this);p.append($("<td>"))}else{p.append(this._renderCell(m,0,o))}}}this.row_count++;return p},_renderChunk:function(m){var n=this.$el.find("table");_.each(m.ck_data.split("\n"),function(o,p){if(o!==""){n.append(this._renderRow(o))}},this)}});var f=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);scroll_elt=_.find(this.$el.parents(),function(n){return $(n).css("overflow")==="auto"});if(!scroll_elt){scroll_elt=window}this.scroll_elt=$(scroll_elt)},scrolled_to_bottom:function(){return(this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0)}});var l=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:this.options.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}});var d=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(o){var r=parent.Galaxy;if(r&&r.modal){this.modal=r.modal}if(r&&r.frame){this.frame=r.frame}if(!this.modal||!this.frame){return}var n=o.model;var q=n.get("metadata");if(!n.get("data_type")){return}this.data_type=n.get("data_type");if(this.data_type=="bed"){if(q.get("chromCol")&&q.get("startCol")&&q.get("endCol")){this.col.chrom=q.get("chromCol")-1;this.col.start=q.get("startCol")-1;this.col.end=q.get("endCol")-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.");return}}if(this.data_type=="vcf"){function p(t,u){for(var s=0;s<u.length;s++){if(u[s].match(t)){return s}}return -1}this.col.chrom=p("Chrom",q.get("column_names"));this.col.start=p("Pos",q.get("column_names"));this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.");return}}if(this.col.chrom===undefined){return}if(n.id){this.dataset_id=n.id}else{console.log("TabularButtonTrackster : Dataset identification is missing.");return}if(n.get("url_viz")){this.url_viz=n.get("url_viz")}else{console.log("TabularButtonTrackster : Url for visualization controller is missing.");return}if(n.get("genome_build")){this.genome_build=n.get("genome_build")}var m=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.setElement(o.$el);this.$el.append(m.render().$el);this.hide()},events:{"mouseover tr":"show",mouseleave:"hide"},show:function(r){function q(w){return !isNaN(parseFloat(w))&&isFinite(w)}if(this.col.chrom===null){return}var v=$(r.target).parent();var s=v.children().eq(this.col.chrom).html();var m=v.children().eq(this.col.start).html();var o=this.col.end?v.children().eq(this.col.end).html():m;if(!s.match("^#")&&s!==""&&q(m)){var u={dataset_id:this.dataset_id,gene_region:s+":"+m+"-"+o};var p=v.offset();var n=p.left-10;var t=p.top-$(window).scrollTop()+3;$("#btn_viz").css({position:"fixed",top:t+"px",left:n+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,u,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},hide:function(){this.$el.find("#btn_viz").hide()},create_trackster_action:function(m,p,o){var n=this;return function(){var q={};if(o){q["f-dbkey"]=o}$.ajax({url:m+"/list_tracks?"+$.param(q),dataType:"html",error:function(){n.modal.show({title:"Something went wrong!",body:"Unfortunately we could not add this dataset to the track browser. Please try again or contact us.",buttons:{Cancel:function(){n.modal.hide()}}})},success:function(r){n.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.modal.hide()},"View in saved visualization":function(){n.modal.show({title:"Add Data to Saved Visualization",body:r,buttons:{Cancel:function(){n.modal.hide()},"Add to visualization":function(){n.modal.hide();n.modal.$el.find("input[name=id]:checked").each(function(){var s=$(this).val();p.id=s;n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})})}}})},"View in new visualization":function(){n.modal.hide();n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})}}})}});return false}}});var k=function(p,n,q,m){var o=new n({model:new p(q)});o.render();if(m){m.append(o.$el)}return o};var c=function(o){if(!o.model){o.model=new h(o.dataset_config)}var n=o.parent_elt;var p=o.embedded;delete o.embedded;delete o.parent_elt;delete o.dataset_config;var m=(p?new l(o):new f(o));m.render();if(n){n.append(m.$el)}return m};return{Dataset:b,TabularDataset:h,DatasetCollection:e,TabularDatasetChunkedView:a,createTabularDatasetChunkedView:c}});
\ No newline at end of file
+define(["mvc/ui/ui-modal","mvc/ui/ui-frames"],function(j,i){var g=Backbone.Model.extend({});var b=Backbone.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this._set_metadata();this.on("change",this._set_metadata,this)},_set_metadata:function(){var m=new g();_.each(_.keys(this.attributes),function(n){if(n.indexOf("metadata_")===0){var o=n.split("metadata_")[1];m.set(o,this.attributes[n]);delete this.attributes[n]}},this);this.set("metadata",m,{silent:true})},get_metadata:function(m){return this.attributes.metadata.get(m)},urlRoot:galaxy_config.root+"api/datasets"});var h=b.extend({defaults:_.extend({},b.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(m){b.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0);this.attributes.chunk_url=galaxy_config.root+"dataset/display?dataset_id="+this.id;this.attributes.url_viz=galaxy_config.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof){return null}var m=this,n=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:m.attributes.chunk_index++}).success(function(o){var p;if(o.ck_data!==""){p=o}else{m.attributes.at_eof=true;p=null}n.resolve(p)});return n}});var e=Backbone.Collection.extend({model:b});var a=Backbone.View.extend({initialize:function(m){this.row_count=0;this.loading_chunk=false;this.header_color="#AAA";this.dark_row_color="#DDD";new d({model:m.model,$el:this.$el})},expand_to_container:function(){if(this.$el.height()<this.scroll_elt.height()){this.attempt_to_fetch()}},attempt_to_fetch:function(n){var m=this;if(!this.loading_chunk&&this.scrolled_to_bottom()){this.loading_chunk=true;this.loading_indicator.show();$.when(m.model.get_next_chunk()).then(function(o){if(o){m._renderChunk(o);m.loading_chunk=false}m.loading_indicator.hide();m.expand_to_container()})}},render:function(){this.loading_indicator=$("<div/>").attr("id","loading_indicator");this.$el.append(this.loading_indicator);var p=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(p);var m=this.model.get_metadata("column_names"),q=$("<tr/>").css("background-color",this.header_color).appendTo(p);if(m){q.append("<th>"+m.join("</th><th>")+"</th>")}var o=this,n=this.model.get("first_data_chunk");if(n){this._renderChunk(n)}else{$.when(o.model.get_next_chunk()).then(function(r){o._renderChunk(r)})}this.scroll_elt.scroll(function(){o.attempt_to_fetch()})},scrolled_to_bottom:function(){return false},_renderCell:function(p,m,q){var n=$("<td>").text(p);var o=this.model.get_metadata("column_types");if(q!==undefined){n.attr("colspan",q).addClass("stringalign")}else{if(o){if(m<o.length){if(o[m]==="str"||o[m]==="list"){n.addClass("stringalign")}}}}return n},_renderRow:function(m){var n=m.split("\t"),p=$("<tr>"),o=this.model.get_metadata("columns");if(this.row_count%2!==0){p.css("background-color",this.dark_row_color)}if(n.length===o){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this)}else{if(n.length>o){_.each(n.slice(0,o-1),function(r,q){p.append(this._renderCell(r,q))},this);p.append(this._renderCell(n.slice(o-1).join("\t"),o-1))}else{if(o>5&&n.length===o-1){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this);p.append($("<td>"))}else{p.append(this._renderCell(m,0,o))}}}this.row_count++;return p},_renderChunk:function(m){var n=this.$el.find("table");_.each(m.ck_data.split("\n"),function(o,p){if(o!==""){n.append(this._renderRow(o))}},this)}});var f=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);scroll_elt=_.find(this.$el.parents(),function(n){return $(n).css("overflow")==="auto"});if(!scroll_elt){scroll_elt=window}this.scroll_elt=$(scroll_elt)},scrolled_to_bottom:function(){return(this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0)}});var l=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:this.options.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}});var d=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(o){var r=parent.Galaxy;if(r&&r.modal){this.modal=r.modal}if(r&&r.frame){this.frame=r.frame}if(!this.modal||!this.frame){return}var n=o.model;var q=n.get("metadata");if(!n.get("data_type")){return}this.data_type=n.get("data_type");if(this.data_type=="bed"){if(q.get("chromCol")&&q.get("startCol")&&q.get("endCol")){this.col.chrom=q.get("chromCol")-1;this.col.start=q.get("startCol")-1;this.col.end=q.get("endCol")-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.");return}}if(this.data_type=="vcf"){function p(t,u){for(var s=0;s<u.length;s++){if(u[s].match(t)){return s}}return -1}this.col.chrom=p("Chrom",q.get("column_names"));this.col.start=p("Pos",q.get("column_names"));this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.");return}}if(this.col.chrom===undefined){return}if(n.id){this.dataset_id=n.id}else{console.log("TabularButtonTrackster : Dataset identification is missing.");return}if(n.get("url_viz")){this.url_viz=n.get("url_viz")}else{console.log("TabularButtonTrackster : Url for visualization controller is missing.");return}if(n.get("genome_build")){this.genome_build=n.get("genome_build")}var m=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.setElement(o.$el);this.$el.append(m.render().$el);this.hide()},events:{"mouseover tr":"show",mouseleave:"hide"},show:function(r){function q(w){return !isNaN(parseFloat(w))&&isFinite(w)}if(this.col.chrom===null){return}var v=$(r.target).parent();var s=v.children().eq(this.col.chrom).html();var m=v.children().eq(this.col.start).html();var o=this.col.end?v.children().eq(this.col.end).html():m;if(!s.match("^#")&&s!==""&&q(m)){var u={dataset_id:this.dataset_id,gene_region:s+":"+m+"-"+o};var p=v.offset();var n=p.left-10;var t=p.top-$(window).scrollTop()+3;$("#btn_viz").css({position:"fixed",top:t+"px",left:n+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,u,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},hide:function(){this.$el.find("#btn_viz").hide()},create_trackster_action:function(m,p,o){var n=this;return function(){var q={};if(o){q["f-dbkey"]=o}$.ajax({url:m+"/list_tracks?"+$.param(q),dataType:"html",error:function(){n.modal.show({title:"Something went wrong!",body:"Unfortunately we could not add this dataset to the track browser. Please try again or contact us.",buttons:{Cancel:function(){n.modal.hide()}}})},success:function(r){n.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.modal.hide()},"View in saved visualization":function(){n.modal.show({title:"Add Data to Saved Visualization",body:r,buttons:{Cancel:function(){n.modal.hide()},"Add to visualization":function(){n.modal.hide();n.modal.$el.find("input[name=id]:checked").each(function(){var s=$(this).val();p.id=s;n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})})}}})},"View in new visualization":function(){n.modal.hide();n.frame.add({title:"Trackster",type:"url",content:m+"/trackster?"+$.param(p)})}}})}});return false}}});var k=function(p,n,q,m){var o=new n({model:new p(q)});o.render();if(m){m.append(o.$el)}return o};var c=function(o){if(!o.model){o.model=new h(o.dataset_config)}var n=o.parent_elt;var p=o.embedded;delete o.embedded;delete o.parent_elt;delete o.dataset_config;var m=(p?new l(o):new f(o));m.render();if(n){n.append(m.$el);m.expand_to_container()}return m};return{Dataset:b,TabularDataset:h,DatasetCollection:e,TabularDatasetChunkedView:a,createTabularDatasetChunkedView:c}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/9304293c4eb1/
Changeset: 9304293c4eb1
User: jmchilton
Date: 2014-06-10 22:01:38
Summary: Add utility for debugging sqlalchemy queries in db_shell.py.
Should aid in interactively building up queries.
Affected #: 1 file
diff -r 24c5a89db2634fcd5339205164f64e3d7a396003 -r 9304293c4eb1af6b0682dc479923adea5180145f scripts/db_shell.py
--- a/scripts/db_shell.py
+++ b/scripts/db_shell.py
@@ -36,3 +36,72 @@
from galaxy.model.mapping import init
sa_session = init( '/tmp/', db_url ).context
from galaxy.model import *
+
+# Helper function for debugging sqlalchemy queries...
+# http://stackoverflow.com/questions/5631078/sqlalchemy-print-the-actual-query
+import decimal
+import datetime
+
+
+def printquery(statement, bind=None):
+ """
+ print a query, with values filled in
+ for debugging purposes *only*
+ for security, you should always separate queries from their values
+ please also note that this function is quite slow
+ """
+ import sqlalchemy.orm
+ if isinstance(statement, sqlalchemy.orm.Query):
+ if bind is None:
+ bind = statement.session.get_bind(
+ statement._mapper_zero_or_none()
+ )
+ statement = statement.statement
+ elif bind is None:
+ bind = statement.bind
+
+ dialect = bind.dialect
+ compiler = statement._compiler(dialect)
+
+ class LiteralCompiler(compiler.__class__):
+ def visit_bindparam(
+ self, bindparam, within_columns_clause=False,
+ literal_binds=False, **kwargs
+ ):
+ return super(LiteralCompiler, self).render_literal_bindparam(
+ bindparam,
+ within_columns_clause=within_columns_clause,
+ literal_binds=literal_binds,
+ **kwargs
+ )
+
+ def render_literal_value(self, value, type_):
+ """Render the value of a bind parameter as a quoted literal.
+
+ This is used for statement sections that do not accept bind paramters
+ on the target driver/database.
+
+ This should be implemented by subclasses using the quoting services
+ of the DBAPI.
+
+ """
+ if isinstance(value, basestring):
+ value = value.replace("'", "''")
+ return "'%s'" % value
+ elif value is None:
+ return "NULL"
+ elif isinstance(value, (float, int, long)):
+ return repr(value)
+ elif isinstance(value, decimal.Decimal):
+ return str(value)
+ elif isinstance(value, datetime.datetime):
+ return "TO_DATE('%s','YYYY-MM-DD HH24:MI:SS')" % value.strftime("%Y-%m-%d %H:%M:%S")
+
+ else:
+ raise NotImplementedError(
+ "Don't know how to literal-quote value %r" % value
+ )
+
+ compiler = LiteralCompiler(dialect, statement)
+ print compiler.process(statement)
+
https://bitbucket.org/galaxy/galaxy-central/commits/9a905e98e155/
Changeset: 9a905e98e155
User: jmchilton
Date: 2014-06-10 22:01:38
Summary: Allow injection of high-level helper utility into dynamic destination rules.
Helper currently has methods methods for determining users recent usage - job count and sum of job runtime - filterable by user_email, job creation and update time, destination id, job states (only 'ok' job state would make sense for runtime - only way Galaxy has that data). Goal here is to allow dynamic destination to assign higher priorities to users who have not used Galaxy recently.
Example usage here : https://gist.github.com/jmchilton/a1b4f0bd3ce7189c0caf.
Affected #: 2 files
diff -r 9304293c4eb1af6b0682dc479923adea5180145f -r 9a905e98e1550314cf821a99c2adc1b00a4eed83 lib/galaxy/jobs/mapper.py
--- a/lib/galaxy/jobs/mapper.py
+++ b/lib/galaxy/jobs/mapper.py
@@ -5,6 +5,7 @@
log = logging.getLogger( __name__ )
import galaxy.jobs.rules
+from .rule_helper import RuleHelper
DYNAMIC_RUNNER_NAME = "dynamic"
DYNAMIC_DESTINATION_ID = "dynamic_legacy_from_url"
@@ -56,12 +57,13 @@
def __invoke_expand_function( self, expand_function ):
function_arg_names = inspect.getargspec( expand_function ).args
-
+ app = self.job_wrapper.app
possible_args = { "job_id" : self.job_wrapper.job_id,
"tool" : self.job_wrapper.tool,
"tool_id" : self.job_wrapper.tool.id,
"job_wrapper" : self.job_wrapper,
- "app" : self.job_wrapper.app }
+ "rule_helper": RuleHelper( app ),
+ "app" : app }
actual_args = {}
diff -r 9304293c4eb1af6b0682dc479923adea5180145f -r 9a905e98e1550314cf821a99c2adc1b00a4eed83 lib/galaxy/jobs/rule_helper.py
--- /dev/null
+++ b/lib/galaxy/jobs/rule_helper.py
@@ -0,0 +1,87 @@
+from datetime import datetime
+
+from sqlalchemy import (
+ and_,
+ func
+)
+
+from galaxy import model
+
+import logging
+log = logging.getLogger( __name__ )
+
+
+class RuleHelper( object ):
+ """ Utillity to allow job rules to interface cleanly with the rest of
+ Galaxy and shield them from low-level details of models, metrics, etc....
+
+ Currently focus is on figuring out job statistics for a given user, but
+ could interface with other stuff as well.
+ """
+
+ def __init__( self, app ):
+ self.app = app
+
+ def job_count(
+ self,
+ **kwds
+ ):
+ query = self.query( model.Job )
+ return self._filter_job_query( query, **kwds ).count()
+
+ def sum_job_runtime(
+ self,
+ **kwds
+ ):
+ # TODO: Consider sum_core_hours or something that scales runtime by
+ # by calculated cores per job.
+ query = self.metric_query(
+ select=func.sum( model.JobMetricNumeric.table.c.metric_value ),
+ metric_name="runtime_seconds",
+ plugin="core",
+ )
+ query = query.join( model.Job )
+ return float( self._filter_job_query( query, **kwds ).first()[ 0 ] )
+
+ def metric_query( self, select, metric_name, plugin, numeric=True ):
+ metric_class = model.JobMetricNumeric if numeric else model.JobMetricText
+ query = self.query( select )
+ query = query.filter( metric_class.table.c.plugin == plugin )
+ query = query.filter( metric_class.table.c.metric_name == metric_name )
+ return query
+
+ def query( self, select_expression ):
+ return self.app.model.context.query( select_expression )
+
+ def _filter_job_query(
+ self,
+ query,
+ for_user_email=None,
+ for_destination=None,
+ for_job_states=None,
+ created_in_last=None,
+ updated_in_last=None,
+ ):
+ query = query.join( model.User )
+ if for_user_email is not None:
+ query = query.filter( model.User.table.c.email == for_user_email )
+
+ if for_destination is not None:
+ query = query.filter( model.Job.table.c.destination_id == for_destination )
+
+ if created_in_last is not None:
+ end_date = datetime.now()
+ start_date = end_date - created_in_last
+ query = query.filter( model.Job.table.c.create_time >= start_date )
+
+ if updated_in_last is not None:
+ end_date = datetime.now()
+ start_date = end_date - updated_in_last
+ log.info( end_date )
+ log.info( start_date )
+ query = query.filter( model.Job.table.c.update_time >= start_date )
+
+ if for_job_states is not None:
+ query = query.filter( model.Job.table.c.state.in_( for_job_states ) )
+
+ return query
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: davebgx: Additional fixes for urllib2's 3xx redirects not handling POST requests. This changeset handles httpd proxies that redirect to a secure port before delivering the request to Paste.
by commits-noreply@bitbucket.org 10 Jun '14
by commits-noreply@bitbucket.org 10 Jun '14
10 Jun '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/24c5a89db263/
Changeset: 24c5a89db263
User: davebgx
Date: 2014-06-10 17:11:32
Summary: Additional fixes for urllib2's 3xx redirects not handling POST requests. This changeset handles httpd proxies that redirect to a secure port before delivering the request to Paste.
Affected #: 1 file
diff -r 47e32138de3d0a9debf25cb6b59c967b647af84e -r 24c5a89db2634fcd5339205164f64e3d7a396003 lib/tool_shed/scripts/api/common.py
--- a/lib/tool_shed/scripts/api/common.py
+++ b/lib/tool_shed/scripts/api/common.py
@@ -11,13 +11,25 @@
from tool_shed.util import common_util
from tool_shed.util import hg_util
+
+class HTTPRedirectWithDataHandler( urllib2.HTTPRedirectHandler ):
+
+ def redirect_request( self, request, fp, code, msg, headers, newurl ):
+ request_method = request.get_method()
+ if ( code in ( 301, 302, 303, 307 ) and request_method in ( "GET", "HEAD", "POST", "PUT", "DELETE" ) ):
+ newurl = newurl.replace( ' ', '%20' )
+ return urllib2.Request( newurl,
+ data=request.data,
+ headers=request.headers,
+ origin_req_host=request.get_origin_req_host(),
+ unverifiable=True )
+ else:
+ urllib2.HTTPRedirectHandler.redirect_request( request, fp, code, msg, headers, newurl )
+
def build_request_with_data( url, data, api_key, method ):
"""Build a request with the received method."""
- protocol = common_util.get_protocol_from_tool_shed_url( url )
- if protocol == 'http':
- opener = urllib2.build_opener( urllib2.HTTPHandler )
- elif protocol == 'https':
- opener = urllib2.build_opener( urllib2.HTTPSHandler )
+ opener = urllib2.build_opener( HTTPRedirectWithDataHandler )
+ urllib2.install_opener( opener )
url = make_url( url, api_key=api_key, args=None )
request = urllib2.Request( url, headers={ 'Content-Type': 'application/json' }, data=json.dumps( data ) )
request_method = request.get_method()
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0