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
November 2012
- 1 participants
- 133 discussions
commit/galaxy-central: greg: Per James Johnson, handle files with a .tar extension when installing tool dependencies along with a tool shed repository.
by Bitbucket 06 Nov '12
by Bitbucket 06 Nov '12
06 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/dd4786c5b4e4/
changeset: dd4786c5b4e4
user: greg
date: 2012-11-06 14:38:52
summary: Per James Johnson, handle files with a .tar extension when installing tool dependencies along with a tool shed repository.
affected #: 1 file
diff -r b996950ffcf2342f1211dc49e6ca75c4dfd7050f -r dd4786c5b4e48db780f6ec5da42dfafec19538f4 lib/galaxy/tool_shed/tool_dependencies/common_util.py
--- a/lib/galaxy/tool_shed/tool_dependencies/common_util.py
+++ b/lib/galaxy/tool_shed/tool_dependencies/common_util.py
@@ -93,7 +93,7 @@
def tar_extraction_directory( file_path, file_name ):
"""Try to return the correct extraction directory."""
file_name = file_name.strip()
- extensions = [ '.tar.gz', '.tgz', '.tar.bz2', '.zip' ]
+ extensions = [ '.tar.gz', '.tgz', '.tar.bz2', '.tar', '.zip' ]
for extension in extensions:
if file_name.find( extension ) > 0:
dir_name = file_name[ :-len( extension ) ]
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
7 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/74f946b09dd0/
changeset: 74f946b09dd0
user: carlfeberhard
date: 2012-11-05 22:42:16
summary: util/debugging.py: add stack trace formatter
affected #: 1 file
diff -r 9d6a61f060d359a0289b3163990f6a8ba122d253 -r 74f946b09dd06341a02d009a81c00e25dd5dfb59 lib/galaxy/util/debugging.py
--- /dev/null
+++ b/lib/galaxy/util/debugging.py
@@ -0,0 +1,29 @@
+
+import inspect
+import pprint
+
+import logging
+log = logging.getLogger( __name__ )
+
+def stack_trace_string( max_depth=None, line_format="{index}:{file}:{function}:{line}" ):
+ """
+ Returns a string representation of the current stack.
+
+ :param depth: positive integer to control how many levels of the stack are
+ returned. max_depth=None returns the entire stack (default).
+ """
+ stack_list = []
+ for index, caller in enumerate( inspect.stack() ):
+ # don't include this function
+ if index == 0: continue
+ if max_depth and index > max_depth: break
+
+ caller_data = {
+ 'index' : str( index ),
+ 'file' : caller[1],
+ 'function' : caller[3],
+ 'line' : caller[2]
+ }
+ stack_list.append( line_format.format( **caller_data ) )
+
+ return '\n'.join( stack_list )
https://bitbucket.org/galaxy/galaxy-central/changeset/472a8f0ef7f5/
changeset: 472a8f0ef7f5
user: carlfeberhard
date: 2012-11-05 22:45:10
summary: fix to model/__init__: was importing sys from galaxy.web.form_builder.*
affected #: 1 file
diff -r 74f946b09dd06341a02d009a81c00e25dd5dfb59 -r 472a8f0ef7f5517d20cecaa8a0a65d952fc7d35e lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -18,7 +18,7 @@
from galaxy.model.item_attrs import UsesAnnotations, APIItem
from sqlalchemy.orm import object_session
from sqlalchemy.sql.expression import func
-import os.path, os, errno, codecs, operator, socket, pexpect, logging, time, shutil
+import sys, os.path, os, errno, codecs, operator, socket, pexpect, logging, time, shutil
if sys.version_info[:2] < ( 2, 5 ):
from sets import Set as set
https://bitbucket.org/galaxy/galaxy-central/changeset/613df4d4ca7d/
changeset: 613df4d4ca7d
user: carlfeberhard
date: 2012-11-05 22:47:14
summary: comments & docs for QuotaAgent.get_percent
affected #: 1 file
diff -r 472a8f0ef7f5517d20cecaa8a0a65d952fc7d35e -r 613df4d4ca7d41c240311991022148dedb2e620d lib/galaxy/quota/__init__.py
--- a/lib/galaxy/quota/__init__.py
+++ b/lib/galaxy/quota/__init__.py
@@ -122,20 +122,26 @@
dqa = self.model.DefaultQuotaAssociation( default_type, quota )
self.sa_session.add( dqa )
self.sa_session.flush()
+
def get_percent( self, trans=None, user=False, history=False, usage=False, quota=False ):
+ """
+ Return the percentage of any storage quota applicable to the user/transaction.
+ """
+ # if trans passed, use it to get the user, history (instead of/override vals passed)
if trans:
user = trans.user
history = trans.history
+ # if quota wasn't passed, attempt to get the quota
if quota is False:
quota = self.get_quota( user )
+ # return none if no applicable quotas or quotas disabled
if quota is None:
return None
+ # get the usage, if it wasn't passed
if usage is False:
usage = self.get_usage( trans, user, history )
- percent = int( float( usage ) / quota * 100 )
- if percent > 100:
- percent = 100
- return percent
+ return min( ( int( float( usage ) / quota * 100 ), 100 ) )
+
def set_entity_quota_associations( self, quotas=[], users=[], groups=[], delete_existing_assocs=True ):
for quota in quotas:
if delete_existing_assocs:
https://bitbucket.org/galaxy/galaxy-central/changeset/c57bcb1d78fc/
changeset: c57bcb1d78fc
user: carlfeberhard
date: 2012-11-05 22:49:58
summary: api/history_contents: allow anon-user to query own, current history; improve doc string
affected #: 1 file
diff -r 613df4d4ca7d41c240311991022148dedb2e620d -r c57bcb1d78fcb49e8b856a0c4e28d59626e3403f lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -26,51 +26,100 @@
def index( self, trans, history_id, ids=None, **kwd ):
"""
GET /api/histories/{encoded_history_id}/contents
- Displays a collection (list) of history contents
+ Displays a collection (list) of history contents (HDAs)
+
+ :param history_id: an encoded id string of the `History` to search
+ :param ids: (optional) a comma separated list of encoded `HDA` ids
+
+ If Ids is not given, index returns a list of *summary* json objects for
+ every `HDA` associated with the given `history_id`.
+ See _summary_hda_dict.
+
+ If ids is given, index returns a *more complete* json object for each
+ HDA in the ids list.
+
+ Note: Anonymous users are allowed to get their current history contents
+ (generally useful for browser UI access of the api)
"""
rval = []
try:
- history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True )
+ # get the history, if anon user and requesting current history - allow it
+ if( ( trans.user == None )
+ and ( history_id == trans.security.encode_id( trans.history.id ) ) ):
+ #TODO:?? is secure?
+ history = trans.history
- # if no ids passed, return a _SUMMARY_ of _all_ datasets in the history
- if not ids:
- for dataset in history.datasets:
- api_type = "file"
- encoded_id = trans.security.encode_id( dataset.id )
- # build the summary
- rval.append( dict( id = encoded_id,
- type = api_type,
- name = dataset.name,
- url = url_for( 'history_content', history_id=history_id, id=encoded_id, ) ) )
+ # otherwise, check permissions for the history first
+ else:
+ history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True )
- # if ids, return _FULL_ data (as show) for each id passed
- #NOTE: this might not be the best form (passing all info),
- # but we(I?) need an hda collection with full data somewhere
+ # build the return hda data list
+ if ids:
+ # if ids, return _FULL_ data (as show) for each id passed
+ #NOTE: this might not be the best form (passing all info),
+ # but we(I?) need an hda collection with full data somewhere
+ ids = ids.split( ',' )
+ for hda in history.datasets:
+ if trans.security.encode_id( hda.id ) in ids:
+ rval.append( get_hda_dict( trans, history, hda, for_editing=True ) )
+
else:
- ids = ids.split( ',' )
- for id in ids:
- hda = self.get_history_dataset_association( trans, history, id,
- check_ownership=True, check_accessible=True, check_state=False )
- rval.append( get_hda_dict( trans, history, hda, for_editing=True ) )
+ # if no ids passed, return a _SUMMARY_ of _all_ datasets in the history
+ for hda in history.datasets:
+ rval.append( self._summary_hda_dict( trans, history_id, hda ) )
except Exception, e:
rval = "Error in history API at listing contents"
- log.error( rval + ": %s" % str(e) )
+ log.error( rval + ": %s, %s" % ( type( e ), str( e ) ) )
trans.response.status = 500
+
return rval
+ def _summary_hda_dict( self, trans, history_id, hda ):
+ """
+ Returns a dictionary based on the HDA in .. _summary form::
+ {
+ 'id' : < the encoded dataset id >,
+ 'name' : < currently only returns 'file' >,
+ 'type' : < name of the dataset >,
+ 'url' : < api url to retrieve this datasets full data >,
+ }
+ """
+ api_type = "file"
+ encoded_id = trans.security.encode_id( hda.id )
+ return {
+ 'id' : encoded_id,
+ 'name' : hda.name,
+ 'type' : api_type,
+ 'url' : url_for( 'history_content', history_id=history_id, id=encoded_id, ),
+ }
+
@web.expose_api
def show( self, trans, id, history_id, **kwd ):
"""
GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}
Displays information about a history content (dataset).
+
+
"""
hda_dict = {}
try:
- history = self.get_history( trans, history_id,
- check_ownership=True, check_accessible=True, deleted=False )
- hda = self.get_history_dataset_association( trans, history, id,
- check_ownership=True, check_accessible=True )
+ # for anon users:
+ #TODO: check login_required?
+ #TODO: this isn't actually most_recently_used (as defined in histories)
+ if( ( trans.user == None )
+ and ( history_id == trans.security.encode_id( trans.history.id ) ) ):
+ history = trans.history
+ #TODO: dataset/hda by id (from history) OR check_ownership for anon user
+ hda = self.get_history_dataset_association( trans, history, id,
+ check_ownership=False, check_accessible=True )
+
+ else:
+ history = self.get_history( trans, history_id,
+ check_ownership=True, check_accessible=True, deleted=False )
+ hda = self.get_history_dataset_association( trans, history, id,
+ check_ownership=True, check_accessible=True )
+
hda_dict = get_hda_dict( trans, history, hda, for_editing=True )
except Exception, e:
@@ -112,7 +161,7 @@
return "Not implemented."
-# move these into model?? hell if I know...doesn't seem like the urls should go here
+#TODO: move these into model
def get_hda_dict( trans, history, hda, for_editing ):
hda_dict = hda.get_api_value( view='element' )
@@ -146,13 +195,14 @@
if meta_files:
hda_dict[ 'meta_files' ] = meta_files
- #hda_dict[ 'display_apps' ] = get_display_apps( trans, hda )
+ hda_dict[ 'display_apps' ] = get_display_apps( trans, hda )
hda_dict[ 'visualizations' ] = hda.get_visualizations()
hda_dict[ 'peek' ] = to_unicode( hda.display_peek() )
return hda_dict
def get_display_apps( trans, hda ):
+ #TODO: make more straightforward (somehow)
display_apps = []
def get_display_app_url( display_app_link, hda, trans ):
@@ -165,7 +215,6 @@
app_name=urllib.quote_plus( display_app_link.display_application.id ),
link_name=urllib.quote_plus( display_app_link.id ) )
-
for display_app in hda.get_display_applications( trans ).itervalues():
app_links = []
for display_app_link in display_app.links.itervalues():
https://bitbucket.org/galaxy/galaxy-central/changeset/7942fb2a20c5/
changeset: 7942fb2a20c5
user: carlfeberhard
date: 2012-11-05 22:51:58
summary: api/users.show: added current as viable id to display json for trans.user; show, index: added key 'auota_percent' to json, returns null if no quota on user, percent otherwise
affected #: 1 file
diff -r c57bcb1d78fcb49e8b856a0c4e28d59626e3403f -r 7942fb2a20c5bd4b66f02e5f58335fc1b74cb040 lib/galaxy/webapps/galaxy/api/users.py
--- a/lib/galaxy/webapps/galaxy/api/users.py
+++ b/lib/galaxy/webapps/galaxy/api/users.py
@@ -26,6 +26,7 @@
# only admins can see deleted users
if not trans.user_is_admin():
return []
+
else:
route = 'user'
query = query.filter( trans.app.model.User.table.c.deleted == False )
@@ -33,9 +34,13 @@
if not trans.user_is_admin():
item = trans.user.get_api_value( value_mapper={ 'id': trans.security.encode_id } )
item['url'] = url_for( route, id=item['id'] )
+ item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans )
return [item]
+
for user in query:
item = user.get_api_value( value_mapper={ 'id': trans.security.encode_id } )
+ #TODO: move into api_values
+ item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans )
item['url'] = url_for( route, id=item['id'] )
rval.append( item )
return rval
@@ -50,20 +55,36 @@
"""
deleted = util.string_as_bool( deleted )
try:
+ # user is requesting data about themselves
if id == "current":
- user = trans.user
+ # ...and is anonymous - return usage and quota (if any)
+ if not trans.user:
+ item = self.anon_user_api_value( trans )
+ return item
+
+ # ...and is logged in - return full
+ else:
+ user = trans.user
else:
user = self.get_user( trans, id, deleted=deleted )
+
+ # check that the user is requesting themselves (and they aren't del'd) unless admin
if not trans.user_is_admin():
assert trans.user == user
assert not user.deleted
+
except:
if trans.user_is_admin():
raise
else:
raise HTTPBadRequest( detail='Invalid user id ( %s ) specified' % id )
+
item = user.get_api_value( view='element', value_mapper={ 'id': trans.security.encode_id,
'total_disk_usage': float } )
+ #TODO: move into api_values (needs trans, tho - can we do that with api_keys/@property??)
+ #TODO: works with other users (from admin)??
+ item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans )
+
return item
@web.expose_api
@@ -93,3 +114,16 @@
@web.expose_api
def undelete( self, trans, **kwd ):
raise HTTPNotImplemented()
+
+ #TODO: move to more basal, common resource than this
+ def anon_user_api_value( self, trans ):
+ """
+ Returns data for an anonymous user, truncated to only usage and quota_percent
+ """
+ usage = trans.app.quota_agent.get_usage( trans )
+ percent = trans.app.quota_agent.get_percent( trans=trans, usage=usage )
+ return {
+ 'total_disk_usage' : int( usage ),
+ 'nice_total_disk_usage' : util.nice_size( usage ),
+ 'quota_percent' : percent
+ }
https://bitbucket.org/galaxy/galaxy-central/changeset/24ce9866b5af/
changeset: 24ce9866b5af
user: carlfeberhard
date: 2012-11-05 22:56:28
summary: added user backbone model; added quota meter view on user model
affected #: 5 files
diff -r 7942fb2a20c5bd4b66f02e5f58335fc1b74cb040 -r 24ce9866b5af82325d2047b5d6c346ceae64c041 static/scripts/mvc/user/user-model.js
--- /dev/null
+++ b/static/scripts/mvc/user/user-model.js
@@ -0,0 +1,56 @@
+var User = BaseModel.extend( LoggableMixin ).extend({
+ //logger : console,
+
+ defaults : {
+ id : null,
+ username : "(anonymous user)",
+ email : "",
+ total_disk_usage : 0,
+ nice_total_disk_usage : "0 bytes"
+ },
+
+ initialize : function( data ){
+ this.log( 'User.initialize:', data );
+
+ this.on( 'loaded', function( model, resp ){ this.log( this + ' has loaded:', model, resp ); });
+ this.on( 'change', function( model, data ){ this.log( this + ' has changed:', model, data.changes ); });
+ },
+
+ urlRoot : 'api/users',
+ loadFromApi : function( idOrCurrent, options ){
+ idOrCurrent = idOrCurrent || User.CURRENT_ID_STR;
+ options = options || {};
+ var model = this,
+ userFn = options.success;
+ options.success = function( model, response ){
+ model.trigger( 'loaded', model, response );
+ if( userFn ){ userFn( model, response ); }
+ };
+ if( idOrCurrent === User.CURRENT_ID_STR ){
+ options.url = this.urlRoot + '/' + User.CURRENT_ID_STR;
+ }
+ return BaseModel.prototype.fetch.call( this, options );
+ },
+
+ toString : function(){
+ var userInfo = [ this.get( 'username' ) ];
+ if( this.get( 'id' ) ){
+ userInfo.unshift( this.get( 'id' ) );
+ userInfo.push( this.get( 'email' ) );
+ }
+ return 'User(' + userInfo.join( ':' ) + ')';
+ }
+});
+User.CURRENT_ID_STR = 'current';
+
+User.getCurrentUserFromApi = function( options ){
+ var currentUser = new User();
+ currentUser.loadFromApi( User.CURRENT_ID_STR, options );
+ return currentUser;
+};
+
+var UserCollection = Backbone.Collection.extend( LoggableMixin ).extend({
+ model : User,
+ logger : console,
+ urlRoot : 'api/users'
+});
diff -r 7942fb2a20c5bd4b66f02e5f58335fc1b74cb040 -r 24ce9866b5af82325d2047b5d6c346ceae64c041 static/scripts/mvc/user/user-quotameter.js
--- /dev/null
+++ b/static/scripts/mvc/user/user-quotameter.js
@@ -0,0 +1,118 @@
+// strange view that spans two frames: renders to two separate elements based on a User's disk usage:
+// a quota/usage bar (curr. masthead), and
+// an over-quota message (curr. history panel)
+
+// for now, keep the view in the history panel (where the message is), but render ALSO to the masthead
+
+var UserQuotaMeter = BaseView.extend( LoggableMixin ).extend({
+ logger : console,
+
+ options : {
+ warnAtPercent : 85,
+ errorAtPercent : 100,
+
+ // the quota/usage bar is in the masthead
+ meterDocument : window.top.document,
+ containerSelector : '.quota-meter-container',
+ meterSelector : '#quota-meter',
+ barSelector : '#quota-meter-bar',
+ textSelector : '#quota-meter-text',
+
+ // the quota message currently displays in the history panel
+ msgDocument : ( top.frames.galaxy_history )?( top.frames.galaxy_history.document )
+ :( top.document ),
+ msgSelector : '#quota-message-container',
+
+ warnClass : 'quota-meter-bar-warn',
+ errorClass : 'quota-meter-bar-error',
+ usageTemplate : 'Using <%= nice_total_disk_usage %>',
+ quotaTemplate : 'Using <%= quota_percent %>%',
+ meterTemplate : '', // see where I'm going?
+ animationSpeed : 'fast'
+ },
+
+ initialize : function( options ){
+ this.log( this + '.initialize:', options );
+
+ _.extend( this.options, options );
+
+ //this.bind( 'all', function( event, data ){ this.log( this + ' event:', event, data ); }, this );
+ this.model.bind( 'change:quota_percent change:total_disk_usage', this.render, this );
+ },
+
+ update : function( options ){
+ this.log( this + ' updating user data...', options );
+ this.model.loadFromApi( this.model.get( 'id' ), options );
+ return this;
+ },
+
+ isOverQuota : function(){
+ return ( this.model.get( 'quota_percent' ) !== null
+ && this.model.get( 'quota_percent' ) >= this.options.errorAtPercent );
+ },
+
+ _render_quota : function(){
+ var modelJson = this.model.toJSON(),
+ //prevPercent = this.model.previous( 'quota_percent' ),
+ percent = modelJson.quota_percent,
+ meter = $( UserQuotaMeter.templates.quota( modelJson ) );
+ //this.log( this + '.rendering quota, percent:', percent, 'meter:', meter );
+
+ // OVER QUOTA: color the quota bar and show the quota error message
+ if( this.isOverQuota() ){
+ //this.log( '\t over quota' );
+ meter.addClass( 'progress-danger' );
+ meter.find( '#quota-meter-text' ).css( 'color', 'white' );
+ //TODO: only trigger event if state has changed
+ this.trigger( 'quota:over', modelJson );
+
+ // APPROACHING QUOTA: color the quota bar
+ } else if( percent >= this.options.warnAtPercent ){
+ //this.log( '\t approaching quota' );
+ meter.addClass( 'progress-warning' );
+ //TODO: only trigger event if state has changed
+ this.trigger( 'quota:under quota:under:approaching', modelJson );
+
+ // otherwise, hide/don't use the msg box
+ } else {
+ meter.addClass( 'progress-success' );
+ //TODO: only trigger event if state has changed
+ this.trigger( 'quota:under quota:under:ok', modelJson );
+ }
+ return meter;
+ },
+
+ _render_usage : function(){
+ var usage = $( UserQuotaMeter.templates.usage( this.model.toJSON() ) );
+ this.log( this + '.rendering usage:', usage );
+ return usage;
+ },
+
+ render : function(){
+ //this.log( this + '.rendering' );
+ var meterHtml = null;
+
+ // no quota on server ('quota_percent' === null (can be valid at 0)), show usage instead
+ this.log( this + '.model.quota_percent:', this.model.get( 'quota_percent' ) );
+ if( ( this.model.get( 'quota_percent' ) === null )
+ || ( this.model.get( 'quota_percent' ) === undefined ) ){
+ meterHtml = this._render_usage();
+
+ // otherwise, render percent of quota (and warning, error)
+ } else {
+ meterHtml = this._render_quota();
+ }
+
+ this.$el.html( meterHtml );
+ //this.log( this + '.$el:', this.$el );
+ return this;
+ },
+
+ toString : function(){
+ return 'UserQuotaMeter(' + this.model + ')';
+ }
+});
+UserQuotaMeter.templates = {
+ quota : Handlebars.templates[ 'template-user-quotaMeter-quota' ],
+ usage : Handlebars.templates[ 'template-user-quotaMeter-usage' ]
+};
diff -r 7942fb2a20c5bd4b66f02e5f58335fc1b74cb040 -r 24ce9866b5af82325d2047b5d6c346ceae64c041 static/scripts/templates/compiled/template-user-quotaMeter-quota.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-user-quotaMeter-quota.js
@@ -0,0 +1,19 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-user-quotaMeter-quota'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
+
+
+ buffer += "<div id=\"quota-meter\" class=\"quota-meter progress\">\n <div id=\"quota-meter-bar\" class=\"quota-meter-bar bar\" style=\"width: ";
+ foundHelper = helpers.quota_percent;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.quota_percent; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "%\"></div>\n ";
+ buffer += "\n <div id=\"quota-meter-text\" class=\"quota-meter-text\"style=\"top: 6px\">\n Using ";
+ foundHelper = helpers.quota_percent;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.quota_percent; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "%\n </div>\n</div>";
+ return buffer;});
+})();
\ No newline at end of file
diff -r 7942fb2a20c5bd4b66f02e5f58335fc1b74cb040 -r 24ce9866b5af82325d2047b5d6c346ceae64c041 static/scripts/templates/compiled/template-user-quotaMeter-usage.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-user-quotaMeter-usage.js
@@ -0,0 +1,14 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-user-quotaMeter-usage'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
+
+
+ buffer += "\n<div id=\"quota-meter\" class=\"quota-meter\" style=\"background-color: transparent\">\n <div id=\"quota-meter-text\" class=\"quota-meter-text\" style=\"top: 6px; color: white\">\n Using ";
+ foundHelper = helpers.nice_total_disk_usage;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.nice_total_disk_usage; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "\n </div>\n</div>";
+ return buffer;});
+})();
\ No newline at end of file
diff -r 7942fb2a20c5bd4b66f02e5f58335fc1b74cb040 -r 24ce9866b5af82325d2047b5d6c346ceae64c041 static/scripts/templates/ui-templates.html
--- /dev/null
+++ b/static/scripts/templates/ui-templates.html
@@ -0,0 +1,18 @@
+<script type="text/template" class="template-history" id="template-user-quotaMeter-quota">
+<div id="quota-meter" class="quota-meter progress">
+ <div id="quota-meter-bar" class="quota-meter-bar bar" style="width: {{quota_percent}}%"></div>
+ {{! TODO: remove the hardcoded style }}
+ <div id="quota-meter-text" class="quota-meter-text"style="top: 6px">
+ Using {{ quota_percent }}%
+ </div>
+</div>
+</script>
+
+<script type="text/template" class="template-history" id="template-user-quotaMeter-usage">
+{{! TODO: remove the hardcoded styles }}
+<div id="quota-meter" class="quota-meter" style="background-color: transparent">
+ <div id="quota-meter-text" class="quota-meter-text" style="top: 6px; color: white">
+ Using {{ nice_total_disk_usage }}
+ </div>
+</div>
+</script>
https://bitbucket.org/galaxy/galaxy-central/changeset/b996950ffcf2/
changeset: b996950ffcf2
user: carlfeberhard
date: 2012-11-05 22:59:20
summary: (alt)history: incorporate quota meter; bugifxes
affected #: 4 files
diff -r 24ce9866b5af82325d2047b5d6c346ceae64c041 -r b996950ffcf2342f1211dc49e6ca75c4dfd7050f static/scripts/mvc/history.js
--- a/static/scripts/mvc/history.js
+++ b/static/scripts/mvc/history.js
@@ -6,19 +6,44 @@
Backbone.js implementation of history panel
TODO:
+ bug:
+ anon, mako:
+ tooltips not rendered
+ anno, tags rendered
+ title editable
+ bug:
+ when over quota history is re-rendered, over quota msg is not displayed
+ bc the quota:over event isn't fired
+ bc the user state hasn't changed
+
+ anon user, mako template init:
+ bug: rename url seems to be wrong url
+
currently, adding a dataset (via tool execute, etc.) creates a new dataset and refreshes the page
- from mako template:
+ logged in, mako template:
+ BUG: am able to start upload even if over quota - 'runs' forever
+
+ BUG: from above sit, delete uploading hda - now in state 'discarded'! ...new state to handle
+ bug: quotaMeter bar rendering square in chrome
+ BUG: quotaMsg not showing when 100% (on load)
+ BUG: upload, history size, doesn't change
+ TODO: on hdas state:final, update ONLY the size...from what? histories.py? in js?
BUG: imported, shared history with unaccessible dataset errs in historycontents when getting history
(entire history is inaccessible)
- BUG: anon user, broken updater (upload)
- added check_state to UsesHistoryDatasetAssocMixin
- BUG: anon user
- BUG: historyItem, error'd ds show display, download?
+ ??: still happening?
- from loadFromAPI:
+ from loadFromApi:
BUG: not showing previous annotations
fixed:
+ BUG: historyItem, error'd ds show display, download?
+ FIXED: removed
+ bug: loading hdas (alt_hist)
+ FIXED: added anon user api request ( trans.user == None and trans.history.id == requested id )
+ bug: quota meter not updating on upload/tool run
+ FIXED: quotaMeter now listens for 'state:final' from glx_history in alternate_history.mako
+ bug: use of new HDACollection with event listener in init doesn't die...keeps reporting
+ FIXED: change getVisible to return an array
BUG: history, broken intial hist state (running, updater, etc.)
??: doesn't seem to happen anymore
BUG: collapse all should remove all expanded from storage
@@ -40,16 +65,16 @@
HDACollection, meta_files, display_apps, etc.
- break this file up
- localize all
- ?: render url templates on init or render?
- ?: history, annotation won't accept unicode
quota mgr
show_deleted/hidden:
use storage
on/off ui
move histview fadein/out in render to app?
don't draw body until it's first expand event
+ localize all
+ break this file up
+ ?: render url templates on init or render?
+ ?: history, annotation won't accept unicode
hierarchy:
dataset -> hda
@@ -62,6 +87,7 @@
css/html class/id 'item' -> hda
add classes, ids on empty divs
events (local/ui and otherwise)
+ list in docs as well
require.js
convert function comments to jsDoc style, complete comments
move inline styles into base.less
@@ -118,7 +144,7 @@
// based on trans.user (is_admin or security_agent.can_access_dataset( <user_roles>, hda.dataset ))
accessible : false,
- // this needs to be removed (it is a function of the view type (e.g. HDAForEditingView))
+ //TODO: this needs to be removed (it is a function of the view type (e.g. HDAForEditingView))
for_editing : true
},
@@ -139,8 +165,14 @@
this.set( 'state', HistoryDatasetAssociation.STATES.NOT_VIEWABLE );
}
- this.on( 'change', function( event, x, y, z ){
- this.log( this + ' has changed:', event, x, y, z );
+ //this.on( 'change', function( currModel, changedList ){
+ // this.log( this + ' has changed:', currModel, changedList );
+ //});
+ this.on( 'change:state', function( currModel, newState ){
+ this.log( this + ' has changed state:', currModel, newState );
+ if( this.inFinalState() ){
+ this.trigger( 'state:final', currModel, newState, this.previous( 'state' ) );
+ }
});
},
@@ -148,15 +180,6 @@
return ( this.get( 'deleted' ) || this.get( 'purged' ) );
},
- // roughly can_edit from history_common.mako - not deleted or purged = editable
- isEditable : function(){
- return (
- //this.get( 'for_editing' )
- //&& !( this.get( 'deleted' ) || this.get( 'purged' ) )??
- !this.isDeletedOrPurged()
- );
- },
-
// based on show_deleted, show_hidden (gen. from the container control), would this ds show in the list of ds's?
//TODO: too many visibles
isVisible : function( show_deleted, show_hidden ){
@@ -174,11 +197,15 @@
// 'final' states are states where no processing (for the ds) is left to do on the server
inFinalState : function(){
+ var state = this.get( 'state' );
return (
- ( this.get( 'state' ) === HistoryDatasetAssociation.STATES.OK )
- || ( this.get( 'state' ) === HistoryDatasetAssociation.STATES.FAILED_METADATA )
- || ( this.get( 'state' ) === HistoryDatasetAssociation.STATES.EMPTY )
- || ( this.get( 'state' ) === HistoryDatasetAssociation.STATES.ERROR )
+ ( state === HistoryDatasetAssociation.STATES.NEW )
+ || ( state === HistoryDatasetAssociation.STATES.OK )
+ || ( state === HistoryDatasetAssociation.STATES.EMPTY )
+ || ( state === HistoryDatasetAssociation.STATES.FAILED_METADATA )
+ || ( state === HistoryDatasetAssociation.STATES.NOT_VIEWABLE )
+ || ( state === HistoryDatasetAssociation.STATES.DISCARDED )
+ || ( state === HistoryDatasetAssociation.STATES.ERROR )
);
},
@@ -199,24 +226,32 @@
//------------------------------------------------------------------------------
HistoryDatasetAssociation.STATES = {
- NOT_VIEWABLE : 'noPermission', // not in trans.app.model.Dataset.states
- NEW : 'new',
UPLOAD : 'upload',
QUEUED : 'queued',
RUNNING : 'running',
+ SETTING_METADATA : 'setting_metadata',
+
+ NEW : 'new',
OK : 'ok',
EMPTY : 'empty',
- ERROR : 'error',
+
+ FAILED_METADATA : 'failed_metadata',
+ NOT_VIEWABLE : 'noPermission', // not in trans.app.model.Dataset.states
DISCARDED : 'discarded',
- SETTING_METADATA : 'setting_metadata',
- FAILED_METADATA : 'failed_metadata'
+ ERROR : 'error'
};
//==============================================================================
var HDACollection = Backbone.Collection.extend( LoggableMixin ).extend({
model : HistoryDatasetAssociation,
- logger : console,
+ //logger : console,
+
+ initialize : function(){
+ //this.bind( 'all', function( x, y, z ){
+ // console.info( this + '', x, y, z );
+ //});
+ },
// return the ids of every hda in this collection
ids : function(){
@@ -225,9 +260,7 @@
// return an HDA collection containing every 'shown' hda based on show_deleted/hidden
getVisible : function( show_deleted, show_hidden ){
- return new HDACollection(
- this.filter( function( item ){ return item.isVisible( show_deleted, show_hidden ); })
- );
+ return this.filter( function( item ){ return item.isVisible( show_deleted, show_hidden ); });
},
// get a map where <possible hda state> : [ <list of hda ids in that state> ]
@@ -243,6 +276,17 @@
return stateLists;
},
+ // returns the id of every hda still running (not in a final state)
+ running : function(){
+ var idList = [];
+ this.each( function( item ){
+ if( !item.inFinalState() ){
+ idList.push( item.get( 'id' ) );
+ }
+ });
+ return idList;
+ },
+
// update (fetch -> render) the hdas with the ids given
update : function( ids ){
this.log( this + 'update:', ids );
@@ -307,13 +351,13 @@
this.checkForUpdates();
}
- this.on( 'change', function( event, x, y, z ){
- this.log( this + ' has changed:', event, x, y, z );
- });
+ //this.on( 'change', function( currModel, changedList ){
+ // this.log( this + ' has changed:', currModel, changedList );
+ //});
},
// get data via the api (alternative to sending options,hdas to initialize)
- loadFromAPI : function( historyId, callback ){
+ loadFromApi : function( historyId, callback ){
var history = this;
// fetch the history AND the user (mainly to see if they're logged in at this point)
@@ -353,43 +397,13 @@
// get the history's state from it's cummulative ds states, delay + update if needed
checkForUpdates : function( datasets ){
// get overall History state from collection, run updater if History has running/queued hdas
- this.stateFromStateIds();
- if( ( this.get( 'state' ) === HistoryDatasetAssociation.STATES.RUNNING )
- || ( this.get( 'state' ) === HistoryDatasetAssociation.STATES.QUEUED ) ){
+ // boiling it down on the client to running/not
+ if( this.hdas.running().length ){
this.stateUpdater();
}
return this;
},
- // sets history state based on current hdas' states
- // ported from api/histories.traverse (with placement of error state changed)
- stateFromStateIds : function(){
- var stateIdLists = this.hdas.getStateLists();
- this.attributes.state_ids = stateIdLists;
-
- //TODO: make this more concise
- if( ( stateIdLists.running.length > 0 )
- || ( stateIdLists.upload.length > 0 )
- || ( stateIdLists.setting_metadata.length > 0 ) ){
- this.set( 'state', HistoryDatasetAssociation.STATES.RUNNING );
-
- } else if( stateIdLists.queued.length > 0 ){
- this.set( 'state', HistoryDatasetAssociation.STATES.QUEUED );
-
- } else if( ( stateIdLists.error.length > 0 )
- || ( stateIdLists.failed_metadata.length > 0 ) ){
- this.set( 'state', HistoryDatasetAssociation.STATES.ERROR );
-
- } else if( stateIdLists.ok.length === this.hdas.length ){
- this.set( 'state', HistoryDatasetAssociation.STATES.OK );
-
- } else {
- throw( this + '.stateFromStateDetails: unable to determine '
- + 'history state from hda states: ' + this.get( 'state_ids' ) );
- }
- return this;
- },
-
// update this history, find any hda's running/queued, update ONLY those that have changed states,
// set up to run this again in some interval of time
stateUpdater : function(){
@@ -407,6 +421,7 @@
history.set( response );
history.log( 'current history state:', history.get( 'state' ), '(was)', oldState );
+ //TODO: revisit this - seems too elaborate, need something straightforward
// for each state, check for the difference between old dataset states and new
// the goal here is to check ONLY those datasets that have changed states (not all datasets)
var changedIds = [];
@@ -451,7 +466,7 @@
// view for HistoryDatasetAssociation model above
// uncomment this out see log messages
- logger : console,
+ //logger : console,
tagName : "div",
className : "historyItemContainer",
@@ -537,6 +552,9 @@
view.$el.append( itemWrapper ).fadeIn( 'fast', function(){
view.log( view + ' rendered:', view.$el );
view.trigger( 'rendered' );
+ if( view.model.inFinalState() ){
+ view.trigger( 'rendered:final' );
+ }
});
});
return this;
@@ -697,7 +715,7 @@
var modelData = _.extend( this.model.toJSON(), { urls: this.urls } );
// if there's no dbkey and it's editable : pass a flag to the template to render a link to editing in the '?'
if( this.model.get( 'metadata_dbkey' ) === '?'
- && this.model.isEditable() ){
+ && !this.model.isDeletedOrPurged() ){
_.extend( modelData, { dbkey_unknown_and_editable : true });
}
return HDAView.templates.hdaSummary( modelData );
@@ -1290,7 +1308,7 @@
var HistoryView = BaseView.extend( LoggableMixin ).extend({
// uncomment this out see log messages
- logger : console,
+ //logger : console,
// direct attachment to existing element
el : 'body.historyPage',
@@ -1369,7 +1387,7 @@
// render the main template, tooltips
//NOTE: this is done before the items, since item views should handle theirs themselves
newRender.append( HistoryView.templates.historyPanel( modelJson ) );
- historyView.$el.find( '.tooltip' ).tooltip();
+ newRender.find( '.tooltip' ).tooltip();
// render hda views (if any)
if( !this.model.hdas.length
@@ -1394,6 +1412,7 @@
//TODO: ideally, these would be set up before the fade in (can't because of async save text)
historyView.setUpBehaviours();
+
historyView.trigger( 'rendered' );
next();
});
@@ -1410,7 +1429,7 @@
visibleHdas = this.model.hdas.getVisible( show_deleted, show_hidden );
// only render the shown hdas
- visibleHdas.each( function( hda ){
+ _.each( visibleHdas, function( hda ){
var hdaId = hda.get( 'id' ),
expanded = historyView.storage.get( 'expandedHdas' ).get( hdaId );
historyView.hdaViews[ hdaId ] = new HDAView({
@@ -1428,21 +1447,28 @@
// set up HistoryView->HDAView listeners
setUpHdaListeners : function( hdaView ){
- var history = this;
+ var historyView = this;
// use storage to maintain a list of hdas whose bodies are expanded
hdaView.bind( 'toggleBodyVisibility', function( id, visible ){
if( visible ){
- history.storage.get( 'expandedHdas' ).set( id, true );
+ historyView.storage.get( 'expandedHdas' ).set( id, true );
} else {
- history.storage.get( 'expandedHdas' ).deleteKey( id );
+ historyView.storage.get( 'expandedHdas' ).deleteKey( id );
}
});
+
+ // rendering listeners
+ //hdaView.bind( 'rendered', function(){});
+ hdaView.bind( 'rendered:final', function(){ historyView.trigger( 'hda:rendered:final' ); });
},
// set up js/widget behaviours: tooltips,
//TODO: these should be either sub-MVs, or handled by events
setUpBehaviours : function(){
+ // anon users shouldn't have access to any of these
+ if( !( this.model.get( 'user' ) && this.model.get( 'user' ).email ) ){ return; }
+
// annotation slide down
var historyAnnotationArea = this.$( '#history-annotation-area' );
this.$( '#history-annotate' ).click( function() {
@@ -1463,6 +1489,20 @@
this.urls.annotate, "new_annotation", 18, true, 4 );
},
+ //TODO: this seems more like a per user message than a history message; IOW, this doesn't belong here
+ showQuotaMessage : function( userData ){
+ var msg = this.$el.find( '#quota-message-container' );
+ //this.log( this + ' showing quota message:', msg, userData );
+ if( msg.is( ':hidden' ) ){ msg.slideDown( 'fast' ); }
+ },
+
+ //TODO: this seems more like a per user message than a history message
+ hideQuotaMessage : function( userData ){
+ var msg = this.$el.find( '#quota-message-container' );
+ //this.log( this + ' hiding quota message:', msg, userData );
+ if( !msg.is( ':hidden' ) ){ msg.slideUp( 'fast' ); }
+ },
+
events : {
'click #history-collapse-all' : 'hideAllHdaBodies',
'click #history-tag' : 'loadAndDisplayTags'
@@ -1470,7 +1510,7 @@
// collapse all hda bodies
hideAllHdaBodies : function(){
- _.each( this.itemViews, function( item ){
+ _.each( this.hdaViews, function( item ){
item.toggleBodyVisibility( null, false );
});
this.storage.set( 'expandedHdas', {} );
diff -r 24ce9866b5af82325d2047b5d6c346ceae64c041 -r b996950ffcf2342f1211dc49e6ca75c4dfd7050f static/scripts/templates/compiled/template-history-historyPanel.js
--- a/static/scripts/templates/compiled/template-history-historyPanel.js
+++ b/static/scripts/templates/compiled/template-history-historyPanel.js
@@ -16,42 +16,52 @@
function program3(depth0,data) {
+ var buffer = "", stack1, foundHelper;
+ buffer += "\n <div id=\"history-name\" style=\"margin-right: 50px;\" class=\"tooltip\"\n title=\"You must be logged in to edit your history name\">";
+ foundHelper = helpers.name;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "</div>\n ";
+ return buffer;}
+
+function program5(depth0,data) {
+
return "refresh";}
-function program5(depth0,data) {
+function program7(depth0,data) {
return "collapse all";}
-function program7(depth0,data) {
+function program9(depth0,data) {
var buffer = "", stack1, foundHelper;
buffer += "\n <a id=\"history-tag\" title=\"";
foundHelper = helpers.local;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(8, program8, data)}); }
- else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(8, program8, data)}); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\"\n class=\"icon-button tags tooltip\" target=\"galaxy_main\" href=\"javascript:void(0)\"></a>\n <a id=\"history-annotate\" title=\"";
- foundHelper = helpers.local;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(10, program10, data)}); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(10, program10, data)}); }
if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "\"\n class=\"icon-button tags tooltip\" target=\"galaxy_main\" href=\"javascript:void(0)\"></a>\n <a id=\"history-annotate\" title=\"";
+ foundHelper = helpers.local;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(12, program12, data)}); }
+ else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(12, program12, data)}); }
+ if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\"\n class=\"icon-button annotate tooltip\" target=\"galaxy_main\" href=\"javascript:void(0)\"></a>\n ";
return buffer;}
-function program8(depth0,data) {
+function program10(depth0,data) {
return "Edit history tags";}
-function program10(depth0,data) {
+function program12(depth0,data) {
return "Edit history annotation";}
-function program12(depth0,data) {
+function program14(depth0,data) {
var buffer = "", stack1, foundHelper;
buffer += "\n <a href=\"";
@@ -60,18 +70,18 @@
stack1 = typeof stack1 === functionType ? stack1() : stack1;
buffer += escapeExpression(stack1) + "\">";
foundHelper = helpers.local;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(13, program13, data)}); }
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(15, program15, data)}); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(13, program13, data)}); }
+ if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(15, program15, data)}); }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "</a>\n ";
return buffer;}
-function program13(depth0,data) {
+function program15(depth0,data) {
return "hide deleted";}
-function program15(depth0,data) {
+function program17(depth0,data) {
var buffer = "", stack1, foundHelper;
buffer += "\n <a href=\"";
@@ -80,52 +90,52 @@
stack1 = typeof stack1 === functionType ? stack1() : stack1;
buffer += escapeExpression(stack1) + "\">";
foundHelper = helpers.local;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(16, program16, data)}); }
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(18, program18, data)}); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(16, program16, data)}); }
+ if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(18, program18, data)}); }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "</a>\n ";
return buffer;}
-function program16(depth0,data) {
+function program18(depth0,data) {
return "hide hidden";}
-function program18(depth0,data) {
+function program20(depth0,data) {
var buffer = "", stack1, foundHelper;
buffer += "\n";
foundHelper = helpers.warningmessagesmall;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(19, program19, data)}); }
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(21, program21, data)}); }
else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(19, program19, data)}); }
+ if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(21, program21, data)}); }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n";
return buffer;}
-function program19(depth0,data) {
+function program21(depth0,data) {
var stack1, foundHelper;
foundHelper = helpers.local;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(20, program20, data)}); }
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(22, program22, data)}); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(20, program20, data)}); }
+ if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(22, program22, data)}); }
if(stack1 || stack1 === 0) { return stack1; }
else { return ''; }}
-function program20(depth0,data) {
+function program22(depth0,data) {
return "You are currently viewing a deleted history!";}
-function program22(depth0,data) {
+function program24(depth0,data) {
var buffer = "", stack1;
buffer += "\n <div id=\"history-tag-area\" style=\"display: none\">\n <strong>Tags:</strong>\n <div class=\"tag-elt\"></div>\n </div>\n\n <div id=\"history-annotation-area\" style=\"display: none\">\n <strong>Annotation / Notes:</strong>\n <div id=\"history-annotation-container\">\n <div id=\"history-annotation\" class=\"tooltip editable-text\" title=\"Click to edit annotation\">\n ";
stack1 = depth0.annotation;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(25, program25, data),fn:self.program(23, program23, data)});
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(27, program27, data),fn:self.program(25, program25, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n </div>\n </div>\n </div>\n ";
return buffer;}
-function program23(depth0,data) {
+function program25(depth0,data) {
var buffer = "", stack1, foundHelper;
buffer += "\n ";
@@ -135,12 +145,12 @@
buffer += escapeExpression(stack1) + "\n ";
return buffer;}
-function program25(depth0,data) {
+function program27(depth0,data) {
return "\n <em>Describe or add notes to history</em>\n ";}
-function program27(depth0,data) {
+function program29(depth0,data) {
var buffer = "", stack1, foundHelper;
buffer += "\n<div id=\"message-container\">\n <div class=\"";
@@ -154,11 +164,6 @@
buffer += escapeExpression(stack1) + "\n </div><br />\n</div>\n";
return buffer;}
-function program29(depth0,data) {
-
-
- return "\n <div id=\"quota-message\" class=\"errormessage\">\n You are over your disk quota. Tool execution is on hold until your disk usage drops below your allocated quota.\n </div>\n <br/>\n ";}
-
function program31(depth0,data) {
@@ -171,13 +176,14 @@
else { stack1 = depth0.nice_size; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
buffer += escapeExpression(stack1) + "</div>\n ";
stack1 = depth0.user;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)});
+ stack1 = stack1 == null || stack1 === false ? stack1 : stack1.email;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n </div> \n</div>\n<div style=\"clear: both;\"></div>\n\n<div id=\"top-links\" class=\"historyLinks\">\n <a title=\"";
foundHelper = helpers.local;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)}); }
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)}); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)}); }
+ if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)}); }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\" class=\"icon-button arrow-circle tooltip\" href=\"";
stack1 = depth0.urls;
@@ -185,42 +191,40 @@
stack1 = typeof stack1 === functionType ? stack1() : stack1;
buffer += escapeExpression(stack1) + "\"></a>\n <a title='";
foundHelper = helpers.local;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)}); }
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)}); }
else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)}); }
+ if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)}); }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "' id=\"history-collapse-all\"\n class='icon-button toggle tooltip' href='javascript:void(0);'></a>\n <div style=\"width: 40px; float: right; white-space: nowrap;\">\n ";
stack1 = depth0.user;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)});
+ stack1 = stack1 == null || stack1 === false ? stack1 : stack1.email;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(9, program9, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n </div>\n</div>\n<div style=\"clear: both;\"></div>\n\n";
buffer += "\n<div class=\"historyLinks\">\n ";
stack1 = depth0.show_deleted;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(12, program12, data)});
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(14, program14, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n ";
stack1 = depth0.show_hidden;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(15, program15, data)});
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(17, program17, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n</div>\n\n";
stack1 = depth0.deleted;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(18, program18, data)});
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(20, program20, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n\n";
buffer += "\n";
buffer += "\n<div style=\"margin: 0px 5px 10px 5px\">\n\n ";
stack1 = depth0.user;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(22, program22, data)});
+ stack1 = stack1 == null || stack1 === false ? stack1 : stack1.email;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(24, program24, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n</div>\n\n";
stack1 = depth0.message;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(27, program27, data)});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n\n<div id=\"quota-message-container\">\n ";
- stack1 = depth0.over_quota;
stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(29, program29, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n</div>\n\n<div id=\"";
+ buffer += "\n\n<div id=\"quota-message-container\" style=\"display: none\">\n <div id=\"quota-message\" class=\"errormessage\">\n You are over your disk quota. Tool execution is on hold until your disk usage drops below your allocated quota.\n </div>\n</div>\n\n<div id=\"";
foundHelper = helpers.id;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
diff -r 24ce9866b5af82325d2047b5d6c346ceae64c041 -r b996950ffcf2342f1211dc49e6ca75c4dfd7050f static/scripts/templates/history-templates.html
--- a/static/scripts/templates/history-templates.html
+++ b/static/scripts/templates/history-templates.html
@@ -110,9 +110,12 @@
<div id="history-name-container" style="position: relative;">
{{! TODO: factor out conditional css }}
<div id="history-size" style="position: absolute; top: 3px; right: 0px;">{{nice_size}}</div>
- {{#if user}}
+ {{#if user.email}}
<div id="history-name" style="margin-right: 50px;" class="tooltip editable-text"
title="Click to rename history">{{name}}</div>
+ {{else}}
+ <div id="history-name" style="margin-right: 50px;" class="tooltip"
+ title="You must be logged in to edit your history name">{{name}}</div>
{{/if}}
</div></div>
@@ -123,7 +126,7 @@
<a title='{{#local}}collapse all{{/local}}' id="history-collapse-all"
class='icon-button toggle tooltip' href='javascript:void(0);'></a><div style="width: 40px; float: right; white-space: nowrap;">
- {{#if user}}
+ {{#if user.email}}
<a id="history-tag" title="{{#local}}Edit history tags{{/local}}"
class="icon-button tags tooltip" target="galaxy_main" href="javascript:void(0)"></a><a id="history-annotate" title="{{#local}}Edit history annotation{{/local}}"
@@ -151,7 +154,7 @@
{{! TODO: move inline styles out }}
<div style="margin: 0px 5px 10px 5px">
- {{#if user}}
+ {{#if user.email}}
<div id="history-tag-area" style="display: none"><strong>Tags:</strong><div class="tag-elt"></div>
@@ -180,13 +183,10 @@
</div>
{{/if}}
-<div id="quota-message-container">
- {{#if over_quota}}
+<div id="quota-message-container" style="display: none"><div id="quota-message" class="errormessage">
You are over your disk quota. Tool execution is on hold until your disk usage drops below your allocated quota.
</div>
- <br/>
- {{/if}}
</div><div id="{{id}}-datasets" class="history-datasets-list"></div>
diff -r 24ce9866b5af82325d2047b5d6c346ceae64c041 -r b996950ffcf2342f1211dc49e6ca75c4dfd7050f templates/root/alternate_history.mako
--- a/templates/root/alternate_history.mako
+++ b/templates/root/alternate_history.mako
@@ -90,10 +90,13 @@
hda_class_name = 'HistoryDatasetAssociation'
encoded_id_template = '<%= id %>'
- username_template = '<%= username %>'
+ #username_template = '<%= username %>'
hda_ext_template = '<%= file_ext %>'
meta_type_template = '<%= file_type %>'
+ display_app_name_template = '<%= name %>'
+ display_app_link_template = '<%= link %>'
+
url_dict = {
# ................................................................ warning message links
'purge' : h.url_for( controller='dataset', action='purge',
@@ -108,6 +111,7 @@
# ................................................................ title actions (display, edit, delete),
'display' : h.url_for( controller='dataset', action='display',
dataset_id=encoded_id_template, preview=True, filename='' ),
+ #TODO:
#'user_display_url' : h.url_for( controller='dataset', action='display_by_username_and_slug',
# username=username_template, slug=encoded_id_template, filename='' ),
'edit' : h.url_for( controller='dataset', action='edit',
@@ -141,8 +145,9 @@
item_class=hda_class_name, item_id=encoded_id_template ),
},
'annotation' : {
+ #TODO: needed? doesn't look like this is used (unless graceful degradation)
#'annotate_url' : h.url_for( controller='dataset', action='annotate',
- # id=encoded_id_template ), # doesn't look like this is used (unless graceful degradation)
+ # id=encoded_id_template ),
'get' : h.url_for( controller='dataset', action='get_annotation_async',
id=encoded_id_template ),
'set' : h.url_for( controller='/dataset', action='annotate_async',
@@ -167,33 +172,24 @@
<%def name="get_current_user()"><%
- if not trans.user:
- return '{}'
- return trans.webapp.api_controllers[ 'users' ].show(
- trans, trans.security.encode_id( trans.user.id ) )
+ return trans.webapp.api_controllers[ 'users' ].show( trans, 'current' )
%></%def><%def name="get_hdas( history_id, hdas )"><%
+ #BUG: one inaccessible dataset will error entire list
+
if not hdas:
return '[]'
# rather just use the history.id (wo the datasets), but...
- #BUG: one inaccessible dataset will error entire list
return trans.webapp.api_controllers[ 'history_contents' ].index(
+ #trans, trans.security.encode_id( history_id ),
trans, trans.security.encode_id( history_id ),
ids=( ','.join([ trans.security.encode_id( hda.id ) for hda in hdas ]) ) )
%></%def>
-<%def name="print_visualizations( datasets )">
-<%
- for dataset in datasets:
- print trans.security.encode_id( dataset.id )
- print dataset.get_visualizations()
-
-%>
-</%def>
## -----------------------------------------------------------------------------
<%def name="javascripts()">
@@ -220,13 +216,17 @@
"template-history-annotationArea",
"template-history-displayApps",
- "template-history-historyPanel"
+ "template-history-historyPanel",
+
+ "template-user-quotaMeter-quota",
+ "template-user-quotaMeter-usage"
)}
##TODO: fix: curr hasta be _after_ h.templates - move somehow
${h.js(
- "mvc/history"
- ##"mvc/tags", "mvc/annotations"
+ "mvc/history",
+ ##"mvc/tags", "mvc/annotations",
+ "mvc/user/user-model", "mvc/user/user-quotameter"
)}
<script type="text/javascript">
@@ -243,31 +243,65 @@
if( console && console.debug ){
//if( console.clear ){ console.clear(); }
console.debug( 'using backbone.js in history panel' );
+ console.pretty = function( o ){ $( '<pre/>' ).text( JSON.stringify( o, null, ' ' ) ).appendTo( 'body' ); }
}
- // Navigate to a dataset.
- console.debug( 'getting data' );
+
+ // load initial data in this page - since we're already sending it...
var user = ${ get_current_user() },
history = ${ get_history( history.id ) },
hdas = ${ get_hdas( history.id, datasets ) };
- //console.debug( 'user:', user );
- //console.debug( 'history:', history );
- //console.debug( 'hdas:', hdas );
+ console.debug( 'user:', user );
+ console.debug( 'history:', history );
+ console.debug( 'hdas:', hdas );
- // i don't like this, but user authentication changes views/behaviour
+ // i don't like this relationship, but user authentication changes views/behaviour
history.user = user;
history.show_deleted = ${ 'true' if show_deleted else 'false' };
history.show_hidden = ${ 'true' if show_hidden else 'false' };
-
+
//console.debug( 'galaxy_paths:', galaxy_paths );
var glx_history = new History( history, hdas );
- var glx_history_view = new HistoryView({ model: glx_history, urlTemplates: galaxy_paths.attributes }).render();
+ glx_history.logger = console;
+ var glx_history_view = new HistoryView({
+ model: glx_history,
+ urlTemplates: galaxy_paths.attributes,
+ logger: console
+ });
+ glx_history_view.render();
+
+
+ // ...OR load from the api
//var glx_history = new History().setPaths( galaxy_paths ),
// glx_history_view = new HistoryView({ model: glx_history });
//console.warn( 'fetching' );
- //glx_history.loadFromAPI( pageData.history.id );
+ //glx_history.loadFromApi( pageData.history.id );
+
+ // quota meter is a cross-frame ui element (meter in masthead, over quota message in history)
+ // create it and join them here for now (via events)
+ window.currUser = new User( user );
+ //window.currUser.logger = console;
+ window.quotaMeter = new UserQuotaMeter({ model: currUser, el: $( top.document ).find( '.quota-meter-container' ) });
+ window.quotaMeter.render();
+ //window.quotaMeter.logger = console;
+
+ // show/hide the 'over quota message' in the history when the meter tells it to
+ quotaMeter.bind( 'quota:over', glx_history_view.showQuotaMessage, glx_history_view );
+ quotaMeter.bind( 'quota:under', glx_history_view.hideQuotaMessage, glx_history_view );
+ // having to add this to handle re-render of hview while overquota (the above do not fire)
+ glx_history_view.on( 'rendered', function(){
+ if( window.quotaMeter.isOverQuota() ){
+ glx_history_view.showQuotaMessage();
+ }
+ });
+
+ // update the quota meter when any hda reaches a 'final' state
+ //NOTE: use an anon function or update will be passed the hda and think it's the options param
+ glx_history_view.on( 'hda:rendered:final', function(){ window.quotaMeter.update({}) }, window.quotaMeter )
+
+
if( console && console.debug ){
window.user = top.user = user;
window._history = top._history = history;
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: Cloud Launch: Fix non-keyboard paste detection for cluster lookup step.
by Bitbucket 05 Nov '12
by Bitbucket 05 Nov '12
05 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/9d6a61f060d3/
changeset: 9d6a61f060d3
user: dannon
date: 2012-11-05 21:30:44
summary: Cloud Launch: Fix non-keyboard paste detection for cluster lookup step.
affected #: 1 file
diff -r 4d0bfc13fd582083eb2caec31029a3b4664da4ce -r 9d6a61f060d359a0289b3163990f6a8ba122d253 templates/cloud/index.mako
--- a/templates/cloud/index.mako
+++ b/templates/cloud/index.mako
@@ -76,7 +76,7 @@
}
});
//When id_secret and id_key are complete, submit to get_account_info
- $("#id_secret, #id_key_id").bind("change paste keyup", function(){
+ $("#id_secret, #id_key_id").bind("change paste keyup input propertychange", function(){
secret_el = $("#id_secret");
key_el = $("#id_key_id");
if (secret_el.val().length === 40 && key_el.val().length === 20){
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: Security: Prevent potential reflected XSS via MessageException (possible in the case of invalid/malicious id lookups, for instance). Cleanup imports.
by Bitbucket 05 Nov '12
by Bitbucket 05 Nov '12
05 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/4d0bfc13fd58/
changeset: 4d0bfc13fd58
user: dannon
date: 2012-11-05 21:21:05
summary: Security: Prevent potential reflected XSS via MessageException (possible in the case of invalid/malicious id lookups, for instance). Cleanup imports.
affected #: 1 file
diff -r 873dba0459da52335fab1dab38de88a92d44a264 -r 4d0bfc13fd582083eb2caec31029a3b4664da4ce lib/galaxy/web/framework/__init__.py
--- a/lib/galaxy/web/framework/__init__.py
+++ b/lib/galaxy/web/framework/__init__.py
@@ -4,19 +4,19 @@
import pkg_resources
-import os, sys, time, socket, random, string
+import os, time, socket, random, string
import inspect
from Cookie import CookieError
pkg_resources.require( "Cheetah" )
from Cheetah.Template import Template
import base
-import pickle
from functools import wraps
from galaxy import util
from galaxy.exceptions import MessageException
from galaxy.util.json import to_json_string, from_json_string
from galaxy.util.backports.importlib import import_module
+from galaxy.util.sanitize_html import sanitize_html
pkg_resources.require( "simplejson" )
import simplejson
@@ -240,11 +240,11 @@
output_encoding = 'utf-8' )
def handle_controller_exception( self, e, trans, **kwargs ):
+ if isinstance( e, MessageException ):
+ #In the case of a controller exception, sanitize to make sure unsafe html input isn't reflected back to the user
+ return trans.show_message( sanitize_html(e.err_msg), e.type )
- if isinstance( e, MessageException ):
- return trans.show_message( e.err_msg, e.type )
def make_body_iterable( self, trans, body ):
-
if isinstance( body, FormBuilder ):
body = trans.show_form( body )
return base.WebApplication.make_body_iterable( self, trans, body )
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: dan: Add a message about tools that will not be enabled during migration due to not being in the tool_conf.xml.
by Bitbucket 05 Nov '12
by Bitbucket 05 Nov '12
05 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/873dba0459da/
changeset: 873dba0459da
user: dan
date: 2012-11-05 17:09:50
summary: Add a message about tools that will not be enabled during migration due to not being in the tool_conf.xml.
affected #: 1 file
diff -r 8afb981f46c11886a6106fa317936e709c311791 -r 873dba0459da52335fab1dab38de88a92d44a264 lib/galaxy/tool_shed/install_manager.py
--- a/lib/galaxy/tool_shed/install_manager.py
+++ b/lib/galaxy/tool_shed/install_manager.py
@@ -143,6 +143,8 @@
tool_panel_dict_for_tool_config = generate_tool_panel_dict_for_tool_config( guid, tool_config, tool_sections=tool_sections )
for k, v in tool_panel_dict_for_tool_config.items():
tool_panel_dict_for_display[ k ] = v
+ else:
+ print 'The tool "%s" (%s) has not been enabled because it is not defined in a proprietary tool config (%s).' % ( guid, tool_config, ", ".join( self.proprietary_tool_confs or [] ) )
metadata_dict, invalid_file_tups = generate_metadata_for_changeset_revision( app=self.app,
repository=tool_shed_repository,
repository_clone_url=repository_clone_url,
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/changeset/a1a547faab1e/
changeset: a1a547faab1e
user: jgoecks
date: 2012-11-04 17:04:55
summary: Unordered GTF parsing enhancements: (a) make more lenient by default so that transcript_ids are local to chromosomes, as is the case for some popular data sources and (b) add 'strict' mode for strict parsing.
affected #: 1 file
diff -r b3585fb0c98639a57d8934f09f4553a3ad69e80b -r a1a547faab1e43c09fa53c6bb8470bd11deaef7d lib/galaxy/datatypes/util/gff_util.py
--- a/lib/galaxy/datatypes/util/gff_util.py
+++ b/lib/galaxy/datatypes/util/gff_util.py
@@ -359,23 +359,35 @@
attrs_strs.append( format_string % ( name, value ) )
return " ; ".join( attrs_strs )
-def read_unordered_gtf( iterator ):
+def read_unordered_gtf( iterator, strict=False ):
"""
Returns GTF features found in an iterator. GTF lines need not be ordered
or clustered for reader to work. Reader returns GFFFeature objects sorted
by transcript_id, chrom, and start position.
"""
+
+ # -- Get function that generates line/feature key. --
+
+ get_transcript_id = lambda fields: parse_gff_attributes( fields[8] )[ 'transcript_id' ]
+ if strict:
+ # Strict GTF parsing uses transcript_id only to group lines into feature.
+ key_fn = get_transcript_id
+ else:
+ # Use lenient parsing where chromosome + transcript_id is the key. This allows
+ # transcripts with same ID on different chromosomes; this occurs in some popular
+ # datasources, such as RefGenes in UCSC.
+ key_fn = lambda fields: fields[0] + '_' + get_transcript_id( fields )
+
# Aggregate intervals by transcript_id.
feature_intervals = odict()
for count, line in enumerate( iterator ):
- line_attrs = parse_gff_attributes( line.split('\t')[8] )
- transcript_id = line_attrs[ 'transcript_id' ]
- if transcript_id in feature_intervals:
- feature = feature_intervals[ transcript_id ]
+ line_key = key_fn( line.split('\t') )
+ if line_key in feature_intervals:
+ feature = feature_intervals[ line_key ]
else:
feature = []
- feature_intervals[ transcript_id ] = feature
+ feature_intervals[ line_key ] = feature
feature.append( GFFInterval( None, line.split( '\t' ) ) )
# Create features.
https://bitbucket.org/galaxy/galaxy-central/changeset/b49bf5d522ee/
changeset: b49bf5d522ee
user: jgoecks
date: 2012-11-04 20:49:46
summary: Transition track labels when adding/removing tracks.
affected #: 1 file
diff -r a1a547faab1e43c09fa53c6bb8470bd11deaef7d -r b49bf5d522eef420b1dff41690aa09abb6492202 static/scripts/viz/circster.js
--- a/static/scripts/viz/circster.js
+++ b/static/scripts/viz/circster.js
@@ -40,6 +40,7 @@
.selectAll("g")
.data(dataHandler)
.enter().append("g")
+ .attr("class", "tick")
.attr("transform", function(d) {
return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")" +
"translate(" + d.radius + ",0)";
@@ -214,9 +215,14 @@
}
self.zoom_drag_timeout = setTimeout(function() {
// Render more detail in tracks' visible elements.
+ // FIXME: do not do this right now; it is not fully implemented--e.g. data bounds
+ // are not updated when new data is fetched--and fetching more detailed quantitative
+ // data is not that useful.
+ /*
_.each(self.circular_views, function(view) {
view.update_scale(scale);
});
+ */
}, 400);
}
}))
@@ -452,6 +458,8 @@
this.parent_elt.selectAll('g>path.chrom-background').transition().duration(1000).attr('d', new_d);
this._transition_chrom_data();
+
+ this._transition_labels();
},
/**
@@ -547,6 +555,11 @@
},
/**
+ * Transition labels to new values (e.g new radius or data bounds).
+ */
+ _transition_labels: function() {},
+
+ /**
* Update data bounds.
*/
_update_data_bounds: function() {
@@ -669,7 +682,6 @@
/** Returns an array of tick angles and labels, given a chrom arc. */
var chromArcTicks = function(d) {
- if (d.endAngle - d.startAngle < self.min_arc_len) { return []; }
var k = (d.endAngle - d.startAngle) / d.value,
ticks = d3.range(0, d.value, 25000000).map(function(v, i) {
return {
@@ -694,7 +706,10 @@
return d.angle > Math.PI ? "rotate(180)translate(-16)" : null;
};
- this.drawTicks(this.parent_elt, this.chroms_layout, chromArcTicks, textTransform);
+ // Filter chroms for only those large enough for display.
+ var visibleChroms = _.filter(this.chroms_layout, function(c) { return c.endAngle - c.startAngle > self.min_arc_len; });
+
+ this.drawTicks(this.parent_elt, visibleChroms, chromArcTicks, textTransform);
}
});
_.extend(CircsterChromLabelTrackView.prototype, UsesTicks);
@@ -755,37 +770,67 @@
.angle(line.angle());
},
+ /**
+ * Render track min, max using ticks.
+ */
render_labels: function() {
- // -- Render min and max using ticks. --
var self = this,
// Keep counter of visible chroms.
- visibleChroms = 0,
- dataBoundsTicks = function(d) {
- // Do not add ticks to small chroms.
- if (d.endAngle - d.startAngle < 0.08) { return []; }
-
- // Only show bounds on every 3rd chromosome; also update visibleChroms count.
- if (visibleChroms++ % 3 !== 0) { return []; }
-
- // Set up data to display min, max ticks.
- return [
- {
- radius: self.radius_bounds[0],
- angle: d.startAngle,
- label: self.formatNum(self.data_bounds[0])
- },
- {
- radius: self.radius_bounds[1],
- angle: d.startAngle,
- label: self.formatNum(self.data_bounds[1])
- }
- ];
- },
textTransform = function() {
return "rotate(90)";
};
- this.drawTicks(this.parent_elt, this.chroms_layout, dataBoundsTicks, textTransform, true);
+ // Filter for visible chroms, then for every third chrom so that labels attached to only every
+ // third chrom.
+ var visibleChroms = _.filter(this.chroms_layout, function(c) { return c.endAngle - c.startAngle > 0.08; }),
+ labeledChroms = _.filter(visibleChroms, function(c, i) { return i % 3 === 0; });
+ this.drawTicks(this.parent_elt, labeledChroms, this._data_bounds_ticks_fn(), textTransform, true);
+ },
+
+ /**
+ * Transition labels to new values (e.g new radius or data bounds).
+ */
+ _transition_labels: function() {
+ // FIXME: (a) pull out function for getting labeled chroms? and (b) function used in transition below
+ // is copied from UseTicks mixin, so pull out and make generally available.
+
+ // Transition labels to new radius bounds.
+ var self = this,
+ visibleChroms = _.filter(this.chroms_layout, function(c) { return c.endAngle - c.startAngle > 0.08; }),
+ labeledChroms = _.filter(visibleChroms, function(c, i) { return i % 3 === 0; }),
+ new_data = _.flatten( _.map(labeledChroms, function(c) {
+ return self._data_bounds_ticks_fn()(c);
+ }));
+ this.parent_elt.selectAll('g.tick').data(new_data).transition().attr("transform", function(d) {
+ return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")" +
+ "translate(" + d.radius + ",0)";
+ });
+ },
+
+ /**
+ * Get function for locating data bounds ticks.
+ */
+ _data_bounds_ticks_fn: function() {
+ // Closure vars.
+ var self = this;
+ visibleChroms = 0;
+
+ // Return function for locating ticks based on chrom arc data.
+ return function(d) {
+ // Set up data to display min, max ticks.
+ return [
+ {
+ radius: self.radius_bounds[0],
+ angle: d.startAngle,
+ label: self.formatNum(self.data_bounds[0])
+ },
+ {
+ radius: self.radius_bounds[1],
+ angle: d.startAngle,
+ label: self.formatNum(self.data_bounds[1])
+ }
+ ];
+ };
},
/**
https://bitbucket.org/galaxy/galaxy-central/changeset/54ed06c15085/
changeset: 54ed06c15085
user: jgoecks
date: 2012-11-05 01:26:33
summary: When running tools in Trackster, use Region object.
affected #: 1 file
diff -r b49bf5d522eef420b1dff41690aa09abb6492202 -r 54ed06c150857fb4e3d9a96b2f5d177208bad8cf static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -1695,22 +1695,24 @@
//
// Create track for tool's output immediately to provide user feedback.
//
- var
+ var region = new visualization.GenomeRegion({
+ chrom: this.track.view.chrom,
+ start: this.track.view.low,
+ end: this.track.view.high
+ }),
url_params =
{
target_dataset_id: this.track.original_dataset_id,
action: 'rerun',
tool_id: this.name,
- regions: [{
- chrom: this.track.view.chrom,
- start: this.track.view.low,
- end: this.track.view.high
- }]
+ regions: [
+ region.toJSON()
+ ]
},
current_track = this.track,
// Set name of track to include tool name, parameters, and region used.
track_name = url_params.tool_id +
- current_track.tool_region_and_parameters_str(url_params.chrom, url_params.low, url_params.high),
+ current_track.tool_region_and_parameters_str(region),
container;
// If track not in a group, create a group for it and add new track to group. If track
@@ -3040,13 +3042,10 @@
/**
* Utility function that creates a label string describing the region and parameters of a track's tool.
*/
- tool_region_and_parameters_str: function(chrom, low, high) {
- // Region is chrom:low-high or 'all.'
- var
- track = this,
- region = (chrom !== undefined && low !== undefined && high !== undefined ?
- chrom + ":" + low + "-" + high : "all");
- return " - region=[" + region + "], parameters=[" + track.tool.get_param_values().join(", ") + "]";
+ tool_region_and_parameters_str: function(region) {
+ var track = this,
+ region_str = (region !== undefined ? region.toString() : "all");
+ return " - region=[" + region_str + "], parameters=[" + track.tool.get_param_values().join(", ") + "]";
},
/**
* Returns true if data is compatible with a given mode. Defaults to true because, for many tracks,
https://bitbucket.org/galaxy/galaxy-central/changeset/8afb981f46c1/
changeset: 8afb981f46c1
user: jgoecks
date: 2012-11-05 03:44:29
summary: Pack scripts.
affected #: 2 files
diff -r 54ed06c150857fb4e3d9a96b2f5d177208bad8cf -r 8afb981f46c11886a6106fa317936e709c311791 static/scripts/packed/viz/circster.js
--- a/static/scripts/packed/viz/circster.js
+++ b/static/scripts/packed/viz/circster.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","libs/d3","viz/visualization"],function(g,k,h){var l=Backbone.Model.extend({is_visible:function(p,m){var n=p.getBoundingClientRect(),o=$("svg")[0].getBoundingClientRect();if(n.right<0||n.left>o.right||n.bottom<0||n.top>o.bottom){return false}return true}});var c=Backbone.Model.extend({});var a=Backbone.View.extend({className:"circster",initialize:function(m){this.total_gap=m.total_gap;this.genome=m.genome;this.dataset_arc_height=m.dataset_arc_height;this.track_gap=5;this.label_arc_height=50;this.scale=1;this.circular_views=null;this.chords_views=null;this.model.get("tracks").on("add",this.add_track,this);this.model.get("tracks").on("remove",this.remove_track,this);this.get_circular_tracks()},get_circular_tracks:function(){return this.model.get("tracks").filter(function(m){return m.get("track_type")!=="DiagonalHeatmapTrack"})},get_chord_tracks:function(){return this.model.get("tracks").filter(function(m){return m.get("track_type")==="DiagonalHeatmapTrack"})},get_tracks_bounds:function(){var n=this.get_circular_tracks();dataset_arc_height=this.dataset_arc_height,min_dimension=Math.min(this.$el.width(),this.$el.height()),radius_start=min_dimension/2-n.length*(this.dataset_arc_height+this.track_gap)-(this.label_arc_height+this.track_gap),tracks_start_radii=k.range(radius_start,min_dimension/2,this.dataset_arc_height+this.track_gap);var m=this;return g.map(tracks_start_radii,function(o){return[o,o+m.dataset_arc_height]})},render:function(){var v=this,p=this.dataset_arc_height,m=v.$el.width(),u=v.$el.height(),r=this.get_circular_tracks(),o=this.get_chord_tracks(),q=this.get_tracks_bounds(),n=k.select(v.$el[0]).append("svg").attr("width",m).attr("height",u).attr("pointer-events","all").append("svg:g").call(k.behavior.zoom().on("zoom",function(){var w=k.event.scale;n.attr("transform","translate("+k.event.translate+") scale("+w+")");if(v.scale!==w){if(v.zoom_drag_timeout){clearTimeout(v.zoom_drag_timeout)}v.zoom_drag_timeout=setTimeout(function(){g.each(v.circular_views,function(x){x.update_scale(w)})},400)}})).attr("transform","translate("+m/2+","+u/2+")").append("svg:g").attr("class","tracks");this.circular_views=r.map(function(x,y){var z=(x.get("track_type")==="LineTrack"?d:e),w=new z({el:n.append("g")[0],track:x,radius_bounds:q[y],genome:v.genome,total_gap:v.total_gap});w.render();return w});this.chords_views=o.map(function(x){var w=new i({el:n.append("g")[0],track:x,radius_bounds:q[0],genome:v.genome,total_gap:v.total_gap});w.render();return w});var t=this.circular_views[this.circular_views.length-1].radius_bounds[1],s=[t,t+this.label_arc_height];this.label_track_view=new b({el:n.append("g")[0],track:new c(),radius_bounds:s,genome:v.genome,total_gap:v.total_gap});this.label_track_view.render()},add_track:function(s){if(s.get("track_type")==="DiagonalHeatmapTrack"){var o=this.circular_views[0].radius_bounds,r=new i({el:k.select("g.tracks").append("g")[0],track:s,radius_bounds:o,genome:this.genome,total_gap:this.total_gap});r.render();this.chords_views.push(r)}else{var q=this.get_tracks_bounds();g.each(this.circular_views,function(u,v){u.update_radius_bounds(q[v])});g.each(this.chords_views,function(u){u.update_radius_bounds(q[0])});var p=this.circular_views.length,t=(s.get("track_type")==="LineTrack"?d:e),m=new t({el:k.select("g.tracks").append("g")[0],track:s,radius_bounds:q[p],genome:this.genome,total_gap:this.total_gap});m.render();this.circular_views.push(m);var n=q[q.length-1];n[1]=n[0];this.label_track_view.update_radius_bounds(n)}},remove_track:function(n,p,o){var m=this.circular_views[o.index];this.circular_views.splice(o.index,1);m.$el.remove();var q=this.get_tracks_bounds();g.each(this.circular_views,function(r,s){r.update_radius_bounds(q[s])})}});var j=Backbone.View.extend({tagName:"g",initialize:function(m){this.bg_stroke="ccc";this.loading_bg_fill="000";this.bg_fill="ccc";this.total_gap=m.total_gap;this.track=m.track;this.radius_bounds=m.radius_bounds;this.genome=m.genome;this.chroms_layout=this._chroms_layout();this.data_bounds=[];this.scale=1;this.parent_elt=k.select(this.$el[0])},get_fill_color:function(){var m=this.track.get("config").get_value("block_color");if(!m){m=this.track.get("config").get_value("color")}return m},render:function(){var q=this.parent_elt;if(!q){console.log("no parent elt")}var p=this.chroms_layout,s=k.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]),m=q.selectAll("g").data(p).enter().append("svg:g"),o=m.append("path").attr("d",s).attr("class","chrom-background").style("stroke",this.bg_stroke).style("fill",this.loading_bg_fill);o.append("title").text(function(u){return u.data.chrom});var n=this,r=n.track.get("data_manager"),t=(r?r.data_is_ready():true);$.when(t).then(function(){$.when(n._render_data(q)).then(function(){o.style("fill",n.bg_fill)})})},update_radius_bounds:function(n){this.radius_bounds=n;var m=k.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]);this.parent_elt.selectAll("g>path.chrom-background").transition().duration(1000).attr("d",m);this._transition_chrom_data()},update_scale:function(p){var o=this.scale;this.scale=p;if(p<=o){return}var n=this,m=new l();this.parent_elt.selectAll("path.chrom-data").filter(function(r,q){return m.is_visible(this)}).each(function(w,s){var v=k.select(this),r=v.attr("chrom"),u=n.genome.get_chrom_region(r),t=n.track.get("data_manager"),q;if(!t.can_get_more_detailed_data(u)){return}q=n.track.get("data_manager").get_more_detailed_data(u,"Coverage",0,p);$.when(q).then(function(z){v.remove();n._update_data_bounds();var y=g.find(n.chroms_layout,function(A){return A.data.chrom===r});var x=n.get_fill_color();n._render_chrom_data(n.parent_elt,y,z).style("stroke",x).style("fill",x)})});return n},_transition_chrom_data:function(){var n=this.track,p=this.chroms_layout,m=this.parent_elt.selectAll("g>path.chrom-data"),q=m[0].length;if(q>0){var o=this;$.when(n.get("data_manager").get_genome_wide_data(this.genome)).then(function(s){var r=g.reject(g.map(s,function(t,u){var v=null,w=o._get_path_function(p[u],t);if(w){v=w(t.data)}return v}),function(t){return t===null});m.each(function(u,t){k.select(this).transition().duration(1000).attr("d",r[t])})})}},_update_data_bounds:function(){var m=this.data_bounds;this.data_bounds=this.get_data_bounds(this.track.get("data_manager").get_genome_wide_data(this.genome));if(this.data_bounds[0]<m[0]||this.data_bounds[1]>m[1]){this._transition_chrom_data()}},_render_data:function(p){var o=this,n=this.chroms_layout,m=this.track,q=$.Deferred();$.when(m.get("data_manager").get_genome_wide_data(this.genome)).then(function(s){o.data_bounds=o.get_data_bounds(s);layout_and_data=g.zip(n,s),chroms_data_layout=g.map(layout_and_data,function(t){var u=t[0],v=t[1];return o._render_chrom_data(p,u,v)});var r=o.get_fill_color();o.parent_elt.selectAll("path.chrom-data").style("stroke",r).style("fill",r);q.resolve(p)});return q},_render_chrom_data:function(m,n,o){},_get_path_function:function(n,m){},_chroms_layout:function(){var n=this.genome.get_chroms_info(),p=k.layout.pie().value(function(r){return r.len}).sort(null),q=p(n),m=this.total_gap/n.length,o=g.map(q,function(t,s){var r=t.endAngle-m;t.endAngle=(r>t.startAngle?r:t.startAngle);return t});return o}});var b=j.extend({initialize:function(m){j.prototype.initialize.call(this,m);this.innerRadius=this.radius_bounds[0];this.radius_bounds[0]=this.radius_bounds[1];this.bg_stroke="fff";this.bg_fill="fff";this.min_arc_len=0.08},_render_data:function(o){var n=this,m=o.selectAll("g");m.selectAll("path").attr("id",function(r){return"label-"+r.data.chrom});m.append("svg:text").filter(function(r){return r.endAngle-r.startAngle>n.min_arc_len}).attr("text-anchor","middle").append("svg:textPath").attr("xlink:href",function(r){return"#label-"+r.data.chrom}).attr("startOffset","25%").attr("font-weight","bold").text(function(r){return r.data.chrom});var q=function(t){if(t.endAngle-t.startAngle<n.min_arc_len){return[]}var r=(t.endAngle-t.startAngle)/t.value,s=k.range(0,t.value,25000000).map(function(u,w){return{angle:u*r+t.startAngle,label:w===0?0:(w%3?null:u/1000000+"M")}});if(s.length<4){s[s.length-1].label=Math.round((s[s.length-1].angle-t.startAngle)/r/1000000)+"M"}return s};var p=this.parent_elt.append("g").selectAll("g").data(this.chroms_layout).enter().append("g").selectAll("g").data(q).enter().append("g").attr("transform",function(r){return"rotate("+(r.angle*180/Math.PI-90)+")translate("+n.innerRadius+",0)"});p.append("line").attr("x1",1).attr("y1",0).attr("x2",4).attr("y2",0).style("stroke","#000");p.append("text").attr("x",4).attr("dy",".35em").attr("text-anchor",function(r){return r.angle>Math.PI?"end":null}).attr("transform",function(r){return r.angle>Math.PI?"rotate(180)translate(-16)":null}).text(function(r){return r.label})}});var f=j.extend({_render_chrom_data:function(m,p,n){var q=this._get_path_function(p,n);if(!q){return null}var o=m.datum(n.data),r=o.append("path").attr("class","chrom-data").attr("chrom",p.data.chrom).attr("d",q);return r},_get_path_function:function(p,o){if(typeof o==="string"||!o.data||o.data.length===0){return null}var m=k.scale.linear().domain(this.data_bounds).range(this.radius_bounds);var q=k.scale.linear().domain([0,o.data.length]).range([p.startAngle,p.endAngle]);var n=k.svg.line.radial().interpolate("linear").radius(function(r){return m(r[1])}).angle(function(s,r){return q(r)});return k.svg.area.radial().interpolate(n.interpolate()).innerRadius(m(0)).outerRadius(n.radius()).angle(n.angle())},get_data_bounds:function(m){}});var e=f.extend({get_data_bounds:function(n){var m=g.map(n,function(o){if(typeof o==="string"||!o.max){return 0}return o.max});return[0,(m&&typeof m!=="string"?g.max(m):0)]}});var d=f.extend({get_data_bounds:function(n){var m=g.flatten(g.map(n,function(o){if(o){return g.map(o.data,function(q){return q[1]})}else{return 0}}));return[g.min(m),g.max(m)]}});var i=j.extend({render:function(){var m=this;$.when(m.track.get("data_manager").data_is_ready()).then(function(){$.when(m.track.get("data_manager").get_genome_wide_data(m.genome)).then(function(p){var o=[],n=m.genome.get_chroms_info();g.each(p,function(t,s){var q=n[s].chrom;var r=g.map(t.data,function(v){var u=m._get_region_angle(q,v[1]),w=m._get_region_angle(v[3],v[4]);return{source:{startAngle:u,endAngle:u+0.01},target:{startAngle:w,endAngle:w+0.01}}});o=o.concat(r)});m.parent_elt.append("g").attr("class","chord").selectAll("path").data(o).enter().append("path").style("fill",m.get_fill_color()).attr("d",k.svg.chord().radius(m.radius_bounds[0])).style("opacity",1)})})},update_radius_bounds:function(m){this.radius_bounds=m;this.parent_elt.selectAll("path").transition().attr("d",k.svg.chord().radius(this.radius_bounds[0]))},_get_region_angle:function(o,m){var n=g.find(this.chroms_layout,function(p){return p.data.chrom===o});return n.endAngle-((n.endAngle-n.startAngle)*(n.data.len-m)/n.data.len)}});return{CircsterView:a}});
\ No newline at end of file
+define(["libs/underscore","libs/d3","viz/visualization"],function(g,l,i){var m=Backbone.Model.extend({is_visible:function(q,n){var o=q.getBoundingClientRect(),p=$("svg")[0].getBoundingClientRect();if(o.right<0||o.left>p.right||o.bottom<0||o.top>p.bottom){return false}return true}});var h={drawTicks:function(r,q,v,p,n){var u=r.append("g").selectAll("g").data(q).enter().append("g").selectAll("g").data(v).enter().append("g").attr("class","tick").attr("transform",function(w){return"rotate("+(w.angle*180/Math.PI-90)+")translate("+w.radius+",0)"});var t=[],s=[],o=function(w){return w.angle>Math.PI?"end":null};if(n){t=[0,0,0,-4];s=[4,0,"",".35em"];o=null}else{t=[1,0,4,0];s=[0,4,".35em",""]}u.append("line").attr("x1",t[0]).attr("y1",t[1]).attr("x2",t[2]).attr("y1",t[3]).style("stroke","#000");u.append("text").attr("x",s[0]).attr("y",s[1]).attr("dx",s[2]).attr("dy",s[3]).attr("text-anchor",o).attr("transform",p).text(function(w){return w.label})},formatNum:function(o,n){var q=null;if(o<1){q=o.toPrecision(n)}else{var p=Math.round(o.toPrecision(n));if(o<1000){q=p}else{if(o<1000000){q=Math.round((p/1000).toPrecision(3)).toFixed(0)+"K"}else{if(o<1000000000){q=Math.round((p/1000000).toPrecision(3)).toFixed(0)+"M"}}}}return q}};var c=Backbone.Model.extend({});var a=Backbone.View.extend({className:"circster",initialize:function(n){this.total_gap=n.total_gap;this.genome=n.genome;this.dataset_arc_height=n.dataset_arc_height;this.track_gap=10;this.label_arc_height=50;this.scale=1;this.circular_views=null;this.chords_views=null;this.model.get("tracks").on("add",this.add_track,this);this.model.get("tracks").on("remove",this.remove_track,this);this.get_circular_tracks()},get_circular_tracks:function(){return this.model.get("tracks").filter(function(n){return n.get("track_type")!=="DiagonalHeatmapTrack"})},get_chord_tracks:function(){return this.model.get("tracks").filter(function(n){return n.get("track_type")==="DiagonalHeatmapTrack"})},get_tracks_bounds:function(){var o=this.get_circular_tracks();dataset_arc_height=this.dataset_arc_height,min_dimension=Math.min(this.$el.width(),this.$el.height()),radius_start=min_dimension/2-o.length*(this.dataset_arc_height+this.track_gap)-(this.label_arc_height+this.track_gap),tracks_start_radii=l.range(radius_start,min_dimension/2,this.dataset_arc_height+this.track_gap);var n=this;return g.map(tracks_start_radii,function(p){return[p,p+n.dataset_arc_height]})},render:function(){var w=this,q=this.dataset_arc_height,n=w.$el.width(),v=w.$el.height(),s=this.get_circular_tracks(),p=this.get_chord_tracks(),r=this.get_tracks_bounds(),o=l.select(w.$el[0]).append("svg").attr("width",n).attr("height",v).attr("pointer-events","all").append("svg:g").call(l.behavior.zoom().on("zoom",function(){var x=l.event.scale;o.attr("transform","translate("+l.event.translate+") scale("+x+")");if(w.scale!==x){if(w.zoom_drag_timeout){clearTimeout(w.zoom_drag_timeout)}w.zoom_drag_timeout=setTimeout(function(){},400)}})).attr("transform","translate("+n/2+","+v/2+")").append("svg:g").attr("class","tracks");this.circular_views=s.map(function(y,z){var A=(y.get("track_type")==="LineTrack"?d:e),x=new A({el:o.append("g")[0],track:y,radius_bounds:r[z],genome:w.genome,total_gap:w.total_gap});x.render();return x});this.chords_views=p.map(function(y){var x=new j({el:o.append("g")[0],track:y,radius_bounds:r[0],genome:w.genome,total_gap:w.total_gap});x.render();return x});var u=this.circular_views[this.circular_views.length-1].radius_bounds[1],t=[u,u+this.label_arc_height];this.label_track_view=new b({el:o.append("g")[0],track:new c(),radius_bounds:t,genome:w.genome,total_gap:w.total_gap});this.label_track_view.render()},add_track:function(t){if(t.get("track_type")==="DiagonalHeatmapTrack"){var p=this.circular_views[0].radius_bounds,s=new j({el:l.select("g.tracks").append("g")[0],track:t,radius_bounds:p,genome:this.genome,total_gap:this.total_gap});s.render();this.chords_views.push(s)}else{var r=this.get_tracks_bounds();g.each(this.circular_views,function(v,w){v.update_radius_bounds(r[w])});g.each(this.chords_views,function(v){v.update_radius_bounds(r[0])});var q=this.circular_views.length,u=(t.get("track_type")==="LineTrack"?d:e),n=new u({el:l.select("g.tracks").append("g")[0],track:t,radius_bounds:r[q],genome:this.genome,total_gap:this.total_gap});n.render();this.circular_views.push(n);var o=r[r.length-1];o[1]=o[0];this.label_track_view.update_radius_bounds(o)}},remove_track:function(o,q,p){var n=this.circular_views[p.index];this.circular_views.splice(p.index,1);n.$el.remove();var r=this.get_tracks_bounds();g.each(this.circular_views,function(s,t){s.update_radius_bounds(r[t])})}});var k=Backbone.View.extend({tagName:"g",initialize:function(n){this.bg_stroke="ccc";this.loading_bg_fill="000";this.bg_fill="ccc";this.total_gap=n.total_gap;this.track=n.track;this.radius_bounds=n.radius_bounds;this.genome=n.genome;this.chroms_layout=this._chroms_layout();this.data_bounds=[];this.scale=1;this.parent_elt=l.select(this.$el[0])},get_fill_color:function(){var n=this.track.get("config").get_value("block_color");if(!n){n=this.track.get("config").get_value("color")}return n},render:function(){var r=this.parent_elt;if(!r){console.log("no parent elt")}var q=this.chroms_layout,t=l.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]),n=r.selectAll("g").data(q).enter().append("svg:g"),p=n.append("path").attr("d",t).attr("class","chrom-background").style("stroke",this.bg_stroke).style("fill",this.loading_bg_fill);p.append("title").text(function(v){return v.data.chrom});var o=this,s=o.track.get("data_manager"),u=(s?s.data_is_ready():true);$.when(u).then(function(){$.when(o._render_data(r)).then(function(){p.style("fill",o.bg_fill);o.render_labels()})})},render_labels:function(){},update_radius_bounds:function(o){this.radius_bounds=o;var n=l.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]);this.parent_elt.selectAll("g>path.chrom-background").transition().duration(1000).attr("d",n);this._transition_chrom_data();this._transition_labels()},update_scale:function(q){var p=this.scale;this.scale=q;if(q<=p){return}var o=this,n=new m();this.parent_elt.selectAll("path.chrom-data").filter(function(s,r){return n.is_visible(this)}).each(function(x,t){var w=l.select(this),s=w.attr("chrom"),v=o.genome.get_chrom_region(s),u=o.track.get("data_manager"),r;if(!u.can_get_more_detailed_data(v)){return}r=o.track.get("data_manager").get_more_detailed_data(v,"Coverage",0,q);$.when(r).then(function(A){w.remove();o._update_data_bounds();var z=g.find(o.chroms_layout,function(B){return B.data.chrom===s});var y=o.get_fill_color();o._render_chrom_data(o.parent_elt,z,A).style("stroke",y).style("fill",y)})});return o},_transition_chrom_data:function(){var o=this.track,q=this.chroms_layout,n=this.parent_elt.selectAll("g>path.chrom-data"),r=n[0].length;if(r>0){var p=this;$.when(o.get("data_manager").get_genome_wide_data(this.genome)).then(function(t){var s=g.reject(g.map(t,function(u,v){var w=null,x=p._get_path_function(q[v],u);if(x){w=x(u.data)}return w}),function(u){return u===null});n.each(function(v,u){l.select(this).transition().duration(1000).attr("d",s[u])})})}},_transition_labels:function(){},_update_data_bounds:function(){var n=this.data_bounds;this.data_bounds=this.get_data_bounds(this.track.get("data_manager").get_genome_wide_data(this.genome));if(this.data_bounds[0]<n[0]||this.data_bounds[1]>n[1]){this._transition_chrom_data()}},_render_data:function(q){var p=this,o=this.chroms_layout,n=this.track,r=$.Deferred();$.when(n.get("data_manager").get_genome_wide_data(this.genome)).then(function(t){p.data_bounds=p.get_data_bounds(t);layout_and_data=g.zip(o,t),chroms_data_layout=g.map(layout_and_data,function(u){var v=u[0],w=u[1];return p._render_chrom_data(q,v,w)});var s=p.get_fill_color();p.parent_elt.selectAll("path.chrom-data").style("stroke",s).style("fill",s);r.resolve(q)});return r},_render_chrom_data:function(n,o,p){},_get_path_function:function(o,n){},_chroms_layout:function(){var o=this.genome.get_chroms_info(),q=l.layout.pie().value(function(s){return s.len}).sort(null),r=q(o),n=this.total_gap/o.length,p=g.map(r,function(u,t){var s=u.endAngle-n;u.endAngle=(s>u.startAngle?s:u.startAngle);return u});return p}});var b=k.extend({initialize:function(n){k.prototype.initialize.call(this,n);this.innerRadius=this.radius_bounds[0];this.radius_bounds[0]=this.radius_bounds[1];this.bg_stroke="fff";this.bg_fill="fff";this.min_arc_len=0.08},_render_data:function(p){var o=this,n=p.selectAll("g");n.selectAll("path").attr("id",function(t){return"label-"+t.data.chrom});n.append("svg:text").filter(function(t){return t.endAngle-t.startAngle>o.min_arc_len}).attr("text-anchor","middle").append("svg:textPath").attr("xlink:href",function(t){return"#label-"+t.data.chrom}).attr("startOffset","25%").attr("font-weight","bold").text(function(t){return t.data.chrom});var q=function(v){var t=(v.endAngle-v.startAngle)/v.value,u=l.range(0,v.value,25000000).map(function(w,x){return{radius:o.innerRadius,angle:w*t+v.startAngle,label:x===0?0:(x%3?null:o.formatNum(w))}});if(u.length<4){u[u.length-1].label=o.formatNum(Math.round((u[u.length-1].angle-v.startAngle)/t))}return u};var s=function(t){return t.angle>Math.PI?"rotate(180)translate(-16)":null};var r=g.filter(this.chroms_layout,function(t){return t.endAngle-t.startAngle>o.min_arc_len});this.drawTicks(this.parent_elt,r,q,s)}});g.extend(b.prototype,h);var f=k.extend({_render_chrom_data:function(n,q,o){var r=this._get_path_function(q,o);if(!r){return null}var p=n.datum(o.data),s=p.append("path").attr("class","chrom-data").attr("chrom",q.data.chrom).attr("d",r);return s},_get_path_function:function(q,p){if(typeof p==="string"||!p.data||p.data.length===0){return null}var n=l.scale.linear().domain(this.data_bounds).range(this.radius_bounds);var r=l.scale.linear().domain([0,p.data.length]).range([q.startAngle,q.endAngle]);var o=l.svg.line.radial().interpolate("linear").radius(function(s){return n(s[1])}).angle(function(t,s){return r(s)});return l.svg.area.radial().interpolate(o.interpolate()).innerRadius(n(0)).outerRadius(o.radius()).angle(o.angle())},render_labels:function(){var n=this,q=function(){return"rotate(90)"};var p=g.filter(this.chroms_layout,function(r){return r.endAngle-r.startAngle>0.08}),o=g.filter(p,function(s,r){return r%3===0});this.drawTicks(this.parent_elt,o,this._data_bounds_ticks_fn(),q,true)},_transition_labels:function(){var o=this,q=g.filter(this.chroms_layout,function(r){return r.endAngle-r.startAngle>0.08}),p=g.filter(q,function(s,r){return r%3===0}),n=g.flatten(g.map(p,function(r){return o._data_bounds_ticks_fn()(r)}));this.parent_elt.selectAll("g.tick").data(n).transition().attr("transform",function(r){return"rotate("+(r.angle*180/Math.PI-90)+")translate("+r.radius+",0)"})},_data_bounds_ticks_fn:function(){var n=this;visibleChroms=0;return function(o){return[{radius:n.radius_bounds[0],angle:o.startAngle,label:n.formatNum(n.data_bounds[0])},{radius:n.radius_bounds[1],angle:o.startAngle,label:n.formatNum(n.data_bounds[1])}]}},get_data_bounds:function(n){}});g.extend(f.prototype,h);var e=f.extend({get_data_bounds:function(o){var n=g.map(o,function(p){if(typeof p==="string"||!p.max){return 0}return p.max});return[0,(n&&typeof n!=="string"?g.max(n):0)]}});var d=f.extend({get_data_bounds:function(o){var n=g.flatten(g.map(o,function(p){if(p){return g.map(p.data,function(q){return q[1]})}else{return 0}}));return[g.min(n),g.max(n)]}});var j=k.extend({render:function(){var n=this;$.when(n.track.get("data_manager").data_is_ready()).then(function(){$.when(n.track.get("data_manager").get_genome_wide_data(n.genome)).then(function(q){var p=[],o=n.genome.get_chroms_info();g.each(q,function(u,t){var r=o[t].chrom;var s=g.map(u.data,function(w){var v=n._get_region_angle(r,w[1]),x=n._get_region_angle(w[3],w[4]);return{source:{startAngle:v,endAngle:v+0.01},target:{startAngle:x,endAngle:x+0.01}}});p=p.concat(s)});n.parent_elt.append("g").attr("class","chord").selectAll("path").data(p).enter().append("path").style("fill",n.get_fill_color()).attr("d",l.svg.chord().radius(n.radius_bounds[0])).style("opacity",1)})})},update_radius_bounds:function(n){this.radius_bounds=n;this.parent_elt.selectAll("path").transition().attr("d",l.svg.chord().radius(this.radius_bounds[0]))},_get_region_angle:function(p,n){var o=g.find(this.chroms_layout,function(q){return q.data.chrom===p});return o.endAngle-((o.endAngle-o.startAngle)*(o.data.len-n)/o.data.len)}});return{CircsterView:a}});
\ No newline at end of file
diff -r 54ed06c150857fb4e3d9a96b2f5d177208bad8cf -r 8afb981f46c11886a6106fa317936e709c311791 static/scripts/packed/viz/trackster/tracks.js
--- a/static/scripts/packed/viz/trackster/tracks.js
+++ b/static/scripts/packed/viz/trackster/tracks.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","mvc/data","viz/trackster/filters"],function(ab,x,l,u,L,Y,i){var q=ab.extend;var V=function(ac){return("isResolved" in ac)};var n={};var k=function(ac,ad){n[ac.attr("id")]=ad};var m=function(ac,ae,ag,af){ag=".group";var ad={};n[ac.attr("id")]=af;ac.bind("drag",{handle:"."+ae,relative:true},function(ao,ap){var an=$(this),at=$(this).parent(),ak=at.children(),am=n[$(this).attr("id")],aj,ai,aq,ah,al;ai=$(this).parents(ag);if(ai.length!==0){aq=ai.position().top;ah=aq+ai.outerHeight();if(ap.offsetY<aq){$(this).insertBefore(ai);var ar=n[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable_before(am,ar);return}else{if(ap.offsetY>ah){$(this).insertAfter(ai);var ar=n[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable(am);return}}}ai=null;for(al=0;al<ak.length;al++){aj=$(ak.get(al));aq=aj.position().top;ah=aq+aj.outerHeight();if(aj.is(ag)&&this!==aj.get(0)&&ap.offsetY>=aq&&ap.offsetY<=ah){if(ap.offsetY-aq<ah-ap.offsetY){aj.find(".content-div").prepend(this)}else{aj.find(".content-div").append(this)}if(am.container){am.container.remove_drawable(am)}n[aj.attr("id")].add_drawable(am);return}}for(al=0;al<ak.length;al++){aj=$(ak.get(al));if(ap.offsetY<aj.position().top&&!(aj.hasClass("reference-track")||aj.hasClass("intro"))){break}}if(al===ak.length){if(this!==ak.get(al-1)){at.append(this);n[at.attr("id")].move_drawable(am,al)}}else{if(this!==ak.get(al)){$(this).insertBefore(ak.get(al));n[at.attr("id")].move_drawable(am,(ap.deltaY>0?al-1:al))}}}).bind("dragstart",function(){ad["border-top"]=ac.css("border-top");ad["border-bottom"]=ac.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ad)})};var aa=16,G=9,D=20,A=100,I=12000,S=400,K=5000,w=100,o="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",v="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",y="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",Q=10,H=20;function W(ad,ac){if(!ac){ac=0}var ae=Math.pow(10,ac);return Math.round(ad*ae)/ae}var r=function(ad,ac,af){if(!r.id_counter){r.id_counter=0}this.id=r.id_counter++;this.name=af.name;this.view=ad;this.container=ac;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:af.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=af.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ag){ag.stopPropagation()});var ae=this;this.container_div.hover(function(){ae.icons_div.show()},function(){ae.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};r.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ac){if(ac.content_visible){ac.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ac.hide_contents();ac.content_visible=false}else{ac.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ac.content_visible=true;ac.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ad){var af=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ac=function(){ad.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(ag){if((ag.keyCode||ag.which)===27){af()}else{if((ag.keyCode||ag.which)===13){ac()}}};$(window).bind("keypress.check_enter_esc",ae);show_modal("Configure",ad.config.build_form(),{Cancel:af,OK:ac})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.remove()}}];q(r.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(){},to_dict:function(){},set_name:function(ac){this.old_name=this.name;this.name=ac;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ac=this.view;this.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ad,ai,ah,ag,ac,af){var ae=this;this.action_icons[ad]=$("<a/>").attr("href","javascript:void(0);").attr("title",ai).addClass("icon-button").addClass(ah).tooltip().click(function(){ag(ae)}).appendTo(this.icons_div);if(af){this.action_icons[ad].hide()}},build_action_icons:function(ac){var ae;for(var ad=0;ad<ac.length;ad++){ae=ac[ad];this.add_action_icon(ae.name,ae.title,ae.css_class,ae.on_click_fn,ae.prepend,ae.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var z=function(ad,ac,ae){r.call(this,ad,ac,ae);this.obj_type=ae.obj_type;this.drawables=[]};q(z.prototype,r.prototype,{unpack_drawables:function(ae){this.drawables=[];var ad;for(var ac=0;ac<ae.length;ac++){ad=p(ae[ac],this.view,this);this.add_drawable(ad)}},init:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].init()}},_draw:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac]._draw()}},to_dict:function(){var ad=[];for(var ac=0;ac<this.drawables.length;ac++){ad.push(this.drawables[ac].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ad}},add_drawable:function(ac){this.drawables.push(ac);ac.container=this;this.changed()},add_drawable_before:function(ae,ac){this.changed();var ad=this.drawables.indexOf(ac);if(ad!==-1){this.drawables.splice(ad,0,ae);return true}return false},replace_drawable:function(ae,ac,ad){var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables[af]=ac;if(ad){ae.container_div.replaceWith(ac.container_div)}this.changed()}return af},remove_drawable:function(ad){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);ad.container=null;this.changed();return true}return false},move_drawable:function(ad,ae){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);this.drawables.splice(ae,0,ad);this.changed();return true}return false},get_drawables:function(){return this.drawables}});var P=function(ad,ac,af){q(af,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});z.call(this,ad,ac,af);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);k(this.container_div,this);k(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in af){this.unpack_drawables(af.drawables)}if("filters" in af){var ae=this.filters_manager;this.filters_manager=new i.FiltersManager(this,af.filters);ae.parent_div.replaceWith(this.filters_manager.parent_div);if(af.filters.visible){this.setup_multitrack_filtering()}}};q(P.prototype,r.prototype,z.prototype,{action_icons_def:[r.prototype.action_icons_def[0],r.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters();ac._restore_filter_managers()}else{ac.setup_multitrack_filtering();ac.request_draw(true)}ac.filters_manager.toggle()}},r.prototype.action_icons_def[2]],build_container_div:function(){var ac=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ac)}return ac},build_header_div:function(){var ac=$("<div/>").addClass("track-header");ac.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ac);return ac},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ae=this.drawables.length;if(ae===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ae===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var al,ak,ai,ao=true,ag=this.drawables[0].get_type(),ac=0;for(al=0;al<ae;al++){ai=this.drawables[al];if(ai.get_type()!==ag){can_composite=false;break}if(ai instanceof c){ac++}}if(ao||ac===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".bs-tooltip").remove()}if(ac>1&&ac===this.drawables.length){var ap={},ad;ai=this.drawables[0];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];ap[ad.name]=[ad]}for(al=1;al<this.drawables.length;al++){ai=this.drawables[al];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];if(ad.name in ap){ap[ad.name].push(ad)}}}this.filters_manager.remove_all();var af,ah,aj,am;for(var an in ap){af=ap[an];if(af.length===ac){ah=new i.NumberFilter({name:af[0].name,index:af[0].index});this.filters_manager.add_filter(ah)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].filters_manager=this.saved_filters_managers[ac]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ac=0;ac<this.drawables.length;ac++){drawable=this.drawables[ac];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ag=[];for(var ad=0;ad<this.drawables.length;ad++){ag.push(this.drawables[ad].name)}var ae="Composite Track of "+this.drawables.length+" tracks ("+ag.join(", ")+")";var af=new f(this.view,this.view,{name:ae,drawables:this.drawables});var ac=this.container.replace_drawable(this,af,true);af.request_draw()},add_drawable:function(ac){z.prototype.add_drawable.call(this,ac);this.update_icons()},remove_drawable:function(ac){z.prototype.remove_drawable.call(this,ac);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ac=q(z.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ac},request_draw:function(ac,ae){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].request_draw(ac,ae)}}});var Z=Backbone.View.extend({initialize:function(ac){q(ac,{obj_type:"View"});z.call(this,"View",ac.container,ac);this.chrom=null;this.vis_id=ac.vis_id;this.dbkey=ac.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new x.CanvasManager(this.container.get(0).ownerDocument);this.reset()},render:function(){this.requested_redraw=false;var ae=this.container,ac=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ae);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ae);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ae);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;k(this.viewport_container,ac);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var af=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){x.select_datasets(select_datasets_url,add_track_async_url,{"f-dbkey":ac.dbkey},function(ag){ab.each(ag,function(ah){ac.add_drawable(p(ah,ac,ac))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ad=function(ag){if(ag.type==="focusout"||(ag.keyCode||ag.which)===13||(ag.keyCode||ag.which)===27){if((ag.keyCode||ag.which)!==27){ac.go_to($(this).val())}$(this).hide();$(this).val("");ac.location_span.show();ac.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ad).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ac.location_span.hide();ac.chrom_select.hide();ac.nav_input.val(ac.chrom+":"+ac.low+"-"+ac.high);ac.nav_input.css("display","inline-block");ac.nav_input.select();ac.nav_input.focus();ac.nav_input.autocomplete({source:function(ai,ag){var aj=[],ah=$.map(ac.get_drawables(),function(ak){return ak.data_manager.search_features(ai.term).success(function(al){aj=aj.concat(al)})});$.when.apply($,ah).done(function(){ag($.map(aj,function(ak){return{label:ak[0],value:ak[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ac.zoom_out();ac.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ac.zoom_in();ac.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ac.change_chrom(ac.chrom_select.val())});this.browser_content_div.click(function(ag){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ag){ac.zoom_in(ag.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ag,ah){this.current_x=ah.offsetX}).bind("drag",function(ag,ai){var aj=ai.offsetX-this.current_x;this.current_x=ai.offsetX;var ah=Math.round(aj/ac.viewport_container.width()*(ac.max_high-ac.max_low));ac.move_delta(-ah)});this.overview_close.click(function(){ac.reset_overview()});this.viewport_container.bind("draginit",function(ag,ah){if(ag.clientX>ac.viewport_container.width()-16){return false}}).bind("dragstart",function(ag,ah){ah.original_low=ac.low;ah.current_height=ag.clientY;ah.current_x=ah.offsetX}).bind("drag",function(ai,ak){var ag=$(this);var al=ak.offsetX-ak.current_x;var ah=ag.scrollTop()-(ai.clientY-ak.current_height);ag.scrollTop(ah);ak.current_height=ai.clientY;ak.current_x=ak.offsetX;var aj=Math.round(al/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}).bind("mousewheel",function(ai,ak,ah,ag){if(ah){ah*=50;var aj=Math.round(-ah/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}});this.top_labeltrack.bind("dragstart",function(ag,ah){return $("<div />").css({height:ac.browser_content_div.height()+ac.top_labeltrack.height()+ac.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ak,al){$(al.proxy).css({left:Math.min(ak.pageX,al.startX)-ac.container.offset().left,width:Math.abs(ak.pageX-al.startX)});var ah=Math.min(ak.pageX,al.startX)-ac.container.offset().left,ag=Math.max(ak.pageX,al.startX)-ac.container.offset().left,aj=(ac.high-ac.low),ai=ac.viewport_container.width();ac.update_location(Math.round(ah/ai*aj)+ac.low,Math.round(ag/ai*aj)+ac.low)}).bind("dragend",function(al,am){var ah=Math.min(al.pageX,am.startX),ag=Math.max(al.pageX,am.startX),aj=(ac.high-ac.low),ai=ac.viewport_container.width(),ak=ac.low;ac.low=Math.round(ah/ai*aj)+ak;ac.high=Math.round(ag/ai*aj)+ak;$(am.proxy).remove();ac.request_redraw()});this.add_label_track(new X(this,{content_div:this.top_labeltrack}));this.add_label_track(new X(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ac.resize_window()},500)});$(document).bind("redraw",function(){ac.redraw()});this.reset();$(window).trigger("resize")}});q(Z.prototype,z.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ad,af,ac,ag){if(this.timer){clearTimeout(this.timer)}if(ag){var ae=this;this.timer=setTimeout(function(){ae.trigger("navigate",ad+":"+af+"-"+ac)},500)}else{view.trigger("navigate",ad+":"+af+"-"+ac)}},update_location:function(ac,ae){this.location_span.text(commatize(ac)+" - "+commatize(ae));this.nav_input.val(this.chrom+":"+commatize(ac)+"-"+commatize(ae));var ad=view.chrom_select.val();if(ad!==""){this.trigger_navigate(ad,view.low,view.high,true)}},load_chroms:function(ae){ae.num=w;var ac=this,ad=$.Deferred();$.ajax({url:chrom_url+"/"+this.dbkey,data:ae,dataType:"json",success:function(ag){if(ag.chrom_info.length===0){return}if(ag.reference){ac.add_label_track(new B(ac))}ac.chrom_data=ag.chrom_info;var aj='<option value="">Select Chrom/Contig</option>';for(var ai=0,af=ac.chrom_data.length;ai<af;ai++){var ah=ac.chrom_data[ai].chrom;aj+='<option value="'+ah+'">'+ah+"</option>"}if(ag.prev_chroms){aj+='<option value="previous">Previous '+w+"</option>"}if(ag.next_chroms){aj+='<option value="next">Next '+w+"</option>"}ac.chrom_select.html(aj);ac.chrom_start_index=ag.start_index;ad.resolve(ag)},error:function(){alert("Could not load chroms for this dbkey:",ac.dbkey)}});return ad},change_chrom:function(ah,ad,aj){var ae=this;if(!ae.chrom_data){ae.load_chroms_deferred.then(function(){ae.change_chrom(ah,ad,aj)});return}if(!ah||ah==="None"){return}if(ah==="previous"){ae.load_chroms({low:this.chrom_start_index-w});return}if(ah==="next"){ae.load_chroms({low:this.chrom_start_index+w});return}var ai=$.grep(ae.chrom_data,function(ak,al){return ak.chrom===ah})[0];if(ai===undefined){ae.load_chroms({chrom:ah},function(){ae.change_chrom(ah,ad,aj)});return}else{if(ah!==ae.chrom){ae.chrom=ah;ae.chrom_select.val(ae.chrom);ae.max_high=ai.len-1;ae.reset();ae.request_redraw(true);for(var ag=0,ac=ae.drawables.length;ag<ac;ag++){var af=ae.drawables[ag];if(af.init){af.init()}}if(ae.reference_track){ae.reference_track.init()}}if(ad!==undefined&&aj!==undefined){ae.low=Math.max(ad,0);ae.high=Math.min(aj,ae.max_high)}else{ae.low=0;ae.high=ae.max_high}ae.reset_overview();ae.request_redraw()}},go_to:function(ag){ag=ag.replace(/ |,/g,"");var ak=this,ac,af,ad=ag.split(":"),ai=ad[0],aj=ad[1];if(aj!==undefined){try{var ah=aj.split("-");ac=parseInt(ah[0],10);af=parseInt(ah[1],10)}catch(ae){return false}}ak.change_chrom(ai,ac,af)},move_fraction:function(ae){var ac=this;var ad=ac.high-ac.low;this.move_delta(ae*ad)},move_delta:function(af){var ac=this;var ae=ac.high-ac.low;if(ac.low-af<ac.max_low){ac.low=ac.max_low;ac.high=ac.max_low+ae}else{if(ac.high-af>ac.max_high){ac.high=ac.max_high;ac.low=ac.max_high-ae}else{ac.high-=af;ac.low-=af}}ac.request_redraw();var ad=ac.chrom_select.val();this.trigger_navigate(ad,ac.low,ac.high,true)},add_drawable:function(ac){z.prototype.add_drawable.call(this,ac);ac.init();this.changed();this.update_intro_div()},add_label_track:function(ac){ac.view=this;ac.init();this.label_tracks.push(ac)},remove_drawable:function(ae,ad){z.prototype.remove_drawable.call(this,ae);if(ad){var ac=this;ae.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ak,ac,aj,al){var ai=this,ah=(al?[al]:ai.drawables),ae;var ad;for(var ag=0;ag<ah.length;ag++){ad=ah[ag];ae=-1;for(var af=0;af<ai.tracks_to_be_redrawn.length;af++){if(ai.tracks_to_be_redrawn[af][0]===ad){ae=af;break}}if(ae<0){ai.tracks_to_be_redrawn.push([ad,ac,aj])}else{ai.tracks_to_be_redrawn[ag][1]=ac;ai.tracks_to_be_redrawn[ag][2]=aj}}if(!this.requested_redraw){requestAnimationFrame(function(){ai._redraw(ak)});this.requested_redraw=true}},_redraw:function(am){this.requested_redraw=false;var aj=this.low,af=this.high;if(aj<this.max_low){aj=this.max_low}if(af>this.max_high){af=this.max_high}var al=this.high-this.low;if(this.high!==0&&al<this.min_separation){af=aj+this.min_separation}this.low=Math.floor(aj);this.high=Math.ceil(af);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var ac=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ai=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var an=13;this.overview_box.css({left:ac,width:Math.max(an,ai)}).show();if(ai<an){this.overview_box.css("left",ac-(an-ai)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ac,width:ai})}if(!am){var ae,ad,ak;for(var ag=0,ah=this.tracks_to_be_redrawn.length;ag<ah;ag++){ae=this.tracks_to_be_redrawn[ag][0];ad=this.tracks_to_be_redrawn[ag][1];ak=this.tracks_to_be_redrawn[ag][2];if(ae){ae._draw(ad,ak)}}this.tracks_to_be_redrawn=[];for(ag=0,ah=this.label_tracks.length;ag<ah;ag++){this.label_tracks[ag]._draw()}}},zoom_in:function(ad,ae){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var af=this.high-this.low,ag=af/2+this.low,ac=(af/this.zoom_factor)/2;if(ad){ag=ad/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ag-ac);this.high=Math.round(ag+ac);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ad=this.high-this.low,ae=ad/2+this.low,ac=(ad*this.zoom_factor)/2;this.low=Math.round(ae-ac);this.high=Math.round(ae+ac);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ae){if(this.overview_drawable){if(this.overview_drawable.dataset_id===ae.dataset_id){return}this.overview_viewport.find(".track").remove()}var ad=ae.copy({content_div:this.overview_viewport}),ac=this;ad.header_div.hide();ad.is_overview=true;ac.overview_drawable=ad;this.overview_drawable.postdraw_actions=function(){ac.overview_highlight.show().height(ac.overview_drawable.content_div.height());ac.overview_viewport.height(ac.overview_drawable.content_div.height()+ac.overview_box.outerHeight());ac.overview_close.show();ac.resize_window()};ac.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".bs-tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var s=function(ae,aj,af){this.track=ae;this.name=aj.name;this.params=[];var aq=aj.params;for(var ag=0;ag<aq.length;ag++){var al=aq[ag],ad=al.name,ap=al.label,ah=unescape(al.html),ar=al.value,an=al.type;if(an==="number"){this.params.push(new e(ad,ap,ah,(ad in af?af[ad]:ar),al.min,al.max))}else{if(an==="select"){this.params.push(new N(ad,ap,ah,(ad in af?af[ad]:ar)))}else{console.log("WARNING: unrecognized tool parameter type:",ad,an)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(au){au.stopPropagation()}).click(function(au){au.stopPropagation()}).bind("dblclick",function(au){au.stopPropagation()});var ao=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var am=this.params;var ak=this;$.each(this.params,function(av,ay){var ax=$("<div>").addClass("param-row").appendTo(ak.parent_div);var au=$("<div>").addClass("param-label").text(ay.label).appendTo(ax);var aw=$("<div/>").addClass("param-input").html(ay.html).appendTo(ax);aw.find(":input").val(ay.value);$("<div style='clear: both;'/>").appendTo(ax)});this.parent_div.find("input").click(function(){$(this).select()});var at=$("<div>").addClass("param-row").appendTo(this.parent_div);var ai=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(at);var ac=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(at);ac.click(function(){ak.run_on_region()});ai.click(function(){ak.run_on_dataset()});if("visible" in af&&af.visible){this.parent_div.show()}};q(s.prototype,{update_params:function(){for(var ac=0;ac<this.params.length;ac++){this.params[ac].update_value()}},state_dict:function(){var ad={};for(var ac=0;ac<this.params.length;ac++){ad[this.params[ac].name]=this.params[ac].value}ad.visible=this.parent_div.is(":visible");return ad},get_param_values_dict:function(){var ac={};this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();ac[ad]=ae});return ac},get_param_values:function(){var ac=[];this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();if(ad){ac[ac.length]=ae}});return ac},run_on_dataset:function(){var ac=this;ac.run({target_dataset_id:this.track.original_dataset_id,tool_id:ac.name},null,function(ad){show_modal(ac.name+" is Running",ac.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ad={target_dataset_id:this.track.original_dataset_id,action:"rerun",tool_id:this.name,regions:[{chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}]},ah=this.track,ae=ad.tool_id+ah.tool_region_and_parameters_str(ad.chrom,ad.low,ad.high),ac;if(ah.container===view){var ag=new P(view,view,{name:this.name});var af=ah.container.replace_drawable(ah,ag,false);ag.container_div.insertBefore(ah.view.content_div.children()[af]);ag.add_drawable(ah);ah.container_div.appendTo(ag.content_div);ac=ag}else{ac=ah.container}var ai=new ah.constructor(view,ac,{name:ae,hda_ldda:"hda"});ai.init_for_tool_data();ai.change_mode(ah.mode);ai.set_filters_manager(ah.filters_manager.copy(ai));ai.update_icons();ac.add_drawable(ai);ai.tiles_div.text("Starting job.");this.update_params();this.run(ad,ai,function(aj){ai.set_dataset(new Y.Dataset(aj));ai.tiles_div.text("Running job.");ai.init()})},run:function(ac,ae,af){ac.inputs=this.get_param_values_dict();var ad=new l.ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(ac),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ag){return ag!=="pending"}});$.when(ad.go()).then(function(ag){if(ag==="no converter"){ae.container_div.addClass("error");ae.content_div.text(J)}else{if(ag.error){ae.container_div.addClass("error");ae.content_div.text(y+ag.message)}else{af(ag)}}})}});var N=function(ad,ac,ae,af){this.name=ad;this.label=ac;this.html=$(ae);this.value=af};q(N.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(ae,ad,ag,ah,af,ac){N.call(this,ae,ad,ag,ah);this.min=af;this.max=ac};q(e.prototype,N.prototype,{update_value:function(){N.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var C=function(ac,ad){L.Scaler.call(this,ad);this.filter=ac};C.prototype.gen_val=function(ac){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ac[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ac){this.track=ac.track;this.params=ac.params;this.values={};this.restore_values((ac.saved_values?ac.saved_values:{}));this.onchange=ac.onchange};q(F.prototype,{restore_values:function(ac){var ad=this;$.each(this.params,function(ae,af){if(ac[af.key]!==undefined){ad.values[af.key]=ac[af.key]}else{ad.values[af.key]=af.default_value}})},build_form:function(){var af=this;var ac=$("<div />");var ae;function ad(ak,ag){for(var ao=0;ao<ak.length;ao++){ae=ak[ao];if(ae.hidden){continue}var ai="param_"+ao;var at=af.values[ae.key];var av=$("<div class='form-row' />").appendTo(ag);av.append($("<label />").attr("for",ai).text(ae.label+":"));if(ae.type==="bool"){av.append($('<input type="checkbox" />').attr("id",ai).attr("name",ai).attr("checked",at))}else{if(ae.type==="text"){av.append($('<input type="text"/>').attr("id",ai).val(at).click(function(){$(this).select()}))}else{if(ae.type==="select"){var aq=$("<select />").attr("id",ai);for(var am=0;am<ae.options.length;am++){$("<option/>").text(ae.options[am].label).attr("value",ae.options[am].value).appendTo(aq)}aq.val(at);av.append(aq)}else{if(ae.type==="color"){var au=$("<div/>").appendTo(av),ap=$("<input />").attr("id",ai).attr("name",ai).val(at).css("float","left").appendTo(au).click(function(ax){$(".bs-tooltip").removeClass("in");var aw=$(this).siblings(".bs-tooltip").addClass("in");aw.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(aw).height()/2)+($(this).height()/2)}).show();aw.click(function(ay){ay.stopPropagation()});$(document).bind("click.color-picker",function(){aw.hide();$(document).unbind("click.color-picker")});ax.stopPropagation()}),an=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(au).attr("title","Set new random color").tooltip(),ar=$("<div class='bs-tooltip right' style='position: absolute;' />").appendTo(au).hide(),aj=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(ar),ah=$("<div class='tooltip-arrow'></div>").appendTo(ar),al=$.farbtastic(aj,{width:100,height:100,callback:ap,color:at});au.append($("<div/>").css("clear","both"));(function(aw){an.click(function(){aw.setColor(l.get_random_color())})})(al)}else{av.append($("<input />").attr("id",ai).attr("name",ai).val(at))}}}}if(ae.help){av.append($("<div class='help'/>").text(ae.help))}}}ad(this.params,ac);return ac},update_from_form:function(ac){var ae=this;var ad=false;$.each(this.params,function(af,ah){if(!ah.hidden){var ai="param_"+af;var ag=ac.find("#"+ai).val();if(ah.type==="float"){ag=parseFloat(ag)}else{if(ah.type==="int"){ag=parseInt(ag)}else{if(ah.type==="bool"){ag=ac.find("#"+ai).is(":checked")}}}if(ag!==ae.values[ah.key]){ae.values[ah.key]=ag;ad=true}}});if(ad){this.onchange();this.track.changed()}}});var b=function(ac,ag,ae,ad,af){this.track=ac;this.region=ag;this.low=ag.get("start");this.high=ag.get("end");this.resolution=ae;this.html_elt=$("<div class='track-tile'/>").append(ad).height($(ad).attr("height"));this.data=af;this.stale=false};b.prototype.predisplay_actions=function(){};var j=function(ac,ah,ae,ad,af,ag){b.call(this,ac,ah,ae,ad,af);this.max_val=ag};q(j.prototype,b.prototype);var O=function(af,an,ag,ae,ai,ap,aj,aq,ad,am){b.call(this,af,an,ag,ae,ai);this.mode=aj;this.all_slotted=ad;this.feature_mapper=am;this.has_icons=false;if(aq){this.has_icons=true;var ak=this;ae=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:ae.width}).prependTo(this.html_elt);var al=new x.GenomeRegion({chrom:af.view.chrom,start:this.low,end:this.high}),ao=ai.length,ah=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ac=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ah.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.DEEP_DATA_REQ);$(".bs-tooltip").hide();af.request_draw(true)}).dblclick(function(ar){ar.stopPropagation()});ac.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.BROAD_DATA_REQ);$(".bs-tooltip").hide();af.request_draw(true)}).dblclick(function(ar){ar.stopPropagation()})}};q(O.prototype,b.prototype);O.prototype.predisplay_actions=function(){var ad=this,ac={};if(ad.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ao){if(!this.hovered){return}var aj=$(this).offset(),an=ao.pageX-aj.left,am=ao.pageY-aj.top,at=ad.feature_mapper.get_feature_data(an,am),ak=(at?at[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!ak||$(this).attr("id")!==ak.toString()){$(this).remove()}});if(at){var af=ac[ak];if(!af){var ak=at[0],ap={name:at[3],start:at[1],end:at[2],strand:at[4]},ai=ad.track.filters_manager.filters,ah;for(var al=0;al<ai.length;al++){ah=ai[al];ap[ah.name]=at[ah.index]}var af=$("<div/>").attr("id",ak).addClass("feature-popup"),au=$("<table/>"),ar,aq,av;for(ar in ap){aq=ap[ar];av=$("<tr/>").appendTo(au);$("<th/>").appendTo(av).text(ar);$("<td/>").attr("align","left").appendTo(av).text(typeof(aq)==="number"?W(aq,2):aq)}af.append($("<div class='feature-popup-inner'>").append(au));ac[ak]=af}af.appendTo($(this).parents(".track-content").children(".overlay"));var ag=an+parseInt(ad.html_elt.css("left"))-af.width()/2,ae=am+parseInt(ad.html_elt.css("top"))+7;af.css("left",ag+"px").css("top",ae+"px")}else{if(!ao.isPropagationStopped()){ao.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ao)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(ad,ac,ae){q(ae,{drag_handle_class:"draghandle"});r.call(this,ad,ac,ae);this.dataset=new Y.Dataset({id:ae.dataset_id,hda_ldda:ae.hda_ldda});this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ae?ae.data_query_wait:K);this.data_manager=("data_manager" in ae?ae.data_manager:new x.GenomeDataManager({dataset:this.dataset,data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ae)||ae.resize){this.add_resize_handle()}}};q(g.prototype,r.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},r.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ac){ac.view.set_overview(ac)}},r.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters()}else{ac.filters_manager.init_filters()}ac.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ac){ac.dynamic_tool_div.toggle();if(ac.dynamic_tool_div.is(":visible")){ac.set_name(ac.name+ac.tool_region_and_parameters_str())}else{ac.revert_name()}$(".bs-tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ac){var af='<strong>Tool</strong>: <%= track.tool.name %><br/><strong>Dataset</strong>: <%= track.name %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ae=ab.template(af,{track:ac});var ah=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ad=function(){var aj=$('select[name="regions"] option:selected').val(),al,ai=new x.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ak=ab.map($(".bookmark"),function(am){return new x.GenomeRegion({from_str:$(am).children(".position").text()})});if(aj==="cur"){al=[ai]}else{if(aj==="bookmarks"){al=ak}else{al=[ai].concat(ak)}}hide_modal();window.location.href=galaxy_paths.get("sweepster_url")+"?"+$.param({dataset_id:ac.dataset_id,hda_ldda:ac.hda_ldda,regions:JSON.stringify(new Backbone.Collection(al).toJSON())})},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ad()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",ae,{No:ah,Yes:ad})}},r.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset_id&&r.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ac=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ac)}this.name_div=$("<div/>").addClass("track-name").appendTo(ac).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ac},on_resize:function(){},add_resize_handle:function(){var ac=this;var af=false;var ae=false;var ad=$("<div class='track-resize'>");$(ac.container_div).hover(function(){if(ac.content_visible){af=true;ad.show()}},function(){af=false;if(!ae){ad.hide()}});ad.hide().bind("dragstart",function(ag,ah){ae=true;ah.original_height=$(ac.content_div).height()}).bind("drag",function(ah,ai){var ag=Math.min(Math.max(ai.original_height+ai.deltaY,ac.min_height_px),ac.max_height_px);$(ac.tiles_div).css("height",ag);ac.visible_height_px=(ac.max_height_px===ag?0:ag);ac.on_resize()}).bind("dragend",function(ag,ah){ac.tile_cache.clear();ae=false;if(!af){ad.hide()}ac.config.values.height=ac.visible_height_px;ac.changed()}).appendTo(ac.container_div)},set_display_modes:function(af,ai){this.display_modes=af;this.mode=(ai?ai:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ad=this,ag={};for(var ae=0,ac=ad.display_modes.length;ae<ac;ae++){var ah=ad.display_modes[ae];ag[ah]=function(aj){return function(){ad.change_mode(aj);ad.icons_div.show();ad.container_div.mouseleave(function(){ad.icons_div.hide()})}}(ah)}make_popupmenu(this.action_icons.mode_icon,ag)},build_action_icons:function(){r.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof X){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof R){return"VcfTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(ae){var ad=this;ad.enabled=false;ad.tile_cache.clear();ad.data_manager.clear();ad.content_div.css("height","auto");ad.tiles_div.text("").children().remove();ad.container_div.removeClass("nodata error pending");if(!ad.dataset_id){return}var ac=$.Deferred(),af={hda_ldda:ad.hda_ldda,data_type:this.dataset_check_type,chrom:ad.view.chrom,retry:ae};$.getJSON(this.dataset.url(),af,function(ag){if(!ag||ag==="error"||ag.kind==="error"){ad.container_div.addClass("error");ad.tiles_div.text(o);if(ag.message){ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ag.message+"</pre>",{Close:hide_modal})}));ad.tiles_div.append($("<span/>").text(" "));ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ad.init(true)}))}}else{if(ag==="no converter"){ad.container_div.addClass("error");ad.tiles_div.text(J)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){ad.container_div.addClass("nodata");ad.tiles_div.text(E)}else{if(ag==="pending"){ad.container_div.addClass("pending");ad.tiles_div.html(v);setTimeout(function(){ad.init()},ad.data_query_wait)}else{if(ag==="data"||ag.status==="data"){if(ag.valid_chroms){ad.valid_chroms=ag.valid_chroms;ad.update_icons()}ad.tiles_div.text(U);if(ad.view.chrom){ad.tiles_div.text("");ad.tiles_div.css("height",ad.visible_height_px+"px");ad.enabled=true;$.when(ad.predraw_init()).done(function(){ac.resolve();ad.container_div.removeClass("nodata error pending");ad.request_draw()})}else{ac.resolve()}}}}}}});this.update_icons();return ac},predraw_init:function(){},get_drawables:function(){return this}});var M=function(ae,ad,af){g.call(this,ae,ad,af);var ac=this;m(ac.container_div,ac.drag_handle_class,".group",ac);this.filters_manager=new i.FiltersManager(this,("filters" in af?af.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in af&&af.tool?new s(this,af.tool,af.tool_state):null);this.tile_cache=new x.Cache(Q);if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(af.mode){this.change_mode(af.mode)}};q(M.prototype,r.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.slotters[ac.view.resolution_px_b].max_rows*=2;ac.request_draw(true)},hide:true}]),copy:function(ac){var ad=this.to_dict();q(ad,{data_manager:this.data_manager});var ae=new this.constructor(this.view,ac,ad);ae.change_mode(this.mode);ae.enabled=this.enabled;return ae},set_filters_manager:function(ac){this.filters_manager=ac;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},change_mode:function(ad){var ac=this;ac.mode=ad;ac.config.values.mode=ad;ac.tile_cache.clear();ac.request_draw();this.action_icons.mode_icon.attr("title","Set display mode (now: "+ac.mode+")");return ac},update_icons:function(){var ac=this;if(ac.filters_available){ac.action_icons.filters_icon.show()}else{ac.action_icons.filters_icon.hide()}if(ac.tool){ac.action_icons.tools_icon.show();ac.action_icons.param_space_viz_icon.show()}else{ac.action_icons.tools_icon.hide();ac.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ad,ae,ac){return ad+"_"+ae+"_"+ac},request_draw:function(ad,ac){this.view.request_redraw(false,ad,ac,this)},before_draw:function(){},_draw:function(ad,an){if(!this.can_draw()){return}var al=this.view.low,ah=this.view.high,aj=ah-al,ae=this.view.container.width(),ap=this.view.resolution_px_b,ag=this.view.resolution_b_px;if(this.is_overview){al=this.view.max_low;ah=this.view.max_high;ag=(view.max_high-view.max_low)/ae;ap=1/ag}this.before_draw();this.tiles_div.children().addClass("remove");var ac=Math.floor(al/(ag*S)),ak=true,ao=[],ai=function(aq){return(aq&&"track" in aq)};while((ac*S*ag)<ah){var am=this.draw_helper(ad,ae,ac,ag,this.tiles_div,ap);if(ai(am)){ao.push(am)}else{ak=false}ac+=1}if(!an){this.tiles_div.children(".remove").removeClass("remove").remove()}var af=this;if(ak){this.tiles_div.children(".remove").remove();af.postdraw_actions(ao,ae,ap,an)}},postdraw_actions:function(ae,af,ah,ac){var ag=false;for(var ad=0;ad<ae.length;ad++){if(ae[ad].has_icons){ag=true;break}}if(ag){for(var ad=0;ad<ae.length;ad++){tile=ae[ad];if(!tile.has_icons){tile.html_elt.css("padding-top",D)}}}},draw_helper:function(ac,ao,au,ar,ah,ai,ap){var an=this,ax=this._gen_tile_cache_key(ao,ai,au),af=this._get_tile_bounds(au,ar);if(!ap){ap={}}var aw=(ac?undefined:an.tile_cache.get_elt(ax));if(aw){an.show_tile(aw,ah,ai);return aw}var al=true;var at=an.data_manager.get_data(af,an.mode,ar,an.data_url_extra_params);if(V(at)){al=false}var aj;if(view.reference_track&&ai>view.canvas_manager.char_width_px){aj=view.reference_track.data_manager.get_data(af,an.mode,ar,view.reference_track.data_url_extra_params);if(V(aj)){al=false}}if(al){q(at,ap.more_tile_data);var ak=an.mode;if(ak==="Auto"){ak=an.get_mode(at);an.update_auto_mode(ak)}var ae=an.view.canvas_manager.new_canvas(),av=af.get("start"),ad=af.get("end"),ao=Math.ceil((ad-av)*ai)+an.left_offset,am=an.get_canvas_height(at,ak,ai,ao);ae.width=ao;ae.height=am;var aq=ae.getContext("2d");aq.translate(this.left_offset,0);var aw=an.draw_tile(at,aq,ak,ar,af,ai,aj);if(aw!==undefined){an.tile_cache.set_elt(ax,aw);an.show_tile(aw,ah,ai)}return aw}var ag=$.Deferred();$.when(at,aj).then(function(){view.request_redraw(false,false,false,an);ag.resolve()});return ag},get_canvas_height:function(ac,ae,af,ad){return this.visible_height_px},draw_tile:function(ac,ad,ah,af,ag,ai,ae){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(ae,ah,ai){var ad=this,ac=ae.html_elt;ae.predisplay_actions();var ag=(ae.low-(this.is_overview?this.view.max_low:this.view.low))*ai;if(this.left_offset){ag-=this.left_offset}ac.css({position:"absolute",top:0,left:ag});if(ac.hasClass("remove")){ac.removeClass("remove")}else{ah.append(ac)}ae.html_elt.height("auto");this.max_height_px=Math.max(this.max_height_px,ae.html_elt.height());ae.html_elt.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},_get_tile_bounds:function(ac,ad){var af=Math.floor(ac*S*ad),ag=Math.ceil(S*ad),ae=(af+ag<=this.view.max_high?af+ag:this.view.max_high);return new x.GenomeRegion({chrom:this.view.chrom,start:af,end:ae})},tool_region_and_parameters_str:function(ae,ac,af){var ad=this,ag=(ae!==undefined&&ac!==undefined&&af!==undefined?ae+":"+ac+"-"+af:"all");return" - region=["+ag+"], parameters=["+ad.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(ac,ad){return true},can_subset:function(ac){return false},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state";this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(ae,af,ah,ac){var ad=this;ad.normal_postdraw_actions(ae,af,ah,ac);ad.dataset_check_type="converted_datasets_state";ad.data_query_wait=K;var ag=new l.ServerStateDeferred({url:ad.dataset_state_url,url_params:{dataset_id:ad.dataset_id,hda_ldda:ad.hda_ldda},interval:ad.data_query_wait,success_fn:function(ai){return ai!=="pending"}});$.when(ag.go()).then(function(){ad.data_manager.set("data_type","data")});ad.postdraw_actions=ad.normal_postdraw_actions}}});var X=function(ad,ac){var ae={resize:false};g.call(this,ad,ac,ae);this.container_div.addClass("label-track")};q(X.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},_draw:function(){var ae=this.view,af=ae.high-ae.low,ai=Math.floor(Math.pow(10,Math.floor(Math.log(af)/Math.log(10)))),ac=Math.floor(ae.low/ai)*ai,ag=this.view.container.width(),ad=$("<div style='position: relative; height: 1.3em;'></div>");while(ac<ae.high){var ah=(ac-ae.low)/af*ag;ad.append($("<div class='label'>"+commatize(ac)+"</div>").css({position:"absolute",left:ah-1}));ac+=ai}this.content_div.children(":first").remove();this.content_div.append(ad)}});var f=function(ad,ac,ag){M.call(this,ad,ac,ag);this.drawables=[];this.left_offset=0;if("drawables" in ag){var af;for(var ae=0;ae<ag.drawables.length;ae++){af=ag.drawables[ae];this.drawables[ae]=p(af,ad,null);if(af.left_offset>this.left_offset){this.left_offset=af.left_offset}}this.enabled=true}if(this.drawables.length!==0){this.set_display_modes(this.drawables[0].display_modes,this.drawables[0].mode)}this.update_icons();this.obj_type="CompositeTrack"};q(f.prototype,M.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_group()}}].concat(M.prototype.action_icons_def),to_dict:z.prototype.to_dict,add_drawable:z.prototype.add_drawable,unpack_drawables:z.prototype.unpack_drawables,change_mode:function(ac){M.prototype.change_mode.call(this,ac);for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].change_mode(ac)}},init:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].init())}var ac=this;$.when.apply($,ae).then(function(){ac.enabled=true;ac.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:r.prototype.can_draw,draw_helper:function(ad,at,az,aw,ak,am,au){var ar=this,aD=this._gen_tile_cache_key(at,am,az),ah=this._get_tile_bounds(az,aw);if(!au){au={}}var aC=(ad?undefined:ar.tile_cache.get_elt(aD));if(aC){ar.show_tile(aC,ak,am);return aC}var al=[],ar,ap=true,ax,an;for(var ay=0;ay<this.drawables.length;ay++){ar=this.drawables[ay];ax=ar.data_manager.get_data(ah,ar.mode,aw,ar.data_url_extra_params);if(V(ax)){ap=false}al.push(ax);an=null;if(view.reference_track&&am>view.canvas_manager.char_width_px){an=view.reference_track.data_manager.get_data(ah,ar.mode,aw,view.reference_track.data_url_extra_params);if(V(an)){ap=false}}al.push(an)}if(ap){q(ax,au.more_tile_data);this.tile_predraw_init();var ag=ar.view.canvas_manager.new_canvas(),ai=ar._get_tile_bounds(az,aw),aA=ah.get("start"),ae=ah.get("end"),aB=0,at=Math.ceil((ae-aA)*am)+this.left_offset,aq=0,af=[],ay;var ac=0;for(ay=0;ay<this.drawables.length;ay++,aB+=2){ar=this.drawables[ay];ax=al[aB];var ao=ar.mode;if(ao==="Auto"){ao=ar.get_mode(ax);ar.update_auto_mode(ao)}af.push(ao);ac=ar.get_canvas_height(ax,ao,am,at);if(ac>aq){aq=ac}}ag.width=at;ag.height=(au.height?au.height:aq);aB=0;var av=ag.getContext("2d");av.translate(this.left_offset,0);av.globalAlpha=0.5;av.globalCompositeOperation="source-over";for(ay=0;ay<this.drawables.length;ay++,aB+=2){ar=this.drawables[ay];ax=al[aB];an=al[aB+1];aC=ar.draw_tile(ax,av,af[ay],aw,ah,am,an)}this.tile_cache.set_elt(aD,aC);this.show_tile(aC,ak,am);return aC}var aj=$.Deferred(),ar=this;$.when.apply($,al).then(function(){view.request_redraw(false,false,false,ar);aj.resolve()});return aj},show_group:function(){var af=new P(this.view,this.container,{name:this.name}),ac;for(var ae=0;ae<this.drawables.length;ae++){ac=this.drawables[ae];ac.update_icons();af.add_drawable(ac);ac.container=af;af.content_div.append(ac.container_div)}var ad=this.container.replace_drawable(this,af,true);af.request_draw()},tile_predraw_init:function(){var af=Number.MAX_VALUE,ac=-af,ad;for(var ae=0;ae<this.drawables.length;ae++){ad=this.drawables[ae];if(ad instanceof h){if(ad.prefs.min_value<af){af=ad.prefs.min_value}if(ad.prefs.max_value>ac){ac=ad.prefs.max_value}}}for(var ae=0;ae<this.drawables.length;ae++){ad=this.drawables[ae];ad.prefs.min_value=af;ad.prefs.max_value=ac}},postdraw_actions:function(ae,ah,aj,ad){M.prototype.postdraw_actions.call(this,ae,ah,aj,ad);var ag=-1;for(var af=0;af<ae.length;af++){var ac=ae[af].html_elt.find("canvas").height();if(ac>ag){ag=ac}}for(var af=0;af<ae.length;af++){var ai=ae[af];if(ai.html_elt.find("canvas").height()!==ag){this.draw_helper(true,ah,ai.index,ai.resolution,ai.html_elt.parent(),aj,{height:ag});ai.html_elt.remove()}}}});var B=function(ac){M.call(this,ac,{content_div:ac.top_labeltrack},{resize:false});ac.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url+"/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new x.ReferenceTrackDataManager({data_url:this.data_url});this.hide_contents()};q(B.prototype,r.prototype,M.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},can_draw:r.prototype.can_draw,draw_helper:function(ag,ae,ac,ad,ah,ai,af){if(ai>this.view.canvas_manager.char_width_px){return M.prototype.draw_helper.call(this,ag,ae,ac,ad,ah,ai,af)}else{this.hide_contents();return null}},draw_tile:function(ak,al,ag,af,ai,am){var ae=this;if(am>this.view.canvas_manager.char_width_px){if(ak.data===null){this.hide_contents();return}var ad=al.canvas;al.font=al.canvas.manager.default_font;al.textAlign="center";ak=ak.data;for(var ah=0,aj=ak.length;ah<aj;ah++){var ac=Math.floor(ah*am);al.fillText(ak[ah],ac,10)}this.show_contents();return new b(ae,ai,af,ad,ak)}this.hide_contents()}});var h=function(ae,ad,af){var ac=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";M.call(this,ae,ad,af);this.hda_ldda=af.hda_ldda;this.dataset_id=af.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:l.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);ac.vertical_range=ac.prefs.max_value-ac.prefs.min_value;ac.set_min_value(ac.prefs.min_value);ac.set_max_value(ac.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};q(h.prototype,r.prototype,M.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(ac){this.prefs.min_value=ac;$("#linetrack_"+this.dataset_id+"_minval").text(this.prefs.min_value);this.tile_cache.clear();this.request_draw()},set_max_value:function(ac){this.prefs.max_value=ac;$("#linetrack_"+this.dataset_id+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.request_draw()},predraw_init:function(){var ac=this;ac.vertical_range=undefined;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.hda_ldda},function(ad){ac.container_div.addClass("line-track");var ag=ad.data;if(isNaN(parseFloat(ac.prefs.min_value))||isNaN(parseFloat(ac.prefs.max_value))){var ae=ag.min,ai=ag.max;ae=Math.floor(Math.min(0,Math.max(ae,ag.mean-2*ag.sd)));ai=Math.ceil(Math.max(0,Math.min(ai,ag.mean+2*ag.sd)));ac.prefs.min_value=ae;ac.prefs.max_value=ai;$("#track_"+ac.dataset_id+"_minval").val(ac.prefs.min_value);$("#track_"+ac.dataset_id+"_maxval").val(ac.prefs.max_value)}ac.vertical_range=ac.prefs.max_value-ac.prefs.min_value;ac.total_frequency=ag.total_frequency;ac.container_div.find(".yaxislabel").remove();var ah=$("<div/>").text(W(ac.prefs.min_value,3)).make_text_editable({num_cols:6,on_finish:function(aj){$(".bs-tooltip").remove();var aj=parseFloat(aj);if(!isNaN(aj)){ac.set_min_value(aj)}},help_text:"Set min value"}).addClass("yaxislabel bottom").attr("id","linetrack_"+ac.dataset_id+"_minval").prependTo(ac.container_div),af=$("<div/>").text(W(ac.prefs.max_value,3)).make_text_editable({num_cols:6,on_finish:function(aj){$(".bs-tooltip").remove();var aj=parseFloat(aj);if(!isNaN(aj)){ac.set_max_value(aj)}},help_text:"Set max value"}).addClass("yaxislabel top").attr("id","linetrack_"+ac.dataset_id+"_maxval").prependTo(ac.container_div)})},draw_tile:function(al,aj,ae,ad,ag,ak){var ac=aj.canvas,af=ag.get("start"),ai=ag.get("end"),ah=new L.LinePainter(al.data,af,ai,this.prefs,ae);ah.draw(aj,ac.width,ac.height,ak);return new b(this,ag,ad,ac,al.data)},can_subset:function(ac){return false}});var t=function(ae,ad,af){var ac=this;this.display_modes=["Heatmap"];this.mode="Heatmap";M.call(this,ae,ad,af);this.hda_ldda=af.hda_ldda;this.dataset_id=af.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);ac.vertical_range=ac.prefs.max_value-ac.prefs.min_value;ac.set_min_value(ac.prefs.min_value);ac.set_max_value(ac.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};q(t.prototype,r.prototype,M.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(ac){this.prefs.min_value=ac;this.tile_cache.clear();this.request_draw()},set_max_value:function(ac){this.prefs.max_value=ac;this.tile_cache.clear();this.request_draw()},draw_tile:function(ac,ae,ai,ag,ah,aj){var af=ae.canvas,ad=new L.DiagonalHeatmapPainter(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai);ad.draw(ae,af.width,af.height,aj);return new b(this,ah,ag,af,ac.data)}});var c=function(af,ae,ah){var ad=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];M.call(this,af,ae,ah);var ag=l.get_random_color(),ac=l.get_random_color([ag,"#FFFFFF"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ag},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ah.prefs,onchange:function(){ad.set_name(ad.prefs.name);ad.tile_cache.clear();ad.set_painter_from_config();ad.request_draw()}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.hda_ldda=ah.hda_ldda;this.dataset_id=ah.dataset_id;this.original_dataset_id=ah.dataset_id;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};q(c.prototype,r.prototype,M.prototype,{set_dataset:function(ac){this.dataset_id=ac.get("id");this.hda_ldda=ac.get("hda_ldda");this.dataset=ac;this.data_manager.set("dataset",ac)},set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},before_draw:function(){this.max_height_px=0},postdraw_actions:function(ar,am,ah,ag){M.prototype.postdraw_actions.call(this,ar,ag);var al=this,ao;if(al.mode==="Coverage"){var ad=-1;for(ao=0;ao<ar.length;ao++){var an=ar[ao].max_val;if(an>ad){ad=an}}for(ao=0;ao<ar.length;ao++){var au=ar[ao];if(au.max_val!==ad){au.html_elt.remove();al.draw_helper(true,am,au.index,au.resolution,au.html_elt.parent(),ah,{more_tile_data:{max:ad}})}}}if(al.filters_manager){var ai=al.filters_manager.filters;for(var aq=0;aq<ai.length;aq++){ai[aq].update_ui_elt()}var at=false,ac,aj;for(ao=0;ao<ar.length;ao++){if(ar[ao].data.length){ac=ar[ao].data[0];for(var aq=0;aq<ai.length;aq++){aj=ai[aq];if(aj.applies_to(ac)&&aj.min!==aj.max){at=true;break}}}}if(al.filters_available!==at){al.filters_available=at;if(!al.filters_available){al.filters_manager.hide()}al.update_icons()}}this.container_div.find(".yaxislabel").remove();var af=ar[0];if(af instanceof j){var ak=(this.prefs.histogram_max?this.prefs.histogram_max:af.max_val),ae=$("<div/>").text(ak).make_text_editable({num_cols:12,on_finish:function(av){$(".bs-tooltip").remove();var av=parseFloat(av);al.prefs.histogram_max=(!isNaN(av)?av:null);al.tile_cache.clear();al.request_draw()},help_text:"Set max value; leave blank to use default"}).addClass("yaxislabel top").css("color",this.prefs.label_color);this.container_div.prepend(ae)}if(af instanceof O){var ap=true;for(ao=0;ao<ar.length;ao++){if(!ar[ao].all_slotted){ap=false;break}}if(!ap){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ac){var ac;if(this.mode==="Auto"){if(ac==="no_detail"){ac="feature spans"}else{if(ac==="summary_tree"){ac="coverage histogram"}}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ac+")")}},incremental_slots:function(ag,ac,af){var ad=this.view.canvas_manager.dummy_context,ae=this.slotters[ag];if(!ae||(ae.mode!==af)){ae=new (u.FeatureSlotter)(ag,af,A,function(ah){return ad.measureText(ah)});this.slotters[ag]=ae}return ae.slot_features(ac)},get_mode:function(ac){if(ac.dataset_type==="summary_tree"){mode="summary_tree"}else{if(ac.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}}return mode},get_canvas_height:function(ac,ag,ah,ad){if(ag==="summary_tree"||ag==="Coverage"){return this.summary_draw_height}else{var af=this.incremental_slots(ah,ac.data,ag);var ae=new (this.painter)(null,null,null,this.prefs,ag);return Math.max(aa,ae.get_required_height(af,ad))}},draw_tile:function(am,aq,ao,ar,af,aj,ae){var ap=this,ad=aq.canvas,ay=af.get("start"),ac=af.get("end"),ag=this.left_offset;if(ao==="summary_tree"||ao==="Coverage"){var aA=new L.SummaryTreePainter(am,ay,ac,this.prefs);aA.draw(aq,ad.width,ad.height,aj);return new j(ap,af,ar,ad,am.data,am.max)}var ai=[],an=this.slotters[aj].slots;all_slotted=true;if(am.data){var ak=this.filters_manager.filters;for(var at=0,av=am.data.length;at<av;at++){var ah=am.data[at];var au=false;var al;for(var ax=0,aC=ak.length;ax<aC;ax++){al=ak[ax];al.update_attrs(ah);if(!al.keep(ah)){au=true;break}}if(!au){ai.push(ah);if(!(ah[0] in an)){all_slotted=false}}}}var aB=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null);var az=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null);var aA=new (this.painter)(ai,ay,ac,this.prefs,ao,aB,az,ae);var aw=null;aq.fillStyle=this.prefs.block_color;aq.font=aq.canvas.manager.default_font;aq.textAlign="right";if(am.data){aw=aA.draw(aq,ad.width,ad.height,aj,an);aw.translation=-ag}return new O(ap,af,ar,ad,am.data,aj,ao,am.message,all_slotted,aw)},data_and_mode_compatible:function(ac,ad){if(ad==="Auto"){return true}else{if(ad==="Coverage"){return ac.dataset_type==="summary_tree"}else{if(ac.extra_info==="no_detail"||ac.dataset_type==="summary_tree"){return false}else{return true}}}},can_subset:function(ac){if(ac.dataset_type==="summary_tree"||ac.message||ac.extra_info==="no_detail"){return false}return true}});var R=function(ad,ac,ae){c.call(this,ad,ac,ae);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:l.get_random_color()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ae.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=L.ReadPainter};q(R.prototype,r.prototype,M.prototype,c.prototype);var T=function(ae,ad,ag){c.call(this,ae,ad,ag);var af=l.get_random_color(),ac=l.get_random_color([af,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:af},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"Clear value to set automatically"},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=L.ReadPainter;this.update_icons()};q(T.prototype,r.prototype,M.prototype,c.prototype);var d={LineTrack:h,FeatureTrack:c,VcfTrack:R,ReadTrack:T,DiagonalHeatmapTrack:t,CompositeTrack:f,DrawableGroup:P};var p=function(ae,ad,ac){if("copy" in ae){return ae.copy(ac)}else{var af=ae.obj_type;if(!af){af=ae.track_type}return new d[af](ad,ac,ae)}};return{TracksterView:Z,DrawableGroup:P,LineTrack:h,FeatureTrack:c,DiagonalHeatmapTrack:t,ReadTrack:T,VcfTrack:R,CompositeTrack:f,object_from_template:p}});
\ No newline at end of file
+define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","mvc/data","viz/trackster/filters"],function(ab,x,l,u,L,Y,i){var q=ab.extend;var V=function(ac){return("isResolved" in ac)};var n={};var k=function(ac,ad){n[ac.attr("id")]=ad};var m=function(ac,ae,ag,af){ag=".group";var ad={};n[ac.attr("id")]=af;ac.bind("drag",{handle:"."+ae,relative:true},function(ao,ap){var an=$(this),at=$(this).parent(),ak=at.children(),am=n[$(this).attr("id")],aj,ai,aq,ah,al;ai=$(this).parents(ag);if(ai.length!==0){aq=ai.position().top;ah=aq+ai.outerHeight();if(ap.offsetY<aq){$(this).insertBefore(ai);var ar=n[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable_before(am,ar);return}else{if(ap.offsetY>ah){$(this).insertAfter(ai);var ar=n[ai.attr("id")];ar.remove_drawable(am);ar.container.add_drawable(am);return}}}ai=null;for(al=0;al<ak.length;al++){aj=$(ak.get(al));aq=aj.position().top;ah=aq+aj.outerHeight();if(aj.is(ag)&&this!==aj.get(0)&&ap.offsetY>=aq&&ap.offsetY<=ah){if(ap.offsetY-aq<ah-ap.offsetY){aj.find(".content-div").prepend(this)}else{aj.find(".content-div").append(this)}if(am.container){am.container.remove_drawable(am)}n[aj.attr("id")].add_drawable(am);return}}for(al=0;al<ak.length;al++){aj=$(ak.get(al));if(ap.offsetY<aj.position().top&&!(aj.hasClass("reference-track")||aj.hasClass("intro"))){break}}if(al===ak.length){if(this!==ak.get(al-1)){at.append(this);n[at.attr("id")].move_drawable(am,al)}}else{if(this!==ak.get(al)){$(this).insertBefore(ak.get(al));n[at.attr("id")].move_drawable(am,(ap.deltaY>0?al-1:al))}}}).bind("dragstart",function(){ad["border-top"]=ac.css("border-top");ad["border-bottom"]=ac.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ad)})};var aa=16,G=9,D=20,A=100,I=12000,S=400,K=5000,w=100,o="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",v="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",y="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",Q=10,H=20;function W(ad,ac){if(!ac){ac=0}var ae=Math.pow(10,ac);return Math.round(ad*ae)/ae}var r=function(ad,ac,af){if(!r.id_counter){r.id_counter=0}this.id=r.id_counter++;this.name=af.name;this.view=ad;this.container=ac;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:af.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=af.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ag){ag.stopPropagation()});var ae=this;this.container_div.hover(function(){ae.icons_div.show()},function(){ae.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};r.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ac){if(ac.content_visible){ac.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ac.hide_contents();ac.content_visible=false}else{ac.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ac.content_visible=true;ac.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ad){var af=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ac=function(){ad.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(ag){if((ag.keyCode||ag.which)===27){af()}else{if((ag.keyCode||ag.which)===13){ac()}}};$(window).bind("keypress.check_enter_esc",ae);show_modal("Configure",ad.config.build_form(),{Cancel:af,OK:ac})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.remove()}}];q(r.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(){},to_dict:function(){},set_name:function(ac){this.old_name=this.name;this.name=ac;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ac=this.view;this.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ad,ai,ah,ag,ac,af){var ae=this;this.action_icons[ad]=$("<a/>").attr("href","javascript:void(0);").attr("title",ai).addClass("icon-button").addClass(ah).tooltip().click(function(){ag(ae)}).appendTo(this.icons_div);if(af){this.action_icons[ad].hide()}},build_action_icons:function(ac){var ae;for(var ad=0;ad<ac.length;ad++){ae=ac[ad];this.add_action_icon(ae.name,ae.title,ae.css_class,ae.on_click_fn,ae.prepend,ae.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var z=function(ad,ac,ae){r.call(this,ad,ac,ae);this.obj_type=ae.obj_type;this.drawables=[]};q(z.prototype,r.prototype,{unpack_drawables:function(ae){this.drawables=[];var ad;for(var ac=0;ac<ae.length;ac++){ad=p(ae[ac],this.view,this);this.add_drawable(ad)}},init:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].init()}},_draw:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac]._draw()}},to_dict:function(){var ad=[];for(var ac=0;ac<this.drawables.length;ac++){ad.push(this.drawables[ac].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ad}},add_drawable:function(ac){this.drawables.push(ac);ac.container=this;this.changed()},add_drawable_before:function(ae,ac){this.changed();var ad=this.drawables.indexOf(ac);if(ad!==-1){this.drawables.splice(ad,0,ae);return true}return false},replace_drawable:function(ae,ac,ad){var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables[af]=ac;if(ad){ae.container_div.replaceWith(ac.container_div)}this.changed()}return af},remove_drawable:function(ad){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);ad.container=null;this.changed();return true}return false},move_drawable:function(ad,ae){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);this.drawables.splice(ae,0,ad);this.changed();return true}return false},get_drawables:function(){return this.drawables}});var P=function(ad,ac,af){q(af,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});z.call(this,ad,ac,af);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);k(this.container_div,this);k(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in af){this.unpack_drawables(af.drawables)}if("filters" in af){var ae=this.filters_manager;this.filters_manager=new i.FiltersManager(this,af.filters);ae.parent_div.replaceWith(this.filters_manager.parent_div);if(af.filters.visible){this.setup_multitrack_filtering()}}};q(P.prototype,r.prototype,z.prototype,{action_icons_def:[r.prototype.action_icons_def[0],r.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters();ac._restore_filter_managers()}else{ac.setup_multitrack_filtering();ac.request_draw(true)}ac.filters_manager.toggle()}},r.prototype.action_icons_def[2]],build_container_div:function(){var ac=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ac)}return ac},build_header_div:function(){var ac=$("<div/>").addClass("track-header");ac.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ac);return ac},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ae=this.drawables.length;if(ae===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ae===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var al,ak,ai,ao=true,ag=this.drawables[0].get_type(),ac=0;for(al=0;al<ae;al++){ai=this.drawables[al];if(ai.get_type()!==ag){can_composite=false;break}if(ai instanceof c){ac++}}if(ao||ac===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".bs-tooltip").remove()}if(ac>1&&ac===this.drawables.length){var ap={},ad;ai=this.drawables[0];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];ap[ad.name]=[ad]}for(al=1;al<this.drawables.length;al++){ai=this.drawables[al];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];if(ad.name in ap){ap[ad.name].push(ad)}}}this.filters_manager.remove_all();var af,ah,aj,am;for(var an in ap){af=ap[an];if(af.length===ac){ah=new i.NumberFilter({name:af[0].name,index:af[0].index});this.filters_manager.add_filter(ah)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].filters_manager=this.saved_filters_managers[ac]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ac=0;ac<this.drawables.length;ac++){drawable=this.drawables[ac];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ag=[];for(var ad=0;ad<this.drawables.length;ad++){ag.push(this.drawables[ad].name)}var ae="Composite Track of "+this.drawables.length+" tracks ("+ag.join(", ")+")";var af=new f(this.view,this.view,{name:ae,drawables:this.drawables});var ac=this.container.replace_drawable(this,af,true);af.request_draw()},add_drawable:function(ac){z.prototype.add_drawable.call(this,ac);this.update_icons()},remove_drawable:function(ac){z.prototype.remove_drawable.call(this,ac);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ac=q(z.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ac},request_draw:function(ac,ae){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].request_draw(ac,ae)}}});var Z=Backbone.View.extend({initialize:function(ac){q(ac,{obj_type:"View"});z.call(this,"View",ac.container,ac);this.chrom=null;this.vis_id=ac.vis_id;this.dbkey=ac.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new x.CanvasManager(this.container.get(0).ownerDocument);this.reset()},render:function(){this.requested_redraw=false;var ae=this.container,ac=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ae);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ae);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ae);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;k(this.viewport_container,ac);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var af=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){x.select_datasets(select_datasets_url,add_track_async_url,{"f-dbkey":ac.dbkey},function(ag){ab.each(ag,function(ah){ac.add_drawable(p(ah,ac,ac))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ad=function(ag){if(ag.type==="focusout"||(ag.keyCode||ag.which)===13||(ag.keyCode||ag.which)===27){if((ag.keyCode||ag.which)!==27){ac.go_to($(this).val())}$(this).hide();$(this).val("");ac.location_span.show();ac.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ad).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ac.location_span.hide();ac.chrom_select.hide();ac.nav_input.val(ac.chrom+":"+ac.low+"-"+ac.high);ac.nav_input.css("display","inline-block");ac.nav_input.select();ac.nav_input.focus();ac.nav_input.autocomplete({source:function(ai,ag){var aj=[],ah=$.map(ac.get_drawables(),function(ak){return ak.data_manager.search_features(ai.term).success(function(al){aj=aj.concat(al)})});$.when.apply($,ah).done(function(){ag($.map(aj,function(ak){return{label:ak[0],value:ak[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ac.zoom_out();ac.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ac.zoom_in();ac.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ac.change_chrom(ac.chrom_select.val())});this.browser_content_div.click(function(ag){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ag){ac.zoom_in(ag.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ag,ah){this.current_x=ah.offsetX}).bind("drag",function(ag,ai){var aj=ai.offsetX-this.current_x;this.current_x=ai.offsetX;var ah=Math.round(aj/ac.viewport_container.width()*(ac.max_high-ac.max_low));ac.move_delta(-ah)});this.overview_close.click(function(){ac.reset_overview()});this.viewport_container.bind("draginit",function(ag,ah){if(ag.clientX>ac.viewport_container.width()-16){return false}}).bind("dragstart",function(ag,ah){ah.original_low=ac.low;ah.current_height=ag.clientY;ah.current_x=ah.offsetX}).bind("drag",function(ai,ak){var ag=$(this);var al=ak.offsetX-ak.current_x;var ah=ag.scrollTop()-(ai.clientY-ak.current_height);ag.scrollTop(ah);ak.current_height=ai.clientY;ak.current_x=ak.offsetX;var aj=Math.round(al/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}).bind("mousewheel",function(ai,ak,ah,ag){if(ah){ah*=50;var aj=Math.round(-ah/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}});this.top_labeltrack.bind("dragstart",function(ag,ah){return $("<div />").css({height:ac.browser_content_div.height()+ac.top_labeltrack.height()+ac.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ak,al){$(al.proxy).css({left:Math.min(ak.pageX,al.startX)-ac.container.offset().left,width:Math.abs(ak.pageX-al.startX)});var ah=Math.min(ak.pageX,al.startX)-ac.container.offset().left,ag=Math.max(ak.pageX,al.startX)-ac.container.offset().left,aj=(ac.high-ac.low),ai=ac.viewport_container.width();ac.update_location(Math.round(ah/ai*aj)+ac.low,Math.round(ag/ai*aj)+ac.low)}).bind("dragend",function(al,am){var ah=Math.min(al.pageX,am.startX),ag=Math.max(al.pageX,am.startX),aj=(ac.high-ac.low),ai=ac.viewport_container.width(),ak=ac.low;ac.low=Math.round(ah/ai*aj)+ak;ac.high=Math.round(ag/ai*aj)+ak;$(am.proxy).remove();ac.request_redraw()});this.add_label_track(new X(this,{content_div:this.top_labeltrack}));this.add_label_track(new X(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ac.resize_window()},500)});$(document).bind("redraw",function(){ac.redraw()});this.reset();$(window).trigger("resize")}});q(Z.prototype,z.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ad,af,ac,ag){if(this.timer){clearTimeout(this.timer)}if(ag){var ae=this;this.timer=setTimeout(function(){ae.trigger("navigate",ad+":"+af+"-"+ac)},500)}else{view.trigger("navigate",ad+":"+af+"-"+ac)}},update_location:function(ac,ae){this.location_span.text(commatize(ac)+" - "+commatize(ae));this.nav_input.val(this.chrom+":"+commatize(ac)+"-"+commatize(ae));var ad=view.chrom_select.val();if(ad!==""){this.trigger_navigate(ad,view.low,view.high,true)}},load_chroms:function(ae){ae.num=w;var ac=this,ad=$.Deferred();$.ajax({url:chrom_url+"/"+this.dbkey,data:ae,dataType:"json",success:function(ag){if(ag.chrom_info.length===0){return}if(ag.reference){ac.add_label_track(new B(ac))}ac.chrom_data=ag.chrom_info;var aj='<option value="">Select Chrom/Contig</option>';for(var ai=0,af=ac.chrom_data.length;ai<af;ai++){var ah=ac.chrom_data[ai].chrom;aj+='<option value="'+ah+'">'+ah+"</option>"}if(ag.prev_chroms){aj+='<option value="previous">Previous '+w+"</option>"}if(ag.next_chroms){aj+='<option value="next">Next '+w+"</option>"}ac.chrom_select.html(aj);ac.chrom_start_index=ag.start_index;ad.resolve(ag)},error:function(){alert("Could not load chroms for this dbkey:",ac.dbkey)}});return ad},change_chrom:function(ah,ad,aj){var ae=this;if(!ae.chrom_data){ae.load_chroms_deferred.then(function(){ae.change_chrom(ah,ad,aj)});return}if(!ah||ah==="None"){return}if(ah==="previous"){ae.load_chroms({low:this.chrom_start_index-w});return}if(ah==="next"){ae.load_chroms({low:this.chrom_start_index+w});return}var ai=$.grep(ae.chrom_data,function(ak,al){return ak.chrom===ah})[0];if(ai===undefined){ae.load_chroms({chrom:ah},function(){ae.change_chrom(ah,ad,aj)});return}else{if(ah!==ae.chrom){ae.chrom=ah;ae.chrom_select.val(ae.chrom);ae.max_high=ai.len-1;ae.reset();ae.request_redraw(true);for(var ag=0,ac=ae.drawables.length;ag<ac;ag++){var af=ae.drawables[ag];if(af.init){af.init()}}if(ae.reference_track){ae.reference_track.init()}}if(ad!==undefined&&aj!==undefined){ae.low=Math.max(ad,0);ae.high=Math.min(aj,ae.max_high)}else{ae.low=0;ae.high=ae.max_high}ae.reset_overview();ae.request_redraw()}},go_to:function(ag){ag=ag.replace(/ |,/g,"");var ak=this,ac,af,ad=ag.split(":"),ai=ad[0],aj=ad[1];if(aj!==undefined){try{var ah=aj.split("-");ac=parseInt(ah[0],10);af=parseInt(ah[1],10)}catch(ae){return false}}ak.change_chrom(ai,ac,af)},move_fraction:function(ae){var ac=this;var ad=ac.high-ac.low;this.move_delta(ae*ad)},move_delta:function(af){var ac=this;var ae=ac.high-ac.low;if(ac.low-af<ac.max_low){ac.low=ac.max_low;ac.high=ac.max_low+ae}else{if(ac.high-af>ac.max_high){ac.high=ac.max_high;ac.low=ac.max_high-ae}else{ac.high-=af;ac.low-=af}}ac.request_redraw();var ad=ac.chrom_select.val();this.trigger_navigate(ad,ac.low,ac.high,true)},add_drawable:function(ac){z.prototype.add_drawable.call(this,ac);ac.init();this.changed();this.update_intro_div()},add_label_track:function(ac){ac.view=this;ac.init();this.label_tracks.push(ac)},remove_drawable:function(ae,ad){z.prototype.remove_drawable.call(this,ae);if(ad){var ac=this;ae.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ak,ac,aj,al){var ai=this,ah=(al?[al]:ai.drawables),ae;var ad;for(var ag=0;ag<ah.length;ag++){ad=ah[ag];ae=-1;for(var af=0;af<ai.tracks_to_be_redrawn.length;af++){if(ai.tracks_to_be_redrawn[af][0]===ad){ae=af;break}}if(ae<0){ai.tracks_to_be_redrawn.push([ad,ac,aj])}else{ai.tracks_to_be_redrawn[ag][1]=ac;ai.tracks_to_be_redrawn[ag][2]=aj}}if(!this.requested_redraw){requestAnimationFrame(function(){ai._redraw(ak)});this.requested_redraw=true}},_redraw:function(am){this.requested_redraw=false;var aj=this.low,af=this.high;if(aj<this.max_low){aj=this.max_low}if(af>this.max_high){af=this.max_high}var al=this.high-this.low;if(this.high!==0&&al<this.min_separation){af=aj+this.min_separation}this.low=Math.floor(aj);this.high=Math.ceil(af);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var ac=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ai=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var an=13;this.overview_box.css({left:ac,width:Math.max(an,ai)}).show();if(ai<an){this.overview_box.css("left",ac-(an-ai)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ac,width:ai})}if(!am){var ae,ad,ak;for(var ag=0,ah=this.tracks_to_be_redrawn.length;ag<ah;ag++){ae=this.tracks_to_be_redrawn[ag][0];ad=this.tracks_to_be_redrawn[ag][1];ak=this.tracks_to_be_redrawn[ag][2];if(ae){ae._draw(ad,ak)}}this.tracks_to_be_redrawn=[];for(ag=0,ah=this.label_tracks.length;ag<ah;ag++){this.label_tracks[ag]._draw()}}},zoom_in:function(ad,ae){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var af=this.high-this.low,ag=af/2+this.low,ac=(af/this.zoom_factor)/2;if(ad){ag=ad/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ag-ac);this.high=Math.round(ag+ac);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ad=this.high-this.low,ae=ad/2+this.low,ac=(ad*this.zoom_factor)/2;this.low=Math.round(ae-ac);this.high=Math.round(ae+ac);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ae){if(this.overview_drawable){if(this.overview_drawable.dataset_id===ae.dataset_id){return}this.overview_viewport.find(".track").remove()}var ad=ae.copy({content_div:this.overview_viewport}),ac=this;ad.header_div.hide();ad.is_overview=true;ac.overview_drawable=ad;this.overview_drawable.postdraw_actions=function(){ac.overview_highlight.show().height(ac.overview_drawable.content_div.height());ac.overview_viewport.height(ac.overview_drawable.content_div.height()+ac.overview_box.outerHeight());ac.overview_close.show();ac.resize_window()};ac.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".bs-tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var s=function(ae,aj,af){this.track=ae;this.name=aj.name;this.params=[];var aq=aj.params;for(var ag=0;ag<aq.length;ag++){var al=aq[ag],ad=al.name,ap=al.label,ah=unescape(al.html),ar=al.value,an=al.type;if(an==="number"){this.params.push(new e(ad,ap,ah,(ad in af?af[ad]:ar),al.min,al.max))}else{if(an==="select"){this.params.push(new N(ad,ap,ah,(ad in af?af[ad]:ar)))}else{console.log("WARNING: unrecognized tool parameter type:",ad,an)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(au){au.stopPropagation()}).click(function(au){au.stopPropagation()}).bind("dblclick",function(au){au.stopPropagation()});var ao=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var am=this.params;var ak=this;$.each(this.params,function(av,ay){var ax=$("<div>").addClass("param-row").appendTo(ak.parent_div);var au=$("<div>").addClass("param-label").text(ay.label).appendTo(ax);var aw=$("<div/>").addClass("param-input").html(ay.html).appendTo(ax);aw.find(":input").val(ay.value);$("<div style='clear: both;'/>").appendTo(ax)});this.parent_div.find("input").click(function(){$(this).select()});var at=$("<div>").addClass("param-row").appendTo(this.parent_div);var ai=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(at);var ac=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(at);ac.click(function(){ak.run_on_region()});ai.click(function(){ak.run_on_dataset()});if("visible" in af&&af.visible){this.parent_div.show()}};q(s.prototype,{update_params:function(){for(var ac=0;ac<this.params.length;ac++){this.params[ac].update_value()}},state_dict:function(){var ad={};for(var ac=0;ac<this.params.length;ac++){ad[this.params[ac].name]=this.params[ac].value}ad.visible=this.parent_div.is(":visible");return ad},get_param_values_dict:function(){var ac={};this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();ac[ad]=ae});return ac},get_param_values:function(){var ac=[];this.parent_div.find(":input").each(function(){var ad=$(this).attr("name"),ae=$(this).val();if(ad){ac[ac.length]=ae}});return ac},run_on_dataset:function(){var ac=this;ac.run({target_dataset_id:this.track.original_dataset_id,tool_id:ac.name},null,function(ad){show_modal(ac.name+" is Running",ac.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ai=new x.GenomeRegion({chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}),ad={target_dataset_id:this.track.original_dataset_id,action:"rerun",tool_id:this.name,regions:[ai.toJSON()]},ah=this.track,ae=ad.tool_id+ah.tool_region_and_parameters_str(ai),ac;if(ah.container===view){var ag=new P(view,view,{name:this.name});var af=ah.container.replace_drawable(ah,ag,false);ag.container_div.insertBefore(ah.view.content_div.children()[af]);ag.add_drawable(ah);ah.container_div.appendTo(ag.content_div);ac=ag}else{ac=ah.container}var aj=new ah.constructor(view,ac,{name:ae,hda_ldda:"hda"});aj.init_for_tool_data();aj.change_mode(ah.mode);aj.set_filters_manager(ah.filters_manager.copy(aj));aj.update_icons();ac.add_drawable(aj);aj.tiles_div.text("Starting job.");this.update_params();this.run(ad,aj,function(ak){aj.set_dataset(new Y.Dataset(ak));aj.tiles_div.text("Running job.");aj.init()})},run:function(ac,ae,af){ac.inputs=this.get_param_values_dict();var ad=new l.ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(ac),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ag){return ag!=="pending"}});$.when(ad.go()).then(function(ag){if(ag==="no converter"){ae.container_div.addClass("error");ae.content_div.text(J)}else{if(ag.error){ae.container_div.addClass("error");ae.content_div.text(y+ag.message)}else{af(ag)}}})}});var N=function(ad,ac,ae,af){this.name=ad;this.label=ac;this.html=$(ae);this.value=af};q(N.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(ae,ad,ag,ah,af,ac){N.call(this,ae,ad,ag,ah);this.min=af;this.max=ac};q(e.prototype,N.prototype,{update_value:function(){N.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var C=function(ac,ad){L.Scaler.call(this,ad);this.filter=ac};C.prototype.gen_val=function(ac){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ac[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ac){this.track=ac.track;this.params=ac.params;this.values={};this.restore_values((ac.saved_values?ac.saved_values:{}));this.onchange=ac.onchange};q(F.prototype,{restore_values:function(ac){var ad=this;$.each(this.params,function(ae,af){if(ac[af.key]!==undefined){ad.values[af.key]=ac[af.key]}else{ad.values[af.key]=af.default_value}})},build_form:function(){var af=this;var ac=$("<div />");var ae;function ad(ak,ag){for(var ao=0;ao<ak.length;ao++){ae=ak[ao];if(ae.hidden){continue}var ai="param_"+ao;var at=af.values[ae.key];var av=$("<div class='form-row' />").appendTo(ag);av.append($("<label />").attr("for",ai).text(ae.label+":"));if(ae.type==="bool"){av.append($('<input type="checkbox" />').attr("id",ai).attr("name",ai).attr("checked",at))}else{if(ae.type==="text"){av.append($('<input type="text"/>').attr("id",ai).val(at).click(function(){$(this).select()}))}else{if(ae.type==="select"){var aq=$("<select />").attr("id",ai);for(var am=0;am<ae.options.length;am++){$("<option/>").text(ae.options[am].label).attr("value",ae.options[am].value).appendTo(aq)}aq.val(at);av.append(aq)}else{if(ae.type==="color"){var au=$("<div/>").appendTo(av),ap=$("<input />").attr("id",ai).attr("name",ai).val(at).css("float","left").appendTo(au).click(function(ax){$(".bs-tooltip").removeClass("in");var aw=$(this).siblings(".bs-tooltip").addClass("in");aw.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(aw).height()/2)+($(this).height()/2)}).show();aw.click(function(ay){ay.stopPropagation()});$(document).bind("click.color-picker",function(){aw.hide();$(document).unbind("click.color-picker")});ax.stopPropagation()}),an=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(au).attr("title","Set new random color").tooltip(),ar=$("<div class='bs-tooltip right' style='position: absolute;' />").appendTo(au).hide(),aj=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(ar),ah=$("<div class='tooltip-arrow'></div>").appendTo(ar),al=$.farbtastic(aj,{width:100,height:100,callback:ap,color:at});au.append($("<div/>").css("clear","both"));(function(aw){an.click(function(){aw.setColor(l.get_random_color())})})(al)}else{av.append($("<input />").attr("id",ai).attr("name",ai).val(at))}}}}if(ae.help){av.append($("<div class='help'/>").text(ae.help))}}}ad(this.params,ac);return ac},update_from_form:function(ac){var ae=this;var ad=false;$.each(this.params,function(af,ah){if(!ah.hidden){var ai="param_"+af;var ag=ac.find("#"+ai).val();if(ah.type==="float"){ag=parseFloat(ag)}else{if(ah.type==="int"){ag=parseInt(ag)}else{if(ah.type==="bool"){ag=ac.find("#"+ai).is(":checked")}}}if(ag!==ae.values[ah.key]){ae.values[ah.key]=ag;ad=true}}});if(ad){this.onchange();this.track.changed()}}});var b=function(ac,ag,ae,ad,af){this.track=ac;this.region=ag;this.low=ag.get("start");this.high=ag.get("end");this.resolution=ae;this.html_elt=$("<div class='track-tile'/>").append(ad).height($(ad).attr("height"));this.data=af;this.stale=false};b.prototype.predisplay_actions=function(){};var j=function(ac,ah,ae,ad,af,ag){b.call(this,ac,ah,ae,ad,af);this.max_val=ag};q(j.prototype,b.prototype);var O=function(af,an,ag,ae,ai,ap,aj,aq,ad,am){b.call(this,af,an,ag,ae,ai);this.mode=aj;this.all_slotted=ad;this.feature_mapper=am;this.has_icons=false;if(aq){this.has_icons=true;var ak=this;ae=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:ae.width}).prependTo(this.html_elt);var al=new x.GenomeRegion({chrom:af.view.chrom,start:this.low,end:this.high}),ao=ai.length,ah=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ac=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ah.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.DEEP_DATA_REQ);$(".bs-tooltip").hide();af.request_draw(true)}).dblclick(function(ar){ar.stopPropagation()});ac.click(function(){ak.stale=true;af.data_manager.get_more_data(al,af.mode,ak.resolution,{},af.data_manager.BROAD_DATA_REQ);$(".bs-tooltip").hide();af.request_draw(true)}).dblclick(function(ar){ar.stopPropagation()})}};q(O.prototype,b.prototype);O.prototype.predisplay_actions=function(){var ad=this,ac={};if(ad.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ao){if(!this.hovered){return}var aj=$(this).offset(),an=ao.pageX-aj.left,am=ao.pageY-aj.top,at=ad.feature_mapper.get_feature_data(an,am),ak=(at?at[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!ak||$(this).attr("id")!==ak.toString()){$(this).remove()}});if(at){var af=ac[ak];if(!af){var ak=at[0],ap={name:at[3],start:at[1],end:at[2],strand:at[4]},ai=ad.track.filters_manager.filters,ah;for(var al=0;al<ai.length;al++){ah=ai[al];ap[ah.name]=at[ah.index]}var af=$("<div/>").attr("id",ak).addClass("feature-popup"),au=$("<table/>"),ar,aq,av;for(ar in ap){aq=ap[ar];av=$("<tr/>").appendTo(au);$("<th/>").appendTo(av).text(ar);$("<td/>").attr("align","left").appendTo(av).text(typeof(aq)==="number"?W(aq,2):aq)}af.append($("<div class='feature-popup-inner'>").append(au));ac[ak]=af}af.appendTo($(this).parents(".track-content").children(".overlay"));var ag=an+parseInt(ad.html_elt.css("left"))-af.width()/2,ae=am+parseInt(ad.html_elt.css("top"))+7;af.css("left",ag+"px").css("top",ae+"px")}else{if(!ao.isPropagationStopped()){ao.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ao)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(ad,ac,ae){q(ae,{drag_handle_class:"draghandle"});r.call(this,ad,ac,ae);this.dataset=new Y.Dataset({id:ae.dataset_id,hda_ldda:ae.hda_ldda});this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ae?ae.data_query_wait:K);this.data_manager=("data_manager" in ae?ae.data_manager:new x.GenomeDataManager({dataset:this.dataset,data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ae)||ae.resize){this.add_resize_handle()}}};q(g.prototype,r.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},r.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ac){ac.view.set_overview(ac)}},r.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters()}else{ac.filters_manager.init_filters()}ac.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ac){ac.dynamic_tool_div.toggle();if(ac.dynamic_tool_div.is(":visible")){ac.set_name(ac.name+ac.tool_region_and_parameters_str())}else{ac.revert_name()}$(".bs-tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ac){var af='<strong>Tool</strong>: <%= track.tool.name %><br/><strong>Dataset</strong>: <%= track.name %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ae=ab.template(af,{track:ac});var ah=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ad=function(){var aj=$('select[name="regions"] option:selected').val(),al,ai=new x.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ak=ab.map($(".bookmark"),function(am){return new x.GenomeRegion({from_str:$(am).children(".position").text()})});if(aj==="cur"){al=[ai]}else{if(aj==="bookmarks"){al=ak}else{al=[ai].concat(ak)}}hide_modal();window.location.href=galaxy_paths.get("sweepster_url")+"?"+$.param({dataset_id:ac.dataset_id,hda_ldda:ac.hda_ldda,regions:JSON.stringify(new Backbone.Collection(al).toJSON())})},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ad()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",ae,{No:ah,Yes:ad})}},r.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset_id&&r.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ac=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ac)}this.name_div=$("<div/>").addClass("track-name").appendTo(ac).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ac},on_resize:function(){},add_resize_handle:function(){var ac=this;var af=false;var ae=false;var ad=$("<div class='track-resize'>");$(ac.container_div).hover(function(){if(ac.content_visible){af=true;ad.show()}},function(){af=false;if(!ae){ad.hide()}});ad.hide().bind("dragstart",function(ag,ah){ae=true;ah.original_height=$(ac.content_div).height()}).bind("drag",function(ah,ai){var ag=Math.min(Math.max(ai.original_height+ai.deltaY,ac.min_height_px),ac.max_height_px);$(ac.tiles_div).css("height",ag);ac.visible_height_px=(ac.max_height_px===ag?0:ag);ac.on_resize()}).bind("dragend",function(ag,ah){ac.tile_cache.clear();ae=false;if(!af){ad.hide()}ac.config.values.height=ac.visible_height_px;ac.changed()}).appendTo(ac.container_div)},set_display_modes:function(af,ai){this.display_modes=af;this.mode=(ai?ai:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ad=this,ag={};for(var ae=0,ac=ad.display_modes.length;ae<ac;ae++){var ah=ad.display_modes[ae];ag[ah]=function(aj){return function(){ad.change_mode(aj);ad.icons_div.show();ad.container_div.mouseleave(function(){ad.icons_div.hide()})}}(ah)}make_popupmenu(this.action_icons.mode_icon,ag)},build_action_icons:function(){r.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof X){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof R){return"VcfTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(ae){var ad=this;ad.enabled=false;ad.tile_cache.clear();ad.data_manager.clear();ad.content_div.css("height","auto");ad.tiles_div.text("").children().remove();ad.container_div.removeClass("nodata error pending");if(!ad.dataset_id){return}var ac=$.Deferred(),af={hda_ldda:ad.hda_ldda,data_type:this.dataset_check_type,chrom:ad.view.chrom,retry:ae};$.getJSON(this.dataset.url(),af,function(ag){if(!ag||ag==="error"||ag.kind==="error"){ad.container_div.addClass("error");ad.tiles_div.text(o);if(ag.message){ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ag.message+"</pre>",{Close:hide_modal})}));ad.tiles_div.append($("<span/>").text(" "));ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ad.init(true)}))}}else{if(ag==="no converter"){ad.container_div.addClass("error");ad.tiles_div.text(J)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){ad.container_div.addClass("nodata");ad.tiles_div.text(E)}else{if(ag==="pending"){ad.container_div.addClass("pending");ad.tiles_div.html(v);setTimeout(function(){ad.init()},ad.data_query_wait)}else{if(ag==="data"||ag.status==="data"){if(ag.valid_chroms){ad.valid_chroms=ag.valid_chroms;ad.update_icons()}ad.tiles_div.text(U);if(ad.view.chrom){ad.tiles_div.text("");ad.tiles_div.css("height",ad.visible_height_px+"px");ad.enabled=true;$.when(ad.predraw_init()).done(function(){ac.resolve();ad.container_div.removeClass("nodata error pending");ad.request_draw()})}else{ac.resolve()}}}}}}});this.update_icons();return ac},predraw_init:function(){},get_drawables:function(){return this}});var M=function(ae,ad,af){g.call(this,ae,ad,af);var ac=this;m(ac.container_div,ac.drag_handle_class,".group",ac);this.filters_manager=new i.FiltersManager(this,("filters" in af?af.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in af&&af.tool?new s(this,af.tool,af.tool_state):null);this.tile_cache=new x.Cache(Q);if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(af.mode){this.change_mode(af.mode)}};q(M.prototype,r.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.slotters[ac.view.resolution_px_b].max_rows*=2;ac.request_draw(true)},hide:true}]),copy:function(ac){var ad=this.to_dict();q(ad,{data_manager:this.data_manager});var ae=new this.constructor(this.view,ac,ad);ae.change_mode(this.mode);ae.enabled=this.enabled;return ae},set_filters_manager:function(ac){this.filters_manager=ac;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},change_mode:function(ad){var ac=this;ac.mode=ad;ac.config.values.mode=ad;ac.tile_cache.clear();ac.request_draw();this.action_icons.mode_icon.attr("title","Set display mode (now: "+ac.mode+")");return ac},update_icons:function(){var ac=this;if(ac.filters_available){ac.action_icons.filters_icon.show()}else{ac.action_icons.filters_icon.hide()}if(ac.tool){ac.action_icons.tools_icon.show();ac.action_icons.param_space_viz_icon.show()}else{ac.action_icons.tools_icon.hide();ac.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ad,ae,ac){return ad+"_"+ae+"_"+ac},request_draw:function(ad,ac){this.view.request_redraw(false,ad,ac,this)},before_draw:function(){},_draw:function(ad,an){if(!this.can_draw()){return}var al=this.view.low,ah=this.view.high,aj=ah-al,ae=this.view.container.width(),ap=this.view.resolution_px_b,ag=this.view.resolution_b_px;if(this.is_overview){al=this.view.max_low;ah=this.view.max_high;ag=(view.max_high-view.max_low)/ae;ap=1/ag}this.before_draw();this.tiles_div.children().addClass("remove");var ac=Math.floor(al/(ag*S)),ak=true,ao=[],ai=function(aq){return(aq&&"track" in aq)};while((ac*S*ag)<ah){var am=this.draw_helper(ad,ae,ac,ag,this.tiles_div,ap);if(ai(am)){ao.push(am)}else{ak=false}ac+=1}if(!an){this.tiles_div.children(".remove").removeClass("remove").remove()}var af=this;if(ak){this.tiles_div.children(".remove").remove();af.postdraw_actions(ao,ae,ap,an)}},postdraw_actions:function(ae,af,ah,ac){var ag=false;for(var ad=0;ad<ae.length;ad++){if(ae[ad].has_icons){ag=true;break}}if(ag){for(var ad=0;ad<ae.length;ad++){tile=ae[ad];if(!tile.has_icons){tile.html_elt.css("padding-top",D)}}}},draw_helper:function(ac,ao,au,ar,ah,ai,ap){var an=this,ax=this._gen_tile_cache_key(ao,ai,au),af=this._get_tile_bounds(au,ar);if(!ap){ap={}}var aw=(ac?undefined:an.tile_cache.get_elt(ax));if(aw){an.show_tile(aw,ah,ai);return aw}var al=true;var at=an.data_manager.get_data(af,an.mode,ar,an.data_url_extra_params);if(V(at)){al=false}var aj;if(view.reference_track&&ai>view.canvas_manager.char_width_px){aj=view.reference_track.data_manager.get_data(af,an.mode,ar,view.reference_track.data_url_extra_params);if(V(aj)){al=false}}if(al){q(at,ap.more_tile_data);var ak=an.mode;if(ak==="Auto"){ak=an.get_mode(at);an.update_auto_mode(ak)}var ae=an.view.canvas_manager.new_canvas(),av=af.get("start"),ad=af.get("end"),ao=Math.ceil((ad-av)*ai)+an.left_offset,am=an.get_canvas_height(at,ak,ai,ao);ae.width=ao;ae.height=am;var aq=ae.getContext("2d");aq.translate(this.left_offset,0);var aw=an.draw_tile(at,aq,ak,ar,af,ai,aj);if(aw!==undefined){an.tile_cache.set_elt(ax,aw);an.show_tile(aw,ah,ai)}return aw}var ag=$.Deferred();$.when(at,aj).then(function(){view.request_redraw(false,false,false,an);ag.resolve()});return ag},get_canvas_height:function(ac,ae,af,ad){return this.visible_height_px},draw_tile:function(ac,ad,ah,af,ag,ai,ae){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(ae,ah,ai){var ad=this,ac=ae.html_elt;ae.predisplay_actions();var ag=(ae.low-(this.is_overview?this.view.max_low:this.view.low))*ai;if(this.left_offset){ag-=this.left_offset}ac.css({position:"absolute",top:0,left:ag});if(ac.hasClass("remove")){ac.removeClass("remove")}else{ah.append(ac)}ae.html_elt.height("auto");this.max_height_px=Math.max(this.max_height_px,ae.html_elt.height());ae.html_elt.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},_get_tile_bounds:function(ac,ad){var af=Math.floor(ac*S*ad),ag=Math.ceil(S*ad),ae=(af+ag<=this.view.max_high?af+ag:this.view.max_high);return new x.GenomeRegion({chrom:this.view.chrom,start:af,end:ae})},tool_region_and_parameters_str:function(ae){var ac=this,ad=(ae!==undefined?ae.toString():"all");return" - region=["+ad+"], parameters=["+ac.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(ac,ad){return true},can_subset:function(ac){return false},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state";this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(ae,af,ah,ac){var ad=this;ad.normal_postdraw_actions(ae,af,ah,ac);ad.dataset_check_type="converted_datasets_state";ad.data_query_wait=K;var ag=new l.ServerStateDeferred({url:ad.dataset_state_url,url_params:{dataset_id:ad.dataset_id,hda_ldda:ad.hda_ldda},interval:ad.data_query_wait,success_fn:function(ai){return ai!=="pending"}});$.when(ag.go()).then(function(){ad.data_manager.set("data_type","data")});ad.postdraw_actions=ad.normal_postdraw_actions}}});var X=function(ad,ac){var ae={resize:false};g.call(this,ad,ac,ae);this.container_div.addClass("label-track")};q(X.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},_draw:function(){var ae=this.view,af=ae.high-ae.low,ai=Math.floor(Math.pow(10,Math.floor(Math.log(af)/Math.log(10)))),ac=Math.floor(ae.low/ai)*ai,ag=this.view.container.width(),ad=$("<div style='position: relative; height: 1.3em;'></div>");while(ac<ae.high){var ah=(ac-ae.low)/af*ag;ad.append($("<div class='label'>"+commatize(ac)+"</div>").css({position:"absolute",left:ah-1}));ac+=ai}this.content_div.children(":first").remove();this.content_div.append(ad)}});var f=function(ad,ac,ag){M.call(this,ad,ac,ag);this.drawables=[];this.left_offset=0;if("drawables" in ag){var af;for(var ae=0;ae<ag.drawables.length;ae++){af=ag.drawables[ae];this.drawables[ae]=p(af,ad,null);if(af.left_offset>this.left_offset){this.left_offset=af.left_offset}}this.enabled=true}if(this.drawables.length!==0){this.set_display_modes(this.drawables[0].display_modes,this.drawables[0].mode)}this.update_icons();this.obj_type="CompositeTrack"};q(f.prototype,M.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ac){$(".bs-tooltip").remove();ac.show_group()}}].concat(M.prototype.action_icons_def),to_dict:z.prototype.to_dict,add_drawable:z.prototype.add_drawable,unpack_drawables:z.prototype.unpack_drawables,change_mode:function(ac){M.prototype.change_mode.call(this,ac);for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].change_mode(ac)}},init:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].init())}var ac=this;$.when.apply($,ae).then(function(){ac.enabled=true;ac.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:r.prototype.can_draw,draw_helper:function(ad,at,az,aw,ak,am,au){var ar=this,aD=this._gen_tile_cache_key(at,am,az),ah=this._get_tile_bounds(az,aw);if(!au){au={}}var aC=(ad?undefined:ar.tile_cache.get_elt(aD));if(aC){ar.show_tile(aC,ak,am);return aC}var al=[],ar,ap=true,ax,an;for(var ay=0;ay<this.drawables.length;ay++){ar=this.drawables[ay];ax=ar.data_manager.get_data(ah,ar.mode,aw,ar.data_url_extra_params);if(V(ax)){ap=false}al.push(ax);an=null;if(view.reference_track&&am>view.canvas_manager.char_width_px){an=view.reference_track.data_manager.get_data(ah,ar.mode,aw,view.reference_track.data_url_extra_params);if(V(an)){ap=false}}al.push(an)}if(ap){q(ax,au.more_tile_data);this.tile_predraw_init();var ag=ar.view.canvas_manager.new_canvas(),ai=ar._get_tile_bounds(az,aw),aA=ah.get("start"),ae=ah.get("end"),aB=0,at=Math.ceil((ae-aA)*am)+this.left_offset,aq=0,af=[],ay;var ac=0;for(ay=0;ay<this.drawables.length;ay++,aB+=2){ar=this.drawables[ay];ax=al[aB];var ao=ar.mode;if(ao==="Auto"){ao=ar.get_mode(ax);ar.update_auto_mode(ao)}af.push(ao);ac=ar.get_canvas_height(ax,ao,am,at);if(ac>aq){aq=ac}}ag.width=at;ag.height=(au.height?au.height:aq);aB=0;var av=ag.getContext("2d");av.translate(this.left_offset,0);av.globalAlpha=0.5;av.globalCompositeOperation="source-over";for(ay=0;ay<this.drawables.length;ay++,aB+=2){ar=this.drawables[ay];ax=al[aB];an=al[aB+1];aC=ar.draw_tile(ax,av,af[ay],aw,ah,am,an)}this.tile_cache.set_elt(aD,aC);this.show_tile(aC,ak,am);return aC}var aj=$.Deferred(),ar=this;$.when.apply($,al).then(function(){view.request_redraw(false,false,false,ar);aj.resolve()});return aj},show_group:function(){var af=new P(this.view,this.container,{name:this.name}),ac;for(var ae=0;ae<this.drawables.length;ae++){ac=this.drawables[ae];ac.update_icons();af.add_drawable(ac);ac.container=af;af.content_div.append(ac.container_div)}var ad=this.container.replace_drawable(this,af,true);af.request_draw()},tile_predraw_init:function(){var af=Number.MAX_VALUE,ac=-af,ad;for(var ae=0;ae<this.drawables.length;ae++){ad=this.drawables[ae];if(ad instanceof h){if(ad.prefs.min_value<af){af=ad.prefs.min_value}if(ad.prefs.max_value>ac){ac=ad.prefs.max_value}}}for(var ae=0;ae<this.drawables.length;ae++){ad=this.drawables[ae];ad.prefs.min_value=af;ad.prefs.max_value=ac}},postdraw_actions:function(ae,ah,aj,ad){M.prototype.postdraw_actions.call(this,ae,ah,aj,ad);var ag=-1;for(var af=0;af<ae.length;af++){var ac=ae[af].html_elt.find("canvas").height();if(ac>ag){ag=ac}}for(var af=0;af<ae.length;af++){var ai=ae[af];if(ai.html_elt.find("canvas").height()!==ag){this.draw_helper(true,ah,ai.index,ai.resolution,ai.html_elt.parent(),aj,{height:ag});ai.html_elt.remove()}}}});var B=function(ac){M.call(this,ac,{content_div:ac.top_labeltrack},{resize:false});ac.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url+"/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new x.ReferenceTrackDataManager({data_url:this.data_url});this.hide_contents()};q(B.prototype,r.prototype,M.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},can_draw:r.prototype.can_draw,draw_helper:function(ag,ae,ac,ad,ah,ai,af){if(ai>this.view.canvas_manager.char_width_px){return M.prototype.draw_helper.call(this,ag,ae,ac,ad,ah,ai,af)}else{this.hide_contents();return null}},draw_tile:function(ak,al,ag,af,ai,am){var ae=this;if(am>this.view.canvas_manager.char_width_px){if(ak.data===null){this.hide_contents();return}var ad=al.canvas;al.font=al.canvas.manager.default_font;al.textAlign="center";ak=ak.data;for(var ah=0,aj=ak.length;ah<aj;ah++){var ac=Math.floor(ah*am);al.fillText(ak[ah],ac,10)}this.show_contents();return new b(ae,ai,af,ad,ak)}this.hide_contents()}});var h=function(ae,ad,af){var ac=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";M.call(this,ae,ad,af);this.hda_ldda=af.hda_ldda;this.dataset_id=af.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:l.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);ac.vertical_range=ac.prefs.max_value-ac.prefs.min_value;ac.set_min_value(ac.prefs.min_value);ac.set_max_value(ac.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};q(h.prototype,r.prototype,M.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(ac){this.prefs.min_value=ac;$("#linetrack_"+this.dataset_id+"_minval").text(this.prefs.min_value);this.tile_cache.clear();this.request_draw()},set_max_value:function(ac){this.prefs.max_value=ac;$("#linetrack_"+this.dataset_id+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.request_draw()},predraw_init:function(){var ac=this;ac.vertical_range=undefined;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.hda_ldda},function(ad){ac.container_div.addClass("line-track");var ag=ad.data;if(isNaN(parseFloat(ac.prefs.min_value))||isNaN(parseFloat(ac.prefs.max_value))){var ae=ag.min,ai=ag.max;ae=Math.floor(Math.min(0,Math.max(ae,ag.mean-2*ag.sd)));ai=Math.ceil(Math.max(0,Math.min(ai,ag.mean+2*ag.sd)));ac.prefs.min_value=ae;ac.prefs.max_value=ai;$("#track_"+ac.dataset_id+"_minval").val(ac.prefs.min_value);$("#track_"+ac.dataset_id+"_maxval").val(ac.prefs.max_value)}ac.vertical_range=ac.prefs.max_value-ac.prefs.min_value;ac.total_frequency=ag.total_frequency;ac.container_div.find(".yaxislabel").remove();var ah=$("<div/>").text(W(ac.prefs.min_value,3)).make_text_editable({num_cols:6,on_finish:function(aj){$(".bs-tooltip").remove();var aj=parseFloat(aj);if(!isNaN(aj)){ac.set_min_value(aj)}},help_text:"Set min value"}).addClass("yaxislabel bottom").attr("id","linetrack_"+ac.dataset_id+"_minval").prependTo(ac.container_div),af=$("<div/>").text(W(ac.prefs.max_value,3)).make_text_editable({num_cols:6,on_finish:function(aj){$(".bs-tooltip").remove();var aj=parseFloat(aj);if(!isNaN(aj)){ac.set_max_value(aj)}},help_text:"Set max value"}).addClass("yaxislabel top").attr("id","linetrack_"+ac.dataset_id+"_maxval").prependTo(ac.container_div)})},draw_tile:function(al,aj,ae,ad,ag,ak){var ac=aj.canvas,af=ag.get("start"),ai=ag.get("end"),ah=new L.LinePainter(al.data,af,ai,this.prefs,ae);ah.draw(aj,ac.width,ac.height,ak);return new b(this,ag,ad,ac,al.data)},can_subset:function(ac){return false}});var t=function(ae,ad,af){var ac=this;this.display_modes=["Heatmap"];this.mode="Heatmap";M.call(this,ae,ad,af);this.hda_ldda=af.hda_ldda;this.dataset_id=af.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:af.prefs,onchange:function(){ac.set_name(ac.prefs.name);ac.vertical_range=ac.prefs.max_value-ac.prefs.min_value;ac.set_min_value(ac.prefs.min_value);ac.set_max_value(ac.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};q(t.prototype,r.prototype,M.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(ac){this.prefs.min_value=ac;this.tile_cache.clear();this.request_draw()},set_max_value:function(ac){this.prefs.max_value=ac;this.tile_cache.clear();this.request_draw()},draw_tile:function(ac,ae,ai,ag,ah,aj){var af=ae.canvas,ad=new L.DiagonalHeatmapPainter(ac.data,ah.get("start"),ah.get("end"),this.prefs,ai);ad.draw(ae,af.width,af.height,aj);return new b(this,ah,ag,af,ac.data)}});var c=function(af,ae,ah){var ad=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];M.call(this,af,ae,ah);var ag=l.get_random_color(),ac=l.get_random_color([ag,"#FFFFFF"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ag},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ah.prefs,onchange:function(){ad.set_name(ad.prefs.name);ad.tile_cache.clear();ad.set_painter_from_config();ad.request_draw()}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.hda_ldda=ah.hda_ldda;this.dataset_id=ah.dataset_id;this.original_dataset_id=ah.dataset_id;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};q(c.prototype,r.prototype,M.prototype,{set_dataset:function(ac){this.dataset_id=ac.get("id");this.hda_ldda=ac.get("hda_ldda");this.dataset=ac;this.data_manager.set("dataset",ac)},set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},before_draw:function(){this.max_height_px=0},postdraw_actions:function(ar,am,ah,ag){M.prototype.postdraw_actions.call(this,ar,ag);var al=this,ao;if(al.mode==="Coverage"){var ad=-1;for(ao=0;ao<ar.length;ao++){var an=ar[ao].max_val;if(an>ad){ad=an}}for(ao=0;ao<ar.length;ao++){var au=ar[ao];if(au.max_val!==ad){au.html_elt.remove();al.draw_helper(true,am,au.index,au.resolution,au.html_elt.parent(),ah,{more_tile_data:{max:ad}})}}}if(al.filters_manager){var ai=al.filters_manager.filters;for(var aq=0;aq<ai.length;aq++){ai[aq].update_ui_elt()}var at=false,ac,aj;for(ao=0;ao<ar.length;ao++){if(ar[ao].data.length){ac=ar[ao].data[0];for(var aq=0;aq<ai.length;aq++){aj=ai[aq];if(aj.applies_to(ac)&&aj.min!==aj.max){at=true;break}}}}if(al.filters_available!==at){al.filters_available=at;if(!al.filters_available){al.filters_manager.hide()}al.update_icons()}}this.container_div.find(".yaxislabel").remove();var af=ar[0];if(af instanceof j){var ak=(this.prefs.histogram_max?this.prefs.histogram_max:af.max_val),ae=$("<div/>").text(ak).make_text_editable({num_cols:12,on_finish:function(av){$(".bs-tooltip").remove();var av=parseFloat(av);al.prefs.histogram_max=(!isNaN(av)?av:null);al.tile_cache.clear();al.request_draw()},help_text:"Set max value; leave blank to use default"}).addClass("yaxislabel top").css("color",this.prefs.label_color);this.container_div.prepend(ae)}if(af instanceof O){var ap=true;for(ao=0;ao<ar.length;ao++){if(!ar[ao].all_slotted){ap=false;break}}if(!ap){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ac){var ac;if(this.mode==="Auto"){if(ac==="no_detail"){ac="feature spans"}else{if(ac==="summary_tree"){ac="coverage histogram"}}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ac+")")}},incremental_slots:function(ag,ac,af){var ad=this.view.canvas_manager.dummy_context,ae=this.slotters[ag];if(!ae||(ae.mode!==af)){ae=new (u.FeatureSlotter)(ag,af,A,function(ah){return ad.measureText(ah)});this.slotters[ag]=ae}return ae.slot_features(ac)},get_mode:function(ac){if(ac.dataset_type==="summary_tree"){mode="summary_tree"}else{if(ac.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}}return mode},get_canvas_height:function(ac,ag,ah,ad){if(ag==="summary_tree"||ag==="Coverage"){return this.summary_draw_height}else{var af=this.incremental_slots(ah,ac.data,ag);var ae=new (this.painter)(null,null,null,this.prefs,ag);return Math.max(aa,ae.get_required_height(af,ad))}},draw_tile:function(am,aq,ao,ar,af,aj,ae){var ap=this,ad=aq.canvas,ay=af.get("start"),ac=af.get("end"),ag=this.left_offset;if(ao==="summary_tree"||ao==="Coverage"){var aA=new L.SummaryTreePainter(am,ay,ac,this.prefs);aA.draw(aq,ad.width,ad.height,aj);return new j(ap,af,ar,ad,am.data,am.max)}var ai=[],an=this.slotters[aj].slots;all_slotted=true;if(am.data){var ak=this.filters_manager.filters;for(var at=0,av=am.data.length;at<av;at++){var ah=am.data[at];var au=false;var al;for(var ax=0,aC=ak.length;ax<aC;ax++){al=ak[ax];al.update_attrs(ah);if(!al.keep(ah)){au=true;break}}if(!au){ai.push(ah);if(!(ah[0] in an)){all_slotted=false}}}}var aB=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null);var az=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null);var aA=new (this.painter)(ai,ay,ac,this.prefs,ao,aB,az,ae);var aw=null;aq.fillStyle=this.prefs.block_color;aq.font=aq.canvas.manager.default_font;aq.textAlign="right";if(am.data){aw=aA.draw(aq,ad.width,ad.height,aj,an);aw.translation=-ag}return new O(ap,af,ar,ad,am.data,aj,ao,am.message,all_slotted,aw)},data_and_mode_compatible:function(ac,ad){if(ad==="Auto"){return true}else{if(ad==="Coverage"){return ac.dataset_type==="summary_tree"}else{if(ac.extra_info==="no_detail"||ac.dataset_type==="summary_tree"){return false}else{return true}}}},can_subset:function(ac){if(ac.dataset_type==="summary_tree"||ac.message||ac.extra_info==="no_detail"){return false}return true}});var R=function(ad,ac,ae){c.call(this,ad,ac,ae);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:l.get_random_color()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ae.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=L.ReadPainter};q(R.prototype,r.prototype,M.prototype,c.prototype);var T=function(ae,ad,ag){c.call(this,ae,ad,ag);var af=l.get_random_color(),ac=l.get_random_color([af,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:af},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ac},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"Clear value to set automatically"},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=L.ReadPainter;this.update_icons()};q(T.prototype,r.prototype,M.prototype,c.prototype);var d={LineTrack:h,FeatureTrack:c,VcfTrack:R,ReadTrack:T,DiagonalHeatmapTrack:t,CompositeTrack:f,DrawableGroup:P};var p=function(ae,ad,ac){if("copy" in ae){return ae.copy(ac)}else{var af=ae.obj_type;if(!af){af=ae.track_type}return new d[af](ad,ac,ae)}};return{TracksterView:Z,DrawableGroup:P,LineTrack:h,FeatureTrack:c,DiagonalHeatmapTrack:t,ReadTrack:T,VcfTrack:R,CompositeTrack:f,object_from_template:p}});
\ 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
commit/galaxy-central: smcmanus: The input datatype for display changed from LibraryDataset to Dataset, causing permission-checking issues. They've been fixed.
by Bitbucket 04 Nov '12
by Bitbucket 04 Nov '12
04 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/b3585fb0c986/
changeset: b3585fb0c986
user: smcmanus
date: 2012-11-04 07:49:43
summary: The input datatype for display changed from LibraryDataset to Dataset, causing permission-checking issues. They've been fixed.
affected #: 2 files
diff -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef -r b3585fb0c98639a57d8934f09f4553a3ad69e80b lib/galaxy/security/__init__.py
--- a/lib/galaxy/security/__init__.py
+++ b/lib/galaxy/security/__init__.py
@@ -275,11 +275,12 @@
# then the returned permissions will not carry an entry for the dataset.
ret_permissions = {}
if ( len( permission_items ) > 0 ):
+ # SM: NB: LibraryDatasets became Datasets for some odd reason.
if ( isinstance( permission_items[0], trans.model.LibraryDataset ) ):
ids = [ item.library_dataset_id for item in permission_items ]
permissions = trans.sa_session.query( trans.model.LibraryDatasetPermissions ) \
.filter( and_( trans.model.LibraryDatasetPermissions.library_dataset_id.in_( ids ),
- trans.model.LibraryDatasetPermissions.action == action ) ) \
+ trans.model.LibraryDatasetPermissions.action == action.action ) ) \
.all()
# Massage the return data. We will return a list of permissions
@@ -292,6 +293,23 @@
ret_permissions[ item.library_dataset_id ] = []
for permission in permissions:
ret_permissions[ permission.library_dataset_id ].append( permission )
+ elif ( isinstance( permission_items[0], trans.model.Dataset ) ):
+ ids = [ item.id for item in permission_items ]
+ permissions = trans.sa_session.query( trans.model.DatasetPermissions ) \
+ .filter( and_( trans.model.DatasetPermissions.dataset_id.in_( ids ),
+ trans.model.DatasetPermissions.action == action.action ) ) \
+ .all()
+
+ # Massage the return data. We will return a list of permissions
+ # for each library dataset. So we initialize the return list to
+ # have an empty list for each dataset. Then each permission is
+ # appended to the right lib dataset.
+ # TODO: Consider eliminating the initialization and just return
+ # empty values for each library dataset id.
+ for item in permission_items:
+ ret_permissions[ item.id ] = []
+ for permission in permissions:
+ ret_permissions[ permission.dataset_id ].append( permission )
# Test that we get the same response from get_item_actions each item:
test_code = False
@@ -333,14 +351,13 @@
LDDAs.
"""
all_items_actions = self.get_actions_for_items( trans, action, items )
+ ret_allow_action = {}
- ret_allow_action = {}
# Change item to lib_dataset or vice-versa.
for item in items:
if all_items_actions.has_key( item.id ):
item_actions = all_items_actions[ item.id ]
- # For access, all of the dataset's
if self.permitted_actions.DATASET_ACCESS == action:
ret_allow_action[ item.id ] = True
for item_action in item_actions:
diff -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef -r b3585fb0c98639a57d8934f09f4553a3ad69e80b lib/galaxy/webapps/galaxy/controllers/library_common.py
--- a/lib/galaxy/webapps/galaxy/controllers/library_common.py
+++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py
@@ -131,7 +131,17 @@
comptypes = get_comptypes( trans )
try:
if self.app.config.new_lib_browse:
- pass
+ return trans.fill_template( 'library/common/browse_library_opt.mako',
+ cntrller=cntrller,
+ use_panels=use_panels,
+ library=library,
+ created_ldda_ids=created_ldda_ids,
+ hidden_folder_ids=hidden_folder_ids,
+ show_deleted=show_deleted,
+ comptypes=comptypes,
+ current_user_roles=current_user_roles,
+ message=message,
+ status=status )
else:
return trans.fill_template( 'library/common/browse_library.mako',
cntrller=cntrller,
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: clem...@galaxyproject.org: Bringing Sphinx RST files up to date; changing generated doc so all modules are documented, not just galaxy.*
by Bitbucket 02 Nov '12
by Bitbucket 02 Nov '12
02 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/c0f9edeb7ab1/
changeset: c0f9edeb7ab1
user: clem...(a)galaxyproject.org
date: 2012-10-31 23:41:13
summary: Bringing Sphinx RST files up to date; changing generated doc so all modules are documented, not just galaxy.*
affected #: 27 files
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/index.rst
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -3,22 +3,19 @@
Galaxy is an open, web-based platform for accessible, reproducible, and
transparent computational biomedical research.
- - Accessible: Users without programming experience can easily specify
- parameters and run tools and workflows.
- - Reproducible: Galaxy captures information so that any user can repeat and
- understand a complete computational analysis.
- - Transparent: Users share and publish analyses via the web and create
- Pages, interactive, web-based documents that describe a complete
- analysis.
+
+- Accessible: Users without programming experience can easily specify parameters and run tools and workflows.
+- Reproducible: Galaxy captures information so that any user can repeat and understand a complete computational analysis.
+- Transparent: Users share and publish analyses via the web and create Pages, interactive, web-based documents that describe a complete analysis.
Contents
========
.. toctree::
- :maxdepth: 4
+ :maxdepth: 5
- API Documentation <lib/galaxy.web.api>
+ API Documentation <lib/galaxy.webapps.galaxy.api>
- Application Documentation <lib/galaxy>
+ Application Documentation <lib/modules>
Indices and tables
==================
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.datatypes.converters.rst
--- a/doc/source/lib/galaxy.datatypes.converters.rst
+++ b/doc/source/lib/galaxy.datatypes.converters.rst
@@ -113,6 +113,14 @@
:undoc-members:
:show-inheritance:
+:mod:`interval_to_fli` Module
+-----------------------------
+
+.. automodule:: galaxy.datatypes.converters.interval_to_fli
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
:mod:`interval_to_interval_index_converter` Module
--------------------------------------------------
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.jobs.deferred.rst
--- a/doc/source/lib/galaxy.jobs.deferred.rst
+++ b/doc/source/lib/galaxy.jobs.deferred.rst
@@ -17,6 +17,14 @@
:undoc-members:
:show-inheritance:
+:mod:`genome_index` Module
+--------------------------
+
+.. automodule:: galaxy.jobs.deferred.genome_index
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
:mod:`genome_transfer` Module
-----------------------------
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.jobs.rst
--- a/doc/source/lib/galaxy.jobs.rst
+++ b/doc/source/lib/galaxy.jobs.rst
@@ -25,6 +25,14 @@
:undoc-members:
:show-inheritance:
+:mod:`mapper` Module
+--------------------
+
+.. automodule:: galaxy.jobs.mapper
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
:mod:`transfer_manager` Module
------------------------------
@@ -40,6 +48,7 @@
galaxy.jobs.actions
galaxy.jobs.deferred
+ galaxy.jobs.rules
galaxy.jobs.runners
galaxy.jobs.splitters
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.jobs.runners.cli_job.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.jobs.runners.cli_job.rst
@@ -0,0 +1,19 @@
+cli_job Package
+===============
+
+:mod:`cli_job` Package
+----------------------
+
+.. automodule:: galaxy.jobs.runners.cli_job
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`torque` Module
+--------------------
+
+.. automodule:: galaxy.jobs.runners.cli_job.torque
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.jobs.runners.cli_shell.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.jobs.runners.cli_shell.rst
@@ -0,0 +1,19 @@
+cli_shell Package
+=================
+
+:mod:`cli_shell` Package
+------------------------
+
+.. automodule:: galaxy.jobs.runners.cli_shell
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`rsh` Module
+-----------------
+
+.. automodule:: galaxy.jobs.runners.cli_shell.rsh
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.jobs.runners.rst
--- a/doc/source/lib/galaxy.jobs.runners.rst
+++ b/doc/source/lib/galaxy.jobs.runners.rst
@@ -9,6 +9,22 @@
:undoc-members:
:show-inheritance:
+:mod:`cli` Module
+-----------------
+
+.. automodule:: galaxy.jobs.runners.cli
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`condor` Module
+--------------------
+
+.. automodule:: galaxy.jobs.runners.condor
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
:mod:`drmaa` Module
-------------------
@@ -57,3 +73,11 @@
:undoc-members:
:show-inheritance:
+Subpackages
+-----------
+
+.. toctree::
+
+ galaxy.jobs.runners.cli_job
+ galaxy.jobs.runners.cli_shell
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.util.backports.importlib.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.util.backports.importlib.rst
@@ -0,0 +1,11 @@
+importlib Package
+=================
+
+:mod:`importlib` Package
+------------------------
+
+.. automodule:: galaxy.util.backports.importlib
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.util.backports.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.util.backports.rst
@@ -0,0 +1,18 @@
+backports Package
+=================
+
+:mod:`backports` Package
+------------------------
+
+.. automodule:: galaxy.util.backports
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Subpackages
+-----------
+
+.. toctree::
+
+ galaxy.util.backports.importlib
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.util.rst
--- a/doc/source/lib/galaxy.util.rst
+++ b/doc/source/lib/galaxy.util.rst
@@ -137,3 +137,10 @@
:undoc-members:
:show-inheritance:
+Subpackages
+-----------
+
+.. toctree::
+
+ galaxy.util.backports
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.visualization.data_providers.phyloviz.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.visualization.data_providers.phyloviz.rst
@@ -0,0 +1,43 @@
+phyloviz Package
+================
+
+:mod:`phyloviz` Package
+-----------------------
+
+.. automodule:: galaxy.visualization.data_providers.phyloviz
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`baseparser` Module
+------------------------
+
+.. automodule:: galaxy.visualization.data_providers.phyloviz.baseparser
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`newickparser` Module
+--------------------------
+
+.. automodule:: galaxy.visualization.data_providers.phyloviz.newickparser
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`nexusparser` Module
+-------------------------
+
+.. automodule:: galaxy.visualization.data_providers.phyloviz.nexusparser
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`phyloxmlparser` Module
+----------------------------
+
+.. automodule:: galaxy.visualization.data_providers.phyloviz.phyloxmlparser
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.visualization.data_providers.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.visualization.data_providers.rst
@@ -0,0 +1,42 @@
+data_providers Package
+======================
+
+:mod:`data_providers` Package
+-----------------------------
+
+.. automodule:: galaxy.visualization.data_providers
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`basic` Module
+-------------------
+
+.. automodule:: galaxy.visualization.data_providers.basic
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`genome` Module
+--------------------
+
+.. automodule:: galaxy.visualization.data_providers.genome
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`registry` Module
+----------------------
+
+.. automodule:: galaxy.visualization.data_providers.registry
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Subpackages
+-----------
+
+.. toctree::
+
+ galaxy.visualization.data_providers.phyloviz
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.visualization.genome.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.visualization.genome.rst
@@ -0,0 +1,19 @@
+genome Package
+==============
+
+:mod:`genome` Package
+---------------------
+
+.. automodule:: galaxy.visualization.genome
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`visual_analytics` Module
+------------------------------
+
+.. automodule:: galaxy.visualization.genome.visual_analytics
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.visualization.rst
--- a/doc/source/lib/galaxy.visualization.rst
+++ b/doc/source/lib/galaxy.visualization.rst
@@ -22,5 +22,7 @@
.. toctree::
+ galaxy.visualization.data_providers
+ galaxy.visualization.genome
galaxy.visualization.tracks
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.visualization.tracks.rst
--- a/doc/source/lib/galaxy.visualization.tracks.rst
+++ b/doc/source/lib/galaxy.visualization.tracks.rst
@@ -9,14 +9,6 @@
:undoc-members:
:show-inheritance:
-:mod:`data_providers` Module
-----------------------------
-
-.. automodule:: galaxy.visualization.tracks.data_providers
- :members:
- :undoc-members:
- :show-inheritance:
-
:mod:`summary` Module
---------------------
@@ -25,11 +17,3 @@
:undoc-members:
:show-inheritance:
-:mod:`visual_analytics` Module
-------------------------------
-
-.. automodule:: galaxy.visualization.tracks.visual_analytics
- :members:
- :undoc-members:
- :show-inheritance:
-
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.web.api.rst
--- a/doc/source/lib/galaxy.web.api.rst
+++ /dev/null
@@ -1,352 +0,0 @@
-Galaxy API Documentation
-************************
-
-Background
-==========
-In addition to being accessible through a web interface, Galaxy can now also be
-accessed programmatically, through shell scripts and other programs. The web
-interface is appropriate for things like exploratory analysis, visualization,
-construction of workflows, and rerunning workflows on new datasets.
-
-The web interface is less suitable for things like
- - Connecting a Galaxy instance directly to your sequencer and running
- workflows whenever data is ready
- - Running a workflow against multiple datasets (which can be done with the
- web interface, but is tedious)
- - When the analysis involves complex control, such as looping and
- branching.
-
-The Galaxy API addresses these and other situations by exposing Galaxy
-internals through an additional interface, known as an Application Programming
-Interface, or API.
-
-Quickstart
-==========
-
-Set the following option in universe_wsgi.ini and start the server::
-
- enable_api = True
-
-Log in as your user, navigate to the API Keys page in the User menu, and
-generate a new API key. Make a note of the API key, and then pull up a
-terminal. Now we'll use the display.py script in your galaxy/scripts/api
-directory for a short example::
-
- % ./display.py my_key http://localhost:4096/api/histories
- Collection Members
- ------------------
- #1: /api/histories/8c49be448cfe29bc
- name: Unnamed history
- id: 8c49be448cfe29bc
- #2: /api/histories/33b43b4e7093c91f
- name: output test
- id: 33b43b4e7093c91f
-
-The result is a Collection of the histories of the user specified by the API
-key (you). To look at the details of a particular history, say #1 above, do
-the following::
-
- % ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc
- Member Information
- ------------------
- state_details: {'ok': 1, 'failed_metadata': 0, 'upload': 0, 'discarded': 0, 'running': 0, 'setting_metadata': 0, 'error': 0, 'new': 0, 'queued': 0, 'empty': 0}
- state: ok
- contents_url: /api/histories/8c49be448cfe29bc/contents
- id: 8c49be448cfe29bc
- name: Unnamed history
-
-This gives detailed information about the specific member in question, in this
-case the History. To view history contents, do the following::
-
-
- % ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc/contents
- Collection Members
- ------------------
- #1: /api/histories/8c49be448cfe29bc/contents/6f91353f3eb0fa4a
- name: Pasted Entry
- type: file
- id: 6f91353f3eb0fa4a
-
-What we have here is another Collection of items containing all of the datasets
-in this particular history. Finally, to view details of a particular dataset
-in this collection, execute the following::
-
- % ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc/contents/6f91353f3eb0f…
- Member Information
- ------------------
- misc_blurb: 1 line
- name: Pasted Entry
- data_type: txt
- deleted: False
- file_name: /Users/yoplait/work/galaxy-stock/database/files/000/dataset_82.dat
- state: ok
- download_url: /datasets/6f91353f3eb0fa4a/display?to_ext=txt
- visible: True
- genome_build: ?
- model_class: HistoryDatasetAssociation
- file_size: 17
- metadata_data_lines: 1
- id: 6f91353f3eb0fa4a
- misc_info: uploaded txt file
- metadata_dbkey: ?
-
-And now you've successfully used the API to request and select a history,
-browse the contents of that history, and then look at detailed information
-about a particular dataset.
-
-For a more comprehensive Data Library example, set the following option in your
-universe_wsgi.ini as well, and restart galaxy again::
-
- admin_users = you(a)example.org
- library_import_dir = /path/to/some/directory
-
-In the directory you specified for 'library_import_dir', create some
-subdirectories, and put (or symlink) files to import into Galaxy into those
-subdirectories.
-
-In Galaxy, create an account that matches the address you put in 'admin_users',
-then browse to that user's preferences and generate a new API Key. Copy the
-key to your clipboard and then use these scripts::
-
- % ./display.py my_key http://localhost:4096/api/libraries
- Collection Members
- ------------------
-
- 0 elements in collection
-
- % ./library_create_library.py my_key http://localhost:4096/api/libraries api_test 'API Test Library'
- Response
- --------
- /api/libraries/f3f73e481f432006
- name: api_test
- id: f3f73e481f432006
-
- % ./display.py my_key http://localhost:4096/api/libraries
- Collection Members
- ------------------
- /api/libraries/f3f73e481f432006
- name: api_test
- id: f3f73e481f432006
-
- % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006
- Member Information
- ------------------
- synopsis: None
- contents_url: /api/libraries/f3f73e481f432006/contents
- description: API Test Library
- name: api_test
-
- % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents
- Collection Members
- ------------------
- /api/libraries/f3f73e481f432006/contents/28202595c0d2591f61ddda595d2c3670
- name: /
- type: folder
- id: 28202595c0d2591f61ddda595d2c3670
-
- % ./library_create_folder.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents 28202595c0d2591f61ddda595d2c3670 api_test_folder1 'API Test Folder 1'
- Response
- --------
- /api/libraries/f3f73e481f432006/contents/28202595c0d2591fa4f9089d2303fd89
- name: api_test_folder1
- id: 28202595c0d2591fa4f9089d2303fd89
-
- % ./library_upload_from_import_dir.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents 28202595c0d2591fa4f9089d2303fd89 bed bed hg19
- Response
- --------
- /api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87d7b
- name: 2.bed
- id: e9ef7fdb2db87d7b
- /api/libraries/f3f73e481f432006/contents/3b7f6a31f80a5018
- name: 3.bed
- id: 3b7f6a31f80a5018
-
- % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents
- Collection Members
- ------------------
- /api/libraries/f3f73e481f432006/contents/28202595c0d2591f61ddda595d2c3670
- name: /
- type: folder
- id: 28202595c0d2591f61ddda595d2c3670
- /api/libraries/f3f73e481f432006/contents/28202595c0d2591fa4f9089d2303fd89
- name: /api_test_folder1
- type: folder
- id: 28202595c0d2591fa4f9089d2303fd89
- /api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87d7b
- name: /api_test_folder1/2.bed
- type: file
- id: e9ef7fdb2db87d7b
- /api/libraries/f3f73e481f432006/contents/3b7f6a31f80a5018
- name: /api_test_folder1/3.bed
- type: file
- id: 3b7f6a31f80a5018
-
- % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87…
- Member Information
- ------------------
- misc_blurb: 68 regions
- metadata_endCol: 3
- data_type: bed
- metadata_columns: 6
- metadata_nameCol: 4
- uploaded_by: nate@...
- metadata_strandCol: 6
- name: 2.bed
- genome_build: hg19
- metadata_comment_lines: None
- metadata_startCol: 2
- metadata_chromCol: 1
- file_size: 4272
- metadata_data_lines: 68
- message:
- metadata_dbkey: hg19
- misc_info: uploaded bed file
- date_uploaded: 2010-06-22T17:01:51.266119
- metadata_column_types: str, int, int, str, int, str
-
-Other parameters are valid when uploading, they are the same parameters as are
-used in the web form, like 'link_data_only' and etc.
-
-The request and response format should be considered alpha and are subject to change.
-
-
-API Controllers
-===============
-
-:mod:`datasets` Module
-----------------------
-
-.. automodule:: galaxy.web.api.datasets
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`forms` Module
--------------------
-
-.. automodule:: galaxy.web.api.forms
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`genomes` Module
----------------------
-
-.. automodule:: galaxy.web.api.genomes
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`histories` Module
------------------------
-
-.. automodule:: galaxy.web.api.histories
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`history_contents` Module
-------------------------------
-
-.. automodule:: galaxy.web.api.history_contents
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`libraries` Module
------------------------
-
-.. automodule:: galaxy.web.api.libraries
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`library_contents` Module
-------------------------------
-
-.. automodule:: galaxy.web.api.library_contents
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`permissions` Module
--------------------------
-
-.. automodule:: galaxy.web.api.permissions
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`quotas` Module
---------------------
-
-.. automodule:: galaxy.web.api.quotas
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`request_types` Module
----------------------------
-
-.. automodule:: galaxy.web.api.request_types
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`requests` Module
-----------------------
-
-.. automodule:: galaxy.web.api.requests
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`roles` Module
--------------------
-
-.. automodule:: galaxy.web.api.roles
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`samples` Module
----------------------
-
-.. automodule:: galaxy.web.api.samples
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`tools` Module
--------------------
-
-.. automodule:: galaxy.web.api.tools
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`users` Module
--------------------
-
-.. automodule:: galaxy.web.api.users
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`visualizations` Module
-----------------------------
-
-.. automodule:: galaxy.web.api.visualizations
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`workflows` Module
------------------------
-
-.. automodule:: galaxy.web.api.workflows
- :members:
- :undoc-members:
- :show-inheritance:
-
-
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.web.base.controllers.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.web.base.controllers.rst
@@ -0,0 +1,11 @@
+controllers Package
+===================
+
+:mod:`admin` Module
+-------------------
+
+.. automodule:: galaxy.web.base.controllers.admin
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.web.base.rst
--- a/doc/source/lib/galaxy.web.base.rst
+++ b/doc/source/lib/galaxy.web.base.rst
@@ -9,3 +9,10 @@
:undoc-members:
:show-inheritance:
+Subpackages
+-----------
+
+.. toctree::
+
+ galaxy.web.base.controllers
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.web.controllers.rst
--- a/doc/source/lib/galaxy.web.controllers.rst
+++ /dev/null
@@ -1,235 +0,0 @@
-controllers Package
-===================
-
-:mod:`controllers` Package
---------------------------
-
-.. automodule:: galaxy.web.controllers
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`admin` Module
--------------------
-
-.. automodule:: galaxy.web.controllers.admin
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`admin_toolshed` Module
-----------------------------
-
-.. automodule:: galaxy.web.controllers.admin_toolshed
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`async` Module
--------------------
-
-.. automodule:: galaxy.web.controllers.async
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`cloud` Module
--------------------
-
-.. automodule:: galaxy.web.controllers.cloud
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`data_admin` Module
-------------------------
-
-.. automodule:: galaxy.web.controllers.data_admin
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`dataset` Module
----------------------
-
-.. automodule:: galaxy.web.controllers.dataset
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`error` Module
--------------------
-
-.. automodule:: galaxy.web.controllers.error
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`external_service` Module
-------------------------------
-
-.. automodule:: galaxy.web.controllers.external_service
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`external_services` Module
--------------------------------
-
-.. automodule:: galaxy.web.controllers.external_services
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`forms` Module
--------------------
-
-.. automodule:: galaxy.web.controllers.forms
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`history` Module
----------------------
-
-.. automodule:: galaxy.web.controllers.history
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`library` Module
----------------------
-
-.. automodule:: galaxy.web.controllers.library
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`library_admin` Module
----------------------------
-
-.. automodule:: galaxy.web.controllers.library_admin
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`library_common` Module
-----------------------------
-
-.. automodule:: galaxy.web.controllers.library_common
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`mobile` Module
---------------------
-
-.. automodule:: galaxy.web.controllers.mobile
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`page` Module
-------------------
-
-.. automodule:: galaxy.web.controllers.page
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`request_type` Module
---------------------------
-
-.. automodule:: galaxy.web.controllers.request_type
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`requests` Module
-----------------------
-
-.. automodule:: galaxy.web.controllers.requests
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`requests_admin` Module
-----------------------------
-
-.. automodule:: galaxy.web.controllers.requests_admin
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`requests_common` Module
------------------------------
-
-.. automodule:: galaxy.web.controllers.requests_common
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`root` Module
-------------------
-
-.. automodule:: galaxy.web.controllers.root
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`tag` Module
------------------
-
-.. automodule:: galaxy.web.controllers.tag
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`tool_runner` Module
--------------------------
-
-.. automodule:: galaxy.web.controllers.tool_runner
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`tracks` Module
---------------------
-
-.. automodule:: galaxy.web.controllers.tracks
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`ucsc_proxy` Module
-------------------------
-
-.. automodule:: galaxy.web.controllers.ucsc_proxy
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`user` Module
-------------------
-
-.. automodule:: galaxy.web.controllers.user
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`visualization` Module
----------------------------
-
-.. automodule:: galaxy.web.controllers.visualization
- :members:
- :undoc-members:
- :show-inheritance:
-
-:mod:`workflow` Module
-----------------------
-
-.. automodule:: galaxy.web.controllers.workflow
- :members:
- :undoc-members:
- :show-inheritance:
-
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.web.rst
--- a/doc/source/lib/galaxy.web.rst
+++ b/doc/source/lib/galaxy.web.rst
@@ -38,9 +38,7 @@
.. toctree::
- galaxy.web.api
galaxy.web.base
- galaxy.web.controllers
galaxy.web.framework
galaxy.web.security
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.webapps.community.controllers.rst
--- a/doc/source/lib/galaxy.webapps.community.controllers.rst
+++ b/doc/source/lib/galaxy.webapps.community.controllers.rst
@@ -41,6 +41,14 @@
:undoc-members:
:show-inheritance:
+:mod:`repository_review` Module
+-------------------------------
+
+.. automodule:: galaxy.webapps.community.controllers.repository_review
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
:mod:`upload` Module
--------------------
@@ -49,6 +57,14 @@
:undoc-members:
:show-inheritance:
+:mod:`user` Module
+------------------
+
+.. automodule:: galaxy.webapps.community.controllers.user
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
:mod:`workflow` Module
----------------------
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.webapps.community.framework.middleware.rst
--- a/doc/source/lib/galaxy.webapps.community.framework.middleware.rst
+++ b/doc/source/lib/galaxy.webapps.community.framework.middleware.rst
@@ -17,3 +17,11 @@
:undoc-members:
:show-inheritance:
+:mod:`remoteuser` Module
+------------------------
+
+.. automodule:: galaxy.webapps.community.framework.middleware.remoteuser
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.webapps.galaxy.api.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.webapps.galaxy.api.rst
@@ -0,0 +1,391 @@
+Galaxy API Documentation
+************************
+
+Background
+==========
+In addition to being accessible through a web interface, Galaxy can now also be
+accessed programmatically, through shell scripts and other programs. The web
+interface is appropriate for things like exploratory analysis, visualization,
+construction of workflows, and rerunning workflows on new datasets.
+
+The web interface is less suitable for things like
+ - Connecting a Galaxy instance directly to your sequencer and running
+ workflows whenever data is ready
+ - Running a workflow against multiple datasets (which can be done with the
+ web interface, but is tedious)
+ - When the analysis involves complex control, such as looping and
+ branching.
+
+The Galaxy API addresses these and other situations by exposing Galaxy
+internals through an additional interface, known as an Application Programming
+Interface, or API.
+
+Quickstart
+==========
+
+Set the following option in universe_wsgi.ini and start the server::
+
+ enable_api = True
+
+Log in as your user, navigate to the API Keys page in the User menu, and
+generate a new API key. Make a note of the API key, and then pull up a
+terminal. Now we'll use the display.py script in your galaxy/scripts/api
+directory for a short example::
+
+ % ./display.py my_key http://localhost:4096/api/histories
+ Collection Members
+ ------------------
+ #1: /api/histories/8c49be448cfe29bc
+ name: Unnamed history
+ id: 8c49be448cfe29bc
+ #2: /api/histories/33b43b4e7093c91f
+ name: output test
+ id: 33b43b4e7093c91f
+
+The result is a Collection of the histories of the user specified by the API
+key (you). To look at the details of a particular history, say #1 above, do
+the following::
+
+ % ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc
+ Member Information
+ ------------------
+ state_details: {'ok': 1, 'failed_metadata': 0, 'upload': 0, 'discarded': 0, 'running': 0, 'setting_metadata': 0, 'error': 0, 'new': 0, 'queued': 0, 'empty': 0}
+ state: ok
+ contents_url: /api/histories/8c49be448cfe29bc/contents
+ id: 8c49be448cfe29bc
+ name: Unnamed history
+
+This gives detailed information about the specific member in question, in this
+case the History. To view history contents, do the following::
+
+
+ % ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc/contents
+ Collection Members
+ ------------------
+ #1: /api/histories/8c49be448cfe29bc/contents/6f91353f3eb0fa4a
+ name: Pasted Entry
+ type: file
+ id: 6f91353f3eb0fa4a
+
+What we have here is another Collection of items containing all of the datasets
+in this particular history. Finally, to view details of a particular dataset
+in this collection, execute the following::
+
+ % ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc/contents/6f91353f3eb0f…
+ Member Information
+ ------------------
+ misc_blurb: 1 line
+ name: Pasted Entry
+ data_type: txt
+ deleted: False
+ file_name: /Users/yoplait/work/galaxy-stock/database/files/000/dataset_82.dat
+ state: ok
+ download_url: /datasets/6f91353f3eb0fa4a/display?to_ext=txt
+ visible: True
+ genome_build: ?
+ model_class: HistoryDatasetAssociation
+ file_size: 17
+ metadata_data_lines: 1
+ id: 6f91353f3eb0fa4a
+ misc_info: uploaded txt file
+ metadata_dbkey: ?
+
+And now you've successfully used the API to request and select a history,
+browse the contents of that history, and then look at detailed information
+about a particular dataset.
+
+For a more comprehensive Data Library example, set the following option in your
+universe_wsgi.ini as well, and restart galaxy again::
+
+ admin_users = you(a)example.org
+ library_import_dir = /path/to/some/directory
+
+In the directory you specified for 'library_import_dir', create some
+subdirectories, and put (or symlink) files to import into Galaxy into those
+subdirectories.
+
+In Galaxy, create an account that matches the address you put in 'admin_users',
+then browse to that user's preferences and generate a new API Key. Copy the
+key to your clipboard and then use these scripts::
+
+ % ./display.py my_key http://localhost:4096/api/libraries
+ Collection Members
+ ------------------
+
+ 0 elements in collection
+
+ % ./library_create_library.py my_key http://localhost:4096/api/libraries api_test 'API Test Library'
+ Response
+ --------
+ /api/libraries/f3f73e481f432006
+ name: api_test
+ id: f3f73e481f432006
+
+ % ./display.py my_key http://localhost:4096/api/libraries
+ Collection Members
+ ------------------
+ /api/libraries/f3f73e481f432006
+ name: api_test
+ id: f3f73e481f432006
+
+ % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006
+ Member Information
+ ------------------
+ synopsis: None
+ contents_url: /api/libraries/f3f73e481f432006/contents
+ description: API Test Library
+ name: api_test
+
+ % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents
+ Collection Members
+ ------------------
+ /api/libraries/f3f73e481f432006/contents/28202595c0d2591f61ddda595d2c3670
+ name: /
+ type: folder
+ id: 28202595c0d2591f61ddda595d2c3670
+
+ % ./library_create_folder.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents 28202595c0d2591f61ddda595d2c3670 api_test_folder1 'API Test Folder 1'
+ Response
+ --------
+ /api/libraries/f3f73e481f432006/contents/28202595c0d2591fa4f9089d2303fd89
+ name: api_test_folder1
+ id: 28202595c0d2591fa4f9089d2303fd89
+
+ % ./library_upload_from_import_dir.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents 28202595c0d2591fa4f9089d2303fd89 bed bed hg19
+ Response
+ --------
+ /api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87d7b
+ name: 2.bed
+ id: e9ef7fdb2db87d7b
+ /api/libraries/f3f73e481f432006/contents/3b7f6a31f80a5018
+ name: 3.bed
+ id: 3b7f6a31f80a5018
+
+ % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents
+ Collection Members
+ ------------------
+ /api/libraries/f3f73e481f432006/contents/28202595c0d2591f61ddda595d2c3670
+ name: /
+ type: folder
+ id: 28202595c0d2591f61ddda595d2c3670
+ /api/libraries/f3f73e481f432006/contents/28202595c0d2591fa4f9089d2303fd89
+ name: /api_test_folder1
+ type: folder
+ id: 28202595c0d2591fa4f9089d2303fd89
+ /api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87d7b
+ name: /api_test_folder1/2.bed
+ type: file
+ id: e9ef7fdb2db87d7b
+ /api/libraries/f3f73e481f432006/contents/3b7f6a31f80a5018
+ name: /api_test_folder1/3.bed
+ type: file
+ id: 3b7f6a31f80a5018
+
+ % ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87…
+ Member Information
+ ------------------
+ misc_blurb: 68 regions
+ metadata_endCol: 3
+ data_type: bed
+ metadata_columns: 6
+ metadata_nameCol: 4
+ uploaded_by: nate@...
+ metadata_strandCol: 6
+ name: 2.bed
+ genome_build: hg19
+ metadata_comment_lines: None
+ metadata_startCol: 2
+ metadata_chromCol: 1
+ file_size: 4272
+ metadata_data_lines: 68
+ message:
+ metadata_dbkey: hg19
+ misc_info: uploaded bed file
+ date_uploaded: 2010-06-22T17:01:51.266119
+ metadata_column_types: str, int, int, str, int, str
+
+Other parameters are valid when uploading, they are the same parameters as are
+used in the web form, like 'link_data_only' and etc.
+
+The request and response format should be considered alpha and are subject to change.
+
+
+API Controllers
+===============
+
+:mod:`datasets` Module
+----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.datasets
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`folder_contents` Module
+-----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.folder_contents
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`folders` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.folders
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`forms` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.forms
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`genomes` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.genomes
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`group_roles` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.group_roles
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`group_users` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.group_users
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`groups` Module
+--------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.groups
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`histories` Module
+-----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.histories
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`history_contents` Module
+------------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.history_contents
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`libraries` Module
+-----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.libraries
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`library_contents` Module
+------------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.library_contents
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`permissions` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.permissions
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`quotas` Module
+--------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.quotas
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`request_types` Module
+---------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.request_types
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`requests` Module
+----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.requests
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`roles` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.roles
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`samples` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.samples
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`tools` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.tools
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`users` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.users
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`visualizations` Module
+----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.visualizations
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`workflows` Module
+-----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.workflows
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.webapps.galaxy.api.rst~
--- /dev/null
+++ b/doc/source/lib/galaxy.webapps.galaxy.api.rst~
@@ -0,0 +1,179 @@
+api Package
+===========
+
+:mod:`datasets` Module
+----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.datasets
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`folder_contents` Module
+-----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.folder_contents
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`folders` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.folders
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`forms` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.forms
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`genomes` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.genomes
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`group_roles` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.group_roles
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`group_users` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.group_users
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`groups` Module
+--------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.groups
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`histories` Module
+-----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.histories
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`history_contents` Module
+------------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.history_contents
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`libraries` Module
+-----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.libraries
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`library_contents` Module
+------------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.library_contents
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`permissions` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.permissions
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`quotas` Module
+--------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.quotas
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`request_types` Module
+---------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.request_types
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`requests` Module
+----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.requests
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`roles` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.roles
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`samples` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.samples
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`tools` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.tools
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`users` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.users
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`visualizations` Module
+----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.visualizations
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`workflows` Module
+-----------------------
+
+.. automodule:: galaxy.webapps.galaxy.api.workflows
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.webapps.galaxy.controllers.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.webapps.galaxy.controllers.rst
@@ -0,0 +1,227 @@
+controllers Package
+===================
+
+:mod:`controllers` Package
+--------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`admin` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.admin
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`admin_toolshed` Module
+----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.admin_toolshed
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`async` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.async
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`cloudlaunch` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.cloudlaunch
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`data_admin` Module
+------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.data_admin
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`dataset` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.dataset
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`error` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.error
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`external_service` Module
+------------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.external_service
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`external_services` Module
+-------------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.external_services
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`forms` Module
+-------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.forms
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`history` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.history
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`library` Module
+---------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.library
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`library_admin` Module
+---------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.library_admin
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`library_common` Module
+----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.library_common
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`mobile` Module
+--------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.mobile
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`page` Module
+------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.page
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`request_type` Module
+--------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.request_type
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`requests` Module
+----------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.requests
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`requests_admin` Module
+----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.requests_admin
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`requests_common` Module
+-----------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.requests_common
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`root` Module
+------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.root
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`tag` Module
+-----------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.tag
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`tool_runner` Module
+-------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.tool_runner
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`ucsc_proxy` Module
+------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.ucsc_proxy
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`user` Module
+------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.user
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`visualization` Module
+---------------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.visualization
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+:mod:`workflow` Module
+----------------------
+
+.. automodule:: galaxy.webapps.galaxy.controllers.workflow
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.webapps.galaxy.rst
--- /dev/null
+++ b/doc/source/lib/galaxy.webapps.galaxy.rst
@@ -0,0 +1,19 @@
+galaxy Package
+==============
+
+:mod:`buildapp` Module
+----------------------
+
+.. automodule:: galaxy.webapps.galaxy.buildapp
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Subpackages
+-----------
+
+.. toctree::
+
+ galaxy.webapps.galaxy.api
+ galaxy.webapps.galaxy.controllers
+
diff -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 -r c0f9edeb7ab137bf7adf76478eccb7fc32557cef doc/source/lib/galaxy.webapps.rst
--- a/doc/source/lib/galaxy.webapps.rst
+++ b/doc/source/lib/galaxy.webapps.rst
@@ -16,5 +16,6 @@
galaxy.webapps.community
galaxy.webapps.demo_sequencer
+ galaxy.webapps.galaxy
galaxy.webapps.reports
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: Circster: (a) create mixin for drawing tick labels and (b) use ticks for denoting chromosome length and track min/max.
by Bitbucket 02 Nov '12
by Bitbucket 02 Nov '12
02 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/86f05ee5dedb/
changeset: 86f05ee5dedb
user: jgoecks
date: 2012-11-02 21:15:15
summary: Circster: (a) create mixin for drawing tick labels and (b) use ticks for denoting chromosome length and track min/max.
affected #: 1 file
diff -r 154cda53407f8360ab00b54ec563c1985157c9a5 -r 86f05ee5dedbb1f21bdb8f7e4e823fc760a4d674 static/scripts/viz/circster.js
--- a/static/scripts/viz/circster.js
+++ b/static/scripts/viz/circster.js
@@ -1,5 +1,9 @@
define(["libs/underscore", "libs/d3", "viz/visualization"], function(_, d3, visualization) {
+/**
+ * Utility class for working with SVG.
+ */
+// TODO: make into a mixin.
var SVGUtils = Backbone.Model.extend({
/**
@@ -21,8 +25,89 @@
}
return true;
}
+});
-});
+/**
+ * Mixin for using ticks.
+ */
+var UsesTicks = {
+ drawTicks: function(parent_elt, data, dataHandler, textTransform, horizontal) {
+ // Set up group elements for chroms and for each tick.
+ var ticks = parent_elt.append("g")
+ .selectAll("g")
+ .data(data)
+ .enter().append("g")
+ .selectAll("g")
+ .data(dataHandler)
+ .enter().append("g")
+ .attr("transform", function(d) {
+ return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")" +
+ "translate(" + d.radius + ",0)";
+ });
+
+ // Add line + text for ticks.
+ var tick_coords = [],
+ text_coords = [],
+ text_anchor = function(d) {
+ return d.angle > Math.PI ? "end" : null;
+ };
+ if (horizontal) {
+ tick_coords = [0, 0, 0, -4];
+ text_coords = [4, 0, "", ".35em"];
+ text_anchor = null;
+ }
+ else {
+ tick_coords = [1, 0, 4, 0];
+ text_coords = [0, 4, ".35em", ""];
+
+ }
+
+ ticks.append("line")
+ .attr("x1", tick_coords[0])
+ .attr("y1", tick_coords[1])
+ .attr("x2", tick_coords[2])
+ .attr("y1", tick_coords[3])
+ .style("stroke", "#000");
+
+ ticks.append("text")
+ .attr("x", text_coords[0])
+ .attr("y", text_coords[1])
+ .attr("dx", text_coords[2])
+ .attr("dy", text_coords[3])
+ .attr("text-anchor", text_anchor)
+ .attr("transform", textTransform)
+ .text(function(d) { return d.label; });
+ },
+
+ /**
+ * Format number for display at a tick.
+ */
+ formatNum: function(num, sigDigits) {
+ var rval = null;
+ if (num < 1) {
+ rval = num.toPrecision(sigDigits);
+ }
+ else {
+ // Use round to turn string from toPrecision() back into a number.
+ var roundedNum = Math.round(num.toPrecision(sigDigits));
+
+ // Use abbreviations.
+ if (num < 1000) {
+ rval = roundedNum;
+ }
+ else if (num < 1000000) {
+ // Use K.
+ rval = Math.round((roundedNum/1000).toPrecision(3)).toFixed(0) + 'K';
+ }
+ else if (num < 1000000000) {
+ // Use M.
+ rval = Math.round((roundedNum/1000000).toPrecision(3)).toFixed(0) + 'M';
+ }
+ }
+
+ return rval;
+ }
+};
/**
* A label track.
@@ -39,7 +124,7 @@
this.total_gap = options.total_gap;
this.genome = options.genome;
this.dataset_arc_height = options.dataset_arc_height;
- this.track_gap = 5;
+ this.track_gap = 10;
this.label_arc_height = 50;
this.scale = 1;
this.circular_views = null;
@@ -340,11 +425,19 @@
$.when(data_ready_deferred).then(function() {
$.when(self._render_data(track_parent_elt)).then(function() {
chroms_paths.style("fill", self.bg_fill);
+
+ // Render labels after data is available so that data attributes are available.
+ self.render_labels();
});
});
},
/**
+ * Render track labels.
+ */
+ render_labels: function() {},
+
+ /**
* Update radius bounds.
*/
update_radius_bounds: function(radius_bounds) {
@@ -580,52 +673,31 @@
var k = (d.endAngle - d.startAngle) / d.value,
ticks = d3.range(0, d.value, 25000000).map(function(v, i) {
return {
+ radius: self.innerRadius,
angle: v * k + d.startAngle,
- label: i === 0 ? 0 : (i % 3 ? null : v / 1000000 + "M")
+ label: i === 0 ? 0 : (i % 3 ? null : self.formatNum(v))
};
});
// If there are fewer that 4 ticks, label last tick so that at least one non-zero tick is labeled.
if (ticks.length < 4) {
- ticks[ticks.length-1].label = Math.round(
- ( ticks[ticks.length-1].angle - d.startAngle ) / k / 1000000
- ) + "M";
+ ticks[ticks.length-1].label = self.formatNum(
+ Math.round( ( ticks[ticks.length-1].angle - d.startAngle ) / k )
+ );
}
return ticks;
};
- var ticks = this.parent_elt.append("g")
- .selectAll("g")
- .data(this.chroms_layout)
- .enter().append("g")
- .selectAll("g")
- .data(chromArcTicks)
- .enter().append("g")
- .attr("transform", function(d) {
- return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")" +
- "translate(" + self.innerRadius + ",0)";
- });
+ /** Rotate and move text as needed. */
+ var textTransform = function(d) {
+ return d.angle > Math.PI ? "rotate(180)translate(-16)" : null;
+ };
- ticks.append("line")
- .attr("x1", 1)
- .attr("y1", 0)
- .attr("x2", 4)
- .attr("y2", 0)
- .style("stroke", "#000");
-
- ticks.append("text")
- .attr("x", 4)
- .attr("dy", ".35em")
- .attr("text-anchor", function(d) {
- return d.angle > Math.PI ? "end" : null;
- })
- .attr("transform", function(d) {
- return d.angle > Math.PI ? "rotate(180)translate(-16)" : null;
- })
- .text(function(d) { return d.label; });
+ this.drawTicks(this.parent_elt, this.chroms_layout, chromArcTicks, textTransform);
}
});
+_.extend(CircsterChromLabelTrackView.prototype, UsesTicks);
/**
* View for quantitative track in Circster.
@@ -683,6 +755,39 @@
.angle(line.angle());
},
+ render_labels: function() {
+ // -- Render min and max using ticks. --
+ var self = this,
+ // Keep counter of visible chroms.
+ visibleChroms = 0,
+ dataBoundsTicks = function(d) {
+ // Do not add ticks to small chroms.
+ if (d.endAngle - d.startAngle < 0.08) { return []; }
+
+ // Only show bounds on every 3rd chromosome; also update visibleChroms count.
+ if (visibleChroms++ % 3 !== 0) { return []; }
+
+ // Set up data to display min, max ticks.
+ return [
+ {
+ radius: self.radius_bounds[0],
+ angle: d.startAngle,
+ label: self.formatNum(self.data_bounds[0])
+ },
+ {
+ radius: self.radius_bounds[1],
+ angle: d.startAngle,
+ label: self.formatNum(self.data_bounds[1])
+ }
+ ];
+ },
+ textTransform = function() {
+ return "rotate(90)";
+ };
+
+ this.drawTicks(this.parent_elt, this.chroms_layout, dataBoundsTicks, textTransform, true);
+ },
+
/**
* Returns an array with two values denoting the minimum and maximum
* values for the track.
@@ -690,6 +795,8 @@
get_data_bounds: function(data) {}
});
+_.extend(CircsterQuantitativeTrackView.prototype, UsesTicks);
+
/**
* Layout for summary tree data in a circster visualization.
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
02 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/154cda53407f/
changeset: 154cda53407f
user: smcmanus
date: 2012-11-02 20:38:54
summary: Temporarily reverted library browsing.
affected #: 2 files
diff -r 59a35ec1e2e7ce608d2ae566c7c1e201760c53a1 -r 154cda53407f8360ab00b54ec563c1985157c9a5 templates/library/common/browse_library.mako
--- a/templates/library/common/browse_library.mako
+++ b/templates/library/common/browse_library.mako
@@ -48,7 +48,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js("libs/json2")}
${h.js("libs/jquery/jstorage")}
${common_javascripts()}
${self.grid_javascripts()}
@@ -207,7 +206,7 @@
</script></%def>
-<%def name="render_dataset( cntrller, ldda, library_dataset, can_modify, can_manage, selected, library, folder, pad, parent, row_counter, tracked_datasets, show_deleted=False, simple=False )">
+<%def name="render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, parent, row_counter, tracked_datasets, show_deleted=False, simple=False )"><%
## The received ldda must always be a LibraryDatasetDatasetAssociation object. The object id passed to methods
## from the drop down menu should be the ldda id to prevent id collision ( which could happen when displaying
@@ -215,14 +214,22 @@
## library_dataset, so we display the attributes from the ldda.
from galaxy.webapps.galaxy.controllers.library_common import branch_deleted
-
+
is_admin = trans.user_is_admin() and cntrller == 'library_admin'
- current_version = ( ldda == library_dataset.library_dataset_dataset_association )
+
+ if ldda == library_dataset.library_dataset_dataset_association:
+ current_version = True
+ if is_admin:
+ can_modify = can_manage = True
+ elif cntrller in [ 'library', 'requests' ]:
+ can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, library_dataset )
+ can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, library_dataset )
+ else:
+ can_modify = can_manage = False
+ else:
+ current_version = False
if current_version and ldda.state not in ( 'ok', 'error', 'empty', 'deleted', 'discarded' ):
tracked_datasets[ldda.id] = ldda.state
- # SM: This causes a query to be emitted, but it quickly goes down a
- # rabbit hole of many possible inheritable cases. It may not be
- # possible to easily eliminate the extra query from this call.
info_association, inherited = ldda.get_info_association( restrict=True )
form_type = trans.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
%>
@@ -303,21 +310,9 @@
%endif
</%def>
-<%def name="format_delta( tdelta )">
- <%
- from datetime import datetime
- return "%d.%.6d" % ( tdelta.seconds, tdelta.microseconds )
- %>
-</%def>
-
<%def name="render_folder( cntrller, folder, folder_pad, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=False, parent=None, row_counter=None, root_folder=False, simple=False )"><%
- from galaxy.webapps.galaxy.controllers.library_common import active_folders, active_folders_and_library_datasets, activatable_folders_and_library_datasets, map_library_datasets_to_lddas, branch_deleted, datasets_for_lddas
-
- # SM: DELETEME
- from datetime import datetime, timedelta
- import logging
- log = logging.getLogger( __name__ )
+ from galaxy.webapps.galaxy.controllers.library_common import active_folders, active_folders_and_library_datasets, activatable_folders_and_library_datasets, branch_deleted
is_admin = trans.user_is_admin() and cntrller == 'library_admin'
has_accessible_library_datasets = trans.app.security_agent.has_accessible_library_datasets( trans, folder, trans.user, current_user_roles, search_downward=False )
@@ -330,9 +325,6 @@
pad = folder_pad + 20
expander = h.url_for("/static/images/silk/resultset_next.png")
folder_img = h.url_for("/static/images/silk/folder.png")
- # SM: If this is a comma-delimited list of LDDAs, then split them up
- # into a list. For anything else, turn created_ldda_ids into a single
- # item list.
if created_ldda_ids:
created_ldda_ids = util.listify( created_ldda_ids )
if str( folder.id ) in hidden_folder_ids:
@@ -434,39 +426,47 @@
%>
%endif
<%
- # TODO: If show_deleted is set to True, then nothing is displayed. Why? This wasn't the case
- # in the past.
if show_deleted:
sub_folders, library_datasets = activatable_folders_and_library_datasets( trans, folder )
else:
sub_folders, library_datasets = active_folders_and_library_datasets( trans, folder )
- # Render all the subfolders:
- # TODO: Check permissions first.
- for sub_folder in sub_folders:
- render_folder( cntrller, sub_folder, pad, created_ldda_ids, library, [], tracked_datasets, show_deleted=show_deleted, parent=my_row, row_counter=row_counter, root_folder=False )
-
- # Map LibraryDatasets to LDDAs, then map LDDAs to Datasets.
- # Then determine which Datasets are accessible and which are not.
- # For every LibraryDataset, if there's an LDDA for it and it's
- # accessible then display it.
- if ( len( library_datasets ) > 0 ):
- lib_dataset_ldda_map = map_library_datasets_to_lddas( trans, library_datasets )
- dataset_list = datasets_for_lddas( trans, lib_dataset_ldda_map.values() )
- #can_access_datasets = trans.app.security_agent.dataset_access_mapping( trans, current_user_roles, dataset_list )
- can_access_datasets = trans.app.security_agent.dataset_permission_map_for_access( trans, current_user_roles, dataset_list )
- can_modify_datasets = trans.app.security_agent.item_permission_map_for_modify( trans, current_user_roles, dataset_list )
- can_manage_datasets = trans.app.security_agent.item_permission_map_for_manage( trans, current_user_roles, dataset_list )
- for library_dataset in library_datasets:
- ldda = lib_dataset_ldda_map[ library_dataset.id ]
- if ldda:
- # SMTODO: Fix awkard modify/manage permission checks.
- can_access = is_admin or can_access_datasets[ ldda.dataset_id ]
- can_modify = is_admin or ( cntrller in ['library', 'requests'] and can_modify_datasets[ ldda.dataset_id ])
- can_manage = is_admin or ( cntrller in ['library', 'requests'] and can_manage_datasets[ ldda.dataset_id ])
+ %>
+ %if is_admin:
+ %for sub_folder in sub_folders:
+ ${render_folder( cntrller, sub_folder, pad, created_ldda_ids, library, [], tracked_datasets, show_deleted=show_deleted, parent=my_row, row_counter=row_counter, root_folder=False )}
+ %endfor
+ %for library_dataset in library_datasets:
+ <%
+ ldda = library_dataset.library_dataset_dataset_association
+ if ldda:
+ # There should always be an ldda, but some users running their own instances have reported that
+ # some of their LibraryDatasets have no associated lddas
selected = created_ldda_ids and str( ldda.id ) in created_ldda_ids
- if can_access:
- render_dataset( cntrller, ldda, library_dataset, can_modify, can_manage, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted )
- %>
+ %>
+ %if ldda:
+ ${render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted )}
+ %endif
+ %endfor
+ %else:
+ %for sub_folder in sub_folders:
+ ${render_folder( cntrller, sub_folder, pad, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=show_deleted, parent=my_row, row_counter=row_counter, root_folder=False, simple=simple )}
+ %endfor
+ %for library_dataset in library_datasets:
+ <%
+ ldda = library_dataset.library_dataset_dataset_association
+ if ldda:
+ # There should always be an ldda, but some users running their own instances have reported that
+ # some of their LibraryDatasets have no associated lddas
+ can_access = trans.app.security_agent.can_access_dataset( current_user_roles, ldda.dataset )
+ selected = created_ldda_ids and str( ldda.id ) in created_ldda_ids
+ else:
+ can_access = False
+ %>
+ %if can_access:
+ ${render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted, simple=simple )}
+ %endif
+ %endfor
+ %endif
</%def><%def name="render_content(simple=False)">
@@ -474,8 +474,6 @@
from galaxy import util
from galaxy.webapps.galaxy.controllers.library_common import branch_deleted
from time import strftime
- import logging
- log = logging.getLogger( __name__ )
is_admin = trans.user_is_admin() and cntrller == 'library_admin'
@@ -491,8 +489,6 @@
info_association, inherited = library.get_info_association()
form_type = trans.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
- # SM: These are mostly display-specific; ignore them for now.
- # The has_accessible_folders determines if anything can be shown - use it.
self.has_accessible_datasets = trans.app.security_agent.has_accessible_library_datasets( trans, library.root_folder, trans.user, current_user_roles )
root_folder_has_accessible_library_datasets = trans.app.security_agent.has_accessible_library_datasets( trans, library.root_folder, trans.user, current_user_roles, search_downward=False )
has_accessible_folders = is_admin or trans.app.security_agent.has_accessible_folders( trans, library.root_folder, trans.user, current_user_roles )
@@ -585,16 +581,13 @@
</tr></thead><% row_counter = RowCounter() %>
- ## SM: Here is where we render the libraries based on admin/non-admin privileges:
%if cntrller in [ 'library', 'requests' ]:
${self.render_folder( 'library', library.root_folder, 0, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=show_deleted, parent=None, row_counter=row_counter, root_folder=True, simple=simple )}
- ## SM: TODO: WTF?
%if not library.deleted and self.has_accessible_datasets and not simple:
${render_actions_on_multiple_items()}
%endif
%elif ( trans.user_is_admin() and cntrller in [ 'library_admin', 'requests_admin' ] ):
${self.render_folder( 'library_admin', library.root_folder, 0, created_ldda_ids, library, [], tracked_datasets, show_deleted=show_deleted, parent=None, row_counter=row_counter, root_folder=True )}
- ## SM: TODO: WTF?
%if not library.deleted and not show_deleted and self.has_accessible_datasets:
${render_actions_on_multiple_items()}
%endif
diff -r 59a35ec1e2e7ce608d2ae566c7c1e201760c53a1 -r 154cda53407f8360ab00b54ec563c1985157c9a5 templates/library/common/browse_library_opt.mako
--- /dev/null
+++ b/templates/library/common/browse_library_opt.mako
@@ -0,0 +1,622 @@
+<%namespace file="/message.mako" import="render_msg" />
+<%namespace file="/library/common/library_item_info.mako" import="render_library_item_info" />
+<%namespace file="/library/common/common.mako" import="render_actions_on_multiple_items" />
+<%namespace file="/library/common/common.mako" import="render_compression_types_help" />
+<%namespace file="/library/common/common.mako" import="common_javascripts" />
+
+<%!
+ def inherit(context):
+ if context.get('use_panels'):
+ return '/webapps/galaxy/base_panels.mako'
+ else:
+ return '/base.mako'
+%>
+<%inherit file="${inherit(context)}"/>
+
+<%def name="init()">
+<%
+ self.has_left_panel=False
+ self.has_right_panel=False
+ self.message_box_visible=False
+ self.active_view="user"
+ self.overlay_visible=False
+ self.has_accessible_datasets = False
+%>
+</%def>
+
+##
+## Override methods from base.mako and base_panels.mako
+##
+<%def name="center_panel()">
+ <div style="overflow: auto; height: 100%;">
+ <div class="page-container" style="padding: 10px;">
+ ${render_content()}
+ </div>
+ </div>
+</%def>
+
+## Render the grid's basic elements. Each of these elements can be subclassed.
+<%def name="body()">
+ ${render_content()}
+</%def>
+
+<%def name="title()">Browse data library</%def>
+<%def name="stylesheets()">
+ ${parent.stylesheets()}
+ ${h.css( "library" )}
+</%def>
+
+<%def name="javascripts()">
+ ${parent.javascripts()}
+ ${h.js("libs/json2")}
+ ${h.js("libs/jquery/jstorage")}
+ ${common_javascripts()}
+ ${self.grid_javascripts()}
+</%def>
+
+<%def name="grid_javascripts()">
+ <script type="text/javascript">
+ var init_libraries = function() {
+ var storage_id = "library-expand-state-${trans.security.encode_id(library.id)}";
+
+ var restore_folder_state = function() {
+ var state = $.jStorage.get(storage_id);
+ if (state) {
+ for (var id in state) {
+ if (state[id] === true) {
+ var row = $("#" + id),
+ index = row.parent().children().index(row);
+ row.addClass("expanded").show();
+ row.siblings().filter("tr[parent='" + index + "']").show();
+ }
+ }
+ }
+ };
+
+ var save_folder_state = function() {
+ var state = {};
+ $("tr.folderRow").each( function() {
+ var folder = $(this);
+ state[folder.attr("id")] = folder.hasClass("expanded");
+ });
+ $.jStorage.set(storage_id, state);
+ };
+
+ $("#library-grid").each(function() {
+ var child_of_parent_cache = {};
+ // Recursively fill in children and descendents of each row
+ var process_row = function(q, parents) {
+ // Find my index
+ var parent = q.parent(),
+ this_level = child_of_parent_cache[parent] || (child_of_parent_cache[parent] = parent.children());
+
+ var index = this_level.index(q);
+ // Find my immediate children
+ var children = $(par_child_dict[index]);
+ // Recursively handle them
+ var descendents = children;
+ children.each( function() {
+ child_descendents = process_row( $(this), parents.add(q) );
+ descendents = descendents.add(child_descendents);
+ });
+ // Set up expand / hide link
+ var expand_fn = function() {
+ if ( q.hasClass("expanded") ) {
+ descendents.hide();
+ descendents.removeClass("expanded");
+ q.removeClass("expanded");
+ } else {
+ children.show();
+ q.addClass("expanded");
+ }
+ save_folder_state();
+ };
+ $("." + q.attr("id") + "-click").click(expand_fn);
+ // Check/uncheck boxes in subfolders.
+ q.children("td").children("input[type=checkbox]").click( function() {
+ if ( $(this).is(":checked") ) {
+ descendents.find("input[type=checkbox]").attr("checked", true);
+ } else {
+ descendents.find("input[type=checkbox]").attr("checked", false);
+ // If you uncheck a lower level checkbox, uncheck the boxes above it
+ // (since deselecting a child means the parent is not fully selected any more).
+ parents.children("td").children("input[type=checkbox]").attr("checked", false);
+ }
+ });
+ // return descendents for use by parent
+ return descendents;
+ }
+
+ // Initialize dict[parent_id] = rows_which_have_that_parent_id_as_parent_attr
+ var par_child_dict = {},
+ no_parent = [];
+
+ $(this).find("tbody tr").each( function() {
+ if ( $(this).attr("parent")) {
+ var parent = $(this).attr("parent");
+ if (par_child_dict[parent] !== undefined) {
+ par_child_dict[parent].push(this);
+ } else {
+ par_child_dict[parent] = [this];
+ }
+ } else {
+ no_parent.push(this);
+ }
+ });
+
+ $(no_parent).each( function() {
+ descendents = process_row( $(this), $([]) );
+ descendents.hide();
+ });
+ });
+
+ restore_folder_state();
+ };
+ $(function() {
+ init_libraries();
+ });
+
+ // Looks for changes in dataset state using an async request. Keeps
+ // calling itself (via setTimeout) until all datasets are in a terminal
+ // state.
+ var updater = function ( tracked_datasets ) {
+ // Check if there are any items left to track
+ var empty = true;
+ for ( i in tracked_datasets ) {
+ empty = false;
+ break;
+ }
+ if ( ! empty ) {
+ setTimeout( function() { updater_callback( tracked_datasets ) }, 3000 );
+ }
+ };
+ var updater_callback = function ( tracked_datasets ) {
+ // Build request data
+ var ids = []
+ var states = []
+ $.each( tracked_datasets, function ( id, state ) {
+ ids.push( id );
+ states.push( state );
+ });
+ // Make ajax call
+ $.ajax( {
+ type: "POST",
+ url: "${h.url_for( controller='library_common', action='library_item_updates' )}",
+ dataType: "json",
+ data: { ids: ids.join( "," ), states: states.join( "," ) },
+ success : function ( data ) {
+ $.each( data, function( id, val ) {
+ // Replace HTML
+ var cell = $("#libraryItem-" + id).find("#libraryItemInfo");
+ cell.html( val.html );
+ // If new state was terminal, stop tracking
+ if (( val.state == "ok") || ( val.state == "error") || ( val.state == "empty") || ( val.state == "deleted" ) || ( val.state == "discarded" )) {
+ delete tracked_datasets[ parseInt(id) ];
+ } else {
+ tracked_datasets[ parseInt(id) ] = val.state;
+ }
+ });
+ updater( tracked_datasets );
+ },
+ error: function() {
+ // Just retry, like the old method, should try to be smarter
+ updater( tracked_datasets );
+ }
+ });
+ };
+ </script>
+</%def>
+
+<%def name="render_dataset( cntrller, ldda, library_dataset, can_modify, can_manage, selected, library, folder, pad, parent, row_counter, tracked_datasets, show_deleted=False, simple=False )">
+ <%
+ ## The received ldda must always be a LibraryDatasetDatasetAssociation object. The object id passed to methods
+ ## from the drop down menu should be the ldda id to prevent id collision ( which could happen when displaying
+ ## children, which are always lddas ). We also need to make sure we're displaying the latest version of this
+ ## library_dataset, so we display the attributes from the ldda.
+
+ from galaxy.webapps.galaxy.controllers.library_common import branch_deleted
+
+ is_admin = trans.user_is_admin() and cntrller == 'library_admin'
+ current_version = ( ldda == library_dataset.library_dataset_dataset_association )
+ if current_version and ldda.state not in ( 'ok', 'error', 'empty', 'deleted', 'discarded' ):
+ tracked_datasets[ldda.id] = ldda.state
+ # SM: This causes a query to be emitted, but it quickly goes down a
+ # rabbit hole of many possible inheritable cases. It may not be
+ # possible to easily eliminate the extra query from this call.
+ info_association, inherited = ldda.get_info_association( restrict=True )
+ form_type = trans.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
+ %>
+ %if current_version and ( not ldda.library_dataset.deleted or show_deleted ):
+ <tr class="datasetRow"
+ %if parent is not None:
+ parent="${parent}"
+ %endif
+ id="libraryItem-${ldda.id}">
+ <td style="padding-left: ${pad+20}px;">
+ <input style="float: left;" type="checkbox" name="ldda_ids" id="${trans.security.encode_id( ldda.id )}" value="${trans.security.encode_id( ldda.id )}"
+ %if selected:
+ checked="checked"
+ %endif
+ />
+ %if simple:
+ <label for="${trans.security.encode_id( ldda.id )}">${ util.unicodify( ldda.name )}</label>
+ %else:
+ <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="dataset-${ldda.id}-popup">
+ <a class="view-info" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">
+ %if ldda.library_dataset.deleted:
+ <div class="libraryItem-error">${util.unicodify( ldda.name )}</div>
+ %else:
+ ${util.unicodify( ldda.name )}
+ %endif
+ </a>
+ </div>
+ %if not library.deleted:
+ <div popupmenu="dataset-${ldda.id}-popup">
+ %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_edit_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='move_library_item', cntrller=cntrller, item_type='ldda', item_id=trans.security.encode_id( ldda.id ), source_library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Move this dataset</a>
+ %else:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a>
+ %endif
+ %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify and not info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='ldda', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a>
+ %endif
+ %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify and info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='ldda', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='ldda', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a>
+ %endif
+ %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_manage:
+ %if not trans.app.security_agent.dataset_is_public( ldda.dataset ):
+ <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='ldda', id=trans.security.encode_id( ldda.dataset.id ), use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
+ %endif
+ <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_permissions', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
+ %endif
+ %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), replace_id=trans.security.encode_id( library_dataset.id ), show_deleted=show_deleted )}">Upload a new version of this dataset</a>
+ %endif
+ %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and ldda.has_data:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='import_datasets_to_histories', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), ldda_ids=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Import this dataset into selected histories</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='download_dataset_from_folder', cntrller=cntrller, id=trans.security.encode_id( ldda.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels )}">Download this dataset</a>
+ %endif
+ %if can_modify:
+ %if not library.deleted and not branch_deleted( folder ) and not ldda.library_dataset.deleted:
+ <a class="action-button" confirm="Click OK to delete dataset '${util.unicodify( ldda.name )}'." href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library_dataset.id ), item_type='library_dataset', show_deleted=show_deleted )}">Delete this dataset</a>
+ %elif not library.deleted and not branch_deleted( folder ) and not ldda.library_dataset.purged and ldda.library_dataset.deleted:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library_dataset.id ), item_type='library_dataset', show_deleted=show_deleted )}">Undelete this dataset</a>
+ %endif
+ %endif
+ </div>
+ %endif
+ %endif
+ </td>
+ % if not simple:
+ <td id="libraryItemInfo">${render_library_item_info( ldda )}</td>
+ <td>${ldda.extension}</td>
+ % endif
+ <td>${ldda.create_time.strftime( "%Y-%m-%d" )}</td>
+ <td>${ldda.get_size( nice_size=True )}</td>
+ </tr>
+ <%
+ my_row = row_counter.count
+ row_counter.increment()
+ %>
+ %endif
+</%def>
+
+<%def name="format_delta( tdelta )">
+ <%
+ from datetime import datetime
+ return "%d.%.6d" % ( tdelta.seconds, tdelta.microseconds )
+ %>
+</%def>
+
+<%def name="render_folder( cntrller, folder, folder_pad, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=False, parent=None, row_counter=None, root_folder=False, simple=False )">
+ <%
+ from galaxy.webapps.galaxy.controllers.library_common import active_folders, active_folders_and_library_datasets, activatable_folders_and_library_datasets, map_library_datasets_to_lddas, branch_deleted, datasets_for_lddas
+
+ # SM: DELETEME
+ from datetime import datetime, timedelta
+ import logging
+ log = logging.getLogger( __name__ )
+
+ is_admin = trans.user_is_admin() and cntrller == 'library_admin'
+ has_accessible_library_datasets = trans.app.security_agent.has_accessible_library_datasets( trans, folder, trans.user, current_user_roles, search_downward=False )
+
+ if root_folder:
+ pad = folder_pad
+ expander = h.url_for("/static/images/silk/resultset_bottom.png")
+ folder_img = h.url_for("/static/images/silk/folder_page.png")
+ else:
+ pad = folder_pad + 20
+ expander = h.url_for("/static/images/silk/resultset_next.png")
+ folder_img = h.url_for("/static/images/silk/folder.png")
+ # SM: If this is a comma-delimited list of LDDAs, then split them up
+ # into a list. For anything else, turn created_ldda_ids into a single
+ # item list.
+ if created_ldda_ids:
+ created_ldda_ids = util.listify( created_ldda_ids )
+ if str( folder.id ) in hidden_folder_ids:
+ return ""
+ my_row = None
+ if is_admin:
+ can_add = can_modify = can_manage = True
+ elif cntrller in [ 'library' ]:
+ can_access, folder_ids = trans.app.security_agent.check_folder_contents( trans.user, current_user_roles, folder )
+ if not can_access:
+ can_show, folder_ids = \
+ trans.app.security_agent.show_library_item( trans.user,
+ current_user_roles,
+ folder,
+ [ trans.app.security_agent.permitted_actions.LIBRARY_ADD,
+ trans.app.security_agent.permitted_actions.LIBRARY_MODIFY,
+ trans.app.security_agent.permitted_actions.LIBRARY_MANAGE ] )
+ if not can_show:
+ return ""
+ can_add = trans.app.security_agent.can_add_library_item( current_user_roles, folder )
+ can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, folder )
+ can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, folder )
+ else:
+ can_add = can_modify = can_manage = False
+
+ form_type = trans.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
+ info_association, inherited = folder.get_info_association( restrict=True )
+ %>
+ %if not root_folder and ( not folder.deleted or show_deleted ):
+ <% encoded_id = trans.security.encode_id( folder.id ) %>
+ <tr id="folder-${encoded_id}" class="folderRow libraryOrFolderRow"
+ %if parent is not None:
+ parent="${parent}"
+ style="display: none;"
+ %endif
+ >
+ <td style="padding-left: ${folder_pad}px;">
+ <input type="checkbox" class="folderCheckbox"/>
+ <span class="expandLink folder-${encoded_id}-click">
+ <div style="float: left; margin-left: 2px;" class="menubutton split popup" id="folder_img-${folder.id}-popup">
+ <a class="folder-${encoded_id}-click" href="javascript:void(0);">
+ <span class="rowIcon"></span>
+ %if folder.deleted:
+ <div class="libraryItem-error">${folder.name}</div>
+ %else:
+ ${folder.name}
+ %endif
+ </a>
+ </div>
+ </span>
+ %if not library.deleted:
+ <div popupmenu="folder_img-${folder.id}-popup">
+ %if not branch_deleted( folder ) and can_add:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add datasets</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='create_folder', cntrller=cntrller, parent_id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add sub-folder</a>
+ %endif
+ %if not branch_deleted( folder ):
+ %if has_accessible_library_datasets:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='import_datasets_to_histories', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Select datasets for import into selected histories</a>
+ %endif
+ %if can_modify:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='move_library_item', cntrller=cntrller, item_type='folder', item_id=trans.security.encode_id( folder.id ), source_library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Move this folder</a>
+ %else:
+ <a class="action-button" class="view-info" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a>
+ %endif
+ %endif
+ %if not branch_deleted( folder ) and can_modify and not info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a>
+ %endif
+ %if not branch_deleted( folder ) and can_modify and info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a>
+ %endif
+ %if not branch_deleted( folder ) and can_manage:
+ %if not trans.app.security_agent.folder_is_public( folder ):
+ <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='folder', id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
+ %endif
+ <a class="action-button" href="${h.url_for( controller='library_common', action='folder_permissions', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
+ %endif
+ %if can_modify:
+ %if not library.deleted and not folder.deleted:
+ <a class="action-button" confirm="Click OK to delete the folder '${folder.name}.'" href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Delete this folder</a>
+ %elif not library.deleted and folder.deleted and not folder.purged:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Undelete this folder</a>
+ %endif
+ %endif
+ </div>
+ %endif
+ <td>
+ %if folder.description:
+ ${folder.description}
+ %endif
+ <td colspan="3"></td>
+ </tr>
+ <%
+ my_row = row_counter.count
+ row_counter.increment()
+ %>
+ %endif
+ <%
+ # TODO: If show_deleted is set to True, then nothing is displayed. Why? This wasn't the case
+ # in the past.
+ if show_deleted:
+ sub_folders, library_datasets = activatable_folders_and_library_datasets( trans, folder )
+ else:
+ sub_folders, library_datasets = active_folders_and_library_datasets( trans, folder )
+ # Render all the subfolders:
+ # TODO: Check permissions first.
+ for sub_folder in sub_folders:
+ render_folder( cntrller, sub_folder, pad, created_ldda_ids, library, [], tracked_datasets, show_deleted=show_deleted, parent=my_row, row_counter=row_counter, root_folder=False )
+
+ # Map LibraryDatasets to LDDAs, then map LDDAs to Datasets.
+ # Then determine which Datasets are accessible and which are not.
+ # For every LibraryDataset, if there's an LDDA for it and it's
+ # accessible then display it.
+ if ( len( library_datasets ) > 0 ):
+ lib_dataset_ldda_map = map_library_datasets_to_lddas( trans, library_datasets )
+ dataset_list = datasets_for_lddas( trans, lib_dataset_ldda_map.values() )
+ #can_access_datasets = trans.app.security_agent.dataset_access_mapping( trans, current_user_roles, dataset_list )
+ can_access_datasets = trans.app.security_agent.dataset_permission_map_for_access( trans, current_user_roles, dataset_list )
+ can_modify_datasets = trans.app.security_agent.item_permission_map_for_modify( trans, current_user_roles, dataset_list )
+ can_manage_datasets = trans.app.security_agent.item_permission_map_for_manage( trans, current_user_roles, dataset_list )
+ for library_dataset in library_datasets:
+ ldda = lib_dataset_ldda_map[ library_dataset.id ]
+ if ldda:
+ # SMTODO: Fix awkard modify/manage permission checks.
+ can_access = is_admin or can_access_datasets[ ldda.dataset_id ]
+ can_modify = is_admin or ( cntrller in ['library', 'requests'] and can_modify_datasets[ ldda.dataset_id ])
+ can_manage = is_admin or ( cntrller in ['library', 'requests'] and can_manage_datasets[ ldda.dataset_id ])
+ selected = created_ldda_ids and str( ldda.id ) in created_ldda_ids
+ if can_access:
+ render_dataset( cntrller, ldda, library_dataset, can_modify, can_manage, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted )
+ %>
+</%def>
+
+<%def name="render_content(simple=False)">
+ <%
+ from galaxy import util
+ from galaxy.webapps.galaxy.controllers.library_common import branch_deleted
+ from time import strftime
+ import logging
+ log = logging.getLogger( __name__ )
+
+ is_admin = trans.user_is_admin() and cntrller == 'library_admin'
+
+ if is_admin:
+ can_add = can_modify = can_manage = True
+ elif cntrller in [ 'library', 'requests' ]:
+ can_add = trans.app.security_agent.can_add_library_item( current_user_roles, library )
+ can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, library )
+ can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, library )
+ else:
+ can_add = can_modify = can_manage = False
+
+ info_association, inherited = library.get_info_association()
+ form_type = trans.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
+
+ # SM: These are mostly display-specific; ignore them for now.
+ # The has_accessible_folders determines if anything can be shown - use it.
+ self.has_accessible_datasets = trans.app.security_agent.has_accessible_library_datasets( trans, library.root_folder, trans.user, current_user_roles )
+ root_folder_has_accessible_library_datasets = trans.app.security_agent.has_accessible_library_datasets( trans, library.root_folder, trans.user, current_user_roles, search_downward=False )
+ has_accessible_folders = is_admin or trans.app.security_agent.has_accessible_folders( trans, library.root_folder, trans.user, current_user_roles )
+
+ tracked_datasets = {}
+
+ class RowCounter( object ):
+ def __init__( self ):
+ self.count = 0
+ def increment( self ):
+ self.count += 1
+ def __str__( self ):
+ return str( self.count )
+ %>
+
+ <h2>Data Library “${library.name}”</h2>
+
+ <ul class="manage-table-actions">
+ %if not library.deleted and ( is_admin or can_add ):
+ <li><a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( library.root_folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add datasets</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='library_common', action='create_folder', cntrller=cntrller, parent_id=trans.security.encode_id( library.root_folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add folder</a></li>
+ %endif
+ %if ( ( not library.deleted ) and ( can_modify or can_manage ) ) or ( can_modify and not library.purged ) or ( library.purged ):
+ <li><a class="action-button" id="library-${library.id}-popup" class="menubutton">Library Actions</a></li>
+ <div popupmenu="library-${library.id}-popup">
+ %if not library.deleted:
+ %if can_modify:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='library_info', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
+ <a class="action-button" confirm="Click OK to delete the library named '${library.name}'." href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library.id ), item_type='library' )}">Delete this data library</a>
+ %if show_deleted:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=False )}">Hide deleted items</a>
+ %else:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=True )}">Show deleted items</a>
+ %endif
+ %endif
+ %if can_modify and not library.info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='library', form_type=form_type, library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a>
+ %endif
+ %if can_modify and info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='library', form_type=form_type, library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='library', form_type=form_type, library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a>
+ %endif
+ %if can_manage:
+ %if not trans.app.security_agent.library_is_public( library, contents=True ):
+ <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='library', id=trans.security.encode_id( library.id ), contents=True, use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
+ %endif
+ <a class="action-button" href="${h.url_for( controller='library_common', action='library_permissions', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
+ %endif
+ %if root_folder_has_accessible_library_datasets:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='import_datasets_to_histories', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( library.root_folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Select datasets for import into selected histories</a>
+ %endif
+ %elif can_modify and not library.purged:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library.id ), item_type='library', use_panels=use_panels )}">Undelete this data library</a>
+ %elif library.purged:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">This data library has been purged</a>
+ %endif
+ </div>
+ %endif
+ </ul>
+
+ %if message:
+ ${render_msg( message, status )}
+ %endif
+
+ %if library.synopsis not in [ '', 'None', None ]:
+ <div class="libraryItemBody">
+ ${library.synopsis}
+ </div>
+ %endif
+
+ %if self.has_accessible_datasets:
+ <form name="act_on_multiple_datasets" action="${h.url_for( controller='library_common', action='act_on_multiple_datasets', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}" onSubmit="javascript:return checkForm();" method="post">
+ %endif
+ %if has_accessible_folders:
+ <table cellspacing="0" cellpadding="0" border="0" width="100%" class="grid" id="library-grid">
+ <thead>
+ <tr class="libraryTitle">
+ <th>
+ %if self.has_accessible_datasets:
+ <input type="checkbox" id="checkAll" name=select_all_datasets_checkbox value="true" onclick='checkAllFields(1);'/><input type="hidden" name=select_all_datasets_checkbox value="true"/>
+ %endif
+ Name
+ </th>
+ % if not simple:
+ <th>Message</th>
+ <th>Data type</th>
+ % endif
+ <th>Date uploaded</th>
+ <th>File size</th>
+ </tr>
+ </thead>
+ <% row_counter = RowCounter() %>
+ ## SM: Here is where we render the libraries based on admin/non-admin privileges:
+ %if cntrller in [ 'library', 'requests' ]:
+ ${self.render_folder( 'library', library.root_folder, 0, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=show_deleted, parent=None, row_counter=row_counter, root_folder=True, simple=simple )}
+ ## SM: TODO: WTF?
+ %if not library.deleted and self.has_accessible_datasets and not simple:
+ ${render_actions_on_multiple_items()}
+ %endif
+ %elif ( trans.user_is_admin() and cntrller in [ 'library_admin', 'requests_admin' ] ):
+ ${self.render_folder( 'library_admin', library.root_folder, 0, created_ldda_ids, library, [], tracked_datasets, show_deleted=show_deleted, parent=None, row_counter=row_counter, root_folder=True )}
+ ## SM: TODO: WTF?
+ %if not library.deleted and not show_deleted and self.has_accessible_datasets:
+ ${render_actions_on_multiple_items()}
+ %endif
+ %endif
+ </table>
+ %endif
+ %if self.has_accessible_datasets:
+ </form>
+ %endif
+
+ %if tracked_datasets:
+ <script type="text/javascript">
+ // Updater
+ updater({${ ",".join( [ '"%s" : "%s"' % ( k, v ) for k, v in tracked_datasets.iteritems() ] ) }});
+ </script>
+ <!-- running: do not change this comment, used by TwillTestCase.library_wait -->
+ %endif
+
+ %if self.has_accessible_datasets and not simple:
+ ${render_compression_types_help( comptypes )}
+ %endif
+ %if not has_accessible_folders:
+ The data library '${library.name}' does not contain any datasets that you can access.
+ %endif
+</%def>
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