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
September 2012
- 1 participants
- 161 discussions
commit/galaxy-central: jgoecks: Enhancements for finding available visualizations: (a) use dataset rather than datatype and (b) only show scatterplot for tabular datasets with >=2 numerical columns.
by Bitbucket 18 Sep '12
by Bitbucket 18 Sep '12
18 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/aa0469dd0078/
changeset: aa0469dd0078
user: jgoecks
date: 2012-09-18 19:10:04
summary: Enhancements for finding available visualizations: (a) use dataset rather than datatype and (b) only show scatterplot for tabular datasets with >=2 numerical columns.
affected #: 4 files
diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -545,7 +545,7 @@
raise Exception('Result %s from %s' % (result, cmd))
merge = staticmethod(merge)
- def get_visualizations( self ):
+ def get_visualizations( self, dataset ):
"""
Returns a list of visualizations for datatype.
"""
diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -301,11 +301,25 @@
def as_ucsc_display_file( self, dataset, **kwd ):
return open( dataset.file_name )
- def get_visualizations( self ):
+ def get_visualizations( self, dataset ):
"""
Returns a list of visualizations for datatype.
"""
- return super( Tabular, self ).get_visualizations() + [ 'scatterplot' ]
+
+ # Can visualize tabular data as scatterplot if there are 2+ numerical
+ # columns.
+ num_numerical_cols = 0
+ for col_type in dataset.metadata.column_types:
+ if col_type in [ 'int', 'float' ]:
+ num_numerical_cols += 1
+
+ print dataset.name, num_numerical_cols
+
+ vizs = super( Tabular, self ).get_visualizations( dataset )
+ if num_numerical_cols >= 2:
+ vizs.append( 'scatterplot' )
+
+ return vizs
class Taxonomy( Tabular ):
def __init__(self, **kwd):
diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1245,6 +1245,9 @@
def get_display_applications( self, trans ):
return self.datatype.get_display_applications_by_dataset( self, trans )
+ def get_visualizations( self ):
+ return self.datatype.get_visualizations( self )
+
class HistoryDatasetAssociation( DatasetInstance ):
def __init__( self,
hid = None,
diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be templates/root/history_common.mako
--- a/templates/root/history_common.mako
+++ b/templates/root/history_common.mako
@@ -229,7 +229,7 @@
## Visualization icon + visualizations. Using anchor attributes is a HACK to encode needed
## information--URL base, dataset id, dbkey, visualizations--in anchor.
<%
- visualizations = data.datatype.get_visualizations()
+ visualizations = data.get_visualizations()
## HACK: if there are visualizations, only provide trackster for now since others
## are not ready.
if visualizations:
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: carlfeberhard: fix to apply tooltips to running/queued datasets in history panel
by Bitbucket 18 Sep '12
by Bitbucket 18 Sep '12
18 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/5cdb0038c89d/
changeset: 5cdb0038c89d
user: carlfeberhard
date: 2012-09-18 18:39:13
summary: fix to apply tooltips to running/queued datasets in history panel
affected #: 1 file
diff -r 069768b7833ebae78f1c7c7aa97904627540ac3a -r 5cdb0038c89d1396755b2c7e371bde63b221b8df templates/root/history.mako
--- a/templates/root/history.mako
+++ b/templates/root/history.mako
@@ -116,6 +116,43 @@
});
};
+// -----------------------------------------------------------------------------
+function applyTooltip( elem ){
+ // apply twitter bootstrap tooltip to elem
+
+ //!! 2 line tooltips placed above do not render properly
+ //TODO: hack (github has an issue on this - see how it's resolved)
+ var $this = $( elem );
+ if( $this.hasClass( 'tooltip' ) ){
+
+ // remove original tooltip
+ if( $this.attr( 'data-original-title' ) ){
+ // documented method - that doesn't seem to work
+ //$( this ).tooltip( 'destroy' );
+ $this.data( 'tooltip', false );
+
+ // swap title back
+ var title = $this.attr( 'data-original-title' );
+ $this.attr( 'data-original-title', null );
+ $this.attr( 'title', title );
+ }
+
+ // (re-)apply tooltip
+ // place them on the bottom for now
+ $this.tooltip({ placement : 'bottom' });
+ }
+ return this;
+}
+
+function applyTooltips( elem ){
+ // apply twitter bootstrap tooltips to this element and all children
+ $( $( elem ).find( '.tooltip' ).andSelf() ).each( function(){
+ applyTooltip( this );
+ });
+ return this;
+}
+
+// -----------------------------------------------------------------------------
// Create trackster action function.
function create_trackster_action_fn(vis_url, dataset_params, dbkey) {
return function() {
@@ -327,24 +364,7 @@
tag_handling(this);
annotation_handling(this);
-
- //TODO: hack (github has an issue on this - see how it's resolved)
- // fix for two line bootstrap tooltips when placement: above
- $( this ).find( '.tooltip' ).each( function(){
- var $this = $( this );
-
- // documented method - that doesn't seem to work
- //$( this ).tooltip( 'destroy' );
-
- $this.data( 'tooltip', false );
- var title = $this.attr( 'data-original-title' );
- $this.attr( 'data-original-title', null );
- $this.attr( 'title', title );
-
- // place them on the bottom for now
- $this.tooltip({ placement : 'bottom' });
- });
-
+ applyTooltips( this );
});
_.each( $(".visualize-icon"), function(icon) {
@@ -469,8 +489,12 @@
var container = $("#historyItemContainer-" + id);
container.html( val.html );
init_history_items( $("div.historyItemWrapper"), "noinit" );
+
+ // apply ui element behaviors
tag_handling(container);
annotation_handling(container);
+ applyTooltips( container );
+
var viz_icon = container.find(".visualize-icon")[0];
if (viz_icon) { init_viz_icon(viz_icon); }
@@ -674,4 +698,4 @@
</div></body>
-</html>
+</html>
\ 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
18 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/069768b7833e/
changeset: 069768b7833e
user: natefoo
date: 2012-09-18 18:13:02
summary: Add $__user_name__ to job template.
affected #: 1 file
diff -r 32091cc60876e9720f2ae2b855e9e7f43e8c775a -r 069768b7833ebae78f1c7c7aa97904627540ac3a lib/galaxy/jobs/__init__.py
--- a/lib/galaxy/jobs/__init__.py
+++ b/lib/galaxy/jobs/__init__.py
@@ -155,15 +155,18 @@
if special:
out_data[ "output_file" ] = FakeDatasetAssociation( dataset=special.dataset )
- # These can be passed on the command line if wanted as $userId $userEmail
- if job.history and job.history.user: # check for anonymous user!
- userId = '%d' % job.history.user.id
- userEmail = str(job.history.user.email)
+ # These can be passed on the command line if wanted as $__user_*__
+ if job.history and job.history.user:
+ user_id = '%d' % job.history.user.id
+ user_email = str(job.history.user.email)
+ user_name = str(job.history.user.username)
else:
- userId = 'Anonymous'
- userEmail = 'Anonymous'
- incoming['__user_id__'] = incoming['userId'] = userId
- incoming['__user_email__'] = incoming['userEmail'] = userEmail
+ user_id = 'Anonymous'
+ user_email = 'Anonymous'
+ user_name = 'Anonymous'
+ incoming['__user_id__'] = incoming['userId'] = user_id
+ incoming['__user_email__'] = incoming['userEmail'] = user_email
+ incoming['__user_name__'] = user_name
# Build params, done before hook so hook can use
param_dict = self.tool.build_param_dict( incoming, inp_data, out_data, self.get_output_fnames(), self.working_directory )
# Certain tools require tasks to be completed prior to job execution
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: jgoecks: Viz framework: (a) add generic method to datatypes to get available visualizations and (b) attach available visualizations to dataset visualization icon.
by Bitbucket 18 Sep '12
by Bitbucket 18 Sep '12
18 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/32091cc60876/
changeset: 32091cc60876
user: jgoecks
date: 2012-09-18 17:40:57
summary: Viz framework: (a) add generic method to datatypes to get available visualizations and (b) attach available visualizations to dataset visualization icon.
affected #: 5 files
diff -r 5359d1066d91849fbf075f95f4999613d17a9c45 -r 32091cc60876e9720f2ae2b855e9e7f43e8c775a lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -545,6 +545,15 @@
raise Exception('Result %s from %s' % (result, cmd))
merge = staticmethod(merge)
+ def get_visualizations( self ):
+ """
+ Returns a list of visualizations for datatype.
+ """
+
+ if hasattr( self, 'get_track_type' ):
+ return [ 'trackster', 'circster' ]
+ return []
+
class Text( Data ):
file_ext = 'txt'
line_class = 'line'
diff -r 5359d1066d91849fbf075f95f4999613d17a9c45 -r 32091cc60876e9720f2ae2b855e9e7f43e8c775a lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -301,6 +301,12 @@
def as_ucsc_display_file( self, dataset, **kwd ):
return open( dataset.file_name )
+ def get_visualizations( self ):
+ """
+ Returns a list of visualizations for datatype.
+ """
+ return super( Tabular, self ).get_visualizations() + [ 'scatterplot' ]
+
class Taxonomy( Tabular ):
def __init__(self, **kwd):
"""Initialize taxonomy datatype"""
diff -r 5359d1066d91849fbf075f95f4999613d17a9c45 -r 32091cc60876e9720f2ae2b855e9e7f43e8c775a lib/galaxy/web/controllers/visualization.py
--- a/lib/galaxy/web/controllers/visualization.py
+++ b/lib/galaxy/web/controllers/visualization.py
@@ -708,9 +708,12 @@
# Get new dataset if specified.
new_dataset = kwargs.get("dataset_id", None)
+ '''
+ FIXME:
if new_dataset is not None:
if trans.security.decode_id(new_dataset) in [ d["dataset_id"] for d in viz_config.get("tracks") ]:
new_dataset = None # Already in browser, so don't add
+ '''
return trans.fill_template( 'tracks/browser.mako', config=viz_config, add_dataset=new_dataset )
@web.json
diff -r 5359d1066d91849fbf075f95f4999613d17a9c45 -r 32091cc60876e9720f2ae2b855e9e7f43e8c775a templates/root/history.mako
--- a/templates/root/history.mako
+++ b/templates/root/history.mako
@@ -116,6 +116,95 @@
});
};
+// Create trackster action function.
+function create_trackster_action_fn(vis_url, dataset_params, dbkey) {
+ return function() {
+ var params = {};
+ if (dbkey) { params['dbkey'] = dbkey; }
+ $.ajax({
+ url: vis_url + '/list_tracks?f-' + $.param(params),
+ dataType: "html",
+ error: function() { alert( "Could not add this dataset to browser." ); },
+ success: function(table_html) {
+ var parent = window.parent;
+
+ parent.show_modal("View Data in a New or Saved Visualization", "", {
+ "Cancel": function() {
+ parent.hide_modal();
+ },
+ "View in saved visualization": function() {
+ // Show new modal with saved visualizations.
+ parent.show_modal("Add Data to Saved Visualization", table_html, {
+ "Cancel": function() {
+ parent.hide_modal();
+ },
+ "Add to visualization": function() {
+ $(parent.document).find('input[name=id]:checked').each(function() {
+ var vis_id = $(this).val();
+ dataset_params['id'] = vis_id
+ parent.location = vis_url + "/trackster?" + $.param(dataset_params);
+ });
+ },
+ });
+ },
+ "View in new visualization": function() {
+ parent.location = vis_url + "/trackster?" + $.param(dataset_params);
+ }
+ });
+ }
+ });
+ return false;
+ };
+};
+
+/**
+ * Create popup menu for visualization icon.
+ */
+function init_viz_icon(icon) {
+ var icon = $(icon),
+ vis_url = icon.attr('href'),
+ dataset_id = icon.attr('dataset_id'),
+ visualizations = icon.attr('visualizations').split(','),
+ dbkey = icon.attr('dbkey'),
+ popup_menu_dict = {},
+
+ // Create visualization action.
+ create_viz_action = function(visualization) {
+ var action;
+ if (visualization === 'trackster') {
+ action = create_trackster_action_fn(vis_url, params, dbkey);
+ }
+ else {
+ action = function() {
+ window.parent.location = vis_url + '/' + visualization + '?' +
+ $.param(params);
+ };
+ }
+ return action;
+ },
+ params = {dataset_id: dataset_id};
+
+ // Add dbkey to params if it exists.
+ if (dbkey) { params['dbkey'] = dbkey; }
+
+ // Populate menu dict with visualizations.
+ _.each(visualizations, function(visualization) {
+ popup_menu_dict[
+ visualization.charAt(0).toUpperCase() + visualization.slice(1)
+ ] = create_viz_action(visualization);
+ });
+
+ // Set up action or menu.
+ if (visualizations.length === 1) {
+ // No need for popup menu because there's a single visualization.
+ icon.click(create_viz_action(visualizations[0]));
+ }
+ else {
+ make_popupmenu(icon, popup_menu_dict);
+ }
+};
+
+
// Update the message for async operations
function render_message(message, status) {
$("div#message-container").html( "<div class=\"" + status + "message\">" + message + "</div><br/>" );
@@ -258,96 +347,6 @@
});
- // Trackster links
- function init_trackster_links() {
- // Add to trackster browser functionality
- $(".trackster-add").live("click", function() {
- var dataset = this,
- dataset_jquery = $(this);
- $.ajax({
- url: dataset_jquery.attr("data-url"),
- dataType: "html",
- error: function() { alert( "Could not add this dataset to browser." ); },
- success: function(table_html) {
- var parent = window.parent;
-
- parent.show_modal("View Data in a New or Saved Visualization", "", {
- "Cancel": function() {
- parent.hide_modal();
- },
- "View in saved visualization": function() {
- // Show new modal with saved visualizations.
- parent.show_modal("Add Data to Saved Visualization", table_html, {
- "Cancel": function() {
- parent.hide_modal();
- },
- "Add to visualization": function() {
- $(parent.document).find('input[name=id]:checked').each(function() {
- var vis_id = $(this).val();
- parent.location = dataset_jquery.attr("action-url") + "&id=" + vis_id;
- });
- },
- });
- },
- "View in new visualization": function() {
- parent.location = dataset_jquery.attr("new-url");
- }
- });
- }
- });
- });
- }
-
- /**
- * Create popup menu for visualization icon.
- */
- function init_viz_icon(icon) {
- var icon_link = $(icon);
- make_popupmenu( icon_link , {
- "${_("Trackster")}": function() {
- $.ajax({
- url: icon_link.attr("data-url"),
- dataType: "html",
- error: function() { alert( "Could not add this dataset to browser." ); },
- success: function(table_html) {
- var parent = window.parent;
-
- parent.show_modal("View Data in a New or Saved Visualization", "", {
- "Cancel": function() {
- parent.hide_modal();
- },
- "View in saved visualization": function() {
- // Show new modal with saved visualizations.
- parent.hide_modal();
- parent.show_modal("Add Data to Saved Visualization", table_html, {
- "Cancel": function() {
- parent.hide_modal();
- },
- "Add to visualization": function() {
- $(parent.document).find('input[name=id]:checked').each(function() {
- var vis_id = $(this).val();
- parent.location = icon_link.attr("action-url") + "&id=" + vis_id;
- });
- },
- });
- },
- "View in new visualization": function() {
- parent.location = icon_link.attr("new-url");
- }
- });
- }
- });
- },
- //"${_("Scatterplot")}": function() {
- // var data_id = icon_link.parents(".historyItemContainer").attr("id").split("-")[1];
- // parent.galaxy_main.location =
- // "${h.url_for( controller='visualization', action='scatterplot', col1=9, col2=13 )}"
- // + "&dataset_id=" + data_id;
- //}
- } );
- return icon;
- };
-
_.each( $(".visualize-icon"), function(icon) {
init_viz_icon(icon);
});
@@ -472,6 +471,9 @@
init_history_items( $("div.historyItemWrapper"), "noinit" );
tag_handling(container);
annotation_handling(container);
+ var viz_icon = container.find(".visualize-icon")[0];
+ if (viz_icon) { init_viz_icon(viz_icon); }
+
// If new state is terminal, stop tracking
if (TERMINAL_STATES.indexOf(val.state) !== -1) {
if ( val.force_history_refresh ){
diff -r 5359d1066d91849fbf075f95f4999613d17a9c45 -r 32091cc60876e9720f2ae2b855e9e7f43e8c775a templates/root/history_common.mako
--- a/templates/root/history_common.mako
+++ b/templates/root/history_common.mako
@@ -226,17 +226,24 @@
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle tooltip"></a>
- %if data.ext in app.datatypes_registry.get_available_tracks():
- <%
- if data.dbkey != '?':
- data_url = h.url_for( controller='visualization', action='list_tracks', dbkey=data.dbkey )
- data_url = data_url.replace( 'dbkey', 'f-dbkey' )
- else:
- data_url = h.url_for( controller='visualization', action='list_tracks' )
- %>
- <a href="javascript:void(0)" data-url="${data_url}" class="icon-button chart_curve tooltip visualize-icon"
- action-url="${h.url_for( controller='tracks', action='browser', dataset_id=dataset_id)}"
- new-url="${h.url_for( controller='tracks', action='index', dataset_id=dataset_id, default_dbkey=data.dbkey)}" title="Visualize"></a>
+ ## Visualization icon + visualizations. Using anchor attributes is a HACK to encode needed
+ ## information--URL base, dataset id, dbkey, visualizations--in anchor.
+ <%
+ visualizations = data.datatype.get_visualizations()
+ ## HACK: if there are visualizations, only provide trackster for now since others
+ ## are not ready.
+ if visualizations:
+ visualizations = [ 'trackster' ]
+ %>
+ %if visualizations:
+ <a href="${h.url_for( controller='visualization' )}"
+ class="icon-button chart_curve tooltip visualize-icon"
+ title="Visualize"
+ dataset_id="${dataset_id}"
+ %if data.dbkey != '?':
+ dbkey="${data.dbkey}"
+ %endif
+ visualizations="${','.join(visualizations)}"></a>
%endif
<%
isPhylogenyData = isinstance(data.datatype, (Phyloxml, Nexus, Newick))
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: Grammar. it's -> its in admin panel (and tests)
by Bitbucket 18 Sep '12
by Bitbucket 18 Sep '12
18 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/5359d1066d91/
changeset: 5359d1066d91
user: dannon
date: 2012-09-18 15:34:51
summary: Grammar. it's -> its in admin panel (and tests)
affected #: 2 files
diff -r ba64c2178fbee9a83f79580c434ab280d8a0b738 -r 5359d1066d91849fbf075f95f4999613d17a9c45 templates/webapps/galaxy/admin/center.mako
--- a/templates/webapps/galaxy/admin/center.mako
+++ b/templates/webapps/galaxy/admin/center.mako
@@ -51,7 +51,7 @@
then users that have Role2 will be able to access the library, but will not see those contained datasets whose [dataset] "access" permission
is associated with only Role1.
<p/>
- In addition to the "access library" permission, permission to perform the following functions on the data library (and it's contents) can
+ In addition to the "access library" permission, permission to perform the following functions on the data library (and its contents) can
be granted to users (a library item is one of: a data library, a library folder, a library dataset).
<p/><ul>
diff -r ba64c2178fbee9a83f79580c434ab280d8a0b738 -r 5359d1066d91849fbf075f95f4999613d17a9c45 test/functional/test_library_security.py
--- a/test/functional/test_library_security.py
+++ b/test/functional/test_library_security.py
@@ -93,7 +93,7 @@
permissions_in = [ k for k, v in galaxy.model.Library.permitted_actions.items() ]
permissions_out = []
# Role1 members are: admin_user, regular_user1, regular_user3. Each of these users will be permitted for
- # LIBRARY_ACCESS, LIBRARY_ADD, LIBRARY_MODIFY, LIBRARY_MANAGE on library1 and it's contents.
+ # LIBRARY_ACCESS, LIBRARY_ADD, LIBRARY_MODIFY, LIBRARY_MANAGE on library1 and its contents.
self.library_permissions( self.security.encode_id( library1.id ),
library1.name,
str( role1.id ),
@@ -163,7 +163,7 @@
# Logged in as admin_user
#
# LIBRARY_ACCESS = Role1: admin_user, regular_user1, regular_user3. Each of these users will be permitted for
- # LIBRARY_ACCESS, LIBRARY_ADD, LIBRARY_MODIFY, LIBRARY_MANAGE on this library and it's contents.
+ # LIBRARY_ACCESS, LIBRARY_ADD, LIBRARY_MODIFY, LIBRARY_MANAGE on this library and its contents.
#
# Legitimate roles displayed on the permission form are as follows:
# 'Role1' since the LIBRARY_ACCESS permission is associated with Role1. # Role one members are: admin_user, regular_user1, regular_user3.
@@ -239,7 +239,7 @@
# groups: group1
# users: test(a)bx.psu.edu, test1(a)bx.psu.edu via group1
#
- # We first need to make library1 public, but leave it's contents permissions unchanged
+ # We first need to make library1 public, but leave its contents permissions unchanged
self.make_library_item_public( self.security.encode_id( library1.id ),
self.security.encode_id( library1.id ),
item_type='library',
@@ -433,7 +433,7 @@
permissions_in = [ k for k, v in galaxy.model.Library.permitted_actions.items() ]
permissions_out = []
# Only admin_user will be permitted for
- # LIBRARY_ACCESS, LIBRARY_ADD, LIBRARY_MODIFY, LIBRARY_MANAGE on library2 and it's contents.
+ # LIBRARY_ACCESS, LIBRARY_ADD, LIBRARY_MODIFY, LIBRARY_MANAGE on library2 and its contents.
self.library_permissions( self.security.encode_id( library1.id ),
library1.name,
str( admin_user_private_role.id ),
@@ -526,7 +526,7 @@
ldda8 = get_latest_ldda_by_name( filename )
assert ldda8 is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda8 from the database'
def test_090_make_library2_and_contents_public( self ):
- """Testing making library2 and all of it's contents public"""
+ """Testing making library2 and all of its contents public"""
self.make_library_item_public( self.security.encode_id( library2.id ),
self.security.encode_id( library2.id ),
item_type='library',
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: greg: Apply fix from Jim Johnson for rendering tool dependencies defined in a tool shed repository.
by Bitbucket 18 Sep '12
by Bitbucket 18 Sep '12
18 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/ba64c2178fbe/
changeset: ba64c2178fbe
user: greg
date: 2012-09-18 15:03:39
summary: Apply fix from Jim Johnson for rendering tool dependencies defined in a tool shed repository.
affected #: 1 file
diff -r 19345740820fe9fe62fe46e9ae54efbabc1eb019 -r ba64c2178fbee9a83f79580c434ab280d8a0b738 templates/admin/tool_shed_repository/common.mako
--- a/templates/admin/tool_shed_repository/common.mako
+++ b/templates/admin/tool_shed_repository/common.mako
@@ -129,28 +129,30 @@
<% package_header_row_displayed = True %>
%endif
%for dependency_key, requirements_dict in tool_dependencies.items():
- <%
- name = requirements_dict[ 'name' ]
- version = requirements_dict[ 'version' ]
- type = requirements_dict[ 'type' ]
- install_dir = os.path.join( trans.app.config.tool_dependency_dir,
- name,
- version,
- repository_owner,
- repository_name,
- changeset_revision )
- tool_dependency_readme_text = requirements_dict.get( 'readme', None )
- %>
- %if not os.path.exists( install_dir ):
- <tr>
- <td>${name}</td>
- <td>${version}</td>
- <td>${type}</td>
- <td>${install_dir}</td>
- </tr>
- %if tool_dependency_readme_text:
- <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr>
- <tr><td colspan="4"><pre>${tool_dependency_readme_text}</pre></td></tr>
+ %if dependency_key not in [ 'set_environment' ]:
+ <%
+ name = requirements_dict[ 'name' ]
+ version = requirements_dict[ 'version' ]
+ type = requirements_dict[ 'type' ]
+ install_dir = os.path.join( trans.app.config.tool_dependency_dir,
+ name,
+ version,
+ repository_owner,
+ repository_name,
+ changeset_revision )
+ tool_dependency_readme_text = requirements_dict.get( 'readme', None )
+ %>
+ %if not os.path.exists( install_dir ):
+ <tr>
+ <td>${name}</td>
+ <td>${version}</td>
+ <td>${type}</td>
+ <td>${install_dir}</td>
+ </tr>
+ %if tool_dependency_readme_text:
+ <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr>
+ <tr><td colspan="4"><pre>${tool_dependency_readme_text}</pre></td></tr>
+ %endif
%endif
%endif
%endfor
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: jgoecks: Fix bugs when converting BED to FLI and JS module references.
by Bitbucket 17 Sep '12
by Bitbucket 17 Sep '12
17 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/19345740820f/
changeset: 19345740820f
user: jgoecks
date: 2012-09-17 23:36:40
summary: Fix bugs when converting BED to FLI and JS module references.
affected #: 2 files
diff -r 833f02590bbd11f8ed1bdc024b380c1bb185bfae -r 19345740820fe9fe62fe46e9ae54efbabc1eb019 lib/galaxy/datatypes/converters/interval_to_fli.py
--- a/lib/galaxy/datatypes/converters/interval_to_fli.py
+++ b/lib/galaxy/datatypes/converters/interval_to_fli.py
@@ -53,7 +53,17 @@
else:
# BED format.
for line in open( in_fname, 'r' ):
+ # Ignore track lines.
+ if line.startswith("track"):
+ continue
+
fields = line.split()
+
+ # Ignore lines with no feature name.
+ if len( fields ) < 4:
+ continue
+
+ # Process line
name_loc_dict[ fields[3] ] = {
'contig': fields[0],
'start': int( fields[1] ),
diff -r 833f02590bbd11f8ed1bdc024b380c1bb185bfae -r 19345740820fe9fe62fe46e9ae54efbabc1eb019 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -86,17 +86,17 @@
JSON.parse('${ h.to_json_string( config['bookmarks'] ) }'),
true
);
- ui.init_editor();
+ init_editor();
set_up_router({view: view});
%else:
var continue_fn = function() {
- view = trackster_ui.create_visualization( {
+ view = ui.create_visualization( {
container: $("#browser-container"),
name: $("#new-title").val(),
dbkey: $("#new-dbkey").val()
} );
view.editor = true;
- ui.init_editor();
+ init_editor();
set_up_router({view: view});
hide_modal();
};
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/changeset/5027e0458ef0/
changeset: 5027e0458ef0
user: carlfeberhard
date: 2012-09-17 23:12:42
summary: initial, un-wired prototype for scatterplot visualization
affected #: 6 files
diff -r 65ecf4e0ed28eaa2f3e64495ab800aa7c9779a54 -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 lib/galaxy/visualization/data_providers/basic.py
--- a/lib/galaxy/visualization/data_providers/basic.py
+++ b/lib/galaxy/visualization/data_providers/basic.py
@@ -90,6 +90,11 @@
break
fields = line.split()
+ #pre: column indeces should be avail in fields
+ for col_index in cols:
+ assert col_index < len( fields ), (
+ "column index (%d) must be less than fields length: %d" % ( col_index, len( fields ) ) )
+
data.append( [ cast_val( fields[c], self.original_dataset.metadata.column_types[c] ) for c in cols ] )
f.close()
diff -r 65ecf4e0ed28eaa2f3e64495ab800aa7c9779a54 -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 lib/galaxy/web/api/datasets.py
--- a/lib/galaxy/web/api/datasets.py
+++ b/lib/galaxy/web/api/datasets.py
@@ -215,8 +215,14 @@
# Return data.
data = None
data_provider = trans.app.data_provider_registry.get_data_provider( raw=True, original_dataset=dataset )
+
if data_provider == ColumnDataProvider:
+ #pre: should have column kwargs
+ #print 'kwargs:', kwargs
+ assert 'cols' in kwargs, (
+ "ColumnDataProvider needs a 'cols' parameter in the query string" )
data = data_provider( original_dataset=dataset ).get_data( **kwargs )
+
else:
# Default to genomic data.
# FIXME: need better way to set dataset_type.
diff -r 65ecf4e0ed28eaa2f3e64495ab800aa7c9779a54 -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 lib/galaxy/web/controllers/visualization.py
--- a/lib/galaxy/web/controllers/visualization.py
+++ b/lib/galaxy/web/controllers/visualization.py
@@ -6,6 +6,7 @@
from galaxy.web.controllers.library import LibraryListGrid
from galaxy.visualization.genomes import decode_dbkey
from galaxy.visualization.genome.visual_analytics import get_dataset_job
+from galaxy.visualization.data_providers.basic import ColumnDataProvider
#
# -- Grids --
@@ -801,6 +802,28 @@
def get_item( self, trans, id ):
return self.get_visualization( trans, id )
+ @web.expose
+ def scatterplot( self, trans, dataset_id, cols ):
+ # Get HDA.
+ hda = self.get_dataset( trans, dataset_id, check_ownership=False, check_accessible=True )
+
+ # get some metadata for the page
+ hda_dict = hda.get_api_value()
+ #title = "Scatter plot of {name}:".format( **hda_dict )
+ #subtitle = "{misc_info}".format( **hda_dict )
+
+ #TODO: add column data
+ # Read data.
+ data_provider = ColumnDataProvider( original_dataset=hda )
+ data = data_provider.get_data( cols )
+
+ # Return plot.
+ return trans.fill_template_mako( "visualization/scatterplot.mako",
+ title=hda.name, subtitle=hda.info,
+ hda=hda,
+ data=data )
+
+
@web.json
def bookmarks_from_dataset( self, trans, hda_id=None, ldda_id=None ):
if hda_id:
diff -r 65ecf4e0ed28eaa2f3e64495ab800aa7c9779a54 -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 templates/root/history.mako
--- a/templates/root/history.mako
+++ b/templates/root/history.mako
@@ -17,7 +17,16 @@
<meta http-equiv="Pragma" content="no-cache">
${h.css( "base", "history", "autocomplete_tagging" )}
-${h.js( "libs/jquery/jquery", "libs/bootstrap", "galaxy.base", "libs/json2", "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging" )}
+${h.js(
+ "libs/jquery/jquery",
+ "libs/bootstrap",
+ "galaxy.base",
+ "libs/json2",
+ "libs/jquery/jstorage",
+ "libs/jquery/jquery.autocomplete",
+ "galaxy.autocom_tagging",
+ "libs/underscore"
+)}
<script type="text/javascript">
@@ -289,8 +298,61 @@
});
}
- init_trackster_links();
+ /**
+ * Create popup menu for visualization icon.
+ */
+ function init_viz_icon(icon) {
+ var icon_link = $(icon);
+ make_popupmenu( icon_link , {
+ "${_("Trackster")}": function() {
+ $.ajax({
+ url: icon_link.attr("data-url"),
+ dataType: "html",
+ error: function() { alert( "Could not add this dataset to browser." ); },
+ success: function(table_html) {
+ var parent = window.parent;
+ parent.show_modal("View Data in a New or Saved Visualization", "", {
+ "Cancel": function() {
+ parent.hide_modal();
+ },
+ "View in saved visualization": function() {
+ // Show new modal with saved visualizations.
+ parent.hide_modal();
+ parent.show_modal("Add Data to Saved Visualization", table_html, {
+ "Cancel": function() {
+ parent.hide_modal();
+ },
+ "Add to visualization": function() {
+ $(parent.document).find('input[name=id]:checked').each(function() {
+ var vis_id = $(this).val();
+ parent.location = icon_link.attr("action-url") + "&id=" + vis_id;
+ });
+ },
+ });
+ },
+ "View in new visualization": function() {
+ parent.location = icon_link.attr("new-url");
+ }
+ });
+ }
+ });
+ },
+ //"${_("Scatterplot")}": function() {
+ // var data_id = icon_link.parents(".historyItemContainer").attr("id").split("-")[1];
+ // parent.galaxy_main.location =
+ // "${h.url_for( controller='visualization', action='scatterplot', col1=9, col2=13 )}"
+ // + "&dataset_id=" + data_id;
+ //}
+ } );
+ return icon;
+ };
+
+ _.each( $(".visualize-icon"), function(icon) {
+ console.debug( 'Init visualization icons, icon:', icon );
+ init_viz_icon(icon);
+ });
+
function init_phyloviz_links() {
// PhyloViz links
// Add to trackster browser functionality
diff -r 65ecf4e0ed28eaa2f3e64495ab800aa7c9779a54 -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 templates/root/history_common.mako
--- a/templates/root/history_common.mako
+++ b/templates/root/history_common.mako
@@ -234,9 +234,12 @@
else:
data_url = h.url_for( controller='visualization', action='list_tracks' )
%>
- <a href="javascript:void(0)" data-url="${data_url}" class="icon-button chart_curve tooltip trackster-add"
- action-url="${h.url_for( controller='visualization', action='trackster', dataset_id=dataset_id)}"
- new-url="${h.url_for( controller='visualization', action='trackster', dataset_id=dataset_id, default_dbkey=data.dbkey)}" title="View in Trackster"></a>
+ <!--<a href="javascript:void(0)" data-url="${data_url}" class="icon-button chart_curve tooltip trackster-add"-->
+ <!-- action-url="${h.url_for( controller='visualization', action='trackster', dataset_id=dataset_id)}"-->
+ <!-- new-url="${h.url_for( controller='visualization', action='trackster', dataset_id=dataset_id, default_dbkey=data.dbkey)}" title="View in Trackster"></a>-->
+ <a href="javascript:void(0)" data-url="${data_url}" class="icon-button chart_curve tooltip visualize-icon"
+ action-url="${h.url_for( controller='tracks', action='browser', dataset_id=dataset_id)}"
+ new-url="${h.url_for( controller='tracks', action='index', dataset_id=dataset_id, default_dbkey=data.dbkey)}" title="Visualize"></a>
%endif
<%
isPhylogenyData = isinstance(data.datatype, (Phyloxml, Nexus, Newick))
diff -r 65ecf4e0ed28eaa2f3e64495ab800aa7c9779a54 -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 templates/visualization/scatterplot.mako
--- /dev/null
+++ b/templates/visualization/scatterplot.mako
@@ -0,0 +1,205 @@
+<%inherit file="/base.mako"/>
+
+<%def name="stylesheets()">
+${parent.stylesheets()}
+${h.css( "history", "autocomplete_tagging", "trackster", "overcast/jquery-ui-1.8.5.custom", "library" )}
+
+<style type="text/css">
+* { margin: 0px, padding: 0px; }
+
+.subtitle {
+ margin-left: 1em;
+ margin-top: -1em;
+ color: grey;
+ font-size: small;
+}
+
+.chart {
+ /*shape-rendering: crispEdges;*/
+}
+
+.grid-line {
+ fill: none;
+ stroke: lightgrey;
+ stroke-opacity: 0.5;
+ shape-rendering: crispEdges;
+ stroke-dasharray: 3, 3;
+}
+
+.axis path, .axis line {
+ fill: none;
+ stroke: black;
+ shape-rendering: crispEdges;
+}
+.axis text {
+ font-family: sans-serif;
+ font-size: 12px;
+}
+
+
+circle.bubble {
+ stroke: none;
+ fill: black;
+ fill-opacity: 0.2;
+}
+
+</style>
+
+</%def>
+
+<%def name="javascripts()">
+${parent.javascripts()}
+${h.js( "libs/d3" )}
+
+<script type="text/javascript">
+/* =============================================================================
+todo:
+ validate columns (here or server)
+ send: type, column title/name in JSON
+
+
+ move to obj, possibly view?
+ fetch (new?) data
+ config changes to the graph
+ download svg (png?)
+
+============================================================================= */
+function translateStr( x, y ){
+ return 'translate(' + x + ',' + y + ')';
+}
+function rotateStr( d, x, y ){
+ return 'rotate(' + d + ',' + x + ',' + y + ')';
+}
+
+$(function() {
+ // Constants
+ var data = ${data},
+ MAX_DATA_POINTS = 30000,
+ BUBBLE_RADIUS = 5,
+ ENTRY_ANIM_DURATION = 500,
+ X_TICKS = 10, Y_TICKS = 10,
+ X_AXIS_LABEL_BUMP_Y = 40,
+ Y_AXIS_LABEL_BUMP_X = -35,
+ WIDTH = 300,
+ HEIGHT = 300,
+ MARGIN= 50,
+ xLabel = "Magnitude",
+ yLabel = "Depth";
+
+ // set a cap on the data, limit to first n points
+ data = data.slice( 0, MAX_DATA_POINTS );
+
+ // split the data into columns
+ //TODO: compute min, max on server.
+ var col1_data = data.map( function(e) { return e[0] }),
+ col2_data = data.map( function(e) { return e[1] }),
+ xMin = d3.min( col1_data ),
+ xMax = d3.max( col1_data ),
+ yMin = d3.min( col2_data ),
+ yMax = d3.max( col2_data );
+ console.log( 'col1_data:', col1_data );
+ console.log( 'col2_data:', col2_data );
+ console.log( 'xMin, xMax, yMin, yMax:', xMin, xMax, yMin, yMax );
+
+ // Set up.
+ d3.select( "body" ).append( "svg:svg" )
+ .attr( "width", WIDTH + ( MARGIN * 2 ) )
+ .attr( "height", HEIGHT + ( MARGIN * 2 ) )
+ .attr( "class", "chart" );
+
+ // Scale for x, y based on data domains
+ // origin: bottom, left
+ var x_scale = d3.scale.linear()
+ .domain([ xMin, xMax ])
+ .range([ 0, WIDTH ]),
+ y_scale = d3.scale.linear()
+ .domain([ yMin, yMax ])
+ .range([ HEIGHT, 0 ]);
+
+ // Selection of SVG, append group (will group our entire chart), give attributes
+ // apply a group and transform all coords away from margins
+ var chart = d3.select( ".chart" ).append( "svg:g" )
+ .attr( "class", "content" )
+ .attr( "transform", translateStr( MARGIN, MARGIN ) );
+
+ // axes
+ var xAxisFn = d3.svg.axis()
+ .scale( x_scale )
+ .ticks( X_TICKS )
+ .orient( 'bottom' );
+ var xAxis = chart.append( 'g' ).attr( 'class', 'axis' ).attr( 'id', 'x-axis' )
+ .attr( 'transform', translateStr( 0, HEIGHT ) )
+ .call( xAxisFn )
+ console.debug( 'xAxis:', xAxis ); window.xAxis = xAxis, window.xAxisFn = xAxisFn;
+
+ var xAxisLabel = xAxis.append( 'text' ).attr( 'class', 'axis-label' ).attr( 'id', 'x-axis-label' )
+ .attr( 'x', WIDTH / 2 )
+ .attr( 'y', X_AXIS_LABEL_BUMP_Y )
+ .attr( 'text-anchor', 'middle' )
+ .text( xLabel );
+ console.debug( 'xAxisLabel:', xAxisLabel ); window.xAxisLabel = xAxisLabel;
+
+ var yAxisFn = d3.svg.axis()
+ .scale( y_scale )
+ .ticks( Y_TICKS )
+ .orient( 'left' );
+ var yAxis = chart.append( 'g' ).attr( 'class', 'axis' ).attr( 'id', 'y-axis' )
+ .call( yAxisFn );
+ console.debug( 'yAxis:', yAxis ); window.yAxis = yAxis, window.yAxisFn = yAxisFn;
+
+ var yAxisLabel = yAxis.append( 'text' ).attr( 'class', 'axis-label' ).attr( 'id', 'y-axis-label' )
+ .attr( 'x', Y_AXIS_LABEL_BUMP_X )
+ .attr( 'y', HEIGHT / 2 )
+ .attr( 'text-anchor', 'middle' )
+ .attr( 'transform', rotateStr( -90, Y_AXIS_LABEL_BUMP_X, HEIGHT / 2 ) )
+ .text( yLabel );
+ console.debug( 'yAxisLabel:', yAxisLabel ); window.yAxisLabel = yAxisLabel;
+
+ // grid lines
+ var hGridLines = chart.selectAll( '.h-grid-line' )
+ .data( x_scale.ticks( xAxisFn.ticks()[0] ) )
+ .enter().append( 'svg:line' )
+ .classed( 'grid-line h-grid-line', true )
+ .attr( 'x1', x_scale ).attr( 'y1', 0 )
+ .attr( 'x2', x_scale ).attr( 'y2', HEIGHT )
+ console.debug( 'hGridLines:', hGridLines ); window.hGridLines = hGridLines;
+
+ var vGridLines = chart.selectAll( '.v-grid-line' )
+ .data( y_scale.ticks( yAxisFn.ticks()[0] ) )
+ .enter().append( 'svg:line' )
+ .classed( 'grid-line v-grid-line', true )
+ .attr( 'x1', 0 ) .attr( 'y1', y_scale )
+ .attr( 'x2', WIDTH ).attr( 'y2', y_scale )
+ console.debug( 'vGridLines:', vGridLines ); window.vGridLines = vGridLines;
+
+ // Functions used to render plot.
+ var xPosFn = function( d, i ){
+ return x_scale( col1_data[ i ] );
+ };
+ var yPosFn = function( d, i ){
+ return y_scale( col2_data[ i ] );
+ };
+
+ // Create bubbles for each data point.
+ chart.selectAll( "circle.bubble" )
+ .data(data).enter()
+ .append( "svg:circle" ).attr( "class", "bubble" )
+ // start all bubbles at corner...
+ .attr( "r", 0 )
+ .attr( "fill", "white" )
+ // ...animate to final position
+ .transition().duration( ENTRY_ANIM_DURATION )
+ .attr("cx", xPosFn )
+ .attr("cy", yPosFn )
+ .attr("r", BUBBLE_RADIUS);
+
+ //TODO: on hover red line to axes, display values
+});
+</script>
+</%def>
+
+<%def name="body()">
+ <h1 class="title">Scatterplot of '${title}':</h1>
+ <h2 class="subtitle">${subtitle}</h2>
+
+</%def>
https://bitbucket.org/galaxy/galaxy-central/changeset/833f02590bbd/
changeset: 833f02590bbd
user: carlfeberhard
date: 2012-09-17 23:19:53
summary: scatterplot.mako: some cleanup
affected #: 4 files
diff -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 -r 833f02590bbd11f8ed1bdc024b380c1bb185bfae lib/galaxy/web/api/datasets.py
--- a/lib/galaxy/web/api/datasets.py
+++ b/lib/galaxy/web/api/datasets.py
@@ -219,6 +219,7 @@
if data_provider == ColumnDataProvider:
#pre: should have column kwargs
#print 'kwargs:', kwargs
+ #TODO??: could default to first two here
assert 'cols' in kwargs, (
"ColumnDataProvider needs a 'cols' parameter in the query string" )
data = data_provider( original_dataset=dataset ).get_data( **kwargs )
diff -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 -r 833f02590bbd11f8ed1bdc024b380c1bb185bfae templates/root/history.mako
--- a/templates/root/history.mako
+++ b/templates/root/history.mako
@@ -349,7 +349,6 @@
};
_.each( $(".visualize-icon"), function(icon) {
- console.debug( 'Init visualization icons, icon:', icon );
init_viz_icon(icon);
});
diff -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 -r 833f02590bbd11f8ed1bdc024b380c1bb185bfae templates/root/history_common.mako
--- a/templates/root/history_common.mako
+++ b/templates/root/history_common.mako
@@ -234,9 +234,6 @@
else:
data_url = h.url_for( controller='visualization', action='list_tracks' )
%>
- <!--<a href="javascript:void(0)" data-url="${data_url}" class="icon-button chart_curve tooltip trackster-add"-->
- <!-- action-url="${h.url_for( controller='visualization', action='trackster', dataset_id=dataset_id)}"-->
- <!-- new-url="${h.url_for( controller='visualization', action='trackster', dataset_id=dataset_id, default_dbkey=data.dbkey)}" title="View in Trackster"></a>--><a href="javascript:void(0)" data-url="${data_url}" class="icon-button chart_curve tooltip visualize-icon"
action-url="${h.url_for( controller='tracks', action='browser', dataset_id=dataset_id)}"
new-url="${h.url_for( controller='tracks', action='index', dataset_id=dataset_id, default_dbkey=data.dbkey)}" title="Visualize"></a>
diff -r 5027e0458ef06686cbf56770c5e02e9d5d1673c1 -r 833f02590bbd11f8ed1bdc024b380c1bb185bfae templates/visualization/scatterplot.mako
--- a/templates/visualization/scatterplot.mako
+++ b/templates/visualization/scatterplot.mako
@@ -56,7 +56,6 @@
todo:
validate columns (here or server)
send: type, column title/name in JSON
-
move to obj, possibly view?
fetch (new?) data
@@ -97,9 +96,9 @@
xMax = d3.max( col1_data ),
yMin = d3.min( col2_data ),
yMax = d3.max( col2_data );
- console.log( 'col1_data:', col1_data );
- console.log( 'col2_data:', col2_data );
- console.log( 'xMin, xMax, yMin, yMax:', xMin, xMax, yMin, yMax );
+ //console.log( 'col1_data:', col1_data );
+ //console.log( 'col2_data:', col2_data );
+ //console.log( 'xMin, xMax, yMin, yMax:', xMin, xMax, yMin, yMax );
// Set up.
d3.select( "body" ).append( "svg:svg" )
@@ -130,14 +129,14 @@
var xAxis = chart.append( 'g' ).attr( 'class', 'axis' ).attr( 'id', 'x-axis' )
.attr( 'transform', translateStr( 0, HEIGHT ) )
.call( xAxisFn )
- console.debug( 'xAxis:', xAxis ); window.xAxis = xAxis, window.xAxisFn = xAxisFn;
+ //console.debug( 'xAxis:', xAxis ); window.xAxis = xAxis, window.xAxisFn = xAxisFn;
var xAxisLabel = xAxis.append( 'text' ).attr( 'class', 'axis-label' ).attr( 'id', 'x-axis-label' )
.attr( 'x', WIDTH / 2 )
.attr( 'y', X_AXIS_LABEL_BUMP_Y )
.attr( 'text-anchor', 'middle' )
.text( xLabel );
- console.debug( 'xAxisLabel:', xAxisLabel ); window.xAxisLabel = xAxisLabel;
+ //console.debug( 'xAxisLabel:', xAxisLabel ); window.xAxisLabel = xAxisLabel;
var yAxisFn = d3.svg.axis()
.scale( y_scale )
@@ -145,7 +144,7 @@
.orient( 'left' );
var yAxis = chart.append( 'g' ).attr( 'class', 'axis' ).attr( 'id', 'y-axis' )
.call( yAxisFn );
- console.debug( 'yAxis:', yAxis ); window.yAxis = yAxis, window.yAxisFn = yAxisFn;
+ //console.debug( 'yAxis:', yAxis ); window.yAxis = yAxis, window.yAxisFn = yAxisFn;
var yAxisLabel = yAxis.append( 'text' ).attr( 'class', 'axis-label' ).attr( 'id', 'y-axis-label' )
.attr( 'x', Y_AXIS_LABEL_BUMP_X )
@@ -153,7 +152,7 @@
.attr( 'text-anchor', 'middle' )
.attr( 'transform', rotateStr( -90, Y_AXIS_LABEL_BUMP_X, HEIGHT / 2 ) )
.text( yLabel );
- console.debug( 'yAxisLabel:', yAxisLabel ); window.yAxisLabel = yAxisLabel;
+ //console.debug( 'yAxisLabel:', yAxisLabel ); window.yAxisLabel = yAxisLabel;
// grid lines
var hGridLines = chart.selectAll( '.h-grid-line' )
@@ -162,7 +161,7 @@
.classed( 'grid-line h-grid-line', true )
.attr( 'x1', x_scale ).attr( 'y1', 0 )
.attr( 'x2', x_scale ).attr( 'y2', HEIGHT )
- console.debug( 'hGridLines:', hGridLines ); window.hGridLines = hGridLines;
+ //console.debug( 'hGridLines:', hGridLines ); window.hGridLines = hGridLines;
var vGridLines = chart.selectAll( '.v-grid-line' )
.data( y_scale.ticks( yAxisFn.ticks()[0] ) )
@@ -170,7 +169,7 @@
.classed( 'grid-line v-grid-line', true )
.attr( 'x1', 0 ) .attr( 'y1', y_scale )
.attr( 'x2', WIDTH ).attr( 'y2', y_scale )
- console.debug( 'vGridLines:', vGridLines ); window.vGridLines = vGridLines;
+ //console.debug( 'vGridLines:', vGridLines ); window.vGridLines = vGridLines;
// Functions used to render plot.
var xPosFn = function( d, i ){
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/changeset/5a61f5123386/
changeset: 5a61f5123386
user: james_taylor
date: 2012-09-17 22:24:13
summary: trackster: moving more stuff out of mako into javascript
affected #: 2 files
diff -r 6c0bb542d2e0cbda209e473db9d77a7076614f0d -r 5a61f51233861c6f7f4be41c5fd2de94d468ea61 static/scripts/viz/trackster_ui.js
--- a/static/scripts/viz/trackster_ui.js
+++ b/static/scripts/viz/trackster_ui.js
@@ -12,6 +12,90 @@
this.baseURL = baseURL;
},
+
+ /**
+ * Create button menu
+ */
+ createButtonMenu: function() {
+ var menu = create_icon_buttons_menu([
+ { icon_class: 'plus-button', title: 'Add tracks', on_click: function() {
+ add_datasets(add_datasets_url, add_track_async_url, function(tracks) {
+ _.each(tracks, function(track) {
+ view.add_drawable( trackster_ui.object_from_template(track, view, view) );
+ });
+ });
+ } },
+ { icon_class: 'block--plus', title: 'Add group', on_click: function() {
+ view.add_drawable( new tracks.DrawableGroup(view, view, { name: "New Group" }) );
+ } },
+ { icon_class: 'bookmarks', title: 'Bookmarks', on_click: function() {
+ // HACK -- use style to determine if panel is hidden and hide/show accordingly.
+ parent.force_right_panel(($("div#right").css("right") == "0px" ? "hide" : "show"));
+ } },
+ {
+ icon_class: 'globe',
+ title: 'Circster',
+ on_click: function() {
+ // Add viz id dynamically so that newly saved visualizations work as well.
+ window.location = "${h.url_for( controller='visualization', action='circster' )}?id=" + view.vis_id;
+ }
+ },
+ { icon_class: 'disk--arrow', title: 'Save', on_click: function() {
+ // Show saving dialog box
+ show_modal("Saving...", "progress");
+
+ // Save bookmarks.
+ var bookmarks = [];
+ $(".bookmark").each(function() {
+ bookmarks.push({
+ position: $(this).children(".position").text(),
+ annotation: $(this).children(".annotation").text()
+ });
+ });
+
+ // FIXME: give unique IDs to Drawables and save overview as ID.
+ var overview_track_name = (view.overview_drawable ? view.overview_drawable.name : null),
+ viz_config = {
+ 'id': view.vis_id,
+ 'title': view.name,
+ 'dbkey': view.dbkey,
+ 'type': 'trackster',
+ 'datasets': view.to_dict(),
+ 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high, 'overview': overview_track_name },
+ 'bookmarks': bookmarks
+ };
+
+ $.ajax({
+ url: galaxy_paths.get("visualization_url"),
+ type: "POST",
+ dataType: "json",
+ data: {
+ vis_json: JSON.stringify(viz_config)
+ }
+ }).success(function(vis_info) {
+ hide_modal();
+ view.vis_id = vis_info.vis_id;
+ view.has_changes = false;
+
+ // Needed to set URL when first saving a visualization.
+ window.history.pushState({}, "", vis_info.url + window.location.hash);
+ })
+ .error(function() {
+ show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
+ { "Close" : hide_modal } );
+ });
+ } },
+ { icon_class: 'cross-circle', title: 'Close', on_click: function() {
+ window.location = "${h.url_for( controller='visualization', action='list' )}";
+ } }
+ ],
+ {
+ tooltip_config: { placement: 'bottom' }
+ });
+ this.buttonMenu = menu;
+ return menu;
+ },
+
/**
* Use a popup to select a dataset of create bookmarks from
*/
diff -r 6c0bb542d2e0cbda209e473db9d77a7076614f0d -r 5a61f51233861c6f7f4be41c5fd2de94d468ea61 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -61,85 +61,12 @@
var browser_router;
$(function() {
- // Create and initialize menu.
- var menu = create_icon_buttons_menu([
- { icon_class: 'plus-button', title: 'Add tracks', on_click: function() {
- add_datasets(add_datasets_url, add_track_async_url, function(tracks) {
- _.each(tracks, function(track) {
- view.add_drawable( trackster_ui.object_from_template(track, view, view) );
- });
- });
- } },
- { icon_class: 'block--plus', title: 'Add group', on_click: function() {
- view.add_drawable( new tracks.DrawableGroup(view, view, { name: "New Group" }) );
- } },
- { icon_class: 'bookmarks', title: 'Bookmarks', on_click: function() {
- // HACK -- use style to determine if panel is hidden and hide/show accordingly.
- parent.force_right_panel(($("div#right").css("right") == "0px" ? "hide" : "show"));
- } },
- {
- icon_class: 'globe',
- title: 'Circster',
- on_click: function() {
- // Add viz id dynamically so that newly saved visualizations work as well.
- window.location = "${h.url_for( controller='visualization', action='circster' )}?id=" + view.vis_id;
- }
- },
- { icon_class: 'disk--arrow', title: 'Save', on_click: function() {
- // Show saving dialog box
- show_modal("Saving...", "progress");
-
- // Save bookmarks.
- var bookmarks = [];
- $(".bookmark").each(function() {
- bookmarks.push({
- position: $(this).children(".position").text(),
- annotation: $(this).children(".annotation").text()
- });
- });
- // FIXME: give unique IDs to Drawables and save overview as ID.
- var overview_track_name = (view.overview_drawable ? view.overview_drawable.name : null),
- viz_config = {
- 'id': view.vis_id,
- 'title': view.name,
- 'dbkey': view.dbkey,
- 'type': 'trackster',
- 'datasets': view.to_dict(),
- 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high, 'overview': overview_track_name },
- 'bookmarks': bookmarks
- };
+ ui.createButtonMenu();
- $.ajax({
- url: galaxy_paths.get("visualization_url"),
- type: "POST",
- dataType: "json",
- data: {
- vis_json: JSON.stringify(viz_config)
- }
- }).success(function(vis_info) {
- hide_modal();
- view.vis_id = vis_info.vis_id;
- view.has_changes = false;
-
- // Needed to set URL when first saving a visualization.
- window.history.pushState({}, "", vis_info.url + window.location.hash);
- })
- .error(function() {
- show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
- { "Close" : hide_modal } );
- });
- } },
- { icon_class: 'cross-circle', title: 'Close', on_click: function() {
- window.location = "${h.url_for( controller='visualization', action='list' )}";
- } }
- ],
- {
- tooltip_config: { placement: 'bottom' }
- });
-
- menu.$el.attr("style", "float: right");
- $("#center .unified-panel-header-inner").append(menu.$el);
+ // Attach the button menu to the panel header and float it left
+ ui.buttonMenu.$el.attr("style", "float: right");
+ $("#center .unified-panel-header-inner").append(ui.buttonMenu.$el);
// Hide bookmarks by default right now.
parent.force_right_panel("hide");
@@ -159,7 +86,7 @@
JSON.parse('${ h.to_json_string( config['bookmarks'] ) }'),
true
);
- init_editor();
+ ui.init_editor();
set_up_router({view: view});
%else:
var continue_fn = function() {
@@ -169,7 +96,7 @@
dbkey: $("#new-dbkey").val()
} );
view.editor = true;
- init_editor();
+ ui.init_editor();
set_up_router({view: view});
hide_modal();
};
https://bitbucket.org/galaxy/galaxy-central/changeset/65ecf4e0ed28/
changeset: 65ecf4e0ed28
user: james_taylor
date: 2012-09-17 22:24:27
summary: pack
affected #: 1 file
diff -r 5a61f51233861c6f7f4be41c5fd2de94d468ea61 -r 65ecf4e0ed28eaa2f3e64495ab800aa7c9779a54 static/scripts/packed/viz/trackster_ui.js
--- a/static/scripts/packed/viz/trackster_ui.js
+++ b/static/scripts/packed/viz/trackster_ui.js
@@ -1,1 +1,1 @@
-define(["base","libs/underscore","viz/trackster/slotting","viz/trackster/painters","viz/trackster/tracks"],function(f,c,g,d,b){var a=b.object_from_template;var e=f.Base.extend({initialize:function(h){this.baseURL=h},add_bookmarks:function(){var h=this.baseURL;show_modal("Select dataset for new bookmarks","progress");$.ajax({url:this.baseURL+"/visualization/list_histories",data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(j){show_modal("Select dataset for new bookmarks",j,{Cancel:function(){hide_modal()},Insert:function(){$("input[name=id]:checked,input[name=ldda_ids]:checked").first().each(function(){var k,l=$(this).val();if($(this).attr("name")==="id"){k={hda_id:l}}else{k={ldda_id:l}}$.ajax({url:this.baseURL+"/visualization/bookmarks_from_dataset",data:k,dataType:"json",}).then(function(m){for(i=0;i<m.data.length;i++){var n=m.data[i];add_bookmark(n[0],n[1])}})});hide_modal()}})}})},add_bookmark:function(m,k,h){var o=$("#bookmarks-container"),q=$("<div/>").addClass("bookmark").appendTo(o);var r=$("<div/>").addClass("position").appendTo(q),n=$("<a href=''/>").text(m).appendTo(r).click(function(){view.go_to(m);return false}),l=$("<div/>").text(k).appendTo(q);if(h){var p=$("<div/>").addClass("delete-icon-container").prependTo(q).click(function(){q.slideUp("fast");q.remove();view.has_changes=true;return false}),j=$("<a href=''/>").addClass("icon-button delete").appendTo(p);l.make_text_editable({num_rows:3,use_textarea:true,help_text:"Edit bookmark note"}).addClass("annotation")}view.has_changes=true;return q},create_visualization:function(l,h,k,m,j){view=new b.View(l);view.editor=true;$.when(view.load_chroms_deferred).then(function(){if(h){var v=h.chrom,n=h.start,s=h.end,p=h.overview;if(v&&(n!==undefined)&&s){view.change_chrom(v,n,s)}}if(k){var q,o,r;for(var t=0;t<k.length;t++){view.add_drawable(a(k[t],view,view))}}view.update_intro_div();var w;for(var t=0;t<view.drawables.length;t++){if(view.drawables[t].name===p){view.set_overview(view.drawables[t]);break}}if(m){var u;for(var t=0;t<m.length;t++){u=m[t];add_bookmark(u.position,u.annotation,j)}}view.has_changes=false});return view},init_keyboard_nav:function(h){$(document).keydown(function(j){if($(j.srcElement).is(":input")){return}switch(j.which){case 37:h.move_fraction(0.25);break;case 38:var k=Math.round(h.viewport_container.height()/15);h.viewport_container.scrollTop(h.viewport_container.scrollTop()-20);break;case 39:h.move_fraction(-0.25);break;case 40:var k=Math.round(h.viewport_container.height()/15);h.viewport_container.scrollTop(h.viewport_container.scrollTop()+20);break}})}});return{object_from_template:a,TracksterUI:e}});
\ No newline at end of file
+define(["base","libs/underscore","viz/trackster/slotting","viz/trackster/painters","viz/trackster/tracks"],function(f,c,g,d,b){var a=b.object_from_template;var e=f.Base.extend({initialize:function(h){this.baseURL=h},createButtonMenu:function(){var h=create_icon_buttons_menu([{icon_class:"plus-button",title:"Add tracks",on_click:function(){add_datasets(add_datasets_url,add_track_async_url,function(j){c.each(j,function(k){view.add_drawable(trackster_ui.object_from_template(k,view,view))})})}},{icon_class:"block--plus",title:"Add group",on_click:function(){view.add_drawable(new b.DrawableGroup(view,view,{name:"New Group"}))}},{icon_class:"bookmarks",title:"Bookmarks",on_click:function(){parent.force_right_panel(($("div#right").css("right")=="0px"?"hide":"show"))}},{icon_class:"globe",title:"Circster",on_click:function(){window.location="${h.url_for( controller='visualization', action='circster' )}?id="+view.vis_id}},{icon_class:"disk--arrow",title:"Save",on_click:function(){show_modal("Saving...","progress");var j=[];$(".bookmark").each(function(){j.push({position:$(this).children(".position").text(),annotation:$(this).children(".annotation").text()})});var k=(view.overview_drawable?view.overview_drawable.name:null),l={id:view.vis_id,title:view.name,dbkey:view.dbkey,type:"trackster",datasets:view.to_dict(),viewport:{chrom:view.chrom,start:view.low,end:view.high,overview:k},bookmarks:j};$.ajax({url:galaxy_paths.get("visualization_url"),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(l)}}).success(function(m){hide_modal();view.vis_id=m.vis_id;view.has_changes=false;window.history.pushState({},"",m.url+window.location.hash)}).error(function(){show_modal("Could Not Save","Could not save visualization. Please try again later.",{Close:hide_modal})})}},{icon_class:"cross-circle",title:"Close",on_click:function(){window.location="${h.url_for( controller='visualization', action='list' )}"}}],{tooltip_config:{placement:"bottom"}});this.buttonMenu=h;return h},add_bookmarks:function(){var h=this.baseURL;show_modal("Select dataset for new bookmarks","progress");$.ajax({url:this.baseURL+"/visualization/list_histories",data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(j){show_modal("Select dataset for new bookmarks",j,{Cancel:function(){hide_modal()},Insert:function(){$("input[name=id]:checked,input[name=ldda_ids]:checked").first().each(function(){var k,l=$(this).val();if($(this).attr("name")==="id"){k={hda_id:l}}else{k={ldda_id:l}}$.ajax({url:this.baseURL+"/visualization/bookmarks_from_dataset",data:k,dataType:"json",}).then(function(m){for(i=0;i<m.data.length;i++){var n=m.data[i];add_bookmark(n[0],n[1])}})});hide_modal()}})}})},add_bookmark:function(m,k,h){var o=$("#bookmarks-container"),q=$("<div/>").addClass("bookmark").appendTo(o);var r=$("<div/>").addClass("position").appendTo(q),n=$("<a href=''/>").text(m).appendTo(r).click(function(){view.go_to(m);return false}),l=$("<div/>").text(k).appendTo(q);if(h){var p=$("<div/>").addClass("delete-icon-container").prependTo(q).click(function(){q.slideUp("fast");q.remove();view.has_changes=true;return false}),j=$("<a href=''/>").addClass("icon-button delete").appendTo(p);l.make_text_editable({num_rows:3,use_textarea:true,help_text:"Edit bookmark note"}).addClass("annotation")}view.has_changes=true;return q},create_visualization:function(l,h,k,m,j){view=new b.View(l);view.editor=true;$.when(view.load_chroms_deferred).then(function(){if(h){var v=h.chrom,n=h.start,s=h.end,p=h.overview;if(v&&(n!==undefined)&&s){view.change_chrom(v,n,s)}}if(k){var q,o,r;for(var t=0;t<k.length;t++){view.add_drawable(a(k[t],view,view))}}view.update_intro_div();var w;for(var t=0;t<view.drawables.length;t++){if(view.drawables[t].name===p){view.set_overview(view.drawables[t]);break}}if(m){var u;for(var t=0;t<m.length;t++){u=m[t];add_bookmark(u.position,u.annotation,j)}}view.has_changes=false});return view},init_keyboard_nav:function(h){$(document).keydown(function(j){if($(j.srcElement).is(":input")){return}switch(j.which){case 37:h.move_fraction(0.25);break;case 38:var k=Math.round(h.viewport_container.height()/15);h.viewport_container.scrollTop(h.viewport_container.scrollTop()-20);break;case 39:h.move_fraction(-0.25);break;case 40:var k=Math.round(h.viewport_container.height()/15);h.viewport_container.scrollTop(h.viewport_container.scrollTop()+20);break}})}});return{object_from_template:a,TracksterUI:e}});
\ 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/changeset/67c3ec05a121/
changeset: 67c3ec05a121
user: james_taylor
date: 2012-09-17 22:14:52
summary: trackster: misc fixes and reorganization
affected #: 3 files
diff -r 9deeb2fec6612253de699cc7207ffba09775c88b -r 67c3ec05a12195d30a3fc0ce5247cbc4545027e3 static/scripts/base.js
--- a/static/scripts/base.js
+++ b/static/scripts/base.js
@@ -1,15 +1,15 @@
-define( "libs/backbone", function( backbone ) {
+define( ["libs/backbone/backbone"], function( Backbone ) {
var Base = function() {
if( this.initialize ) {
this.initialize.apply(this, arguments);
}
};
- Base.extend = backbone.Backbone.Model.extend;
+ Base.extend = Backbone.Model.extend;
return {
Base: Base,
- Backbone: backbone.Backbone
+ Backbone: Backbone
};
});
\ No newline at end of file
diff -r 9deeb2fec6612253de699cc7207ffba09775c88b -r 67c3ec05a12195d30a3fc0ce5247cbc4545027e3 static/scripts/viz/trackster_ui.js
--- a/static/scripts/viz/trackster_ui.js
+++ b/static/scripts/viz/trackster_ui.js
@@ -1,4 +1,4 @@
-define( ["libs/underscore","viz/trackster/slotting", "viz/trackster/painters","viz/trackster/tracks"], function( _, slotting, painters, tracks ) {
+define( ["base","libs/underscore","viz/trackster/slotting", "viz/trackster/painters","viz/trackster/tracks"], function( base, _, slotting, painters, tracks ) {
/************************************************************************
* Functions used for creating and managing the Trackster user interface.
@@ -6,139 +6,191 @@
var object_from_template = tracks.object_from_template;
-/**
- * Add bookmark.
- */
-var add_bookmark = function(position, annotation, editable) {
- // Create HTML.
- var bookmarks_container = $("#bookmarks-container"),
- new_bookmark = $("<div/>").addClass("bookmark").appendTo(bookmarks_container);
+var TracksterUI = base.Base.extend({
- var position_div = $("<div/>").addClass("position").appendTo(new_bookmark),
- position_link = $("<a href=''/>").text(position).appendTo(position_div).click(function() {
- view.go_to(position);
- return false;
- }),
- annotation_div = $("<div/>").text(annotation).appendTo(new_bookmark);
+ initialize: function( baseURL ) {
+ this.baseURL = baseURL;
+ },
- // If editable, enable bookmark deletion and annotation editing.
- if (editable) {
- var delete_icon_container = $("<div/>").addClass("delete-icon-container").prependTo(new_bookmark).click(function (){
- // Remove bookmark.
- new_bookmark.slideUp("fast");
- new_bookmark.remove();
- view.has_changes = true;
+ /**
+ * Use a popup to select a dataset of create bookmarks from
+ */
+ add_bookmarks: function() {
+ var baseURL = this.baseURL;
+ show_modal( "Select dataset for new bookmarks", "progress" );
+ $.ajax({
+ url: this.baseURL + "/visualization/list_histories",
+ data: { "f-dbkey": view.dbkey },
+ error: function() { alert( "Grid failed" ); },
+ success: function(table_html) {
+ show_modal(
+ "Select dataset for new bookmarks",
+ table_html, {
+ "Cancel": function() {
+ hide_modal();
+ },
+ "Insert": function() {
+ // Just use the first selected
+ $('input[name=id]:checked,input[name=ldda_ids]:checked').first().each(function(){
+ var data, id = $(this).val();
+ if ($(this).attr("name") === "id") {
+ data = { hda_id: id };
+ } else {
+ data = { ldda_id: id};
+ }
+
+ $.ajax({
+ url: this.baseURL + "/visualization/bookmarks_from_dataset",
+ data: data,
+ dataType: "json",
+ }).then( function(data) {
+ for( i = 0; i < data.data.length; i++ ) {
+ var row = data.data[i];
+ add_bookmark( row[0], row[1] );
+ }
+ });
+ });
+ hide_modal();
+ }
+ }
+ );
+ }
+ });
+ },
+
+ /**
+ * Add bookmark.
+ */
+ add_bookmark: function(position, annotation, editable) {
+ // Create HTML.
+ var bookmarks_container = $("#bookmarks-container"),
+ new_bookmark = $("<div/>").addClass("bookmark").appendTo(bookmarks_container);
+
+ var position_div = $("<div/>").addClass("position").appendTo(new_bookmark),
+ position_link = $("<a href=''/>").text(position).appendTo(position_div).click(function() {
+ view.go_to(position);
return false;
}),
- delete_icon = $("<a href=''/>").addClass("icon-button delete").appendTo(delete_icon_container);
- annotation_div.make_text_editable({
- num_rows: 3,
- use_textarea: true,
- help_text: "Edit bookmark note"
- }).addClass("annotation");
+ annotation_div = $("<div/>").text(annotation).appendTo(new_bookmark);
+
+ // If editable, enable bookmark deletion and annotation editing.
+ if (editable) {
+ var delete_icon_container = $("<div/>").addClass("delete-icon-container").prependTo(new_bookmark).click(function (){
+ // Remove bookmark.
+ new_bookmark.slideUp("fast");
+ new_bookmark.remove();
+ view.has_changes = true;
+ return false;
+ }),
+ delete_icon = $("<a href=''/>").addClass("icon-button delete").appendTo(delete_icon_container);
+ annotation_div.make_text_editable({
+ num_rows: 3,
+ use_textarea: true,
+ help_text: "Edit bookmark note"
+ }).addClass("annotation");
+ }
+
+ view.has_changes = true;
+ return new_bookmark;
+ },
+
+ /**
+ * Create a complete Trackster visualization. Returns view.
+ */
+ create_visualization: function(view_config, viewport_config, drawables_config, bookmarks_config, editable) {
+
+ // Create view.
+ view = new tracks.View(view_config);
+ view.editor = true;
+ $.when( view.load_chroms_deferred ).then(function() {
+ // Viewport config.
+ if (viewport_config) {
+ var
+ chrom = viewport_config.chrom,
+ start = viewport_config.start,
+ end = viewport_config.end,
+ overview_drawable_name = viewport_config.overview;
+
+ if (chrom && (start !== undefined) && end) {
+ view.change_chrom(chrom, start, end);
+ }
+ }
+
+ // Add drawables to view.
+ if (drawables_config) {
+ // FIXME: can from_dict() be used to create view and add drawables?
+ var drawable_config,
+ drawable_type,
+ drawable;
+ for (var i = 0; i < drawables_config.length; i++) {
+ view.add_drawable( object_from_template( drawables_config[i], view, view ) );
+ }
+ }
+
+ // Need to update intro div after drawables have been added.
+ view.update_intro_div();
+
+ // Set overview.
+ var overview_drawable;
+ for (var i = 0; i < view.drawables.length; i++) {
+ if (view.drawables[i].name === overview_drawable_name) {
+ view.set_overview(view.drawables[i]);
+ break;
+ }
+ }
+
+ // Load bookmarks.
+ if (bookmarks_config) {
+ var bookmark;
+ for (var i = 0; i < bookmarks_config.length; i++) {
+ bookmark = bookmarks_config[i];
+ add_bookmark(bookmark['position'], bookmark['annotation'], editable);
+ }
+ }
+
+ // View has no changes as of yet.
+ view.has_changes = false;
+ });
+
+ return view;
+ },
+
+ /**
+ * Set up keyboard navigation for a visualization.
+ */
+ init_keyboard_nav: function(view) {
+ // Keyboard navigation. Scroll ~7% of height when scrolling up/down.
+ $(document).keydown(function(e) {
+ // Do not navigate if arrow keys used in input element.
+ if ($(e.srcElement).is(':input')) {
+ return;
+ }
+
+ // Key codes: left == 37, up == 38, right == 39, down == 40
+ switch(e.which) {
+ case 37:
+ view.move_fraction(0.25);
+ break
+ case 38:
+ var change = Math.round(view.viewport_container.height()/15.0);
+ view.viewport_container.scrollTop( view.viewport_container.scrollTop() - 20);
+ break;
+ case 39:
+ view.move_fraction(-0.25);
+ break;
+ case 40:
+ var change = Math.round(view.viewport_container.height()/15.0);
+ view.viewport_container.scrollTop( view.viewport_container.scrollTop() + 20);
+ break;
+ }
+ });
}
- view.has_changes = true;
- return new_bookmark;
-};
-
-/**
- * Create a complete Trackster visualization. Returns view.
- */
-var create_visualization = function(view_config, viewport_config, drawables_config, bookmarks_config, editable) {
-
- // Create view.
- view = new tracks.View(view_config);
- view.editor = true;
- $.when( view.load_chroms_deferred ).then(function() {
- // Viewport config.
- if (viewport_config) {
- var
- chrom = viewport_config.chrom,
- start = viewport_config.start,
- end = viewport_config.end,
- overview_drawable_name = viewport_config.overview;
-
- if (chrom && (start !== undefined) && end) {
- view.change_chrom(chrom, start, end);
- }
- }
-
- // Add drawables to view.
- if (drawables_config) {
- // FIXME: can from_dict() be used to create view and add drawables?
- var drawable_config,
- drawable_type,
- drawable;
- for (var i = 0; i < drawables_config.length; i++) {
- view.add_drawable( object_from_template( drawables_config[i], view, view ) );
- }
- }
-
- // Need to update intro div after drawables have been added.
- view.update_intro_div();
-
- // Set overview.
- var overview_drawable;
- for (var i = 0; i < view.drawables.length; i++) {
- if (view.drawables[i].name === overview_drawable_name) {
- view.set_overview(view.drawables[i]);
- break;
- }
- }
-
- // Load bookmarks.
- if (bookmarks_config) {
- var bookmark;
- for (var i = 0; i < bookmarks_config.length; i++) {
- bookmark = bookmarks_config[i];
- add_bookmark(bookmark['position'], bookmark['annotation'], editable);
- }
- }
-
- // View has no changes as of yet.
- view.has_changes = false;
- });
-
- return view;
-};
-
-/**
- * Set up keyboard navigation for a visualization.
- */
- var init_keyboard_nav = function(view) {
- // Keyboard navigation. Scroll ~7% of height when scrolling up/down.
- $(document).keydown(function(e) {
- // Do not navigate if arrow keys used in input element.
- if ($(e.srcElement).is(':input')) {
- return;
- }
-
- // Key codes: left == 37, up == 38, right == 39, down == 40
- switch(e.which) {
- case 37:
- view.move_fraction(0.25);
- break
- case 38:
- var change = Math.round(view.viewport_container.height()/15.0);
- view.viewport_container.scrollTop( view.viewport_container.scrollTop() - 20);
- break;
- case 39:
- view.move_fraction(-0.25);
- break;
- case 40:
- var change = Math.round(view.viewport_container.height()/15.0);
- view.viewport_container.scrollTop( view.viewport_container.scrollTop() + 20);
- break;
- }
- });
-};
+});
return {
- add_bookmark: add_bookmark,
object_from_template: object_from_template,
- create_visualization: create_visualization,
- init_keyboard_nav: init_keyboard_nav
+ TracksterUI: TracksterUI
};
});
diff -r 9deeb2fec6612253de699cc7207ffba09775c88b -r 67c3ec05a12195d30a3fc0ce5247cbc4545027e3 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -31,12 +31,11 @@
require.config({
baseUrl: "${h.url_for('/static/scripts') }",
shim: {
- "libs/underscore": { exports: "_" }
+ "libs/underscore": { exports: "_" },
+ "libs/backbone/backbone": { exports: "Backbone" }
}
});
- require( ["viz/trackster_ui","viz/trackster/util","viz/trackster/tracks"], function( trackster_ui, util, tracks ) {
-
- var add_bookmark = trackster_ui.add_bookmark
+ require( ["base", "viz/trackster_ui","viz/trackster/util","viz/trackster/tracks"], function( base, trackster_ui, util, tracks ) {
//
// Place URLs here so that url_for can be used to generate them.
@@ -48,8 +47,9 @@
${render_trackster_js_vars()}
var view,
- browser_router;
-
+ browser_router,
+ ui = new (trackster_ui.TracksterUI)( "${h.url_for('/')}" );
+
/**
* Set up router.
*/
@@ -58,51 +58,7 @@
Backbone.history.start();
};
- /**
- * Use a popup grid to bookmarks from a dataset.
- */
- var add_bookmarks = function() {
- show_modal( "Select dataset for new bookmarks", "progress" );
- $.ajax({
- url: "${h.url_for( controller='visualization', action='list_histories' )}",
- data: { "f-dbkey": view.dbkey },
- error: function() { alert( "Grid failed" ); },
- success: function(table_html) {
- show_modal(
- "Select dataset for new bookmarks",
- table_html, {
- "Cancel": function() {
- hide_modal();
- },
- "Insert": function() {
- // Just use the first selected
- $('input[name=id]:checked,input[name=ldda_ids]:checked').first().each(function(){
- var data, id = $(this).val();
- if ($(this).attr("name") === "id") {
- data = { hda_id: id };
- } else {
- data = { ldda_id: id};
- }
- $.ajax({
- url: "${h.url_for( action='bookmarks_from_dataset' )}",
- data: data,
- dataType: "json",
- }).then( function(data) {
- for( i = 0; i < data.data.length; i++ ) {
- var row = data.data[i];
- add_bookmark( row[0], row[1] );
- }
- });
- });
- hide_modal();
- }
- }
- );
- }
- });
- };
-
var browser_router;
$(function() {
// Create and initialize menu.
@@ -192,7 +148,7 @@
$("#right-border").click(function() { view.resize_window(); });
%if config:
- view = trackster_ui.create_visualization( {
+ view = ui.create_visualization( {
container: $("#browser-container"),
name: "${config.get('title') | h}",
vis_id: "${config.get('vis_id')}",
@@ -262,7 +218,7 @@
// Add new bookmark.
var position = view.chrom + ":" + view.low + "-" + view.high,
annotation = "Bookmark description";
- return add_bookmark(position, annotation, true);
+ return ui.add_bookmark(position, annotation, true);
});
// make_popupmenu( $("#bookmarks-more-button"), {
@@ -271,7 +227,7 @@
// }
// });
- trackster_ui.init_keyboard_nav(view);
+ ui.init_keyboard_nav(view);
};
});
https://bitbucket.org/galaxy/galaxy-central/changeset/6c0bb542d2e0/
changeset: 6c0bb542d2e0
user: james_taylor
date: 2012-09-17 22:15:09
summary: pack scripts
affected #: 2 files
diff -r 67c3ec05a12195d30a3fc0ce5247cbc4545027e3 -r 6c0bb542d2e0cbda209e473db9d77a7076614f0d static/scripts/packed/base.js
--- a/static/scripts/packed/base.js
+++ b/static/scripts/packed/base.js
@@ -1,1 +1,1 @@
-define("libs/backbone",function(b){var a=function(){if(this.initialize){this.initialize.apply(this,arguments)}};a.extend=b.Backbone.Model.extend;return{Base:a,Backbone:b.Backbone}});
\ No newline at end of file
+define(["libs/backbone/backbone"],function(b){var a=function(){if(this.initialize){this.initialize.apply(this,arguments)}};a.extend=b.Model.extend;return{Base:a,Backbone:b}});
\ No newline at end of file
diff -r 67c3ec05a12195d30a3fc0ce5247cbc4545027e3 -r 6c0bb542d2e0cbda209e473db9d77a7076614f0d static/scripts/packed/viz/trackster_ui.js
--- a/static/scripts/packed/viz/trackster_ui.js
+++ b/static/scripts/packed/viz/trackster_ui.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/trackster/slotting","viz/trackster/painters","viz/trackster/tracks"],function(d,h,g,c){var a=c.object_from_template;var f=function(m,k,i){var o=$("#bookmarks-container"),q=$("<div/>").addClass("bookmark").appendTo(o);var r=$("<div/>").addClass("position").appendTo(q),n=$("<a href=''/>").text(m).appendTo(r).click(function(){view.go_to(m);return false}),l=$("<div/>").text(k).appendTo(q);if(i){var p=$("<div/>").addClass("delete-icon-container").prependTo(q).click(function(){q.slideUp("fast");q.remove();view.has_changes=true;return false}),j=$("<a href=''/>").addClass("icon-button delete").appendTo(p);l.make_text_editable({num_rows:3,use_textarea:true,help_text:"Edit bookmark note"}).addClass("annotation")}view.has_changes=true;return q};var b=function(l,i,k,m,j){view=new c.View(l);view.editor=true;$.when(view.load_chroms_deferred).then(function(){if(i){var v=i.chrom,n=i.start,s=i.end,p=i.overview;if(v&&(n!==undefined)&&s){view.change_chrom(v,n,s)}}if(k){var q,o,r;for(var t=0;t<k.length;t++){view.add_drawable(a(k[t],view,view))}}view.update_intro_div();var w;for(var t=0;t<view.drawables.length;t++){if(view.drawables[t].name===p){view.set_overview(view.drawables[t]);break}}if(m){var u;for(var t=0;t<m.length;t++){u=m[t];f(u.position,u.annotation,j)}}view.has_changes=false});return view};var e=function(i){$(document).keydown(function(j){if($(j.srcElement).is(":input")){return}switch(j.which){case 37:i.move_fraction(0.25);break;case 38:var k=Math.round(i.viewport_container.height()/15);i.viewport_container.scrollTop(i.viewport_container.scrollTop()-20);break;case 39:i.move_fraction(-0.25);break;case 40:var k=Math.round(i.viewport_container.height()/15);i.viewport_container.scrollTop(i.viewport_container.scrollTop()+20);break}})};return{add_bookmark:f,object_from_template:a,create_visualization:b,init_keyboard_nav:e}});
\ No newline at end of file
+define(["base","libs/underscore","viz/trackster/slotting","viz/trackster/painters","viz/trackster/tracks"],function(f,c,g,d,b){var a=b.object_from_template;var e=f.Base.extend({initialize:function(h){this.baseURL=h},add_bookmarks:function(){var h=this.baseURL;show_modal("Select dataset for new bookmarks","progress");$.ajax({url:this.baseURL+"/visualization/list_histories",data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(j){show_modal("Select dataset for new bookmarks",j,{Cancel:function(){hide_modal()},Insert:function(){$("input[name=id]:checked,input[name=ldda_ids]:checked").first().each(function(){var k,l=$(this).val();if($(this).attr("name")==="id"){k={hda_id:l}}else{k={ldda_id:l}}$.ajax({url:this.baseURL+"/visualization/bookmarks_from_dataset",data:k,dataType:"json",}).then(function(m){for(i=0;i<m.data.length;i++){var n=m.data[i];add_bookmark(n[0],n[1])}})});hide_modal()}})}})},add_bookmark:function(m,k,h){var o=$("#bookmarks-container"),q=$("<div/>").addClass("bookmark").appendTo(o);var r=$("<div/>").addClass("position").appendTo(q),n=$("<a href=''/>").text(m).appendTo(r).click(function(){view.go_to(m);return false}),l=$("<div/>").text(k).appendTo(q);if(h){var p=$("<div/>").addClass("delete-icon-container").prependTo(q).click(function(){q.slideUp("fast");q.remove();view.has_changes=true;return false}),j=$("<a href=''/>").addClass("icon-button delete").appendTo(p);l.make_text_editable({num_rows:3,use_textarea:true,help_text:"Edit bookmark note"}).addClass("annotation")}view.has_changes=true;return q},create_visualization:function(l,h,k,m,j){view=new b.View(l);view.editor=true;$.when(view.load_chroms_deferred).then(function(){if(h){var v=h.chrom,n=h.start,s=h.end,p=h.overview;if(v&&(n!==undefined)&&s){view.change_chrom(v,n,s)}}if(k){var q,o,r;for(var t=0;t<k.length;t++){view.add_drawable(a(k[t],view,view))}}view.update_intro_div();var w;for(var t=0;t<view.drawables.length;t++){if(view.drawables[t].name===p){view.set_overview(view.drawables[t]);break}}if(m){var u;for(var t=0;t<m.length;t++){u=m[t];add_bookmark(u.position,u.annotation,j)}}view.has_changes=false});return view},init_keyboard_nav:function(h){$(document).keydown(function(j){if($(j.srcElement).is(":input")){return}switch(j.which){case 37:h.move_fraction(0.25);break;case 38:var k=Math.round(h.viewport_container.height()/15);h.viewport_container.scrollTop(h.viewport_container.scrollTop()-20);break;case 39:h.move_fraction(-0.25);break;case 40:var k=Math.round(h.viewport_container.height()/15);h.viewport_container.scrollTop(h.viewport_container.scrollTop()+20);break}})}});return{object_from_template:a,TracksterUI:e}});
\ 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