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 2011
- 1 participants
- 121 discussions
commit/galaxy-central: jgoecks: Trackster: (a) give every Drawable unique id and (b) remove unused reference to jquery.scrollTo.
by Bitbucket 02 Nov '11
by Bitbucket 02 Nov '11
02 Nov '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/611ec861bde5/
changeset: 611ec861bde5
user: jgoecks
date: 2011-11-02 22:48:22
summary: Trackster: (a) give every Drawable unique id and (b) remove unused reference to jquery.scrollTo.
affected #: 2 files
diff -r 9e90faf2cb1c58b19dc715243f4766223a6b3a47 -r 611ec861bde5a6c31eace77f94ab8024159cc77c static/scripts/trackster.js
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -654,6 +654,8 @@
* associated with a view and container. They optionally have a drag handle class.
*/
var Drawable = function(name, view, container, prefs, drag_handle_class) {
+ if (!Drawable.id_counter) { Drawable.id_counter = 0; }
+ this.id = Drawable.id_counter++;
this.name = name;
this.view = view;
this.container = container;
@@ -804,13 +806,11 @@
DrawableCollection.call(this, "DrawableGroup", name, view, container, prefs, "group-handle");
// HTML elements.
- if (!DrawableGroup.id_counter) { DrawableGroup.id_counter = 0; }
- var group_id = DrawableGroup.id_counter++
- this.container_div = $("<div/>").addClass("group").attr("id", "group_" + group_id).appendTo(this.container.content_div);
+ this.container_div = $("<div/>").addClass("group").attr("id", "group_" + this.id).appendTo(this.container.content_div);
this.header_div = $("<div/>").addClass("track-header").appendTo(this.container_div);
this.header_div.append($("<div/>").addClass(this.drag_handle_class));
this.name_div = $("<div/>").addClass("group-name menubutton popup").text(this.name).appendTo(this.header_div);
- this.content_div = $("<div/>").addClass("content-div").attr("id", "group_" + group_id + "_content_div").appendTo(this.container_div);
+ this.content_div = $("<div/>").addClass("content-div").attr("id", "group_" + this.id + "_content_div").appendTo(this.container_div);
// Set up containers/moving for group: register both container_div and content div as container
// because both are used as containers (container div to recognize container, content_div to
@@ -2329,9 +2329,6 @@
this.data_url_extra_params = {}
this.data_query_wait = (data_query_wait ? data_query_wait : DEFAULT_DATA_QUERY_WAIT);
this.dataset_check_url = converted_datasets_state_url;
-
- if (!Track.id_counter) { Track.id_counter = 0; }
- this.id = Track.id_counter++;
//
// Create HTML element structure for track.
diff -r 9e90faf2cb1c58b19dc715243f4766223a6b3a47 -r 611ec861bde5a6c31eace77f94ab8024159cc77c templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -42,7 +42,7 @@
<script type='text/javascript' src="${h.url_for('/static/scripts/excanvas.js')}"></script><![endif]-->
-${h.js( "galaxy.base", "galaxy.panels", "json2", "jquery", "jstorage", "jquery.event.drag", "jquery.mousewheel", "jquery.autocomplete", "trackster", "trackster_ui", "jquery.ui.sortable.slider", "jquery.scrollTo", "farbtastic", "jquery.tipsy" )}
+${h.js( "galaxy.base", "galaxy.panels", "json2", "jquery", "jstorage", "jquery.event.drag", "jquery.mousewheel", "jquery.autocomplete", "trackster", "trackster_ui", "jquery.ui.sortable.slider", "farbtastic", "jquery.tipsy" )}
<script type="text/javascript">
//
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/9e90faf2cb1c/
changeset: 9e90faf2cb1c
user: John Duddy
date: 2011-11-02 22:15:08
summary: Fix signature of slit method
affected #: 1 file
diff -r 9a9479f7e53f31b7296dce641a8c3dd0ed2e230c -r 9e90faf2cb1c58b19dc715243f4766223a6b3a47 lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -462,15 +462,16 @@
dataset.peek = 'file does not exist'
dataset.blurb = 'file purged from disk'
- def split( input_files, subdir_generator_function, split_params):
+ def split( cls, input_datasets, subdir_generator_function, split_params):
"""
Split the input files by line.
"""
if split_params is None:
return
- if len(input_files) > 1:
+ if len(input_datasets) > 1:
raise Exception("Text file splitting does not support multiple files")
+ input_files = [ds.file_name for ds in input_datasets]
lines_per_file = None
chunk_size = None
@@ -534,7 +535,7 @@
part_file.close()
raise
f.close()
- split = staticmethod(split)
+ split = classmethod(split)
class LineCount( Text ):
"""
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: natefoo: The "How to Cite Galaxy" link was being read from screencasts_url, not citation_url.
by Bitbucket 02 Nov '11
by Bitbucket 02 Nov '11
02 Nov '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/9a9479f7e53f/
changeset: 9a9479f7e53f
user: natefoo
date: 2011-11-02 21:39:08
summary: The "How to Cite Galaxy" link was being read from screencasts_url, not citation_url.
affected #: 2 files
diff -r 3e2cebfac37fafe251e314f4dfeb51ae816d8dda -r 9a9479f7e53f31b7296dce641a8c3dd0ed2e230c templates/webapps/galaxy/base_panels.mako
--- a/templates/webapps/galaxy/base_panels.mako
+++ b/templates/webapps/galaxy/base_panels.mako
@@ -114,7 +114,7 @@
['Support', app.config.get( "support_url", "http://wiki.g2.bx.psu.edu/Support" ), "_blank" ],
['Galaxy Wiki', app.config.get( "wiki_url", "http://wiki.g2.bx.psu.edu/" ), "_blank" ],
['Video tutorials (screencasts)', app.config.get( "screencasts_url", "http://galaxycast.org" ), "_blank" ],
- ['How to Cite Galaxy', app.config.get( "screencasts_url", "http://wiki.g2.bx.psu.edu/Citing%20Galaxy" ), "_blank" ]
+ ['How to Cite Galaxy', app.config.get( "citation_url", "http://wiki.g2.bx.psu.edu/Citing%20Galaxy" ), "_blank" ]
]
tab( "help", "Help", None, menu_options=menu_options)
%>
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 '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/3e2cebfac37f/
changeset: 3e2cebfac37f
user: natefoo
date: 2011-11-02 18:37:33
summary: Allow administrators to impersonate other users. Useful for debugging, but be aware that this gives said administrator a full session as the user, with the ability to do anything as that user (the user does not gain the administrator's privileges, however).
affected #: 4 files
diff -r 1bae407d0d51aa07e026896fee8db5f525e71eac -r 3e2cebfac37fafe251e314f4dfeb51ae816d8dda lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -71,6 +71,7 @@
self.allow_user_creation = string_as_bool( kwargs.get( "allow_user_creation", "True" ) )
self.allow_user_deletion = string_as_bool( kwargs.get( "allow_user_deletion", "False" ) )
self.allow_user_dataset_purge = string_as_bool( kwargs.get( "allow_user_dataset_purge", "False" ) )
+ self.allow_user_impersonation = string_as_bool( kwargs.get( "allow_user_impersonation", "False" ) )
self.new_user_dataset_access_role_default_private = string_as_bool( kwargs.get( "new_user_dataset_access_role_default_private", "False" ) )
self.template_path = resolve_path( kwargs.get( "template_path", "templates" ), self.root )
self.template_cache = resolve_path( kwargs.get( "template_cache_path", "database/compiled_templates" ), self.root )
diff -r 1bae407d0d51aa07e026896fee8db5f525e71eac -r 3e2cebfac37fafe251e314f4dfeb51ae816d8dda lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py
+++ b/lib/galaxy/web/controllers/admin.py
@@ -1029,6 +1029,27 @@
id=trans.security.encode_id( repository.id ),
message=message,
status=status ) )
+ @web.expose
+ @web.require_admin
+ def impersonate( self, trans, email=None, **kwd ):
+ if not trans.app.config.allow_user_impersonation:
+ return trans.show_error_message( "User impersonation is not enabled in this instance of Galaxy." )
+ message = ''
+ status = 'done'
+ emails = None
+ if email is not None:
+ user = trans.sa_session.query( trans.app.model.User ).filter_by( email=email ).first()
+ if user:
+ trans.set_user( user )
+ message = 'You are now logged in as %s, <a target="_top" href="%s">return to the home page</a>' % ( email, url_for( controller='root' ) )
+ emails = []
+ else:
+ message = 'Invalid user selected'
+ status = 'error'
+ if emails is None:
+ emails = [ u.email for u in trans.sa_session.query( trans.app.model.User ).enable_eagerloads( False ).all() ]
+ return trans.fill_template( 'admin/impersonate.mako', emails=emails, message=message, status=status )
+
def __get_relative_install_dir( self, trans, repository ):
# Get the directory where the repository is install.
tool_shed = self.__clean_tool_shed_url( repository.tool_shed )
diff -r 1bae407d0d51aa07e026896fee8db5f525e71eac -r 3e2cebfac37fafe251e314f4dfeb51ae816d8dda templates/webapps/galaxy/admin/index.mako
--- a/templates/webapps/galaxy/admin/index.mako
+++ b/templates/webapps/galaxy/admin/index.mako
@@ -46,6 +46,9 @@
<div class="toolTitle"><a href="${h.url_for( controller='admin', action='users', webapp=webapp )}" target="galaxy_main">Manage users</a></div><div class="toolTitle"><a href="${h.url_for( controller='admin', action='groups', webapp=webapp )}" target="galaxy_main">Manage groups</a></div><div class="toolTitle"><a href="${h.url_for( controller='admin', action='roles', webapp=webapp )}" target="galaxy_main">Manage roles</a></div>
+ %if trans.app.config.allow_user_impersonation:
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='impersonate', webapp=webapp )}" target="galaxy_main">Impersonate a user</a></div>
+ %endif
</div></div><div class="toolSectionPad"></div>
diff -r 1bae407d0d51aa07e026896fee8db5f525e71eac -r 3e2cebfac37fafe251e314f4dfeb51ae816d8dda universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -405,6 +405,9 @@
# Allow administrators to delete accounts.
#allow_user_deletion = False
+# Allow administrators to log in as other users (useful for debugging)
+#allow_user_impersonation = False
+
# Allow users to remove their datasets from disk immediately (otherwise,
# datasets will be removed after a time period specified by an administrator in
# the cleanup scripts run via cron)
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/1bae407d0d51/
changeset: 1bae407d0d51
user: natefoo
date: 2011-11-02 18:28:43
summary: Fix a typo in tasks.
affected #: 1 file
diff -r b22ee1d4143247e2b0d8f0974e71cc4682efa401 -r 1bae407d0d51aa07e026896fee8db5f525e71eac lib/galaxy/jobs/__init__.py
--- a/lib/galaxy/jobs/__init__.py
+++ b/lib/galaxy/jobs/__init__.py
@@ -1123,7 +1123,7 @@
def __get_runner_name( self, job_wrapper ):
if self.app.config.use_tasked_jobs and job_wrapper.tool.parallelism is not None and not isinstance(job_wrapper, TaskWrapper):
- runnner_name = "tasks"
+ runner_name = "tasks"
else:
runner_name = ( job_wrapper.get_job_runner().split(":", 1) )[0]
return runner_name
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Fix vertical scrolling via keyboard in Trackster.
by Bitbucket 01 Nov '11
by Bitbucket 01 Nov '11
01 Nov '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/b22ee1d41432/
changeset: b22ee1d41432
user: jgoecks
date: 2011-11-01 22:51:53
summary: Fix vertical scrolling via keyboard in Trackster.
affected #: 3 files
diff -r 0abcd5c667ac1f6199baa9df20d9c8847d7b8908 -r b22ee1d4143247e2b0d8f0974e71cc4682efa401 static/scripts/jquery.scrollTo.js
--- a/static/scripts/jquery.scrollTo.js
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- * jQuery.ScrollTo
- * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
- * Dual licensed under MIT and GPL.
- * Date: 5/25/2009
- *
- * @projectDescription Easy element scrolling using jQuery.
- * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
- * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
- *
- * @author Ariel Flesler
- * @version 1.4.2
- *
- * @id jQuery.scrollTo
- * @id jQuery.fn.scrollTo
- * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
- * The different options for target are:
- * - A number position (will be applied to all axes).
- * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
- * - A jQuery/DOM element ( logically, child of the element to scroll )
- * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
- * - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
-* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
- * - The string 'max' for go-to-end.
- * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
- * @param {Object,Function} settings Optional set of settings or the onAfter callback.
- * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
- * @option {Number} duration The OVERALL length of the animation.
- * @option {String} easing The easing method for the animation.
- * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
- * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
- * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
- * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
- * @option {Function} onAfter Function to be called after the scrolling ends.
- * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
- * @return {jQuery} Returns the same jQuery object, for chaining.
- *
- * @desc Scroll to a fixed position
- * @example $('div').scrollTo( 340 );
- *
- * @desc Scroll relatively to the actual position
- * @example $('div').scrollTo( '+=340px', { axis:'y' } );
- *
- * @dec Scroll using a selector (relative to the scrolled element)
- * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
- *
- * @ Scroll to a DOM element (same for jQuery object)
- * @example var second_child = document.getElementById('container').firstChild.nextSibling;
- * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
- * alert('scrolled!!');
- * }});
- *
- * @desc Scroll on both axes, to different values
- * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
- */
-;(function( $ ){
-
- var $scrollTo = $.scrollTo = function( target, duration, settings ){
- $(window).scrollTo( target, duration, settings );
- };
-
- $scrollTo.defaults = {
- axis:'xy',
- duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
- };
-
- // Returns the element that needs to be animated to scroll the window.
- // Kept for backwards compatibility (specially for localScroll & serialScroll)
- $scrollTo.window = function( scope ){
- return $(window)._scrollable();
- };
-
- // Hack, hack, hack :)
- // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
- $.fn._scrollable = function(){
- return this.map(function(){
- var elem = this,
- isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
-
- if( !isWin )
- return elem;
-
- var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
-
- return $.browser.safari || doc.compatMode == 'BackCompat' ?
- doc.body :
- doc.documentElement;
- });
- };
-
- $.fn.scrollTo = function( target, duration, settings ){
- if( typeof duration == 'object' ){
- settings = duration;
- duration = 0;
- }
- if( typeof settings == 'function' )
- settings = { onAfter:settings };
-
- if( target == 'max' )
- target = 9e9;
-
- settings = $.extend( {}, $scrollTo.defaults, settings );
- // Speed is still recognized for backwards compatibility
- duration = duration || settings.speed || settings.duration;
- // Make sure the settings are given right
- settings.queue = settings.queue && settings.axis.length > 1;
-
- if( settings.queue )
- // Let's keep the overall duration
- duration /= 2;
- settings.offset = both( settings.offset );
- settings.over = both( settings.over );
-
- return this._scrollable().each(function(){
- var elem = this,
- $elem = $(elem),
- targ = target, toff, attr = {},
- win = $elem.is('html,body');
-
- switch( typeof targ ){
- // A number will pass the regex
- case 'number':
- case 'string':
- if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
- targ = both( targ );
- // We are done
- break;
- }
- // Relative selector, no break!
- targ = $(targ,this);
- case 'object':
- // DOMElement / jQuery
- if( targ.is || targ.style )
- // Get the real position of the target
- toff = (targ = $(targ)).offset();
- }
- $.each( settings.axis.split(''), function( i, axis ){
- var Pos = axis == 'x' ? 'Left' : 'Top',
- pos = Pos.toLowerCase(),
- key = 'scroll' + Pos,
- old = elem[key],
- max = $scrollTo.max(elem, axis);
-
- if( toff ){// jQuery / DOMElement
- attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
-
- // If it's a dom element, reduce the margin
- if( settings.margin ){
- attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
- attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
- }
-
- attr[key] += settings.offset[pos] || 0;
-
- if( settings.over[pos] )
- // Scroll to a fraction of its width/height
- attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
- }else{
- var val = targ[pos];
- // Handle percentage values
- attr[key] = val.slice && val.slice(-1) == '%' ?
- parseFloat(val) / 100 * max
- : val;
- }
-
- // Number or 'number'
- if( /^\d+$/.test(attr[key]) )
- // Check the limits
- attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
-
- // Queueing axes
- if( !i && settings.queue ){
- // Don't waste time animating, if there's no need.
- if( old != attr[key] )
- // Intermediate animation
- animate( settings.onAfterFirst );
- // Don't animate this axis again in the next iteration.
- delete attr[key];
- }
- });
-
- animate( settings.onAfter );
-
- function animate( callback ){
- $elem.animate( attr, duration, settings.easing, callback && function(){
- callback.call(this, target, settings);
- });
- };
-
- }).end();
- };
-
- // Max scrolling position, works on quirks mode
- // It only fails (not too badly) on IE, quirks mode.
- $scrollTo.max = function( elem, axis ){
- var Dim = axis == 'x' ? 'Width' : 'Height',
- scroll = 'scroll'+Dim;
-
- if( !$(elem).is('html,body') )
- return elem[scroll] - $(elem)[Dim.toLowerCase()]();
-
- var size = 'client' + Dim,
- html = elem.ownerDocument.documentElement,
- body = elem.ownerDocument.body;
-
- return Math.max( html[scroll], body[scroll] )
- - Math.min( html[size] , body[size] );
-
- };
-
- function both( val ){
- return typeof val == 'object' ? val : { top:val, left:val };
- };
-
-})( jQuery );
\ No newline at end of file
diff -r 0abcd5c667ac1f6199baa9df20d9c8847d7b8908 -r b22ee1d4143247e2b0d8f0974e71cc4682efa401 static/scripts/packed/jquery.scrollTo.js
--- a/static/scripts/packed/jquery.scrollTo.js
+++ /dev/null
@@ -1,1 +0,0 @@
-(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return c.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){var l=this,j=c(l),k=f,i,g={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}k=c(k,this);case"object":if(k.is||k.style){i=(k=c(k)).offset()}}c.each(d.axis.split(""),function(q,r){var s=r=="x"?"Left":"Top",u=s.toLowerCase(),p="scroll"+s,o=l[p],n=a.max(l,r);if(i){g[p]=i[u]+(m?0:o-j.offset()[u]);if(d.margin){g[p]-=parseInt(k.css("margin"+s))||0;g[p]-=parseInt(k.css("border"+s+"Width"))||0}g[p]+=d.offset[u]||0;if(d.over[u]){g[p]+=k[r=="x"?"width":"height"]()*d.over[u]}}else{var t=k[u];g[p]=t.slice&&t.slice(-1)=="%"?parseFloat(t)/100*n:t}if(/^\d+$/.test(g[p])){g[p]=g[p]<=0?0:Math.min(g[p],n)}if(!q&&d.queue){if(o!=g[p]){h(d.onAfterFirst)}delete g[p]}});h(d.onAfter);function h(n){j.animate(g,e,d.easing,n&&function(){n.call(this,f,d)})}}).end()};a.max=function(j,i){var h=i=="x"?"Width":"Height",e="scroll"+h;if(!c(j).is("html,body")){return j[e]-c(j)[h.toLowerCase()]()}var g="client"+h,f=j.ownerDocument.documentElement,d=j.ownerDocument.body;return Math.max(f[e],d[e])-Math.min(f[g],d[g])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);
\ No newline at end of file
diff -r 0abcd5c667ac1f6199baa9df20d9c8847d7b8908 -r b22ee1d4143247e2b0d8f0974e71cc4682efa401 static/scripts/trackster_ui.js
--- a/static/scripts/trackster_ui.js
+++ b/static/scripts/trackster_ui.js
@@ -154,14 +154,14 @@
break
case 38:
var change = Math.round(view.viewport_container.height()/15.0);
- view.viewport_container.scrollTo('-=' + change + 'px');
+ view.viewport_container.scrollTop( view.viewport_container.scrollTop() - 20);
break;
case 39:
view.move_fraction(-0.25);
break;
case 40:
var change = Math.round(view.viewport_container.height()/15.0);
- view.viewport_container.scrollTo('+=' + change + 'px');
+ view.viewport_container.scrollTop( view.viewport_container.scrollTop() + 20);
break;
}
});
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: richard_burhans: consolidated make_html_table for tabular datatypes
by Bitbucket 01 Nov '11
by Bitbucket 01 Nov '11
01 Nov '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/0abcd5c667ac/
changeset: 0abcd5c667ac
user: richard_burhans
date: 2011-11-01 20:52:53
summary: consolidated make_html_table for tabular datatypes
affected #: 3 files
diff -r 33e2ae31dddd0f494841aaa7f408aac9312b031b -r 0abcd5c667ac1f6199baa9df20d9c8847d7b8908 lib/galaxy/datatypes/genetics.py
--- a/lib/galaxy/datatypes/genetics.py
+++ b/lib/galaxy/datatypes/genetics.py
@@ -192,27 +192,9 @@
Tabular.__init__( self, **kwd )
self.column_names = []
- def make_html_table( self, dataset, skipchars=[] ):
- """
- Create HTML table, used for displaying peek
- """
- out = ['<table cellspacing="0" cellpadding="3">']
- comments = []
- try:
- # Generate column header
- out.append( '<tr>' )
- for i, name in enumerate( self.column_names ):
- out.append( '<th>%s.%s</th>' % ( str( i+1 ), name ) )
- if dataset.metadata.columns - len( self.column_names ) > 0:
- for i in range( len( self.column_names ), dataset.metadata.columns ):
- out.append( '<th>%s</th>' % str( i+1 ) )
- out.append( '</tr>' )
- out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
- out.append( '</table>' )
- out = "".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % exc
- return out
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
+ return Tabular.make_html_table( self, dataset, column_names=self.column_names )
def get_mime(self):
"""Returns the mime type of the datatype"""
diff -r 33e2ae31dddd0f494841aaa7f408aac9312b031b -r 0abcd5c667ac1f6199baa9df20d9c8847d7b8908 lib/galaxy/datatypes/interval.py
--- a/lib/galaxy/datatypes/interval.py
+++ b/lib/galaxy/datatypes/interval.py
@@ -219,33 +219,9 @@
os.write(fd, '%s\n' % '\t'.join(tmp) )
os.close(fd)
return open(temp_name)
- def make_html_table( self, dataset, skipchars=[] ):
- """Create HTML table, used for displaying peek"""
- out = ['<table cellspacing="0" cellpadding="3">']
- comments = []
- try:
- # Generate column header
- out.append('<tr>')
- for i in range( 1, dataset.metadata.columns+1 ):
- if i == dataset.metadata.chromCol:
- out.append( '<th>%s.Chrom</th>' % i )
- elif i == dataset.metadata.startCol:
- out.append( '<th>%s.Start</th>' % i )
- elif i == dataset.metadata.endCol:
- out.append( '<th>%s.End</th>' % i )
- elif dataset.metadata.strandCol and i == dataset.metadata.strandCol:
- out.append( '<th>%s.Strand</th>' % i )
- elif dataset.metadata.nameCol and i == dataset.metadata.nameCol:
- out.append( '<th>%s.Name</th>' % i )
- else:
- out.append( '<th>%s</th>' % i )
- out.append('</tr>')
- out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
- out.append( '</table>' )
- out = "".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % str( exc )
- return out
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
+ return Tabular.make_html_table( self, dataset, column_parameter_alias={'chromCol':'Chrom', 'startCol':'Start', 'endCol':'End', 'strandCol':'Strand', 'nameCol':'Name'} )
def ucsc_links( self, dataset, type, app, base_url ):
"""
Generate links to UCSC genome browser sites based on the dbkey
@@ -617,21 +593,9 @@
except:
pass
Tabular.set_meta( self, dataset, overwrite = overwrite, skip = i )
- def make_html_table( self, dataset, skipchars=[] ):
- """Create HTML table, used for displaying peek"""
- out = ['<table cellspacing="0" cellpadding="3">']
- comments = []
- try:
- # Generate column header
- out.append( '<tr>' )
- for i, name in enumerate( self.column_names ):
- out.append( '<th>%s.%s</th>' % ( str( i+1 ), name ) )
- out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
- out.append( '</table>' )
- out = "".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % exc
- return out
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
+ return Tabular.make_html_table( self, dataset, column_names=self.column_names )
def get_estimated_display_viewport( self, dataset ):
"""
Return a chrom, start, stop tuple for viewing a file. There are slight differences between gff 2 and gff 3
@@ -1081,7 +1045,8 @@
link = self._get_remote_call_url( redirect_url, site_name, dataset, type, app, base_url )
ret_val.append( ( site_name, link ) )
return ret_val
- def make_html_table( self, dataset ):
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
return Tabular.make_html_table( self, dataset, skipchars=['track', '#'] )
def set_meta( self, dataset, overwrite = True, **kwd ):
max_data_lines = None
diff -r 33e2ae31dddd0f494841aaa7f408aac9312b031b -r 0abcd5c667ac1f6199baa9df20d9c8847d7b8908 lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -168,24 +168,46 @@
"""Create HTML table, used for displaying peek"""
out = ['<table cellspacing="0" cellpadding="3">']
try:
- out.append( self.make_html_peek_header( dataset, kwargs ) )
- out.append( self.make_html_peek_rows( dataset, kwargs ) )
+ out.append( self.make_html_peek_header( dataset, **kwargs ) )
+ out.append( self.make_html_peek_rows( dataset, **kwargs ) )
out.append( '</table>' )
out = "".join( out )
except Exception, exc:
out = "Can't create peek %s" % str( exc )
return out
- def make_html_peek_header( self, dataset, skipchars=[] ):
+ def make_html_peek_header( self, dataset, skipchars=[], column_names=[], column_number_format='%s', column_parameter_alias={}, **kwargs ):
out = []
try:
+ column_headers = [None] * dataset.metadata.columns
+
+ # fill in empty headers with data from column_names
+ for i in range( min( dataset.metadata.columns, len( column_names ) ) ):
+ if column_headers[i] is None and column_names[i] is not None:
+ column_headers[i] = column_names[i]
+
+ # fill in empty headers from ColumnParameters set in the metadata
+ for name, spec in dataset.metadata.spec.items():
+ if isinstance( spec.param, metadata.ColumnParameter ):
+ try:
+ i = int( getattr( dataset.metadata, name ) ) - 1
+ except:
+ i = -1
+ if 0 <= i < dataset.metadata.columns and column_headers[i] is None:
+ column_headers[i] = column_parameter_alias.get(name, name)
+
out.append( '<tr>' )
- for i in range( 1, dataset.metadata.columns+1 ):
- out.append( '<th>%s</th>' % str( i ) )
+ for i, header in enumerate( column_headers ):
+ out.append( '<th>' )
+ if header is None:
+ out.append( column_number_format % str( i + 1 ) )
+ else:
+ out.append( '%s.%s' % ( str( i + 1 ), escape( header ) ) )
+ out.append( '</th>' )
out.append( '</tr>' )
except Exception, exc:
raise Exception, "Can't create peek header %s" % str( exc )
return "".join( out )
- def make_html_peek_rows( self, dataset, skipchars=[] ):
+ def make_html_peek_rows( self, dataset, skipchars=[], **kwargs ):
out = []
try:
if not dataset.peek:
@@ -235,26 +257,9 @@
'Superorder', 'Order', 'Suborder', 'Superfamily', 'Family', 'Subfamily',
'Tribe', 'Subtribe', 'Genus', 'Subgenus', 'Species', 'Subspecies'
]
- def make_html_table( self, dataset, skipchars=[] ):
- """Create HTML table, used for displaying peek"""
- out = ['<table cellspacing="0" cellpadding="3">']
- comments = []
- try:
- # Generate column header
- out.append( '<tr>' )
- for i, name in enumerate( self.column_names ):
- out.append( '<th>%s.%s</th>' % ( str( i+1 ), name ) )
- # This data type requires at least 24 columns in the data
- if dataset.metadata.columns - len( self.column_names ) > 0:
- for i in range( len( self.column_names ), dataset.metadata.columns ):
- out.append( '<th>%s</th>' % str( i+1 ) )
- out.append( '</tr>' )
- out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
- out.append( '</table>' )
- out = "".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % exc
- return out
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
+ return Tabular.make_html_table( self, dataset, column_names=self.column_names )
class Sam( Tabular ):
file_ext = 'sam'
@@ -264,25 +269,10 @@
self.column_names = ['QNAME', 'FLAG', 'RNAME', 'POS', 'MAPQ', 'CIGAR',
'MRNM', 'MPOS', 'ISIZE', 'SEQ', 'QUAL', 'OPT'
]
- def make_html_table( self, dataset, skipchars=[] ):
- """Create HTML table, used for displaying peek"""
- out = ['<table cellspacing="0" cellpadding="3">']
- try:
- # Generate column header
- out.append( '<tr>' )
- for i, name in enumerate( self.column_names ):
- out.append( '<th>%s.%s</th>' % ( str( i+1 ), name ) )
- # This data type requires at least 11 columns in the data
- if dataset.metadata.columns - len( self.column_names ) > 0:
- for i in range( len( self.column_names ), dataset.metadata.columns ):
- out.append( '<th>%s</th>' % str( i+1 ) )
- out.append( '</tr>' )
- out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
- out.append( '</table>' )
- out = "".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % exc
- return out
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
+ return Tabular.make_html_table( self, dataset, column_names=self.column_names )
+
def sniff( self, filename ):
"""
Determines whether the file is in SAM format
@@ -376,29 +366,9 @@
def init_meta( self, dataset, copy_from=None ):
Tabular.init_meta( self, dataset, copy_from=copy_from )
- def make_html_table( self, dataset, skipchars=[] ):
- """Create HTML table, used for displaying peek"""
- out = ['<table cellspacing="0" cellpadding="3">']
- comments = []
- try:
- # Generate column header
- out.append('<tr>')
- for i in range( 1, dataset.metadata.columns+1 ):
- if i == dataset.metadata.chromCol:
- out.append( '<th>%s.Chrom</th>' % i )
- elif i == dataset.metadata.startCol:
- out.append( '<th>%s.Start</th>' % i )
- elif i == dataset.metadata.baseCol:
- out.append( '<th>%s.Base</th>' % i )
- else:
- out.append( '<th>%s</th>' % i )
- out.append('</tr>')
- out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
- out.append( '</table>' )
- out = "".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % str( exc )
- return out
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
+ return Tabular.make_html_table( self, dataset, column_parameter_alias={'chromCol':'Chrom', 'startCol':'Start', 'baseCol':'Base'} )
def repair_methods( self, dataset ):
"""Return options for removing errors along with a description"""
@@ -464,21 +434,9 @@
def sniff( self, filename ):
headers = get_headers( filename, '\n', count=1 )
return headers[0][0].startswith("##fileformat=VCF")
+ def display_peek( self, dataset ):
+ """Returns formated html of peek"""
+ return Tabular.make_html_table( self, dataset, column_names=self.column_names )
- def make_html_table( self, dataset, skipchars=[] ):
- """Create HTML table, used for displaying peek"""
- out = ['<table cellspacing="0" cellpadding="3">']
- try:
- # Generate column header
- out.append( '<tr>' )
- for i, name in enumerate( self.column_names ):
- out.append( '<th>%s.%s</th>' % ( str( i+1 ), name ) )
- out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
- out.append( '</table>' )
- out = "".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % exc
- return out
-
def get_track_type( self ):
return "VcfTrack", {"data": "tabix", "index": "summary_tree"}
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: Remove debugging statements from f34a17e508e5.
by Bitbucket 01 Nov '11
by Bitbucket 01 Nov '11
01 Nov '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/33e2ae31dddd/
changeset: 33e2ae31dddd
user: jgoecks
date: 2011-11-01 18:43:10
summary: Remove debugging statements from f34a17e508e5.
affected #: 1 file
diff -r 9c7e4bb081b5db8850d4ad7854f721c4c9376552 -r 33e2ae31dddd0f494841aaa7f408aac9312b031b lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -852,7 +852,6 @@
# Recursive function to set param value.
def set_value( param_dict, group_name, group_index, param_name, param_value ):
- print "searching", param_dict
if group_name in param_dict:
param_dict[ group_name ][ group_index ][ param_name ] = param_value
return True
@@ -866,7 +865,6 @@
if isinstance( value, dict ):
return_val = set_value( value, group_name, group_index, param_name, param_value)
if return_val:
- print "setting parameter", param_dict
return return_val
return False
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
01 Nov '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/9c7e4bb081b5/
changeset: 9c7e4bb081b5
user: jgoecks
date: 2011-11-01 18:40:21
summary: Fix bug introduced in f34a17e508e5.
affected #: 1 file
diff -r f34a17e508e5bc07d761eeb8c36a3d076ce9ecf1 -r 9c7e4bb081b5db8850d4ad7854f721c4c9376552 lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -925,7 +925,7 @@
else:
message = 'Attributes updated'
new_dataset.set_meta()
- new_dataset.datatype.after_setting_metadata( data )
+ new_dataset.datatype.after_setting_metadata( new_dataset )
trans.sa_session.flush()
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
01 Nov '11
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/f34a17e508e5/
changeset: f34a17e508e5
user: jgoecks
date: 2011-11-01 15:49:34
summary: Trackster: (a) refactor tool data functionality into TiledTrack class so that it is generally available; (b) enable VcfTracks to work with tools; and (c) more robust parameter setting. Enable Unified Genotyper to work with Trackster.
affected #: 6 files
diff -r 4ba5c0b16190a9977fdefa3b4df508d033929903 -r f34a17e508e5bc07d761eeb8c36a3d076ce9ecf1 lib/galaxy/visualization/tracks/data_providers.py
--- a/lib/galaxy/visualization/tracks/data_providers.py
+++ b/lib/galaxy/visualization/tracks/data_providers.py
@@ -135,10 +135,137 @@
{ 'name' : attrs[ 'name' ], 'type' : column_types[viz_col_index], \
'index' : attrs[ 'index' ] } )
return filters
+
+#
+# -- Base mixins and providers --
+#
+
+class FilterableMixin:
+ def get_filters( self ):
+ """ Returns a dataset's filters. """
+
+ # is_ functions taken from Tabular.set_meta
+ def is_int( column_text ):
+ try:
+ int( column_text )
+ return True
+ except:
+ return False
+ def is_float( column_text ):
+ try:
+ float( column_text )
+ return True
+ except:
+ if column_text.strip().lower() == 'na':
+ return True #na is special cased to be a float
+ return False
+
+ #
+ # Get filters.
+ # TODOs:
+ # (a) might be useful to move this into each datatype's set_meta method;
+ # (b) could look at first N lines to ensure GTF attribute types are consistent.
+ #
+ filters = []
+ # HACK: first 8 fields are for drawing, so start filter column index at 9.
+ filter_col = 8
+ if isinstance( self.original_dataset.datatype, Gff ):
+ # Can filter by score and GTF attributes.
+ filters = [ { 'name': 'Score',
+ 'type': 'int',
+ 'index': filter_col,
+ 'tool_id': 'Filter1',
+ 'tool_exp_name': 'c6' } ]
+ filter_col += 1
+ if isinstance( self.original_dataset.datatype, Gtf ):
+ # Create filters based on dataset metadata.
+ for name, a_type in self.original_dataset.metadata.attribute_types.items():
+ if a_type in [ 'int', 'float' ]:
+ filters.append(
+ { 'name': name,
+ 'type': a_type,
+ 'index': filter_col,
+ 'tool_id': 'gff_filter_by_attribute',
+ 'tool_exp_name': name } )
+ filter_col += 1
+
+ '''
+ # Old code: use first line in dataset to find attributes.
+ for i, line in enumerate( open(self.original_dataset.file_name) ):
+ if not line.startswith('#'):
+ # Look at first line for attributes and types.
+ attributes = parse_gff_attributes( line.split('\t')[8] )
+ for attr, value in attributes.items():
+ # Get attribute type.
+ if is_int( value ):
+ attr_type = 'int'
+ elif is_float( value ):
+ attr_type = 'float'
+ else:
+ attr_type = 'str'
+ # Add to filters.
+ if attr_type is not 'str':
+ filters.append( { 'name': attr, 'type': attr_type, 'index': filter_col } )
+ filter_col += 1
+ break
+ '''
+ elif isinstance( self.original_dataset.datatype, Bed ):
+ # Can filter by score column only.
+ filters = [ { 'name': 'Score',
+ 'type': 'int',
+ 'index': filter_col,
+ 'tool_id': 'Filter1',
+ 'tool_exp_name': 'c5'
+ } ]
+
+ return filters
+
+
+class TabixDataProvider( FilterableMixin, TracksDataProvider ):
+ """
+ Tabix index data provider for the Galaxy track browser.
+ """
+
+ col_name_data_attr_mapping = { 4 : { 'index': 4 , 'name' : 'Score' } }
+
+ def get_iterator( self, chrom, start, end ):
+ start, end = int(start), int(end)
+ if end >= (2<<29):
+ end = (2<<29 - 1) # Tabix-enforced maximum
+
+ bgzip_fname = self.dependencies['bgzip'].file_name
+
+ # if os.path.getsize(self.converted_dataset.file_name) == 0:
+ # return { 'kind': messages.ERROR, 'message': "Tabix converted size was 0, meaning the input file had invalid values." }
+ tabix = ctabix.Tabixfile(bgzip_fname, index_filename=self.converted_dataset.file_name)
+
+ # If chrom is not found in indexes, try removing the first three
+ # characters (e.g. 'chr') and see if that works. This enables the
+ # provider to handle chrome names defined as chrXXX and as XXX.
+ chrom = str(chrom)
+ if chrom not in tabix.contigs and chrom.startswith("chr") and (chrom[3:] in tabix.contigs):
+ chrom = chrom[3:]
+
+ return tabix.fetch(reference=chrom, start=start, end=end)
+
+ def get_data( self, chrom, start, end, start_val=0, max_vals=None, **kwargs ):
+ iterator = self.get_iterator( chrom, start, end )
+ return self.process_data( iterator, start_val, max_vals, **kwargs )
+
+ def write_data_to_file( self, chrom, start, end, filename ):
+ iterator = self.get_iterator( chrom, start, end )
+ out = open( filename, "w" )
+ for line in iterator:
+ out.write( "%s\n" % line )
+ out.close()
+
+#
+# -- BED data providers --
+#
class BedDataProvider( TracksDataProvider ):
"""
- Abstract class that processes BED data from text format to payload format.
+ Abstract class that processes BED data from native format to payload format.
Payload format: [ uid (offset), start, end, name, strand, thick_start, thick_end, blocks ]
"""
@@ -220,7 +347,166 @@
for line in iterator:
out.write( "%s\n" % line )
out.close()
-
+
+class BedTabixDataProvider( TabixDataProvider, BedDataProvider ):
+ """
+ Provides data from a BED file indexed via tabix.
+ """
+ pass
+
+class RawBedDataProvider( BedDataProvider ):
+ """
+ Provide data from BED file.
+
+ NOTE: this data provider does not use indices, and hence will be very slow
+ for large datasets.
+ """
+
+ def get_iterator( self, chrom, start, end ):
+ def line_filter_iter():
+ for line in open( self.original_dataset.file_name ):
+ feature = line.split()
+ feature_chrom = feature[0]
+ feature_start = int( feature[1] )
+ feature_end = int( feature[2] )
+ if feature_chrom != chrom or feature_start > int( end ) or feature_end < int( start ):
+ continue
+ yield line
+ return line_filter_iter()
+
+#
+# -- VCF data providers --
+#
+
+class VcfDataProvider( TracksDataProvider ):
+ """
+ Abstract class that processes VCF data from native format to payload format.
+
+ Payload format: TODO
+ """
+
+ col_name_data_attr_mapping = { 'Qual' : { 'index': 6 , 'name' : 'Qual' } }
+
+
+ def get_iterator( self, chrom, start, end ):
+ raise "Unimplemented Method"
+
+ def get_data( self, chrom, start, end, start_val=0, max_vals=None, **kwargs ):
+ iterator = self.get_iterator( chrom, start, end )
+ return self.process_data( iterator, start_val, max_vals, **kwargs )
+
+ def process_data( self, iterator, start_val=0, max_vals=None, **kwargs ):
+ """
+ Returns a dict with the following attributes:
+ data - a list of variants with the format
+ [<guid>, <start>, <end>, <name>, cigar, seq]
+
+ message - error/informative message
+ """
+ rval = []
+ message = None
+
+ def get_mapping( ref, alt ):
+ """
+ Returns ( offset, new_seq, cigar ) tuple that defines mapping of
+ alt to ref. Cigar format is an array of [ op_index, length ] pairs
+ where op_index is the 0-based index into the string "MIDNSHP=X"
+ """
+
+ cig_ops = "MIDNSHP=X"
+
+ ref_len = len( ref )
+ alt_len = len( alt )
+
+ # Substitutions?
+ if ref_len == alt_len:
+ return 0, alt, [ [ cig_ops.find( "M" ), ref_len ] ]
+
+ # Deletions?
+ alt_in_ref_index = ref.find( alt )
+ if alt_in_ref_index != -1:
+ return alt_in_ref_index, ref[ alt_in_ref_index + 1: ], [ [ cig_ops.find( "D" ), ref_len - alt_len ] ]
+
+ # Insertions?
+ ref_in_alt_index = alt.find( ref )
+ if ref_in_alt_index != -1:
+ return ref_in_alt_index, alt[ ref_in_alt_index + 1: ], [ [ cig_ops.find( "I" ), alt_len - ref_len ] ]
+
+ # Pack data.
+ for count, line in enumerate( iterator ):
+ if count < start_val:
+ continue
+ if max_vals and count-start_val >= max_vals:
+ message = ERROR_MAX_VALS % ( max_vals, "features" )
+ break
+
+ feature = line.split()
+ start = int( feature[1] ) - 1
+ ref = feature[3]
+ alts = feature[4]
+
+ # HACK? alts == '.' --> monomorphism.
+ if alts == '.':
+ alts = ref
+
+ # Pack variants.
+ for alt in alts.split(","):
+ offset, new_seq, cigar = get_mapping( ref, alt )
+ start += offset
+ end = start + len( new_seq )
+
+ # Pack line.
+ payload = [ hash( line ),
+ start,
+ end,
+ # ID:
+ feature[2],
+ cigar,
+ new_seq,
+ float( feature[5] )]
+ rval.append(payload)
+
+ return { 'data': rval, 'message': message }
+
+ def write_data_to_file( self, chrom, start, end, filename ):
+ iterator = self.get_iterator( chrom, start, end )
+ out = open( filename, "w" )
+ for line in iterator:
+ out.write( "%s\n" % line )
+ out.close()
+
+class VcfTabixDataProvider( TabixDataProvider, VcfDataProvider ):
+ """
+ Provides data from a VCF file indexed via tabix.
+ """
+ pass
+
+class RawVcfDataProvider( VcfDataProvider ):
+ """
+ Provide data from VCF file.
+
+ NOTE: this data provider does not use indices, and hence will be very slow
+ for large datasets.
+ """
+
+ def get_iterator( self, chrom, start, end ):
+ def line_filter_iter():
+ for line in open( self.original_dataset.file_name ):
+ if line.startswith("#"):
+ continue
+ variant = line.split()
+ variant_chrom, variant_start, id, ref, alts = variant[ 0:5 ]
+ variant_start = int( variant_start )
+ longest_alt = -1
+ for alt in alts:
+ if len( alt ) > longest_alt:
+ longest_alt = len( alt )
+ variant_end = variant_start + abs( len( ref ) - longest_alt )
+ if variant_chrom != chrom or variant_start > int( end ) or variant_end < int( start ):
+ continue
+ yield line
+ return line_filter_iter()
+
class SummaryTreeDataProvider( TracksDataProvider ):
"""
Summary tree data provider for the Galaxy track browser.
@@ -485,118 +771,7 @@
else:
f = open( self.original_dataset.file_name )
return f, BigWigFile(file=f)
-
-class FilterableMixin:
- def get_filters( self ):
- """ Returns a dataset's filters. """
-
- # is_ functions taken from Tabular.set_meta
- def is_int( column_text ):
- try:
- int( column_text )
- return True
- except:
- return False
- def is_float( column_text ):
- try:
- float( column_text )
- return True
- except:
- if column_text.strip().lower() == 'na':
- return True #na is special cased to be a float
- return False
-
- #
- # Get filters.
- # TODOs:
- # (a) might be useful to move this into each datatype's set_meta method;
- # (b) could look at first N lines to ensure GTF attribute types are consistent.
- #
- filters = []
- # HACK: first 8 fields are for drawing, so start filter column index at 9.
- filter_col = 8
- if isinstance( self.original_dataset.datatype, Gff ):
- # Can filter by score and GTF attributes.
- filters = [ { 'name': 'Score',
- 'type': 'int',
- 'index': filter_col,
- 'tool_id': 'Filter1',
- 'tool_exp_name': 'c6' } ]
- filter_col += 1
- if isinstance( self.original_dataset.datatype, Gtf ):
- # Create filters based on dataset metadata.
- for name, a_type in self.original_dataset.metadata.attribute_types.items():
- if a_type in [ 'int', 'float' ]:
- filters.append(
- { 'name': name,
- 'type': a_type,
- 'index': filter_col,
- 'tool_id': 'gff_filter_by_attribute',
- 'tool_exp_name': name } )
- filter_col += 1
-
- '''
- # Old code: use first line in dataset to find attributes.
- for i, line in enumerate( open(self.original_dataset.file_name) ):
- if not line.startswith('#'):
- # Look at first line for attributes and types.
- attributes = parse_gff_attributes( line.split('\t')[8] )
- for attr, value in attributes.items():
- # Get attribute type.
- if is_int( value ):
- attr_type = 'int'
- elif is_float( value ):
- attr_type = 'float'
- else:
- attr_type = 'str'
- # Add to filters.
- if attr_type is not 'str':
- filters.append( { 'name': attr, 'type': attr_type, 'index': filter_col } )
- filter_col += 1
- break
- '''
- elif isinstance( self.original_dataset.datatype, Bed ):
- # Can filter by score column only.
- filters = [ { 'name': 'Score',
- 'type': 'int',
- 'index': filter_col,
- 'tool_id': 'Filter1',
- 'tool_exp_name': 'c5'
- } ]
-
- return filters
-
-class TabixDataProvider( FilterableMixin, TracksDataProvider ):
- """
- Tabix index data provider for the Galaxy track browser.
- """
-
- col_name_data_attr_mapping = { 4 : { 'index': 4 , 'name' : 'Score' } }
-
- def get_iterator( self, chrom, start, end ):
- start, end = int(start), int(end)
- if end >= (2<<29):
- end = (2<<29 - 1) # Tabix-enforced maximum
-
- bgzip_fname = self.dependencies['bgzip'].file_name
-
- # if os.path.getsize(self.converted_dataset.file_name) == 0:
- # return { 'kind': messages.ERROR, 'message': "Tabix converted size was 0, meaning the input file had invalid values." }
- tabix = ctabix.Tabixfile(bgzip_fname, index_filename=self.converted_dataset.file_name)
-
- # If chrom is not found in indexes, try removing the first three
- # characters (e.g. 'chr') and see if that works. This enables the
- # provider to handle chrome names defined as chrXXX and as XXX.
- chrom = str(chrom)
- if chrom not in tabix.contigs and chrom.startswith("chr") and (chrom[3:] in tabix.contigs):
- chrom = chrom[3:]
-
- return tabix.fetch(reference=chrom, start=start, end=end)
-
- def get_data( self, chrom, start, end, start_val=0, max_vals=None, **kwargs ):
- iterator = self.get_iterator( chrom, start, end )
- return self.process_data( iterator, start_val, max_vals, **kwargs )
-
+
class IntervalIndexDataProvider( FilterableMixin, TracksDataProvider ):
"""
Interval index files used only for GFF files.
@@ -658,86 +833,6 @@
results.append( payload )
return { 'data': results, 'message': message }
-
-class VcfDataProvider( TabixDataProvider ):
- """
- VCF data provider. Payload format uses the read format.
- """
-
- col_name_data_attr_mapping = { 'Qual' : { 'index': 6 , 'name' : 'Qual' } }
-
- def process_data( self, iterator, start_val=0, max_vals=sys.maxint, **kwargs ):
- """
- Returns a dict with the following attributes:
- data - a list of variants with the format
- [<guid>, <start>, <end>, <name>, cigar, seq]
-
- message - error/informative message
- """
- rval = []
- message = None
-
- def get_mapping( ref, alt ):
- """
- Returns ( offset, new_seq, cigar ) tuple that defines mapping of
- alt to ref. Cigar format is an array of [ op_index, length ] pairs
- where op_index is the 0-based index into the string "MIDNSHP=X"
- """
-
- cig_ops = "MIDNSHP=X"
-
- ref_len = len( ref )
- alt_len = len( alt )
-
- # Substitutions?
- if ref_len == alt_len:
- return 0, alt, [ [ cig_ops.find( "M" ), ref_len ] ]
-
- # Deletions?
- alt_in_ref_index = ref.find( alt )
- if alt_in_ref_index != -1:
- return alt_in_ref_index, ref[ alt_in_ref_index + 1: ], [ [ cig_ops.find( "D" ), ref_len - alt_len ] ]
-
- # Insertions?
- ref_in_alt_index = alt.find( ref )
- if ref_in_alt_index != -1:
- return ref_in_alt_index, alt[ ref_in_alt_index + 1: ], [ [ cig_ops.find( "I" ), alt_len - ref_len ] ]
-
- # Pack data.
- for count, line in enumerate( iterator ):
- if count < start_val:
- continue
- if count-start_val >= max_vals:
- message = ERROR_MAX_VALS % ( "max_vals", "features" )
- break
-
- feature = line.split()
- start = int( feature[1] ) - 1
- ref = feature[3]
- alts = feature[4]
-
- # HACK? alts == '.' --> monomorphism.
- if alts == '.':
- alts = ref
-
- # Pack variants.
- for alt in alts.split(","):
- offset, new_seq, cigar = get_mapping( ref, alt )
- start += offset
- end = start + len( new_seq )
-
- # Pack line.
- payload = [ hash( line ),
- start,
- end,
- # ID:
- feature[2],
- cigar,
- new_seq,
- float( feature[5] )]
- rval.append(payload)
-
- return { 'data': rval, 'message': message }
class GFFDataProvider( TracksDataProvider ):
"""
@@ -769,40 +864,16 @@
offset += feature.raw_size
return { 'data': results, 'message': message }
-
-class BedTabixDataProvider( TabixDataProvider, BedDataProvider ):
- """
- Provides data from a BED file indexed via tabix.
- """
- pass
-
-class RawBedDataProvider( BedDataProvider ):
- """
- Provide data from BED file.
-
- NOTE: this data provider does not use indices, and hence will be very slow
- for large datasets.
- """
-
- def get_iterator( self, chrom, start, end ):
- def line_filter_iter():
- for line in open( self.original_dataset.file_name ):
- feature = line.split()
- feature_chrom, feature_start, feature_end = feature[ 0:3 ]
- if feature_chrom != chrom or feature_start > end or feature_end < start:
- continue
- yield line
- return line_filter_iter()
-
+
#
-# Helper methods.
+# -- Helper methods. --
#
# Mapping from dataset type name to a class that can fetch data from a file of that
# type. First key is converted dataset type; if result is another dict, second key
# is original dataset type. TODO: This needs to be more flexible.
dataset_type_name_to_data_provider = {
- "tabix": { Vcf: VcfDataProvider, Bed: BedTabixDataProvider, "default" : TabixDataProvider },
+ "tabix": { Vcf: VcfTabixDataProvider, Bed: BedTabixDataProvider, "default" : TabixDataProvider },
"interval_index": IntervalIndexDataProvider,
"bai": BamDataProvider,
"summary_tree": SummaryTreeDataProvider,
diff -r 4ba5c0b16190a9977fdefa3b4df508d033929903 -r f34a17e508e5bc07d761eeb8c36a3d076ce9ecf1 lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -465,10 +465,14 @@
data = GFFDataProvider( original_dataset=dataset ).get_data( chrom, low, high, **kwargs )
data[ 'dataset_type' ] = 'interval_index'
data[ 'extra_info' ] = None
- if isinstance( dataset.datatype, Bed ):
+ elif isinstance( dataset.datatype, Bed ):
data = RawBedDataProvider( original_dataset=dataset ).get_data( chrom, low, high, **kwargs )
data[ 'dataset_type' ] = 'interval_index'
data[ 'extra_info' ] = None
+ elif isinstance( dataset.datatype, Vcf ):
+ data = RawVcfDataProvider( original_dataset=dataset ).get_data( chrom, low, high, **kwargs )
+ data[ 'dataset_type' ] = 'tabix'
+ data[ 'extra_info' ] = None
return data
@web.json
@@ -586,7 +590,7 @@
data_provider = data_provider_class( converted_dataset=converted_dataset, original_dataset=dataset, dependencies=deps )
# Get and return data from data_provider.
- result = data_provider.get_data( chrom, low, high, int(start_val), int(max_vals), **kwargs )
+ result = data_provider.get_data( chrom, low, high, int( start_val ), int( max_vals ), **kwargs )
result.update( { 'dataset_type': tracks_dataset_type, 'extra_info': extra_info } )
return result
@@ -840,6 +844,45 @@
# Set input datasets for tool. If running on region, extract and use subset
# when possible.
#
+
+ def set_param_value( param_dict, param_name, param_value ):
+ """
+ Set new parameter value in a parameter dictionary.
+ """
+
+ # Recursive function to set param value.
+ def set_value( param_dict, group_name, group_index, param_name, param_value ):
+ print "searching", param_dict
+ if group_name in param_dict:
+ param_dict[ group_name ][ group_index ][ param_name ] = param_value
+ return True
+ elif param_name in param_dict:
+ param_dict[ param_name ] = param_value
+ return True
+ else:
+ # Recursive search.
+ return_val = False
+ for name, value in param_dict.items():
+ if isinstance( value, dict ):
+ return_val = set_value( value, group_name, group_index, param_name, param_value)
+ if return_val:
+ print "setting parameter", param_dict
+ return return_val
+ return False
+
+ # Parse parameter name if necessary.
+ if param_name.find( "|" ) == -1:
+ # Non-grouping parameter.
+ group_name = group_index = None
+ else:
+ # Grouping parameter.
+ group, param_name = param_name.split( "|" )
+ index = group.rfind( "_" )
+ group_name = group[ :index ]
+ group_index = int( group[ index + 1: ] )
+
+ return set_value( param_dict, group_name, group_index, param_name, param_value )
+
for jida in original_job.input_datasets:
input_dataset = jida.dataset
if input_dataset is None: #optional dataset and dataset wasn't selected
@@ -875,10 +918,20 @@
new_dataset.set_size()
new_dataset.info = "Data subset for trackster"
new_dataset.set_dataset_state( trans.app.model.Dataset.states.OK )
+
+ # Set metadata.
+ if trans.app.config.set_metadata_externally:
+ trans.app.datatypes_registry.set_external_metadata_tool.tool_action.execute( trans.app.datatypes_registry.set_external_metadata_tool, trans, incoming = { 'input1':new_dataset } )
+ else:
+ message = 'Attributes updated'
+ new_dataset.set_meta()
+ new_dataset.datatype.after_setting_metadata( data )
+
trans.sa_session.flush()
-
+
# Add dataset to tool's parameters.
- tool_params[ jida.name ] = new_dataset
+ if not set_param_value( tool_params, jida.name, new_dataset ):
+ return to_json_string( { "error" : True, "message" : "error setting parameter %s" % jida.name } )
#
# Execute tool and handle outputs.
diff -r 4ba5c0b16190a9977fdefa3b4df508d033929903 -r f34a17e508e5bc07d761eeb8c36a3d076ce9ecf1 static/scripts/packed/trackster.js
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var class_module=function(b,a){var c=function(){var f=arguments[0];for(var e=1;e<arguments.length;e++){var d=arguments[e];for(key in d){f[key]=d[key]}}return f};a.extend=c};var requestAnimationFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b,a){window.setTimeout(b,1000/60)}})();var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=BEFORE}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=AFTER}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a};var is_overlap=function(c,b){var a=compute_overlap(c,b);return(a!==BEFORE&&a!==AFTER)};var get_random_color=function(a){if(!a){a="#ffffff"}if(typeof(a)==="string"){a=[a]}for(var j=0;j<a.length;j++){a[j]=parseInt(a[j].slice(1),16)}var m=function(t,s,i){return((t*299)+(s*587)+(i*114))/1000};var e=function(u,t,v,r,i,s){return(Math.max(u,r)-Math.min(u,r))+(Math.max(t,i)-Math.min(t,i))+(Math.max(v,s)-Math.min(v,s))};var g,n,f,k,p,h,q,c,d,b,o,l=false;do{g=Math.random()*16777215;n=g|16711680;f=g|65280;k=g|255;d=m(n,f,k);l=true;for(var j=0;j<a.length;j++){p=a[j];h=p|16711680;q=p|65280;c=p|255;b=m(h,q,c);o=e(n,f,k,h,q,c);if((Math.abs(d-b)<125)||(o<500)){l=false;break}}}while(!l);return"#"+(16777216+g).toString(16).substr(1,6)};var trackster_module=function(f,Y){var p=f("class").extend,s=f("slotting"),M=f("painters");var af=function(ag,ah){this.document=ag;this.default_font=ah!==undefined?ah:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};p(af.prototype,{load_pattern:function(ag,ak){var ah=this.patterns,ai=this.dummy_context,aj=new Image();aj.src=image_path+ak;aj.onload=function(){ah[ag]=ai.createPattern(aj,"repeat")}},get_pattern:function(ag){return this.patterns[ag]},new_canvas:function(){var ag=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(ag)}ag.manager=this;return ag}});var n={};var l=function(ag,ah){n[ag.attr("id")]=ah};var m=function(ag,ai,ak,aj){ak=".group";var ah={};n[ag.attr("id")]=aj;ag.bind("drag",{handle:"."+ai,relative:true},function(at,au){var ar=$(this);var ax=$(this).parent(),ao=ax.children(),aq=n[$(this).attr("id")],an,am,av,al,ap;am=$(this).parents(ak);if(am.length!==0){av=am.position().top;al=av+am.outerHeight();if(au.offsetY<av){$(this).insertBefore(am);var aw=n[am.attr("id")];aw.remove_drawable(aq);aw.container.add_drawable_before(aq,aw);return}else{if(au.offsetY>al){$(this).insertAfter(am);var aw=n[am.attr("id")];aw.remove_drawable(aq);aw.container.add_drawable(aq);return}}}am=null;for(ap=0;ap<ao.length;ap++){an=$(ao.get(ap));av=an.position().top;al=av+an.outerHeight();if(an.is(ak)&&this!==an.get(0)&&au.offsetY>=av&&au.offsetY<=al){if(au.offsetY-av<al-au.offsetY){an.find(".content-div").prepend(this)}else{an.find(".content-div").append(this)}if(aq.container){aq.container.remove_drawable(aq)}n[an.attr("id")].add_drawable(aq);return}}for(ap=0;ap<ao.length;ap++){if(au.offsetY<$(ao.get(ap)).position().top){break}}if(ap===ao.length){if(this!==ao.get(ap-1)){ax.append(this);n[ax.attr("id")].move_drawable(aq,ap)}}else{if(this!==ao.get(ap)){$(this).insertBefore(ao.get(ap));n[ax.attr("id")].move_drawable(aq,(au.deltaY>0?ap-1:ap))}}}).bind("dragstart",function(){ah["border-top"]=ag.css("border-top");ah["border-bottom"]=ag.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ah)})};Y.moveable=m;var ae=16,H=9,E=20,T=H+2,z=100,J=12000,R=200,C=5,v=10,L=5000,w=100,o="There was an error in indexing this dataset. ",K="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",F="No data for this chrom/contig.",t="Currently indexing... please wait",x="Tool cannot be rerun: ",a="Loading data...",Z="Ready for display",d=10,u=5,B=5;function aa(ah,ag){if(!ag){ag=0}var ai=Math.pow(10,ag);return Math.round(ah*ai)/ai}var c=function(ag){this.num_elements=ag;this.clear()};p(c.prototype,{get:function(ah){var ag=this.key_ary.indexOf(ah);if(ag!==-1){if(this.obj_cache[ah].stale){this.key_ary.splice(ag,1);delete this.obj_cache[ah]}else{this.move_key_to_end(ah,ag)}}return this.obj_cache[ah]},set:function(ah,ai){if(!this.obj_cache[ah]){if(this.key_ary.length>=this.num_elements){var ag=this.key_ary.shift();delete this.obj_cache[ag]}this.key_ary.push(ah)}this.obj_cache[ah]=ai;return ai},move_key_to_end:function(ah,ag){this.key_ary.splice(ag,1);this.key_ary.push(ah)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var S=function(ah,ag,ai){c.call(this,ah);this.track=ag;this.subset=(ai!==undefined?ai:true)};p(S.prototype,c.prototype,{load_data:function(ap,ak,an,ah,am){var ao=this.track.view.chrom,aj={chrom:ao,low:ap,high:ak,mode:an,resolution:ah,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(aj,am);if(this.track.filters_manager){var aq=[];var ag=this.track.filters_manager.filters;for(var al=0;al<ag.length;al++){aq[aq.length]=ag[al].name}aj.filter_cols=JSON.stringify(aq)}var ai=this;return $.getJSON(this.track.data_url,aj,function(ar){ai.set_data(ap,ak,an,ar)})},get_data:function(ag,ak,al,ah,aj){var ai=this.get_data_from_cache(ag,ak,al);if(ai){return ai}ai=this.load_data(ag,ak,al,ah,aj);this.set_data(ag,ak,al,ai);return ai},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(ao,aj,an,ai,am,ak){var ap=this.get_data_from_cache(ao,aj,an);if(!ap){console.log("ERROR: no current data for: ",this.track,ao,aj,an,ai,am);return}ap.stale=true;var ah=ao;if(ak===this.DEEP_DATA_REQ){$.extend(am,{start_val:ap.data.length+1})}else{if(ak===this.BROAD_DATA_REQ){ah=(ap.max_high?ap.max_high:ap.data[ap.data.length-1][2])+1}}var ag=this,al=this.load_data(ah,aj,an,ai,am);new_data_available=$.Deferred();this.set_data(ao,aj,an,new_data_available);$.when(al).then(function(aq){if(aq.data){aq.data=ap.data.concat(aq.data);if(aq.max_low){aq.max_low=ap.max_low}if(aq.message){aq.message=aq.message.replace(/[0-9]+/,aq.data.length)}}ag.set_data(ao,aj,an,aq);new_data_available.resolve(aq)});return new_data_available},get_data_from_cache:function(ag,ah,ai){return this.get(this.gen_key(ag,ah,ai))},set_data:function(ah,ai,aj,ag){return this.set(this.gen_key(ah,ai,aj),ag)},gen_key:function(ag,ai,aj){var ah=ag+"_"+ai+"_"+aj;return ah},split_key:function(ag){return ag.split("_")}});var I=function(ah,ag,ai){S.call(this,ah,ag,ai)};p(I.prototype,S.prototype,c.prototype,{load_data:function(ag,aj,ak,ah,ai){if(ah>1){return{data:null}}return S.prototype.load_data.call(this,ag,aj,ak,ah,ai)}});var q=function(aj,ah,ag,ai,ak){this.name=aj;this.view=ah;this.container=ag;this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:aj}],saved_values:ai,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ak;this.is_overview=false};p(q.prototype,{init:function(){},request_draw:function(){},_draw:function(){},to_json:function(){},update_track_icons:function(){},set_name:function(ag){this.old_name=this.name;this.name=ag;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)},remove:function(){this.container.remove_drawable(this);this.container_div.fadeOut("slow",function(){$(this).remove();view.update_intro_div();view.has_changes=true})}});var y=function(ak,aj,ah,ag,ai,al){q.call(this,aj,ah,ag,ai,al);this.obj_type=ak;this.drawables=[]};p(y.prototype,q.prototype,{init:function(){for(var ag=0;ag<this.drawables.length;ag++){this.drawables[ag].init()}},_draw:function(){for(var ag=0;ag<this.drawables.length;ag++){this.drawables[ag]._draw()}},to_json:function(){var ah=[];for(var ag=0;ag<this.drawables.length;ag++){ah.push(this.drawables[ag].to_json())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ah}},add_drawable:function(ag){this.drawables.push(ag);ag.container=this},add_drawable_before:function(ai,ag){var ah=this.drawables.indexOf(ag);if(ah!=-1){this.drawables.splice(ah,0,ai);return true}return false},remove_drawable:function(ah){var ag=this.drawables.indexOf(ah);if(ag!=-1){this.drawables.splice(ag,1);ah.container=null;return true}return false},move_drawable:function(ah,ai){var ag=this.drawables.indexOf(ah);if(ag!=-1){this.drawables.splice(ag,1);this.drawables.splice(ai,0,ah);return true}return false}});var Q=function(aj,ah,ag,ai){y.call(this,"DrawableGroup",aj,ah,ag,ai,"group-handle");if(!Q.id_counter){Q.id_counter=0}var ak=Q.id_counter++;this.container_div=$("<div/>").addClass("group").attr("id","group_"+ak).appendTo(this.container.content_div);this.header_div=$("<div/>").addClass("track-header").appendTo(this.container_div);this.header_div.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("group-name menubutton popup").text(this.name).appendTo(this.header_div);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+ak+"_content_div").appendTo(this.container_div);l(this.container_div,this);l(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.update_track_icons()};p(Q.prototype,q.prototype,y.prototype,{update_track_icons:function(){var ah=this;var ag={};ag["Edit configuration"]=function(){var ak=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ai=function(){ah.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},aj=function(al){if((al.keyCode||al.which)===27){ak()}else{if((al.keyCode||al.which)===13){ai()}}};$(window).bind("keypress.check_enter_esc",aj);show_modal("Configure Group",ah.config.build_form(),{Cancel:ak,OK:ai})};ag.Remove=function(){ah.remove()};make_popupmenu(ah.name_div,ag)}});var ad=function(ag,aj,ai,ah){y.call(this,"View");this.container=ag;this.chrom=null;this.vis_id=ai;this.dbkey=ah;this.title=aj;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.init();this.canvas_manager=new af(ag.get(0).ownerDocument);this.reset()};p(ad.prototype,y.prototype,{init:function(){var ai=this.container,ag=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ai);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ai);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ai);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;l(this.viewport_container,ag);this.intro_div=$("<div/>").addClass("intro");var aj=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){add_tracks()});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("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").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ah=function(ak){if(ak.type==="focusout"||(ak.keyCode||ak.which)===13||(ak.keyCode||ak.which)===27){if((ak.keyCode||ak.which)!==27){ag.go_to($(this).val())}$(this).hide();$(this).val("");ag.location_span.show();ag.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ah).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").appendTo(this.nav_controls);this.location_span.click(function(){ag.location_span.hide();ag.chrom_select.hide();ag.nav_input.val(ag.chrom+":"+ag.low+"-"+ag.high);ag.nav_input.css("display","inline-block");ag.nav_input.select();ag.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a id='zoom-out' />").click(function(){ag.zoom_out();ag.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){ag.zoom_in();ag.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ag.change_chrom(ag.chrom_select.val())});this.browser_content_div.click(function(ak){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ak){ag.zoom_in(ak.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ak,al){this.current_x=al.offsetX}).bind("drag",function(ak,am){var an=am.offsetX-this.current_x;this.current_x=am.offsetX;var al=Math.round(an/ag.viewport_container.width()*(ag.max_high-ag.max_low));ag.move_delta(-al)});this.overview_close.click(function(){ag.reset_overview()});this.viewport_container.bind("draginit",function(ak,al){if(ak.clientX>ag.viewport_container.width()-16){return false}}).bind("dragstart",function(ak,al){al.original_low=ag.low;al.current_height=ak.clientY;al.current_x=al.offsetX}).bind("drag",function(am,ao){var ak=$(this);var ap=ao.offsetX-ao.current_x;var al=ak.scrollTop()-(am.clientY-ao.current_height);ak.scrollTop(al);ao.current_height=am.clientY;ao.current_x=ao.offsetX;var an=Math.round(ap/ag.viewport_container.width()*(ag.high-ag.low));ag.move_delta(an)}).bind("mousewheel",function(am,ao,al,ak){if(al){var an=Math.round(-al/ag.viewport_container.width()*(ag.high-ag.low));ag.move_delta(an)}});this.top_labeltrack.bind("dragstart",function(ak,al){return $("<div />").css({height:ag.browser_content_div.height()+ag.top_labeltrack.height()+ag.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ao,ap){$(ap.proxy).css({left:Math.min(ao.pageX,ap.startX),width:Math.abs(ao.pageX-ap.startX)});var al=Math.min(ao.pageX,ap.startX)-ag.container.offset().left,ak=Math.max(ao.pageX,ap.startX)-ag.container.offset().left,an=(ag.high-ag.low),am=ag.viewport_container.width();ag.update_location(Math.round(al/am*an)+ag.low,Math.round(ak/am*an)+ag.low)}).bind("dragend",function(ap,aq){var al=Math.min(ap.pageX,aq.startX),ak=Math.max(ap.pageX,aq.startX),an=(ag.high-ag.low),am=ag.viewport_container.width(),ao=ag.low;ag.low=Math.round(al/am*an)+ao;ag.high=Math.round(ak/am*an)+ao;$(aq.proxy).remove();ag.request_redraw()});this.add_label_track(new ac(this,{content_div:this.top_labeltrack}));this.add_label_track(new ac(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){ag.resize_window()});$(document).bind("redraw",function(){ag.redraw()});this.reset();$(window).trigger("resize");this.update_intro_div()},update_intro_div:function(){if(this.num_tracks===0){this.intro_div.appendTo(this.viewport_container)}else{this.intro_div.remove()}},update_location:function(ag,ah){this.location_span.text(commatize(ag)+" - "+commatize(ah));this.nav_input.val(this.chrom+":"+commatize(ag)+"-"+commatize(ah))},load_chroms:function(ai){ai.num=w;$.extend(ai,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var ag=this,ah=$.Deferred();$.ajax({url:chrom_url,data:ai,dataType:"json",success:function(ak){if(ak.chrom_info.length===0){alert("Invalid chromosome: "+ai.chrom);return}if(ak.reference){ag.add_label_track(new A(ag))}ag.chrom_data=ak.chrom_info;var an='<option value="">Select Chrom/Contig</option>';for(var am=0,aj=ag.chrom_data.length;am<aj;am++){var al=ag.chrom_data[am].chrom;an+='<option value="'+al+'">'+al+"</option>"}if(ak.prev_chroms){an+='<option value="previous">Previous '+w+"</option>"}if(ak.next_chroms){an+='<option value="next">Next '+w+"</option>"}ag.chrom_select.html(an);ag.chrom_start_index=ak.start_index;ah.resolve(ak)},error:function(){alert("Could not load chroms for this dbkey:",ag.dbkey)}});return ah},change_chrom:function(al,ah,an){if(!al||al==="None"){return}var ai=this;if(al==="previous"){ai.load_chroms({low:this.chrom_start_index-w});return}if(al==="next"){ai.load_chroms({low:this.chrom_start_index+w});return}var am=$.grep(ai.chrom_data,function(ao,ap){return ao.chrom===al})[0];if(am===undefined){ai.load_chroms({chrom:al},function(){ai.change_chrom(al,ah,an)});return}else{if(al!==ai.chrom){ai.chrom=al;ai.chrom_select.val(ai.chrom);ai.max_high=am.len-1;ai.reset();ai.request_redraw(true);for(var ak=0,ag=ai.drawables.length;ak<ag;ak++){var aj=ai.drawables[ak];if(aj.init){aj.init()}}}if(ah!==undefined&&an!==undefined){ai.low=Math.max(ah,0);ai.high=Math.min(an,ai.max_high)}ai.reset_overview();ai.request_redraw()}},go_to:function(ak){ak=ak.replace(/ |,/g,"");var ao=this,ag,aj,ah=ak.split(":"),am=ah[0],an=ah[1];if(an!==undefined){try{var al=an.split("-");ag=parseInt(al[0],10);aj=parseInt(al[1],10)}catch(ai){return false}}ao.change_chrom(am,ag,aj)},move_fraction:function(ai){var ag=this;var ah=ag.high-ag.low;this.move_delta(ai*ah)},move_delta:function(ai){var ag=this;var ah=ag.high-ag.low;if(ag.low-ai<ag.max_low){ag.low=ag.max_low;ag.high=ag.max_low+ah}else{if(ag.high-ai>ag.max_high){ag.high=ag.max_high;ag.low=ag.max_high-ah}else{ag.high-=ai;ag.low-=ai}}ag.request_redraw()},add_drawable:function(ag){y.prototype.add_drawable.call(this,ag);ag.init();this.has_changes=true;this.update_intro_div()},add_label_track:function(ag){ag.view=this;ag.init();this.label_tracks.push(ag)},remove_drawable:function(ai,ah){y.prototype.remove_drawable.call(this,ai);if(ah){var ag=this;ai.container_div.fadeOut("slow",function(){$(this).remove();ag.update_intro_div()});this.has_changes=true}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ao,ag,an,ah){var am=this,ak=(ah?[ah]:am.drawables),ai;var ah;for(var al=0;al<ak.length;al++){ah=ak[al];ai=-1;for(var aj=0;aj<am.tracks_to_be_redrawn.length;aj++){if(am.tracks_to_be_redrawn[aj][0]===ah){ai=aj;break}}if(ai<0){am.tracks_to_be_redrawn.push([ah,ag,an])}else{am.tracks_to_be_redrawn[al][1]=ag;am.tracks_to_be_redrawn[al][2]=an}}requestAnimationFrame(function(){am._redraw(ao)})},_redraw:function(aq){var an=this.low,aj=this.high;if(an<this.max_low){an=this.max_low}if(aj>this.max_high){aj=this.max_high}var ap=this.high-this.low;if(this.high!==0&&ap<this.min_separation){aj=an+this.min_separation}this.low=Math.floor(an);this.high=Math.ceil(aj);this.resolution=Math.pow(C,Math.ceil(Math.log((this.high-this.low)/R)/Math.log(C)));this.zoom_res=Math.pow(v,Math.max(0,Math.ceil(Math.log(this.resolution,v)/Math.log(v))));var ag=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var am=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ar=13;this.overview_box.css({left:ag,width:Math.max(ar,am)}).show();if(am<ar){this.overview_box.css("left",ag-(ar-am)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ag,width:am})}this.update_location(this.low,this.high);if(!aq){var ai,ah,ao;for(var ak=0,al=this.tracks_to_be_redrawn.length;ak<al;ak++){ai=this.tracks_to_be_redrawn[ak][0];ah=this.tracks_to_be_redrawn[ak][1];ao=this.tracks_to_be_redrawn[ak][2];if(ai){ai._draw(ah,ao)}}this.tracks_to_be_redrawn=[];for(ak=0,al=this.label_tracks.length;ak<al;ak++){this.label_tracks[ak]._draw()}}},zoom_in:function(ah,ai){if(this.max_high===0||this.high-this.low<this.min_separation){return}var aj=this.high-this.low,ak=aj/2+this.low,ag=(aj/this.zoom_factor)/2;if(ah){ak=ah/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ak-ag);this.high=Math.round(ak+ag);this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ah=this.high-this.low,ai=ah/2+this.low,ag=(ah*this.zoom_factor)/2;this.low=Math.round(ai-ag);this.high=Math.round(ai+ag);this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.request_redraw()},set_overview:function(ai){if(this.overview_drawable){if(this.overview_drawable.dataset_id===ai.dataset_id){return}this.overview_viewport.find(".track").remove()}var ah=ai.copy({content_div:this.overview_viewport}),ag=this;ah.header_div.hide();ah.is_overview=true;ag.overview_drawable=ah;this.overview_drawable.postdraw_actions=function(){ag.overview_highlight.show().height(ag.overview_drawable.content_div.height());ag.overview_viewport.height(ag.overview_drawable.content_div.height()+ag.overview_box.outerHeight());ag.overview_close.show();ag.resize_window()};this.overview_drawable.init();ag.has_changes=true},reset_overview:function(){$(".tipsy").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 r=function(ai,am){this.track=ai;this.name=am.name;this.params=[];var au=am.params;for(var aj=0;aj<au.length;aj++){var ao=au[aj],ah=ao.name,at=ao.label,ak=unescape(ao.html),av=ao.value,aq=ao.type;if(aq==="number"){this.params[this.params.length]=new g(ah,at,ak,av,ao.min,ao.max)}else{if(aq=="select"){this.params[this.params.length]=new O(ah,at,ak,av)}else{console.log("WARNING: unrecognized tool parameter type:",ah,aq)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ax){ax.stopPropagation()}).click(function(ax){ax.stopPropagation()}).bind("dblclick",function(ax){ax.stopPropagation()});var ar=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ap=this.params;var an=this;$.each(this.params,function(ay,aB){var aA=$("<div>").addClass("param-row").appendTo(an.parent_div);var ax=$("<div>").addClass("param-label").text(aB.label).appendTo(aA);var az=$("<div/>").addClass("slider").html(aB.html).appendTo(aA);az.find(":input").val(aB.value);$("<div style='clear: both;'/>").appendTo(aA)});this.parent_div.find("input").click(function(){$(this).select()});var aw=$("<div>").addClass("param-row").appendTo(this.parent_div);var al=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(aw);var ag=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(aw);var an=this;ag.click(function(){an.run_on_region()});al.click(function(){an.run_on_dataset()})};p(r.prototype,{get_param_values_dict:function(){var ag={};this.parent_div.find(":input").each(function(){var ah=$(this).attr("name"),ai=$(this).val();ag[ah]=JSON.stringify(ai)});return ag},get_param_values:function(){var ah=[];var ag={};this.parent_div.find(":input").each(function(){var ai=$(this).attr("name"),aj=$(this).val();if(ai){ah[ah.length]=aj}});return ah},run_on_dataset:function(){var ag=this;ag.run({dataset_id:this.track.original_dataset_id,tool_id:ag.name},null,function(ah){show_modal(ag.name+" is Running",ag.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ah={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name},ak=this.track,ai=ah.tool_id+ak.tool_region_and_parameters_str(ah.chrom,ah.low,ah.high),ag,al;if(ak.container===view){var aj=new Q(this.name,this.track.view,this.track.container);ak.container.add_drawable(aj);ak.container.remove_drawable(ak);aj.add_drawable(ak);ak.container_div.appendTo(aj.content_div);ag=aj}else{ag=ak.container}if(ak instanceof e){al=new V(ai,view,ag,"hda");al.change_mode(ak.mode);ag.add_drawable(al)}al.content_div.text("Starting job.");this.run(ah,al,function(am){al.dataset_id=am.dataset_id;al.content_div.text("Running job.");al.init()})},run:function(ah,ai,aj){$.extend(ah,this.get_param_values_dict());var ag=function(){$.getJSON(rerun_tool_url,ah,function(ak){if(ak==="no converter"){ai.container_div.addClass("error");ai.content_div.text(K)}else{if(ak.error){ai.container_div.addClass("error");ai.content_div.text(x+ak.message)}else{if(ak==="pending"){ai.container_div.addClass("pending");ai.content_div.text("Converting input data so that it can be used quickly with tool.");setTimeout(ag,2000)}else{aj(ak)}}}})};ag()}});var O=function(ah,ag,ai,aj){this.name=ah;this.label=ag;this.html=ai;this.value=aj};var g=function(ai,ah,ak,al,aj,ag){O.call(this,ai,ah,ak,al);this.min=aj;this.max=ag};var h=function(ah,ag,ai,aj){this.name=ah;this.index=ag;this.tool_id=ai;this.tool_exp_name=aj};var W=function(ah,ag,ai,aj){h.call(this,ah,ag,ai,aj);this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.container=null;this.slider=null;this.slider_label=null};p(W.prototype,{applies_to:function(ag){if(ag.length>this.index){return true}return false},keep:function(ag){if(!this.applies_to(ag)){return true}var ah=ag[this.index];return(isNaN(ah)||(ah>=this.low&&ah<=this.high))},update_attrs:function(ah){var ag=false;if(!this.applies_to(ah)){return ag}if(ah[this.index]<this.min){this.min=Math.floor(ah[this.index]);ag=true}if(ah[this.index]>this.max){this.max=Math.ceil(ah[this.index]);ag=true}return ag},update_ui_elt:function(){if(this.min!=this.max){this.container.show()}else{this.container.hide()}var ai=function(al,aj){var ak=aj-al;return(ak<=2?0.01:1)};var ah=this.slider.slider("option","min"),ag=this.slider.slider("option","max");if(this.min<ah||this.max>ag){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",ai(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var ab=function(ar,az){this.track=ar;this.filters=[];for(var au=0;au<az.length;au++){var av=az[au],aA=av.name,ag=av.type,ai=av.index,ay=av.tool_id,ax=av.tool_exp_name;if(ag==="int"||ag==="float"){this.filters[au]=new W(aA,ai,ay,ax)}else{console.log("ERROR: unsupported filter: ",aA,ag)}}var aj=function(aB,aC,aD){aB.click(function(){var aE=aC.text();max=parseFloat(aD.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(aD.slider("option","values")){input_size=2*input_size+1;multi_value=true}aC.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",aE).appendTo(aC).focus().select().click(function(aF){aF.stopPropagation()}).blur(function(){$(this).remove();aC.text(aE)}).keyup(function(aJ){if(aJ.keyCode===27){$(this).trigger("blur")}else{if(aJ.keyCode===13){var aH=aD.slider("option","min"),aF=aD.slider("option","max"),aI=function(aK){return(isNaN(aK)||aK>aF||aK<aH)},aG=$(this).val();if(!multi_value){aG=parseFloat(aG);if(aI(aG)){alert("Parameter value must be in the range ["+aH+"-"+aF+"]");return $(this)}}else{aG=aG.split("-");aG=[parseFloat(aG[0]),parseFloat(aG[1])];if(aI(aG[0])||aI(aG[1])){alert("Parameter value must be in the range ["+aH+"-"+aF+"]");return $(this)}}aD.slider((multi_value?"values":"value"),aG)}}})})};this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(aB){aB.stopPropagation()}).click(function(aB){aB.stopPropagation()}).bind("dblclick",function(aB){aB.stopPropagation()}).bind("keydown",function(aB){aB.stopPropagation()});var aw=$("<div/>").addClass("sliders").appendTo(this.parent_div);var ao=this;$.each(this.filters,function(aE,aG){aG.container=$("<div/>").addClass("filter-row slider-row").appendTo(aw);var aF=$("<div/>").addClass("elt-label").appendTo(aG.container);var aD=$("<span/>").addClass("slider-name").text(aG.name+" ").appendTo(aF);var aC=$("<span/>");var aI=$("<span/>").addClass("slider-value").appendTo(aF).append("[").append(aC).append("]");var aB=$("<div/>").addClass("slider").appendTo(aG.container);aG.control_element=$("<div/>").attr("id",aG.name+"-filter-control").appendTo(aB);var aH=[0,0];aG.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(aK,aL){var aJ=aL.values;aC.text(aJ[0]+"-"+aJ[1]);aG.low=aJ[0];aG.high=aJ[1];ao.track.request_draw(true,true)},change:function(aJ,aK){aG.control_element.slider("option","slide").call(aG.control_element,aJ,aK)}});aG.slider=aG.control_element;aG.slider_label=aC;aj(aI,aC,aG.control_element);$("<div style='clear: both;'/>").appendTo(aG.container)});if(this.filters.length!==0){var al=$("<div/>").addClass("param-row").appendTo(aw);var an=$("<input type='submit'/>").attr("value","Run on complete dataset").appendTo(al);var ah=this;an.click(function(){ah.run_on_dataset()})}var aq=$("<div/>").addClass("display-controls").appendTo(this.parent_div),at,am,ap,ak={Transparency:function(aB){ao.alpha_filter=aB},Height:function(aB){ao.height_filter=aB}};$.each(ak,function(aD,aC){at=$("<div/>").addClass("filter-row").appendTo(aq),am=$("<span/>").addClass("elt-label").text(aD+":").appendTo(at),ap=$("<select/>").attr("name",aD+"_dropdown").css("float","right").appendTo(at);$("<option/>").attr("value",-1).text("== None ==").appendTo(ap);for(var aB=0;aB<ao.filters.length;aB++){$("<option/>").attr("value",aB).text(ao.filters[aB].name).appendTo(ap)}ap.change(function(){$(this).children("option:selected").each(function(){var aE=parseInt($(this).val());ak[aD]((aE>=0?ao.filters[aE]:null));ao.track.request_draw(true,true)})});$("<div style='clear: both;'/>").appendTo(at)});$("<div style='clear: both;'/>").appendTo(this.parent_div)};p(ab.prototype,{reset_filters:function(){for(var ag=0;ag<this.filters.length;ag++){filter=this.filters[ag];filter.slider.slider("option","values",[filter.min,filter.max])}this.alpha_filter=null;this.height_filter=null},run_on_dataset:function(){var ao=function(at,aq,ar){if(!(aq in at)){at[aq]=ar}return at[aq]};var ai={},ag,ah,aj;for(var ak=0;ak<this.filters.length;ak++){ag=this.filters[ak];if(ag.tool_id){if(ag.min!=ag.low){ah=ao(ai,ag.tool_id,[]);ah[ah.length]=ag.tool_exp_name+" >= "+ag.low}if(ag.max!=ag.high){ah=ao(ai,ag.tool_id,[]);ah[ah.length]=ag.tool_exp_name+" <= "+ag.high}}}var am=[];for(var ap in ai){am[am.length]=[ap,ai[ap]]}var an=am.length;(function al(ax,au){var ar=au[0],at=ar[0],aw=ar[1],av="("+aw.join(") and (")+")",aq={cond:av,input:ax,target_dataset_id:ax,tool_id:at},au=au.slice(1);$.getJSON(run_tool_url,aq,function(ay){if(ay.error){show_modal("Filter Dataset","Error running tool "+at,{Close:hide_modal})}else{if(au.length===0){show_modal("Filtering Dataset","Filter(s) are running on the complete dataset. Outputs are in dataset's history.",{Close:hide_modal})}else{al(ay.dataset_id,au)}}})})(this.track.dataset_id,am)}});var D=function(ag,ah){M.Scaler.call(this,ah);this.filter=ag};D.prototype.gen_val=function(ag){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(ag[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var G=function(ag){this.track=ag.track;this.params=ag.params;this.values={};this.restore_values((ag.saved_values?ag.saved_values:{}));this.onchange=ag.onchange};p(G.prototype,{restore_values:function(ag){var ah=this;$.each(this.params,function(ai,aj){if(ag[aj.key]!==undefined){ah.values[aj.key]=ag[aj.key]}else{ah.values[aj.key]=aj.default_value}})},build_form:function(){var ah=this;var ag=$("<div />");$.each(this.params,function(al,aj){if(!aj.hidden){var ai="param_"+al;var an=ah.values[aj.key];var aq=$("<div class='form-row' />").appendTo(ag);aq.append($("<label />").attr("for",ai).text(aj.label+":"));if(aj.type==="bool"){aq.append($('<input type="checkbox" />').attr("id",ai).attr("name",ai).attr("checked",an))}else{if(aj.type==="text"){aq.append($('<input type="text"/>').attr("id",ai).val(an).click(function(){$(this).select()}))}else{if(aj.type==="color"){var am=$("<input />").attr("id",ai).attr("name",ai).val(an);var ao=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var ak=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(ao);var ap=$("<div/>").appendTo(ak).farbtastic({width:100,height:100,callback:am,color:an});$("<div />").append(am).append(ao).appendTo(aq).bind("click",function(ar){ao.css({left:$(this).position().left+($(am).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){ao.hide();$(document).unbind("click.color-picker")});ar.stopPropagation()})}else{aq.append($("<input />").attr("id",ai).attr("name",ai).val(an))}}}}});return ag},update_from_form:function(ag){var ai=this;var ah=false;$.each(this.params,function(aj,al){if(!al.hidden){var am="param_"+aj;var ak=ag.find("#"+am).val();if(al.type==="float"){ak=parseFloat(ak)}else{if(al.type==="int"){ak=parseInt(ak)}else{if(al.type==="bool"){ak=ag.find("#"+am).is(":checked")}}}if(ak!==ai.values[al.key]){ai.values[al.key]=ak;ah=true}}});if(ah){this.onchange()}}});var b=function(ag,aj,ai,ah,ak){this.track=ag;this.index=aj;this.low=aj*R*ai;this.high=(aj+1)*R*ai;this.resolution=ai;this.canvas=$("<div class='track-tile'/>").append(ah);this.data=ak;this.stale=false};b.prototype.predisplay_actions=function(){};var k=function(ag,aj,ai,ah,ak,al){b.call(this,ag,aj,ai,ah,ak);this.max_val=al};p(k.prototype,b.prototype);var P=function(ag,ak,aj,ai,am,an,al,ah){b.call(this,ag,ak,aj,ai,am);this.mode=an;this.message=al;this.feature_mapper=ah};p(P.prototype,b.prototype);P.prototype.predisplay_actions=function(){var ah=this,ag={};if(ah.mode!=="Pack"){return}$(this.canvas).mousemove(function(at){var an=$(this).offset(),ar=at.pageX-an.left,aq=at.pageY-an.top,ax=ah.feature_mapper.get_feature_data(ar,aq),ao=(ax?ax[0]:null);$(this).siblings(".feature-popup").each(function(){if(!ao||$(this).attr("id")!==ao.toString()){$(this).remove()}});if(ax){var aj=ag[ao];if(!aj){var ao=ax[0],au={name:ax[3],start:ax[1],end:ax[2],strand:ax[4]},am=ah.track.filters_manager.filters,al;for(var ap=0;ap<am.length;ap++){al=am[ap];au[al.name]=ax[al.index]}var aj=$("<div/>").attr("id",ao).addClass("feature-popup"),aw,av,ay=$("<table/>").appendTo(aj),az;for(aw in au){av=au[aw];az=$("<tr/>").appendTo(ay);$("<th/>").appendTo(az).text(aw);$("<td/>").attr("align","left").appendTo(az).text(typeof(av)=="number"?aa(av,2):av)}ag[ao]=aj}aj.appendTo($(ah.canvas).parent());var ak=ar+parseInt(ah.canvas.css("left"))+7,ai=aq+parseInt(ah.canvas.css("top"))+7;aj.css("left",ak+"px").css("top",ai+"px")}else{if(!at.isPropagationStopped()){at.stopPropagation();$(this).siblings().each(function(){$(this).trigger(at)})}}}).mouseleave(function(){$(this).siblings(".feature-popup").remove()})};var i=function(aj,ar,ak,an,at,ai,ah){q.call(this,aj,ar,ak,{},"draghandle");this.data_url=(ai?ai:default_data_url);this.data_url_extra_params={};this.data_query_wait=(ah?ah:L);this.dataset_check_url=converted_datasets_state_url;if(!i.id_counter){i.id_counter=0}this.id=i.id_counter++;this.container_div=$("<div />").addClass("track").attr("id","track_"+this.id).css("position","relative");if(an){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(this.header_div)}this.name_div=$("<div/>").addClass("track-name").appendTo(this.header_div).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());this.icons_div=$("<div/>").css("float","left").appendTo(this.header_div).hide();this.settings_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Edit settings").addClass("icon-button settings-icon").tipsy({gravity:"s"}).appendTo(this.icons_div);this.overview_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Set as overview").addClass("icon-button overview-icon").tipsy({gravity:"s"}).appendTo(this.icons_div);this.filters_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Filters").addClass("icon-button filters-icon").tipsy({gravity:"s"}).appendTo(this.icons_div).hide();this.tools_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Tools").addClass("icon-button tools-icon").tipsy({gravity:"s"}).appendTo(this.icons_div).hide();this.remove_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Remove").addClass("icon-button remove-icon").tipsy({gravity:"s"}).appendTo(this.icons_div);var al=this;this.header_div.dblclick(function(au){au.stopPropagation()});this.settings_icon.click(function(){var aw=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},au=function(){al.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},av=function(ax){if((ax.keyCode||ax.which)===27){aw()}else{if((ax.keyCode||ax.which)===13){au()}}};$(window).bind("keypress.check_enter_esc",av);show_modal("Configure Track",al.config.build_form(),{Cancel:aw,OK:au})});this.overview_icon.click(function(){al.view.set_overview(al)});this.filters_icon.click(function(){al.filters_div.toggle();al.filters_manager.reset_filters()});this.tools_icon.click(function(){al.dynamic_tool_div.toggle();if(al.dynamic_tool_div.is(":visible")){al.set_name(al.name+al.tool_region_and_parameters_str())}else{al.revert_name()}$(".tipsy").remove()});this.remove_icon.click(function(){$(".tipsy").remove();al.remove()});if(al.display_modes!==undefined){if(al.mode_div===undefined){al.mode_div=$("<div class='right-float menubutton popup' />").appendTo(al.header_div);var am=(al.config&&al.config.values.mode?al.config.values.mode:al.display_modes[0]);al.mode=am;al.mode_div.text(am);var ag={};for(var ao=0,aq=al.display_modes.length;ao<aq;ao++){var ap=al.display_modes[ao];ag[ap]=function(au){return function(){al.change_mode(au)}}(ap)}make_popupmenu(al.mode_div,ag)}else{al.mode_div.hide()}this.header_div.append($("<div/>").css("clear","both"));this.container_div.hover(function(){al.icons_div.show()},function(){al.icons_div.hide()})}}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.container.content_div.append(this.container_div)};p(i.prototype,q.prototype,{get_type:function(){if(this instanceof ac){return"LabelTrack"}else{if(this instanceof A){return"ReferenceTrack"}else{if(this instanceof j){return"LineTrack"}else{if(this instanceof X){return"ReadTrack"}else{if(this instanceof V){return"ToolDataFeatureTrack"}else{if(this instanceof U){return"VcfTrack"}else{if(this instanceof e){return"FeatureTrack"}}}}}}}return""},init:function(){var ag=this;ag.enabled=false;ag.tile_cache.clear();ag.data_manager.clear();ag.initial_canvas=undefined;ag.content_div.css("height","auto");ag.container_div.removeClass("nodata error pending");if(!ag.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:ag.hda_ldda,dataset_id:ag.dataset_id,chrom:ag.view.chrom},function(ah){if(!ah||ah==="error"||ah.kind==="error"){ag.container_div.addClass("error");ag.content_div.text(o);if(ah.message){var ai=$(" <a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ah.message+"</pre>",{Close:hide_modal})});ag.content_div.append(ai)}}else{if(ah==="no converter"){ag.container_div.addClass("error");ag.content_div.text(K)}else{if(ah==="no data"||(ah.data!==undefined&&(ah.data===null||ah.data.length===0))){ag.container_div.addClass("nodata");ag.content_div.text(F)}else{if(ah==="pending"){ag.container_div.addClass("pending");ag.content_div.text(t);setTimeout(function(){ag.init()},ag.data_query_wait)}else{if(ah.status==="data"){if(ah.valid_chroms){ag.valid_chroms=ah.valid_chroms;ag.update_track_icons()}ag.content_div.text(Z);if(ag.view.chrom){ag.content_div.text("");ag.content_div.css("height",ag.height_px+"px");ag.enabled=true;$.when(ag.predraw_init()).done(function(){ag.container_div.removeClass("nodata error pending");ag.request_draw()})}}}}}}});this.update_track_icons()},predraw_init:function(){}});var N=function(ai,ao,aj,al,ap,an,am,ah,ag){i.call(this,ai,ao,aj,al,ap,ah,ag);var ak=this,ao=ak.view;m(ak.container_div,ak.drag_handle_class,".group",ak);this.filters_manager=new ab(this,(an!==undefined?an:{}));this.filters_available=false;this.filters_visible=false;this.tool=(am!==undefined&&obj_length(am)>0?new r(this,am):undefined);if(this.header_div){if(this.filters_manager){this.filters_div=this.filters_manager.parent_div;this.header_div.after(this.filters_div)}if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}};p(N.prototype,q.prototype,i.prototype,{copy:function(ag){return new this.constructor(this.name,this.view,ag,this.hda_ldda,this.dataset_id,this.prefs,this.filters,this.tool)},to_json: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,}},change_mode:function(ah){var ag=this;ag.mode_div.text(ah);ag.mode=ah;ag.config.values.mode=ah;ag.tile_cache.clear();ag.request_draw();return ag},update_track_icons:function(){var ag=this;if(ag.filters_available>0){ag.filters_icon.show()}else{ag.filters_icon.hide()}if(ag.tool){ag.tools_icon.show()}else{ag.tools_icon.hide()}},_gen_tile_cache_key:function(ah,ai,ag){return ah+"_"+ai+"_"+ag},request_draw:function(ah,ag){this.view.request_redraw(false,ah,ag,this)},_draw:function(ai,aq){if(!this.enabled){return}if(!(this instanceof A)&&(!this.dataset_id)){return}var ap=this.view.low,am=this.view.high,an=am-ap,aj=this.view.container.width(),au=aj/an,al=this.view.resolution,at=$("<div style='position: relative;'></div>");if(this.is_overview){ap=this.view.max_low;am=this.view.max_high;al=Math.pow(C,Math.ceil(Math.log((view.max_high-view.max_low)/R)/Math.log(C)));au=aj/(view.max_high-view.max_low)}if(!aq){this.content_div.children().remove()}this.content_div.append(at);this.max_height=0;var ah=Math.floor(ap/al/R);var ao=true;var ar=[];var ag=0;while((ah*R*al)<am){tile=this.draw_helper(ai,aj,ah,al,at,au);if(tile){ar.push(tile)}else{ao=false}ah+=1;ag++}var ak=this;if(ao){ak.postdraw_actions(ar,aj,au,aq)}},postdraw_actions:function(ak,al,am,ag){var ai=this;var aj=false;for(var ah=0;ah<ak.length;ah++){if(ak[ah].message){aj=true;break}}if(aj){for(var ah=0;ah<ak.length;ah++){tile=ak[ah];if(!tile.message){tile.canvas.css("padding-top",E)}}}},draw_helper:function(ah,ai,aj,am,at,ax,au,an){var ak=this,ar=this._gen_tile_cache_key(ai,ax,aj),ao=aj*R*am,aw=ao+R*am;var ap=(ah?undefined:ak.tile_cache.get(ar));if(ap){ak.show_tile(ap,at,ax);return ap}var aq=function(ay){return("isResolved" in ay)};var al=true;var ag=ak.data_manager.get_data(ao,aw,ak.mode,am,ak.data_url_extra_params);if(aq(ag)){al=false}var av;if(view.reference_track&&ax>view.canvas_manager.char_width_px){av=view.reference_track.data_manager.get_data(ao,aw,ak.mode,am,view.reference_track.data_url_extra_params);if(aq(av)){al=false}}if(al){p(ag,an);var ap=ak.draw_tile(ag,ak.mode,am,aj,ax,av);if(ap!==undefined){ak.tile_cache.set(ar,ap);ak.show_tile(ap,at,ax)}return ap}$.when(ag,av).then(function(){view.request_redraw(false,false,false,ak)});return null},show_tile:function(am,ao,ap){var ai=this,ah=am.canvas,al=ah;if(am.message){var aq=$("<div/>"),an=$("<div/>").addClass("tile-message").text(am.message).css({height:E-1,width:am.canvas.width}).appendTo(aq),ak=$("<a href='javascript:void(0);'/>").addClass("icon more-down").appendTo(an),ag=$("<a href='javascript:void(0);'/>").addClass("icon more-across").appendTo(an);aq.append(ah);al=aq;ak.click(function(){am.stale=true;ai.data_manager.get_more_data(am.low,am.high,ai.mode,am.resolution,{},ai.data_manager.DEEP_DATA_REQ);ai.request_draw()}).dblclick(function(ar){ar.stopPropagation()});ag.click(function(){am.stale=true;ai.data_manager.get_more_data(am.low,am.high,ai.mode,am.resolution,{},ai.data_manager.BROAD_DATA_REQ);ai.request_draw()}).dblclick(function(ar){ar.stopPropagation()})}am.predisplay_actions();var aj=(am.low-(this.is_overview?this.view.max_low:this.view.low))*ap;if(this.left_offset){aj-=this.left_offset}al.css({position:"absolute",top:0,left:aj,height:""});ao.append(al);ai.max_height=Math.max(ai.max_height,al.height());ai.content_div.css("height",ai.max_height+"px");ao.children().css("height",ai.max_height+"px")},_get_tile_bounds:function(ag,ah){var aj=ag*R*ah,ak=R*ah,ai=(aj+ak<=this.view.max_high?aj+ak:this.view.max_high);return[aj,ai]},tool_region_and_parameters_str:function(ai,ag,aj){var ah=this,ak=(ai!==undefined&&ag!==undefined&&aj!==undefined?ai+":"+ag+"-"+aj:"all");return" - region=["+ak+"], parameters=["+ah.tool.get_param_values().join(", ")+"]"}});var ac=function(ah,ag){i.call(this,"label",ah,ag,false,{});this.container_div.addClass("label-track")};p(ac.prototype,i.prototype,{init:function(){this.enabled=true},_draw:function(){var ai=this.view,aj=ai.high-ai.low,am=Math.floor(Math.pow(10,Math.floor(Math.log(aj)/Math.log(10)))),ag=Math.floor(ai.low/am)*am,ak=this.view.container.width(),ah=$("<div style='position: relative; height: 1.3em;'></div>");while(ag<ai.high){var al=(ag-ai.low)/aj*ak;ah.append($("<div class='label'>"+commatize(ag)+"</div>").css({position:"absolute",left:al-1}));ag+=am}this.content_div.children(":first").remove();this.content_div.append(ah)}});var A=function(ag){N.call(this,"reference",ag,{content_div:ag.top_labeltrack},false,{});ag.reference_track=this;this.left_offset=200;this.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.data_url_extra_params={dbkey:ag.dbkey};this.data_manager=new I(B,this,false);this.tile_cache=new c(u)};p(A.prototype,q.prototype,N.prototype,{init:function(){this.enabled=true},draw_tile:function(aq,am,al,ah,ar){var ak=this,ai=R*al;if(ar>this.view.canvas_manager.char_width_px){if(aq.data===null){ak.content_div.css("height","0px");return}var aj=this.view.canvas_manager.new_canvas();var ap=aj.getContext("2d");aj.width=Math.ceil(ai*ar+ak.left_offset);aj.height=ak.height_px;ap.font=ap.canvas.manager.default_font;ap.textAlign="center";aq=aq.data;for(var an=0,ao=aq.length;an<ao;an++){var ag=Math.round(an*ar);ap.fillText(aq[an],ag+ak.left_offset,10)}return new b(ak,ah,al,aj,aq)}this.content_div.css("height","0px")}});var j=function(al,aj,ai,am,ag,ak){var ah=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";N.call(this,al,aj,ai,true,ak);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=am;this.dataset_id=ag;this.original_dataset_id=ag;this.data_manager=new S(B,this);this.tile_cache=new c(u);this.left_offset=0;this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:al},{key:"color",label:"Color",type:"color",default_value: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:this.height_px,hidden:true}],saved_values:ak,onchange:function(){ah.set_name(ah.prefs.name);ah.vertical_range=ah.prefs.max_value-ah.prefs.min_value;$("#linetrack_"+ah.dataset_id+"_minval").text(ah.prefs.min_value);$("#linetrack_"+ah.dataset_id+"_maxval").text(ah.prefs.max_value);ah.tile_cache.clear();ah.request_draw()}});this.prefs=this.config.values;this.height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value;this.add_resize_handle()};p(j.prototype,q.prototype,N.prototype,{add_resize_handle:function(){var ag=this;var aj=false;var ai=false;var ah=$("<div class='track-resize'>");$(ag.container_div).hover(function(){aj=true;ah.show()},function(){aj=false;if(!ai){ah.hide()}});ah.hide().bind("dragstart",function(ak,al){ai=true;al.original_height=$(ag.content_div).height()}).bind("drag",function(al,am){var ak=Math.min(Math.max(am.original_height+am.deltaY,ag.min_height_px),ag.max_height_px);$(ag.content_div).css("height",ak);ag.height_px=ak;ag.request_draw(true)}).bind("dragend",function(ak,al){ag.tile_cache.clear();ai=false;if(!aj){ah.hide()}ag.config.values.height=ag.height_px}).appendTo(ag.container_div)},predraw_init:function(){var ag=this;ag.vertical_range=undefined;return $.getJSON(ag.data_url,{stats:true,chrom:ag.view.chrom,low:null,high:null,hda_ldda:ag.hda_ldda,dataset_id:ag.dataset_id},function(ah){ag.container_div.addClass("line-track");var aj=ah.data;if(isNaN(parseFloat(ag.prefs.min_value))||isNaN(parseFloat(ag.prefs.max_value))){ag.prefs.min_value=aj.min;ag.prefs.max_value=aj.max;$("#track_"+ag.dataset_id+"_minval").val(ag.prefs.min_value);$("#track_"+ag.dataset_id+"_maxval").val(ag.prefs.max_value)}ag.vertical_range=ag.prefs.max_value-ag.prefs.min_value;ag.total_frequency=aj.total_frequency;ag.container_div.find(".yaxislabel").remove();var ak=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+ag.dataset_id+"_minval").text(aa(ag.prefs.min_value,3));var ai=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+ag.dataset_id+"_maxval").text(aa(ag.prefs.max_value,3));ai.css({position:"absolute",top:"24px",left:"10px"});ai.prependTo(ag.container_div);ak.css({position:"absolute",bottom:"2px",left:"10px"});ak.prependTo(ag.container_div)})},draw_tile:function(at,al,ak,ai,ar){if(this.vertical_range===undefined){return}var ag=this._get_tile_bounds(ai,ak),am=ag[0],aq=ag[1],ah=Math.ceil((aq-am)*ar),ao=this.height_px;var aj=this.view.canvas_manager.new_canvas();aj.width=ah,aj.height=ao;var ap=aj.getContext("2d");var an=new M.LinePainter(at.data,am,aq,this.prefs,al);an.draw(ap,ah,ao);return new b(this.track,ai,ak,aj,at.data)}});var e=function(ag,am,ah,al,ao,an,aj,ak){var ai=this;this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];N.call(this,ag,am,ah,true,an,aj,ak);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:ag},{key:"block_color",label:"Block color",type:"color",default_value:get_random_color()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:an,onchange:function(){ai.set_name(ai.prefs.name);ai.tile_cache.clear();ai.request_draw()}});this.prefs=this.config.values;this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=al;this.dataset_id=ao;this.original_dataset_id=ao;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_manager=new S(20,this);this.left_offset=200;this.painter=M.LinkedFeaturePainter};p(e.prototype,q.prototype,N.prototype,{postdraw_actions:function(aw,ag,ax,av){N.prototype.postdraw_actions.call(this,aw,av);var aj=this;if(av){var al=aj.content_div.children();var am=false;for(var ak=al.length-1,aq=0;ak>=aq;ak--){var ai=$(al[ak]);if(am){ai.remove()}else{if(ai.children().length!==0){am=true}}}}if(aj.mode=="Histogram"){var ap=-1;for(var ak=0;ak<aw.length;ak++){var au=aw[ak].max_val;if(au>ap){ap=au}}for(var ak=0;ak<aw.length;ak++){var at=aw[ak];if(at.max_val!==ap){at.canvas.remove();aj.draw_helper(true,ag,at.index,at.resolution,at.canvas.parent(),ax,[],{max:ap})}}}if(aj.filters_manager){var ah=aj.filters_manager.filters;for(var ao=0;ao<ah.length;ao++){ah[ao].update_ui_elt()}var an=false,ar;for(var ak=0;ak<aw.length;ak++){if(aw[ak].data.length){ar=aw[ak].data[0];for(var ao=0;ao<ah.length;ao++){if(ah[ao].applies_to(ar)){an=true;break}}}}if(aj.filters_available!==an){aj.filters_available=an;if(!aj.filters_available){aj.filters_div.hide()}aj.update_track_icons()}}},update_auto_mode:function(ag){if(this.mode=="Auto"){if(ag=="no_detail"){ag="feature spans"}else{if(ag=="summary_tree"){ag="coverage histogram"}}this.mode_div.text("Auto ("+ag+")")}},incremental_slots:function(ak,ah,aj){var ai=this.view.canvas_manager.dummy_context,ag=this.inc_slots[ak];if(!ag||(ag.mode!==aj)){ag=new (s.FeatureSlotter)(ak,aj==="Pack",z,function(al){return ai.measureText(al)});ag.mode=aj;this.inc_slots[ak]=ag}return ag.slot_features(ah)},get_summary_tree_data:function(ak,an,ai,aw){if(aw>ai-an){aw=ai-an}var ar=Math.floor((ai-an)/aw),av=[],aj=0;var al=0,am=0,aq,au=0,ao=[],at,ap;var ah=function(az,ay,aA,ax){az[0]=ay+aA*ax;az[1]=ay+(aA+1)*ax};while(au<aw&&al!==ak.length){var ag=false;for(;au<aw&&!ag;au++){ah(ao,an,au,ar);for(am=al;am<ak.length;am++){aq=ak[am].slice(1,3);if(is_overlap(aq,ao)){ag=true;break}}if(ag){break}}data_start_index=am;av[av.length]=at=[ao[0],0];for(;am<ak.length;am++){aq=ak[am].slice(1,3);if(is_overlap(aq,ao)){at[1]++}else{break}}if(at[1]>aj){aj=at[1]}au++}return{max:aj,delta:ar,data:av}},draw_tile:function(av,ay,aC,aG,aq,aj){var az=this,al=az._get_tile_bounds(aG,aC),aJ=al[0],ah=al[1],ax=ah-aJ,aA=Math.ceil(ax*aq),aP=25,ak=this.left_offset,aw,am;if(ay==="Auto"){if(av.dataset_type==="summary_tree"){ay=av.dataset_type}else{if(av.extra_info==="no_detail"||az.is_overview){ay="no_detail"}else{var aO=av.data;if(this.view.high-this.view.low>J){ay="Squish"}else{ay="Pack"}}}this.update_auto_mode(ay)}if(ay==="summary_tree"||ay==="Histogram"){am=this.summary_draw_height;this.container_div.find(".yaxislabel").remove();var ag=$("<div />").addClass("yaxislabel");ag.text(av.max);ag.css({position:"absolute",top:"24px",left:"10px",color:this.prefs.label_color});ag.prependTo(this.container_div);var ai=this.view.canvas_manager.new_canvas();ai.width=aA+ak;ai.height=am+T;if(av.dataset_type!="summary_tree"){var ar=this.get_summary_tree_data(av.data,aJ,ah,200);if(av.max){ar.max=av.max}av=ar}var aL=new M.SummaryTreePainter(av,aJ,ah,this.prefs);var aB=ai.getContext("2d");aB.translate(ak,T);aL.draw(aB,aA,am);return new k(az,aG,aC,ai,av.data,av.max)}var aw,ao=1;if(ay==="no_detail"||ay==="Squish"||ay==="Pack"){ao=this.incremental_slots(aq,av.data,ay);aw=this.inc_slots[aq].slots}var ap=[];if(av.data){var at=this.filters_manager.filters;for(var aD=0,aF=av.data.length;aD<aF;aD++){var an=av.data[aD];var aE=false;var au;for(var aI=0,aN=at.length;aI<aN;aI++){au=at[aI];au.update_attrs(an);if(!au.keep(an)){aE=true;break}}if(!aE){ap.push(an)}}}var aM=(this.filters_manager.alpha_filter?new D(this.filters_manager.alpha_filter):null);var aK=(this.filters_manager.height_filter?new D(this.filters_manager.height_filter):null);var aL=new (this.painter)(ap,aJ,ah,this.prefs,ay,aM,aK,aj);var am=Math.max(ae,aL.get_required_height(ao));var ai=this.view.canvas_manager.new_canvas();var aH=null;ai.width=aA+ak;ai.height=am;var aB=ai.getContext("2d");aB.fillStyle=this.prefs.block_color;aB.font=aB.canvas.manager.default_font;aB.textAlign="right";this.container_div.find(".yaxislabel").remove();if(av.data){aB.translate(ak,0);aH=aL.draw(aB,aA,am,aw);aH.translation=-ak}return new P(az,aG,aC,ai,av.data,ay,av.message,aH)}});var U=function(ak,ai,ah,am,ag,aj,al){e.call(this,ak,ai,ah,am,ag,aj,al);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:ak},{key:"block_color",label:"Block color",type:"color",default_value: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:aj,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=M.ReadPainter};p(U.prototype,q.prototype,N.prototype,e.prototype);var X=function(ak,ai,ah,am,ag,aj,al){e.call(this,ak,ai,ah,am,ag,aj,al);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:ak},{key:"block_color",label:"Block color",type:"color",default_value: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_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:aj,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=M.ReadPainter;this.update_track_icons()};p(X.prototype,q.prototype,N.prototype,e.prototype);var V=function(ak,ai,ah,am,ag,aj,al){e.call(this,ak,ai,ah,am,ag,aj,al,{});this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};p(V.prototype,q.prototype,N.prototype,e.prototype,{predraw_init:function(){var ah=this;var ag=function(){if(ah.data_manager.size()===0){setTimeout(ag,300)}else{ah.data_url=default_data_url;ah.data_query_wait=L;ah.dataset_state_url=converted_datasets_state_url;$.getJSON(ah.dataset_state_url,{dataset_id:ah.dataset_id,hda_ldda:ah.hda_ldda},function(ai){})}};ag()}});Y.View=ad;Y.DrawableGroup=Q;Y.LineTrack=j;Y.FeatureTrack=e;Y.ReadTrack=X;Y.VcfTrack=U};var slotting_module=function(c,b){var e=c("class").extend;var d=2,a=5;b.FeatureSlotter=function(i,h,f,g){this.slots={};this.start_end_dct={};this.w_scale=i;this.include_label=h;this.max_rows=f;this.measureText=g};e(b.FeatureSlotter.prototype,{slot_features:function(m){var p=this.w_scale,s=this.slots,h=this.start_end_dct,y=[],A=[],n=0,z=this.max_rows;for(var w=0,x=m.length;w<x;w++){var l=m[w],o=l[0];if(s[o]!==undefined){n=Math.max(n,s[o]);A.push(s[o])}else{y.push(w)}}var q=function(F,G){for(var E=0;E<=z;E++){var C=false,H=h[E];if(H!==undefined){for(var B=0,D=H.length;B<D;B++){var i=H[B];if(G>i[0]&&F<i[1]){C=true;break}}}if(!C){return E}}return -1};for(var w=0,x=y.length;w<x;w++){var l=m[y[w]],o=l[0],u=l[1],f=l[2],r=l[3],g=Math.floor(u*p),k=Math.ceil(f*p),v=this.measureText(r).width,j;if(r!==undefined&&this.include_label){v+=(d+a);if(g-v>=0){g-=v;j="left"}else{k+=v;j="right"}}var t=q(g,k);if(t>=0){if(h[t]===undefined){h[t]=[]}h[t].push([g,k]);s[o]=t;n=Math.max(n,t)}else{}}return n+1}})};var painters_module=function(i,w){var t=i("class").extend;var o=function(H,z,F,y,E,C){if(C===undefined){C=4}var B=y-z;var A=E-F;var D=Math.floor(Math.sqrt(B*B+A*A)/C);var I=B/D;var G=A/D;var x;for(x=0;x<D;x++,z+=I,F+=G){if(x%2!==0){continue}H.fillRect(z,F,C,1)}};var p=function(A,z,x,D){var C=z-D/2,B=z+D/2,E=x-Math.sqrt(D*3/2);A.beginPath();A.moveTo(C,E);A.lineTo(B,E);A.lineTo(z,x);A.lineTo(C,E);A.strokeStyle=this.fillStyle;A.fill();A.stroke();A.closePath()};var d=function(x){this.default_val=(x?x:1)};d.prototype.gen_val=function(x){return this.default_val};var l=function(z,B,x,y,A){this.data=z;this.view_start=B;this.view_end=x;this.prefs=t({},this.default_prefs,y);this.mode=A};l.prototype.default_prefs={};var u=function(z,B,x,y,A){l.call(this,z,B,x,y,A)};u.prototype.default_prefs={show_counts:false};u.prototype.draw=function(M,z,L){var E=this.view_start,O=this.view_end-this.view_start,N=z/O;var J=this.data.data,I=this.data.delta,G=this.data.max,B=L;delta_x_px=Math.ceil(I*N);M.save();for(var C=0,D=J.length;C<D;C++){var H=Math.floor((J[C][0]-E)*N);var F=J[C][1];if(!F){continue}var K=F/G*L;if(F!==0&&K<1){K=1}M.fillStyle=this.prefs.block_color;M.fillRect(H,B-K,delta_x_px,K);var A=4;if(this.prefs.show_counts&&(M.measureText(F).width+A)<delta_x_px){M.fillStyle=this.prefs.label_color;M.textAlign="center";M.fillText(F,H+(delta_x_px/2),10)}}M.restore()};var b=function(x,B,D,E,z){l.call(this,x,B,D,E,z);if(this.prefs.min_value===undefined){var F=Infinity;for(var y=0,A=this.data.length;y<A;y++){F=Math.min(F,this.data[y][1])}this.prefs.min_value=F}if(this.prefs.max_value===undefined){var C=-Infinity;for(var y=0,A=this.data.length;y<A;y++){C=Math.max(C,this.data[y][1])}this.prefs.max_value=C}};b.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};b.prototype.draw=function(M,L,J){var E=false,G=this.prefs.min_value,C=this.prefs.max_value,I=C-G,x=J,z=this.view_start,K=this.view_end-this.view_start,A=L/K,H=this.mode,S=this.data;M.save();var T=Math.round(J+G/I*J);if(H!=="Intensity"){M.fillStyle="#aaa";M.fillRect(0,T,L,1)}M.beginPath();var Q,D,B;if(S.length>1){B=Math.ceil((S[1][0]-S[0][0])*A)}else{B=10}for(var N=0,O=S.length;N<O;N++){M.fillStyle=this.prefs.color;Q=Math.round((S[N][0]-z)*A);D=S[N][1];var P=false,F=false;if(D===null){if(E&&H==="Filled"){M.lineTo(Q,x)}E=false;continue}if(D<G){F=true;D=G}else{if(D>C){P=true;D=C}}if(H==="Histogram"){D=Math.round(D/I*x);M.fillRect(Q,T,B,-D)}else{if(H==="Intensity"){D=255-Math.floor((D-G)/I*255);M.fillStyle="rgb("+D+","+D+","+D+")";M.fillRect(Q,0,B,x)}else{D=Math.round(x-(D-G)/I*x);if(E){M.lineTo(Q,D)}else{E=true;if(H==="Filled"){M.moveTo(Q,x);M.lineTo(Q,D)}else{M.moveTo(Q,D)}}}}M.fillStyle=this.prefs.overflow_color;if(P||F){var R;if(H==="Histogram"||H==="Intensity"){R=B}else{Q-=2;R=4}if(P){M.fillRect(Q,0,R,3)}if(F){M.fillRect(Q,x-3,R,3)}}M.fillStyle=this.prefs.color}if(H==="Filled"){if(E){M.lineTo(Q,T);M.lineTo(0,T)}M.fill()}else{M.stroke()}M.restore()};var m=function(x){this.feature_positions={};this.slot_height=x;this.translation=0};m.prototype.map_feature_data=function(y,A,x,z){if(!this.feature_positions[A]){this.feature_positions[A]=[]}this.feature_positions[A].push({data:y,x_start:x,x_end:z})};m.prototype.get_feature_data=function(z,D){var C=Math.floor(D/this.slot_height),B;if(!this.feature_positions[C]){return null}z+=this.translation;for(var A=0;A<this.feature_positions[C].length;A++){B=this.feature_positions[C][A];if(z>=B.x_start&&z<=B.x_end){return B.data}}};var n=function(z,C,x,y,B,D,A){l.call(this,z,C,x,y,B);this.alpha_scaler=(D?D:new d());this.height_scaler=(A?A:new d())};n.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};t(n.prototype,{get_required_height:function(y){var x=y_scale=this.get_row_height(),z=this.mode;if(z==="no_detail"||z==="Squish"||z==="Pack"){x=y*y_scale}return x+Math.max(Math.round(y_scale/2),5)},draw:function(J,H,F,E){var P=this.data,C=this.view_start,L=this.view_end;J.save();J.fillStyle=this.prefs.block_color;J.textAlign="right";var G=this.view_end-this.view_start,D=H/G,K=this.get_row_height(),O=new m(K),A;for(var M=0,N=P.length;M<N;M++){var z=P[M],B=z[0],I=z[1],x=z[2],y=(E&&E[B]!==undefined?E[B]:null);if((I<L&&x>C)&&(this.mode=="Dense"||y!==null)){A=this.draw_element(J,this.mode,z,y,C,L,D,K,H);O.map_feature_data(z,y,A[0],A[1])}}J.restore();return O},draw_element:function(D,z,F,B,A,C,E,y,x){console.log("WARNING: Unimplemented function.");return[0,0]}});var c=10,h=3,k=5,v=10,f=1,r=3,e=3,a=9,j=2,g="#ccc";var q=function(z,C,x,y,B,D,A){n.call(this,z,C,x,y,B,D,A)};t(q.prototype,n.prototype,{get_row_height:function(){var y=this.mode,x;if(y==="Dense"){x=c}else{if(y==="no_detail"){x=h}else{if(y==="Squish"){x=k}else{x=v}}}return x},draw_element:function(L,C,U,G,N,af,aj,al,x){var R=U[0],ah=U[1],Z=U[2],P=U[3],aa=Math.floor(Math.max(0,(ah-N)*aj)),M=Math.ceil(Math.min(x,Math.max(0,(Z-N)*aj))),Y=aa,ak=M,X=(C==="Dense"?0:(0+G))*al,K,ad,Q=null,an=null,A=this.prefs.block_color,ac=this.prefs.label_color;L.globalAlpha=this.alpha_scaler.gen_val(U);if(C==="Dense"){G=1}if(C==="no_detail"){L.fillStyle=A;L.fillRect(aa,X+5,M-aa,f)}else{var J=U[4],W=U[5],ab=U[6],B=U[7];if(W&&ab){Q=Math.floor(Math.max(0,(W-N)*aj));an=Math.ceil(Math.min(x,Math.max(0,(ab-N)*aj)))}var ai,S;if(C==="Squish"||C==="Dense"){ai=1;S=e}else{ai=5;S=a}if(!B){if(U.strand){if(U.strand==="+"){L.fillStyle=L.canvas.manager.get_pattern("right_strand_inv")}else{if(U.strand==="-"){L.fillStyle=L.canvas.manager.get_pattern("left_strand_inv")}}}else{L.fillStyle=A}L.fillRect(aa,X,M-aa,S)}else{var I,T;if(C==="Squish"||C==="Dense"){L.fillStyle=g;I=X+Math.floor(e/2)+1;T=1}else{if(J){var I=X;var T=S;if(J==="+"){L.fillStyle=L.canvas.manager.get_pattern("right_strand")}else{if(J==="-"){L.fillStyle=L.canvas.manager.get_pattern("left_strand")}}}else{L.fillStyle=g;I+=(e/2)+1;T=1}}L.fillRect(aa,I,M-aa,T);var D;for(var ag=0,z=B.length;ag<z;ag++){var E=B[ag],y=Math.floor(Math.max(0,(E[0]-N)*aj)),V=Math.ceil(Math.min(x,Math.max((E[1]-N)*aj)));if(y>V){continue}L.fillStyle=A;L.fillRect(y,X+(S-ai)/2+1,V-y,ai);if(Q!==undefined&&ab>W&&!(y>an||V<Q)){var ae=Math.max(y,Q),H=Math.min(V,an);L.fillRect(ae,X+1,H-ae,S);if(B.length==1&&C=="Pack"){if(J==="+"){L.fillStyle=L.canvas.manager.get_pattern("right_strand_inv")}else{if(J==="-"){L.fillStyle=L.canvas.manager.get_pattern("left_strand_inv")}}if(ae+14<H){ae+=2;H-=2}L.fillRect(ae,X+1,H-ae,S)}}}if(C==="Pack"){L.globalAlpha=1;L.fillStyle="white";var F=this.height_scaler.gen_val(U),O=Math.ceil(S*F),am=Math.round((S-O)/2);if(F!==1){L.fillRect(aa,I+1,M-aa,am);L.fillRect(aa,I+S-am+1,M-aa,am)}}}L.globalAlpha=1;if(C==="Pack"&&ah>N){L.fillStyle=ac;if(N===0&&aa-L.measureText(P).width<0){L.textAlign="left";L.fillText(P,M+j,X+8);ak+=L.measureText(P).width+j}else{L.textAlign="right";L.fillText(P,aa-j,X+8);Y-=L.measureText(P).width+j}}}L.globalAlpha=1;return[Y,ak]}});var s=function(A,D,x,z,C,E,B,y){n.call(this,A,D,x,z,C,E,B);this.ref_seq=(y?y.data:null)};s.prototype.default_prefs=t({},n.prototype.default_prefs,{show_insertions:false});t(s.prototype,n.prototype,{get_row_height:function(){var x,y=this.mode;if(y==="Dense"){x=c}else{if(y==="Squish"){x=k}else{x=v;if(this.prefs.show_insertions){x*=2}}}return x},draw_read:function(U,P,L,Z,A,T,I,F,E){U.textAlign="center";var S=this,z=[Z,A],O=0,V=0,R=0,x=U.canvas.manager.char_width_px;var ae=[];if((P==="Pack"||this.mode==="Auto")&&F!==undefined&&L>x){R=Math.round(L/2)}if(!I){I=[[0,F.length]]}for(var M=0,X=I.length;M<X;M++){var J=I[M],B="MIDNSHP=X"[J[0]],N=J[1];if(B==="H"||B==="S"){O-=N}var G=T+O,ad=Math.floor(Math.max(0,(G-Z)*L)),H=Math.floor(Math.max(0,(G+N-Z)*L));if(ad===H){H+=1}switch(B){case"H":break;case"S":case"M":case"=":if(is_overlap([G,G+N],z)){var Q=F.slice(V,V+N);if(R>0){U.fillStyle=this.prefs.block_color;U.fillRect(ad-R,E+1,H-ad,9);U.fillStyle=g;for(var ab=0,y=Q.length;ab<y;ab++){if(this.prefs.show_differences&&this.ref_seq){var K=this.ref_seq[G-Z+ab];if(!K||K.toLowerCase()===Q[ab].toLowerCase()){continue}}if(G+ab>=Z&&G+ab<=A){var ac=Math.floor(Math.max(0,(G+ab-Z)*L));U.fillText(Q[ab],ac,E+9)}}}else{U.fillStyle=this.prefs.block_color;U.fillRect(ad,E+4,H-ad,e)}}V+=N;O+=N;break;case"N":U.fillStyle=g;U.fillRect(ad-R,E+5,H-ad,1);O+=N;break;case"D":U.fillStyle="red";U.fillRect(ad-R,E+4,H-ad,3);O+=N;break;case"P":break;case"I":var Y=ad-R;if(is_overlap([G,G+N],z)){var Q=F.slice(V,V+N);if(this.prefs.show_insertions){var D=ad-(H-ad)/2;if((P==="Pack"||this.mode==="Auto")&&F!==undefined&&L>x){U.fillStyle="yellow";U.fillRect(D-R,E-9,H-ad,9);ae[ae.length]={type:"triangle",data:[Y,E+4,5]};U.fillStyle=g;switch(compute_overlap([G,G+N],z)){case (OVERLAP_START):Q=Q.slice(Z-G);break;case (OVERLAP_END):Q=Q.slice(0,G-A);break;case (CONTAINED_BY):break;case (CONTAINS):Q=Q.slice(Z-G,G-A);break}for(var ab=0,y=Q.length;ab<y;ab++){var ac=Math.floor(Math.max(0,(G+ab-Z)*L));U.fillText(Q[ab],ac-(H-ad)/2,E)}}else{U.fillStyle="yellow";U.fillRect(D,E+(this.mode!=="Dense"?2:5),H-ad,(P!=="Dense"?e:r))}}else{if((P==="Pack"||this.mode==="Auto")&&F!==undefined&&L>x){ae.push({type:"text",data:[Q.length,Y,E+9]})}else{}}}V+=N;break;case"X":V+=N;break}}U.fillStyle="yellow";var aa,C,af;for(var W=0;W<ae.length;W++){aa=ae[W];C=aa.type;af=aa.data;if(C==="text"){U.save();U.font="bold "+U.font;U.fillText(af[0],af[1],af[2]);U.restore()}else{if(C=="triangle"){p(U,af[0],af[1],af[2])}}}},draw_element:function(Q,L,D,A,T,y,H,R,O){var G=D[0],P=D[1],z=D[2],I=D[3],C=Math.floor(Math.max(0,(P-T)*H)),E=Math.ceil(Math.min(O,Math.max(0,(z-T)*H))),B=(L==="Dense"?0:(0+A))*R,U=this.prefs.block_color,F=this.prefs.label_color,N=0;if((L==="Pack"||this.mode==="Auto")&&H>Q.canvas.manager.char_width_px){var N=Math.round(H/2)}Q.fillStyle=U;if(D[5] instanceof Array){var M=Math.floor(Math.max(0,(D[4][0]-T)*H)),K=Math.ceil(Math.min(O,Math.max(0,(D[4][1]-T)*H))),J=Math.floor(Math.max(0,(D[5][0]-T)*H)),x=Math.ceil(Math.min(O,Math.max(0,(D[5][1]-T)*H)));if(D[4][1]>=T&&D[4][0]<=y&&D[4][2]){this.draw_read(Q,L,H,T,y,D[4][0],D[4][2],D[4][3],B)}if(D[5][1]>=T&&D[5][0]<=y&&D[5][2]){this.draw_read(Q,L,H,T,y,D[5][0],D[5][2],D[5][3],B)}if(J>K){Q.fillStyle=g;o(Q,K-N,B+5,J-N,B+5)}}else{Q.fillStyle=U;this.draw_read(Q,L,H,T,y,P,D[4],D[5],B)}if(L==="Pack"&&P>T&&I!=="."){Q.fillStyle=this.prefs.label_color;var S=1;if(S===0&&C-Q.measureText(I).width<0){Q.textAlign="left";Q.fillText(I,E+j-N,B+8)}else{Q.textAlign="right";Q.fillText(I,C-j-N,B+8)}Q.fillStyle=U}return[0,0]}});w.Scaler=d;w.SummaryTreePainter=u;w.LinePainter=b;w.LinkedFeaturePainter=q;w.ReadPainter=s};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("class",class_module);a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window);
\ No newline at end of file
+var class_module=function(b,a){var c=function(){var f=arguments[0];for(var e=1;e<arguments.length;e++){var d=arguments[e];for(key in d){f[key]=d[key]}}return f};a.extend=c};var requestAnimationFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b,a){window.setTimeout(b,1000/60)}})();var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=BEFORE}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=AFTER}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a};var is_overlap=function(c,b){var a=compute_overlap(c,b);return(a!==BEFORE&&a!==AFTER)};var get_random_color=function(a){if(!a){a="#ffffff"}if(typeof(a)==="string"){a=[a]}for(var j=0;j<a.length;j++){a[j]=parseInt(a[j].slice(1),16)}var m=function(t,s,i){return((t*299)+(s*587)+(i*114))/1000};var e=function(u,t,v,r,i,s){return(Math.max(u,r)-Math.min(u,r))+(Math.max(t,i)-Math.min(t,i))+(Math.max(v,s)-Math.min(v,s))};var g,n,f,k,p,h,q,c,d,b,o,l=false;do{g=Math.random()*16777215;n=g|16711680;f=g|65280;k=g|255;d=m(n,f,k);l=true;for(var j=0;j<a.length;j++){p=a[j];h=p|16711680;q=p|65280;c=p|255;b=m(h,q,c);o=e(n,f,k,h,q,c);if((Math.abs(d-b)<125)||(o<500)){l=false;break}}}while(!l);return"#"+(16777216+g).toString(16).substr(1,6)};var trackster_module=function(f,X){var p=f("class").extend,s=f("slotting"),M=f("painters");var ae=function(af,ag){this.document=af;this.default_font=ag!==undefined?ag:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};p(ae.prototype,{load_pattern:function(af,aj){var ag=this.patterns,ah=this.dummy_context,ai=new Image();ai.src=image_path+aj;ai.onload=function(){ag[af]=ah.createPattern(ai,"repeat")}},get_pattern:function(af){return this.patterns[af]},new_canvas:function(){var af=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(af)}af.manager=this;return af}});var n={};var l=function(af,ag){n[af.attr("id")]=ag};var m=function(af,ah,aj,ai){aj=".group";var ag={};n[af.attr("id")]=ai;af.bind("drag",{handle:"."+ah,relative:true},function(ar,at){var aq=$(this);var aw=$(this).parent(),an=aw.children(),ap=n[$(this).attr("id")],am,al,au,ak,ao;al=$(this).parents(aj);if(al.length!==0){au=al.position().top;ak=au+al.outerHeight();if(at.offsetY<au){$(this).insertBefore(al);var av=n[al.attr("id")];av.remove_drawable(ap);av.container.add_drawable_before(ap,av);return}else{if(at.offsetY>ak){$(this).insertAfter(al);var av=n[al.attr("id")];av.remove_drawable(ap);av.container.add_drawable(ap);return}}}al=null;for(ao=0;ao<an.length;ao++){am=$(an.get(ao));au=am.position().top;ak=au+am.outerHeight();if(am.is(aj)&&this!==am.get(0)&&at.offsetY>=au&&at.offsetY<=ak){if(at.offsetY-au<ak-at.offsetY){am.find(".content-div").prepend(this)}else{am.find(".content-div").append(this)}if(ap.container){ap.container.remove_drawable(ap)}n[am.attr("id")].add_drawable(ap);return}}for(ao=0;ao<an.length;ao++){if(at.offsetY<$(an.get(ao)).position().top){break}}if(ao===an.length){if(this!==an.get(ao-1)){aw.append(this);n[aw.attr("id")].move_drawable(ap,ao)}}else{if(this!==an.get(ao)){$(this).insertBefore(an.get(ao));n[aw.attr("id")].move_drawable(ap,(at.deltaY>0?ao-1:ao))}}}).bind("dragstart",function(){ag["border-top"]=af.css("border-top");ag["border-bottom"]=af.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ag)})};X.moveable=m;var ad=16,H=9,E=20,T=H+2,z=100,J=12000,R=200,C=5,v=10,L=5000,w=100,o="There was an error in indexing this dataset. ",K="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",F="No data for this chrom/contig.",t="Currently indexing... please wait",x="Tool cannot be rerun: ",a="Loading data...",Y="Ready for display",d=10,u=5,B=5;function Z(ag,af){if(!af){af=0}var ah=Math.pow(10,af);return Math.round(ag*ah)/ah}var c=function(af){this.num_elements=af;this.clear()};p(c.prototype,{get:function(ag){var af=this.key_ary.indexOf(ag);if(af!==-1){if(this.obj_cache[ag].stale){this.key_ary.splice(af,1);delete this.obj_cache[ag]}else{this.move_key_to_end(ag,af)}}return this.obj_cache[ag]},set:function(ag,ah){if(!this.obj_cache[ag]){if(this.key_ary.length>=this.num_elements){var af=this.key_ary.shift();delete this.obj_cache[af]}this.key_ary.push(ag)}this.obj_cache[ag]=ah;return ah},move_key_to_end:function(ag,af){this.key_ary.splice(af,1);this.key_ary.push(ag)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var S=function(ag,af,ah){c.call(this,ag);this.track=af;this.subset=(ah!==undefined?ah:true)};p(S.prototype,c.prototype,{load_data:function(ao,aj,am,ag,al){var an=this.track.view.chrom,ai={chrom:an,low:ao,high:aj,mode:am,resolution:ag,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(ai,al);if(this.track.filters_manager){var ap=[];var af=this.track.filters_manager.filters;for(var ak=0;ak<af.length;ak++){ap[ap.length]=af[ak].name}ai.filter_cols=JSON.stringify(ap)}var ah=this;return $.getJSON(this.track.data_url,ai,function(aq){ah.set_data(ao,aj,am,aq)})},get_data:function(af,aj,ak,ag,ai){var ah=this.get_data_from_cache(af,aj,ak);if(ah){return ah}ah=this.load_data(af,aj,ak,ag,ai);this.set_data(af,aj,ak,ah);return ah},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(an,ai,am,ah,al,aj){var ao=this.get_data_from_cache(an,ai,am);if(!ao){console.log("ERROR: no current data for: ",this.track,an,ai,am,ah,al);return}ao.stale=true;var ag=an;if(aj===this.DEEP_DATA_REQ){$.extend(al,{start_val:ao.data.length+1})}else{if(aj===this.BROAD_DATA_REQ){ag=(ao.max_high?ao.max_high:ao.data[ao.data.length-1][2])+1}}var af=this,ak=this.load_data(ag,ai,am,ah,al);new_data_available=$.Deferred();this.set_data(an,ai,am,new_data_available);$.when(ak).then(function(ap){if(ap.data){ap.data=ao.data.concat(ap.data);if(ap.max_low){ap.max_low=ao.max_low}if(ap.message){ap.message=ap.message.replace(/[0-9]+/,ap.data.length)}}af.set_data(an,ai,am,ap);new_data_available.resolve(ap)});return new_data_available},get_data_from_cache:function(af,ag,ah){return this.get(this.gen_key(af,ag,ah))},set_data:function(ag,ah,ai,af){return this.set(this.gen_key(ag,ah,ai),af)},gen_key:function(af,ah,ai){var ag=af+"_"+ah+"_"+ai;return ag},split_key:function(af){return af.split("_")}});var I=function(ag,af,ah){S.call(this,ag,af,ah)};p(I.prototype,S.prototype,c.prototype,{load_data:function(af,ai,aj,ag,ah){if(ag>1){return{data:null}}return S.prototype.load_data.call(this,af,ai,aj,ag,ah)}});var q=function(ai,ag,af,ah,aj){this.name=ai;this.view=ag;this.container=af;this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:ai}],saved_values:ah,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=aj;this.is_overview=false};p(q.prototype,{init:function(){},request_draw:function(){},_draw:function(){},to_json:function(){},update_track_icons:function(){},set_name:function(af){this.old_name=this.name;this.name=af;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)},remove:function(){this.container.remove_drawable(this);this.container_div.fadeOut("slow",function(){$(this).remove();view.update_intro_div();view.has_changes=true})}});var y=function(aj,ai,ag,af,ah,ak){q.call(this,ai,ag,af,ah,ak);this.obj_type=aj;this.drawables=[]};p(y.prototype,q.prototype,{init:function(){for(var af=0;af<this.drawables.length;af++){this.drawables[af].init()}},_draw:function(){for(var af=0;af<this.drawables.length;af++){this.drawables[af]._draw()}},to_json:function(){var ag=[];for(var af=0;af<this.drawables.length;af++){ag.push(this.drawables[af].to_json())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ag}},add_drawable:function(af){this.drawables.push(af);af.container=this},add_drawable_before:function(ah,af){var ag=this.drawables.indexOf(af);if(ag!=-1){this.drawables.splice(ag,0,ah);return true}return false},remove_drawable:function(ag){var af=this.drawables.indexOf(ag);if(af!=-1){this.drawables.splice(af,1);ag.container=null;return true}return false},move_drawable:function(ag,ah){var af=this.drawables.indexOf(ag);if(af!=-1){this.drawables.splice(af,1);this.drawables.splice(ah,0,ag);return true}return false}});var Q=function(ai,ag,af,ah){y.call(this,"DrawableGroup",ai,ag,af,ah,"group-handle");if(!Q.id_counter){Q.id_counter=0}var aj=Q.id_counter++;this.container_div=$("<div/>").addClass("group").attr("id","group_"+aj).appendTo(this.container.content_div);this.header_div=$("<div/>").addClass("track-header").appendTo(this.container_div);this.header_div.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("group-name menubutton popup").text(this.name).appendTo(this.header_div);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+aj+"_content_div").appendTo(this.container_div);l(this.container_div,this);l(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.update_track_icons()};p(Q.prototype,q.prototype,y.prototype,{update_track_icons:function(){var ag=this;var af={};af["Edit configuration"]=function(){var aj=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ah=function(){ag.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ai=function(ak){if((ak.keyCode||ak.which)===27){aj()}else{if((ak.keyCode||ak.which)===13){ah()}}};$(window).bind("keypress.check_enter_esc",ai);show_modal("Configure Group",ag.config.build_form(),{Cancel:aj,OK:ah})};af.Remove=function(){ag.remove()};make_popupmenu(ag.name_div,af)}});var ac=function(af,ai,ah,ag){y.call(this,"View");this.container=af;this.chrom=null;this.vis_id=ah;this.dbkey=ag;this.title=ai;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.init();this.canvas_manager=new ae(af.get(0).ownerDocument);this.reset()};p(ac.prototype,y.prototype,{init:function(){var ah=this.container,af=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ah);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ah);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ah);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;l(this.viewport_container,af);this.intro_div=$("<div/>").addClass("intro");var ai=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){add_tracks()});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("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").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ag=function(aj){if(aj.type==="focusout"||(aj.keyCode||aj.which)===13||(aj.keyCode||aj.which)===27){if((aj.keyCode||aj.which)!==27){af.go_to($(this).val())}$(this).hide();$(this).val("");af.location_span.show();af.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ag).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").appendTo(this.nav_controls);this.location_span.click(function(){af.location_span.hide();af.chrom_select.hide();af.nav_input.val(af.chrom+":"+af.low+"-"+af.high);af.nav_input.css("display","inline-block");af.nav_input.select();af.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a id='zoom-out' />").click(function(){af.zoom_out();af.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){af.zoom_in();af.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){af.change_chrom(af.chrom_select.val())});this.browser_content_div.click(function(aj){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(aj){af.zoom_in(aj.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(aj,ak){this.current_x=ak.offsetX}).bind("drag",function(aj,al){var am=al.offsetX-this.current_x;this.current_x=al.offsetX;var ak=Math.round(am/af.viewport_container.width()*(af.max_high-af.max_low));af.move_delta(-ak)});this.overview_close.click(function(){af.reset_overview()});this.viewport_container.bind("draginit",function(aj,ak){if(aj.clientX>af.viewport_container.width()-16){return false}}).bind("dragstart",function(aj,ak){ak.original_low=af.low;ak.current_height=aj.clientY;ak.current_x=ak.offsetX}).bind("drag",function(al,an){var aj=$(this);var ao=an.offsetX-an.current_x;var ak=aj.scrollTop()-(al.clientY-an.current_height);aj.scrollTop(ak);an.current_height=al.clientY;an.current_x=an.offsetX;var am=Math.round(ao/af.viewport_container.width()*(af.high-af.low));af.move_delta(am)}).bind("mousewheel",function(al,an,ak,aj){if(ak){var am=Math.round(-ak/af.viewport_container.width()*(af.high-af.low));af.move_delta(am)}});this.top_labeltrack.bind("dragstart",function(aj,ak){return $("<div />").css({height:af.browser_content_div.height()+af.top_labeltrack.height()+af.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(an,ao){$(ao.proxy).css({left:Math.min(an.pageX,ao.startX),width:Math.abs(an.pageX-ao.startX)});var ak=Math.min(an.pageX,ao.startX)-af.container.offset().left,aj=Math.max(an.pageX,ao.startX)-af.container.offset().left,am=(af.high-af.low),al=af.viewport_container.width();af.update_location(Math.round(ak/al*am)+af.low,Math.round(aj/al*am)+af.low)}).bind("dragend",function(ao,ap){var ak=Math.min(ao.pageX,ap.startX),aj=Math.max(ao.pageX,ap.startX),am=(af.high-af.low),al=af.viewport_container.width(),an=af.low;af.low=Math.round(ak/al*am)+an;af.high=Math.round(aj/al*am)+an;$(ap.proxy).remove();af.request_redraw()});this.add_label_track(new ab(this,{content_div:this.top_labeltrack}));this.add_label_track(new ab(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){af.resize_window()});$(document).bind("redraw",function(){af.redraw()});this.reset();$(window).trigger("resize");this.update_intro_div()},update_intro_div:function(){if(this.num_tracks===0){this.intro_div.appendTo(this.viewport_container)}else{this.intro_div.remove()}},update_location:function(af,ag){this.location_span.text(commatize(af)+" - "+commatize(ag));this.nav_input.val(this.chrom+":"+commatize(af)+"-"+commatize(ag))},load_chroms:function(ah){ah.num=w;$.extend(ah,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var af=this,ag=$.Deferred();$.ajax({url:chrom_url,data:ah,dataType:"json",success:function(aj){if(aj.chrom_info.length===0){alert("Invalid chromosome: "+ah.chrom);return}if(aj.reference){af.add_label_track(new A(af))}af.chrom_data=aj.chrom_info;var am='<option value="">Select Chrom/Contig</option>';for(var al=0,ai=af.chrom_data.length;al<ai;al++){var ak=af.chrom_data[al].chrom;am+='<option value="'+ak+'">'+ak+"</option>"}if(aj.prev_chroms){am+='<option value="previous">Previous '+w+"</option>"}if(aj.next_chroms){am+='<option value="next">Next '+w+"</option>"}af.chrom_select.html(am);af.chrom_start_index=aj.start_index;ag.resolve(aj)},error:function(){alert("Could not load chroms for this dbkey:",af.dbkey)}});return ag},change_chrom:function(ak,ag,am){if(!ak||ak==="None"){return}var ah=this;if(ak==="previous"){ah.load_chroms({low:this.chrom_start_index-w});return}if(ak==="next"){ah.load_chroms({low:this.chrom_start_index+w});return}var al=$.grep(ah.chrom_data,function(an,ao){return an.chrom===ak})[0];if(al===undefined){ah.load_chroms({chrom:ak},function(){ah.change_chrom(ak,ag,am)});return}else{if(ak!==ah.chrom){ah.chrom=ak;ah.chrom_select.val(ah.chrom);ah.max_high=al.len-1;ah.reset();ah.request_redraw(true);for(var aj=0,af=ah.drawables.length;aj<af;aj++){var ai=ah.drawables[aj];if(ai.init){ai.init()}}}if(ag!==undefined&&am!==undefined){ah.low=Math.max(ag,0);ah.high=Math.min(am,ah.max_high)}ah.reset_overview();ah.request_redraw()}},go_to:function(aj){aj=aj.replace(/ |,/g,"");var an=this,af,ai,ag=aj.split(":"),al=ag[0],am=ag[1];if(am!==undefined){try{var ak=am.split("-");af=parseInt(ak[0],10);ai=parseInt(ak[1],10)}catch(ah){return false}}an.change_chrom(al,af,ai)},move_fraction:function(ah){var af=this;var ag=af.high-af.low;this.move_delta(ah*ag)},move_delta:function(ah){var af=this;var ag=af.high-af.low;if(af.low-ah<af.max_low){af.low=af.max_low;af.high=af.max_low+ag}else{if(af.high-ah>af.max_high){af.high=af.max_high;af.low=af.max_high-ag}else{af.high-=ah;af.low-=ah}}af.request_redraw()},add_drawable:function(af){y.prototype.add_drawable.call(this,af);af.init();this.has_changes=true;this.update_intro_div()},add_label_track:function(af){af.view=this;af.init();this.label_tracks.push(af)},remove_drawable:function(ah,ag){y.prototype.remove_drawable.call(this,ah);if(ag){var af=this;ah.container_div.fadeOut("slow",function(){$(this).remove();af.update_intro_div()});this.has_changes=true}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(an,af,am,ag){var al=this,aj=(ag?[ag]:al.drawables),ah;var ag;for(var ak=0;ak<aj.length;ak++){ag=aj[ak];ah=-1;for(var ai=0;ai<al.tracks_to_be_redrawn.length;ai++){if(al.tracks_to_be_redrawn[ai][0]===ag){ah=ai;break}}if(ah<0){al.tracks_to_be_redrawn.push([ag,af,am])}else{al.tracks_to_be_redrawn[ak][1]=af;al.tracks_to_be_redrawn[ak][2]=am}}requestAnimationFrame(function(){al._redraw(an)})},_redraw:function(ap){var am=this.low,ai=this.high;if(am<this.max_low){am=this.max_low}if(ai>this.max_high){ai=this.max_high}var ao=this.high-this.low;if(this.high!==0&&ao<this.min_separation){ai=am+this.min_separation}this.low=Math.floor(am);this.high=Math.ceil(ai);this.resolution=Math.pow(C,Math.ceil(Math.log((this.high-this.low)/R)/Math.log(C)));this.zoom_res=Math.pow(v,Math.max(0,Math.ceil(Math.log(this.resolution,v)/Math.log(v))));var af=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var al=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var aq=13;this.overview_box.css({left:af,width:Math.max(aq,al)}).show();if(al<aq){this.overview_box.css("left",af-(aq-al)/2)}if(this.overview_highlight){this.overview_highlight.css({left:af,width:al})}this.update_location(this.low,this.high);if(!ap){var ah,ag,an;for(var aj=0,ak=this.tracks_to_be_redrawn.length;aj<ak;aj++){ah=this.tracks_to_be_redrawn[aj][0];ag=this.tracks_to_be_redrawn[aj][1];an=this.tracks_to_be_redrawn[aj][2];if(ah){ah._draw(ag,an)}}this.tracks_to_be_redrawn=[];for(aj=0,ak=this.label_tracks.length;aj<ak;aj++){this.label_tracks[aj]._draw()}}},zoom_in:function(ag,ah){if(this.max_high===0||this.high-this.low<this.min_separation){return}var ai=this.high-this.low,aj=ai/2+this.low,af=(ai/this.zoom_factor)/2;if(ag){aj=ag/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(aj-af);this.high=Math.round(aj+af);this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ag=this.high-this.low,ah=ag/2+this.low,af=(ag*this.zoom_factor)/2;this.low=Math.round(ah-af);this.high=Math.round(ah+af);this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.request_redraw()},set_overview:function(ah){if(this.overview_drawable){if(this.overview_drawable.dataset_id===ah.dataset_id){return}this.overview_viewport.find(".track").remove()}var ag=ah.copy({content_div:this.overview_viewport}),af=this;ag.header_div.hide();ag.is_overview=true;af.overview_drawable=ag;this.overview_drawable.postdraw_actions=function(){af.overview_highlight.show().height(af.overview_drawable.content_div.height());af.overview_viewport.height(af.overview_drawable.content_div.height()+af.overview_box.outerHeight());af.overview_close.show();af.resize_window()};this.overview_drawable.init();af.has_changes=true},reset_overview:function(){$(".tipsy").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 r=function(ah,al){this.track=ah;this.name=al.name;this.params=[];var at=al.params;for(var ai=0;ai<at.length;ai++){var an=at[ai],ag=an.name,ar=an.label,aj=unescape(an.html),au=an.value,ap=an.type;if(ap==="number"){this.params[this.params.length]=new g(ag,ar,aj,au,an.min,an.max)}else{if(ap=="select"){this.params[this.params.length]=new O(ag,ar,aj,au)}else{console.log("WARNING: unrecognized tool parameter type:",ag,ap)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(aw){aw.stopPropagation()}).click(function(aw){aw.stopPropagation()}).bind("dblclick",function(aw){aw.stopPropagation()});var aq=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ao=this.params;var am=this;$.each(this.params,function(ax,aA){var az=$("<div>").addClass("param-row").appendTo(am.parent_div);var aw=$("<div>").addClass("param-label").text(aA.label).appendTo(az);var ay=$("<div/>").addClass("slider").html(aA.html).appendTo(az);ay.find(":input").val(aA.value);$("<div style='clear: both;'/>").appendTo(az)});this.parent_div.find("input").click(function(){$(this).select()});var av=$("<div>").addClass("param-row").appendTo(this.parent_div);var ak=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(av);var af=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(av);var am=this;af.click(function(){am.run_on_region()});ak.click(function(){am.run_on_dataset()})};p(r.prototype,{get_param_values_dict:function(){var af={};this.parent_div.find(":input").each(function(){var ag=$(this).attr("name"),ah=$(this).val();af[ag]=JSON.stringify(ah)});return af},get_param_values:function(){var ag=[];var af={};this.parent_div.find(":input").each(function(){var ah=$(this).attr("name"),ai=$(this).val();if(ah){ag[ag.length]=ai}});return ag},run_on_dataset:function(){var af=this;af.run({dataset_id:this.track.original_dataset_id,tool_id:af.name},null,function(ag){show_modal(af.name+" is Running",af.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ag={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name},aj=this.track,ah=ag.tool_id+aj.tool_region_and_parameters_str(ag.chrom,ag.low,ag.high),af;if(aj.container===view){var ai=new Q(this.name,this.track.view,this.track.container);aj.container.add_drawable(ai);aj.container.remove_drawable(aj);ai.add_drawable(aj);aj.container_div.appendTo(ai.content_div);af=ai}else{af=aj.container}var ak=new aj.constructor(ah,view,af,"hda");ak.init_for_tool_data();ak.change_mode(aj.mode);af.add_drawable(ak);ak.content_div.text("Starting job.");this.run(ag,ak,function(al){ak.dataset_id=al.dataset_id;ak.content_div.text("Running job.");ak.init()})},run:function(ag,ah,ai){$.extend(ag,this.get_param_values_dict());var af=function(){$.getJSON(rerun_tool_url,ag,function(aj){if(aj==="no converter"){ah.container_div.addClass("error");ah.content_div.text(K)}else{if(aj.error){ah.container_div.addClass("error");ah.content_div.text(x+aj.message)}else{if(aj==="pending"){ah.container_div.addClass("pending");ah.content_div.text("Converting input data so that it can be used quickly with tool.");setTimeout(af,2000)}else{ai(aj)}}}})};af()}});var O=function(ag,af,ah,ai){this.name=ag;this.label=af;this.html=ah;this.value=ai};var g=function(ah,ag,aj,ak,ai,af){O.call(this,ah,ag,aj,ak);this.min=ai;this.max=af};var h=function(ag,af,ah,ai){this.name=ag;this.index=af;this.tool_id=ah;this.tool_exp_name=ai};var V=function(ag,af,ah,ai){h.call(this,ag,af,ah,ai);this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.container=null;this.slider=null;this.slider_label=null};p(V.prototype,{applies_to:function(af){if(af.length>this.index){return true}return false},keep:function(af){if(!this.applies_to(af)){return true}var ag=af[this.index];return(isNaN(ag)||(ag>=this.low&&ag<=this.high))},update_attrs:function(ag){var af=false;if(!this.applies_to(ag)){return af}if(ag[this.index]<this.min){this.min=Math.floor(ag[this.index]);af=true}if(ag[this.index]>this.max){this.max=Math.ceil(ag[this.index]);af=true}return af},update_ui_elt:function(){if(this.min!=this.max){this.container.show()}else{this.container.hide()}var ah=function(ak,ai){var aj=ai-ak;return(aj<=2?0.01:1)};var ag=this.slider.slider("option","min"),af=this.slider.slider("option","max");if(this.min<ag||this.max>af){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",ah(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var aa=function(aq,ay){this.track=aq;this.filters=[];for(var at=0;at<ay.length;at++){var au=ay[at],az=au.name,af=au.type,ah=au.index,ax=au.tool_id,aw=au.tool_exp_name;if(af==="int"||af==="float"){this.filters[at]=new V(az,ah,ax,aw)}else{console.log("ERROR: unsupported filter: ",az,af)}}var ai=function(aA,aB,aC){aA.click(function(){var aD=aB.text();max=parseFloat(aC.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(aC.slider("option","values")){input_size=2*input_size+1;multi_value=true}aB.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",aD).appendTo(aB).focus().select().click(function(aE){aE.stopPropagation()}).blur(function(){$(this).remove();aB.text(aD)}).keyup(function(aI){if(aI.keyCode===27){$(this).trigger("blur")}else{if(aI.keyCode===13){var aG=aC.slider("option","min"),aE=aC.slider("option","max"),aH=function(aJ){return(isNaN(aJ)||aJ>aE||aJ<aG)},aF=$(this).val();if(!multi_value){aF=parseFloat(aF);if(aH(aF)){alert("Parameter value must be in the range ["+aG+"-"+aE+"]");return $(this)}}else{aF=aF.split("-");aF=[parseFloat(aF[0]),parseFloat(aF[1])];if(aH(aF[0])||aH(aF[1])){alert("Parameter value must be in the range ["+aG+"-"+aE+"]");return $(this)}}aC.slider((multi_value?"values":"value"),aF)}}})})};this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(aA){aA.stopPropagation()}).click(function(aA){aA.stopPropagation()}).bind("dblclick",function(aA){aA.stopPropagation()}).bind("keydown",function(aA){aA.stopPropagation()});var av=$("<div/>").addClass("sliders").appendTo(this.parent_div);var an=this;$.each(this.filters,function(aD,aF){aF.container=$("<div/>").addClass("filter-row slider-row").appendTo(av);var aE=$("<div/>").addClass("elt-label").appendTo(aF.container);var aC=$("<span/>").addClass("slider-name").text(aF.name+" ").appendTo(aE);var aB=$("<span/>");var aH=$("<span/>").addClass("slider-value").appendTo(aE).append("[").append(aB).append("]");var aA=$("<div/>").addClass("slider").appendTo(aF.container);aF.control_element=$("<div/>").attr("id",aF.name+"-filter-control").appendTo(aA);var aG=[0,0];aF.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(aJ,aK){var aI=aK.values;aB.text(aI[0]+"-"+aI[1]);aF.low=aI[0];aF.high=aI[1];an.track.request_draw(true,true)},change:function(aI,aJ){aF.control_element.slider("option","slide").call(aF.control_element,aI,aJ)}});aF.slider=aF.control_element;aF.slider_label=aB;ai(aH,aB,aF.control_element);$("<div style='clear: both;'/>").appendTo(aF.container)});if(this.filters.length!==0){var ak=$("<div/>").addClass("param-row").appendTo(av);var am=$("<input type='submit'/>").attr("value","Run on complete dataset").appendTo(ak);var ag=this;am.click(function(){ag.run_on_dataset()})}var ap=$("<div/>").addClass("display-controls").appendTo(this.parent_div),ar,al,ao,aj={Transparency:function(aA){an.alpha_filter=aA},Height:function(aA){an.height_filter=aA}};$.each(aj,function(aC,aB){ar=$("<div/>").addClass("filter-row").appendTo(ap),al=$("<span/>").addClass("elt-label").text(aC+":").appendTo(ar),ao=$("<select/>").attr("name",aC+"_dropdown").css("float","right").appendTo(ar);$("<option/>").attr("value",-1).text("== None ==").appendTo(ao);for(var aA=0;aA<an.filters.length;aA++){$("<option/>").attr("value",aA).text(an.filters[aA].name).appendTo(ao)}ao.change(function(){$(this).children("option:selected").each(function(){var aD=parseInt($(this).val());aj[aC]((aD>=0?an.filters[aD]:null));an.track.request_draw(true,true)})});$("<div style='clear: both;'/>").appendTo(ar)});$("<div style='clear: both;'/>").appendTo(this.parent_div)};p(aa.prototype,{reset_filters:function(){for(var af=0;af<this.filters.length;af++){filter=this.filters[af];filter.slider.slider("option","values",[filter.min,filter.max])}this.alpha_filter=null;this.height_filter=null},run_on_dataset:function(){var an=function(ar,ap,aq){if(!(ap in ar)){ar[ap]=aq}return ar[ap]};var ah={},af,ag,ai;for(var aj=0;aj<this.filters.length;aj++){af=this.filters[aj];if(af.tool_id){if(af.min!=af.low){ag=an(ah,af.tool_id,[]);ag[ag.length]=af.tool_exp_name+" >= "+af.low}if(af.max!=af.high){ag=an(ah,af.tool_id,[]);ag[ag.length]=af.tool_exp_name+" <= "+af.high}}}var al=[];for(var ao in ah){al[al.length]=[ao,ah[ao]]}var am=al.length;(function ak(aw,at){var aq=at[0],ar=aq[0],av=aq[1],au="("+av.join(") and (")+")",ap={cond:au,input:aw,target_dataset_id:aw,tool_id:ar},at=at.slice(1);$.getJSON(run_tool_url,ap,function(ax){if(ax.error){show_modal("Filter Dataset","Error running tool "+ar,{Close:hide_modal})}else{if(at.length===0){show_modal("Filtering Dataset","Filter(s) are running on the complete dataset. Outputs are in dataset's history.",{Close:hide_modal})}else{ak(ax.dataset_id,at)}}})})(this.track.dataset_id,al)}});var D=function(af,ag){M.Scaler.call(this,ag);this.filter=af};D.prototype.gen_val=function(af){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(af[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var G=function(af){this.track=af.track;this.params=af.params;this.values={};this.restore_values((af.saved_values?af.saved_values:{}));this.onchange=af.onchange};p(G.prototype,{restore_values:function(af){var ag=this;$.each(this.params,function(ah,ai){if(af[ai.key]!==undefined){ag.values[ai.key]=af[ai.key]}else{ag.values[ai.key]=ai.default_value}})},build_form:function(){var ag=this;var af=$("<div />");$.each(this.params,function(ak,ai){if(!ai.hidden){var ah="param_"+ak;var am=ag.values[ai.key];var ap=$("<div class='form-row' />").appendTo(af);ap.append($("<label />").attr("for",ah).text(ai.label+":"));if(ai.type==="bool"){ap.append($('<input type="checkbox" />').attr("id",ah).attr("name",ah).attr("checked",am))}else{if(ai.type==="text"){ap.append($('<input type="text"/>').attr("id",ah).val(am).click(function(){$(this).select()}))}else{if(ai.type==="color"){var al=$("<input />").attr("id",ah).attr("name",ah).val(am);var an=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var aj=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(an);var ao=$("<div/>").appendTo(aj).farbtastic({width:100,height:100,callback:al,color:am});$("<div />").append(al).append(an).appendTo(ap).bind("click",function(aq){an.css({left:$(this).position().left+($(al).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){an.hide();$(document).unbind("click.color-picker")});aq.stopPropagation()})}else{ap.append($("<input />").attr("id",ah).attr("name",ah).val(am))}}}}});return af},update_from_form:function(af){var ah=this;var ag=false;$.each(this.params,function(ai,ak){if(!ak.hidden){var al="param_"+ai;var aj=af.find("#"+al).val();if(ak.type==="float"){aj=parseFloat(aj)}else{if(ak.type==="int"){aj=parseInt(aj)}else{if(ak.type==="bool"){aj=af.find("#"+al).is(":checked")}}}if(aj!==ah.values[ak.key]){ah.values[ak.key]=aj;ag=true}}});if(ag){this.onchange()}}});var b=function(af,ai,ah,ag,aj){this.track=af;this.index=ai;this.low=ai*R*ah;this.high=(ai+1)*R*ah;this.resolution=ah;this.canvas=$("<div class='track-tile'/>").append(ag);this.data=aj;this.stale=false};b.prototype.predisplay_actions=function(){};var k=function(af,ai,ah,ag,aj,ak){b.call(this,af,ai,ah,ag,aj);this.max_val=ak};p(k.prototype,b.prototype);var P=function(af,aj,ai,ah,al,am,ak,ag){b.call(this,af,aj,ai,ah,al);this.mode=am;this.message=ak;this.feature_mapper=ag};p(P.prototype,b.prototype);P.prototype.predisplay_actions=function(){var ag=this,af={};if(ag.mode!=="Pack"){return}$(this.canvas).mousemove(function(ar){var am=$(this).offset(),aq=ar.pageX-am.left,ap=ar.pageY-am.top,aw=ag.feature_mapper.get_feature_data(aq,ap),an=(aw?aw[0]:null);$(this).siblings(".feature-popup").each(function(){if(!an||$(this).attr("id")!==an.toString()){$(this).remove()}});if(aw){var ai=af[an];if(!ai){var an=aw[0],at={name:aw[3],start:aw[1],end:aw[2],strand:aw[4]},al=ag.track.filters_manager.filters,ak;for(var ao=0;ao<al.length;ao++){ak=al[ao];at[ak.name]=aw[ak.index]}var ai=$("<div/>").attr("id",an).addClass("feature-popup"),av,au,ax=$("<table/>").appendTo(ai),ay;for(av in at){au=at[av];ay=$("<tr/>").appendTo(ax);$("<th/>").appendTo(ay).text(av);$("<td/>").attr("align","left").appendTo(ay).text(typeof(au)=="number"?Z(au,2):au)}af[an]=ai}ai.appendTo($(ag.canvas).parent());var aj=aq+parseInt(ag.canvas.css("left"))+7,ah=ap+parseInt(ag.canvas.css("top"))+7;ai.css("left",aj+"px").css("top",ah+"px")}else{if(!ar.isPropagationStopped()){ar.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ar)})}}}).mouseleave(function(){$(this).siblings(".feature-popup").remove()})};var i=function(ai,aq,aj,am,ar,ah,ag){q.call(this,ai,aq,aj,{},"draghandle");this.data_url=(ah?ah:default_data_url);this.data_url_extra_params={};this.data_query_wait=(ag?ag:L);this.dataset_check_url=converted_datasets_state_url;if(!i.id_counter){i.id_counter=0}this.id=i.id_counter++;this.container_div=$("<div />").addClass("track").attr("id","track_"+this.id).css("position","relative");if(am){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(this.header_div)}this.name_div=$("<div/>").addClass("track-name").appendTo(this.header_div).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());this.icons_div=$("<div/>").css("float","left").appendTo(this.header_div).hide();this.settings_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Edit settings").addClass("icon-button settings-icon").tipsy({gravity:"s"}).appendTo(this.icons_div);this.overview_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Set as overview").addClass("icon-button overview-icon").tipsy({gravity:"s"}).appendTo(this.icons_div);this.filters_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Filters").addClass("icon-button filters-icon").tipsy({gravity:"s"}).appendTo(this.icons_div).hide();this.tools_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Tools").addClass("icon-button tools-icon").tipsy({gravity:"s"}).appendTo(this.icons_div).hide();this.remove_icon=$("<a/>").attr("href","javascript:void(0);").attr("title","Remove").addClass("icon-button remove-icon").tipsy({gravity:"s"}).appendTo(this.icons_div);var ak=this;this.header_div.dblclick(function(at){at.stopPropagation()});this.settings_icon.click(function(){var av=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},at=function(){ak.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},au=function(aw){if((aw.keyCode||aw.which)===27){av()}else{if((aw.keyCode||aw.which)===13){at()}}};$(window).bind("keypress.check_enter_esc",au);show_modal("Configure Track",ak.config.build_form(),{Cancel:av,OK:at})});this.overview_icon.click(function(){ak.view.set_overview(ak)});this.filters_icon.click(function(){ak.filters_div.toggle();ak.filters_manager.reset_filters()});this.tools_icon.click(function(){ak.dynamic_tool_div.toggle();if(ak.dynamic_tool_div.is(":visible")){ak.set_name(ak.name+ak.tool_region_and_parameters_str())}else{ak.revert_name()}$(".tipsy").remove()});this.remove_icon.click(function(){$(".tipsy").remove();ak.remove()});if(ak.display_modes!==undefined){if(ak.mode_div===undefined){ak.mode_div=$("<div class='right-float menubutton popup' />").appendTo(ak.header_div);var al=(ak.config&&ak.config.values.mode?ak.config.values.mode:ak.display_modes[0]);ak.mode=al;ak.mode_div.text(al);var af={};for(var an=0,ap=ak.display_modes.length;an<ap;an++){var ao=ak.display_modes[an];af[ao]=function(at){return function(){ak.change_mode(at)}}(ao)}make_popupmenu(ak.mode_div,af)}else{ak.mode_div.hide()}this.header_div.append($("<div/>").css("clear","both"));this.container_div.hover(function(){ak.icons_div.show()},function(){ak.icons_div.hide()})}}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.container.content_div.append(this.container_div)};p(i.prototype,q.prototype,{get_type:function(){if(this instanceof ab){return"LabelTrack"}else{if(this instanceof A){return"ReferenceTrack"}else{if(this instanceof j){return"LineTrack"}else{if(this instanceof W){return"ReadTrack"}else{if(this instanceof U){return"VcfTrack"}else{if(this instanceof e){return"FeatureTrack"}}}}}}return""},init:function(){var af=this;af.enabled=false;af.tile_cache.clear();af.data_manager.clear();af.initial_canvas=undefined;af.content_div.css("height","auto");af.container_div.removeClass("nodata error pending");if(!af.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:af.hda_ldda,dataset_id:af.dataset_id,chrom:af.view.chrom},function(ag){if(!ag||ag==="error"||ag.kind==="error"){af.container_div.addClass("error");af.content_div.text(o);if(ag.message){var ah=$(" <a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ag.message+"</pre>",{Close:hide_modal})});af.content_div.append(ah)}}else{if(ag==="no converter"){af.container_div.addClass("error");af.content_div.text(K)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){af.container_div.addClass("nodata");af.content_div.text(F)}else{if(ag==="pending"){af.container_div.addClass("pending");af.content_div.text(t);setTimeout(function(){af.init()},af.data_query_wait)}else{if(ag.status==="data"){if(ag.valid_chroms){af.valid_chroms=ag.valid_chroms;af.update_track_icons()}af.content_div.text(Y);if(af.view.chrom){af.content_div.text("");af.content_div.css("height",af.height_px+"px");af.enabled=true;$.when(af.predraw_init()).done(function(){af.container_div.removeClass("nodata error pending");af.request_draw()})}}}}}}});this.update_track_icons()},predraw_init:function(){}});var N=function(aj,ah,ag,am,ai,al,ak){i.call(this,aj,ah,ag,am,ai);var af=this,ah=af.view;m(af.container_div,af.drag_handle_class,".group",af);this.filters_manager=new aa(this,(al!==undefined?al:{}));this.filters_available=false;this.filters_visible=false;this.tool=(ak!==undefined&&obj_length(ak)>0?new r(this,ak):undefined);if(this.header_div){if(this.filters_manager){this.filters_div=this.filters_manager.parent_div;this.header_div.after(this.filters_div)}if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}};p(N.prototype,q.prototype,i.prototype,{copy:function(af){return new this.constructor(this.name,this.view,af,this.hda_ldda,this.dataset_id,this.prefs,this.filters,this.tool)},to_json: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,}},change_mode:function(ag){var af=this;af.mode_div.text(ag);af.mode=ag;af.config.values.mode=ag;af.tile_cache.clear();af.request_draw();return af},update_track_icons:function(){var af=this;if(af.filters_available>0){af.filters_icon.show()}else{af.filters_icon.hide()}if(af.tool){af.tools_icon.show()}else{af.tools_icon.hide()}},_gen_tile_cache_key:function(ag,ah,af){return ag+"_"+ah+"_"+af},request_draw:function(ag,af){this.view.request_redraw(false,ag,af,this)},_draw:function(ah,ap){if(!this.enabled){return}if(!(this instanceof A)&&(!this.dataset_id)){return}var ao=this.view.low,al=this.view.high,am=al-ao,ai=this.view.container.width(),at=ai/am,ak=this.view.resolution,ar=$("<div style='position: relative;'></div>");if(this.is_overview){ao=this.view.max_low;al=this.view.max_high;ak=Math.pow(C,Math.ceil(Math.log((view.max_high-view.max_low)/R)/Math.log(C)));at=ai/(view.max_high-view.max_low)}if(!ap){this.content_div.children().remove()}this.content_div.append(ar);this.max_height=0;var ag=Math.floor(ao/ak/R);var an=true;var aq=[];var af=0;while((ag*R*ak)<al){tile=this.draw_helper(ah,ai,ag,ak,ar,at);if(tile){aq.push(tile)}else{an=false}ag+=1;af++}var aj=this;if(an){aj.postdraw_actions(aq,ai,at,ap)}},postdraw_actions:function(aj,ak,al,af){var ah=this;var ai=false;for(var ag=0;ag<aj.length;ag++){if(aj[ag].message){ai=true;break}}if(ai){for(var ag=0;ag<aj.length;ag++){tile=aj[ag];if(!tile.message){tile.canvas.css("padding-top",E)}}}},draw_helper:function(ag,ah,ai,al,ar,aw,at,am){var aj=this,aq=this._gen_tile_cache_key(ah,aw,ai),an=ai*R*al,av=an+R*al;var ao=(ag?undefined:aj.tile_cache.get(aq));if(ao){aj.show_tile(ao,ar,aw);return ao}var ap=function(ax){return("isResolved" in ax)};var ak=true;var af=aj.data_manager.get_data(an,av,aj.mode,al,aj.data_url_extra_params);if(ap(af)){ak=false}var au;if(view.reference_track&&aw>view.canvas_manager.char_width_px){au=view.reference_track.data_manager.get_data(an,av,aj.mode,al,view.reference_track.data_url_extra_params);if(ap(au)){ak=false}}if(ak){p(af,am);var ao=aj.draw_tile(af,aj.mode,al,ai,aw,au);if(ao!==undefined){aj.tile_cache.set(aq,ao);aj.show_tile(ao,ar,aw)}return ao}$.when(af,au).then(function(){view.request_redraw(false,false,false,aj)});return null},show_tile:function(al,an,ao){var ah=this,ag=al.canvas,ak=ag;if(al.message){var ap=$("<div/>"),am=$("<div/>").addClass("tile-message").text(al.message).css({height:E-1,width:al.canvas.width}).appendTo(ap),aj=$("<a href='javascript:void(0);'/>").addClass("icon more-down").appendTo(am),af=$("<a href='javascript:void(0);'/>").addClass("icon more-across").appendTo(am);ap.append(ag);ak=ap;aj.click(function(){al.stale=true;ah.data_manager.get_more_data(al.low,al.high,ah.mode,al.resolution,{},ah.data_manager.DEEP_DATA_REQ);ah.request_draw()}).dblclick(function(aq){aq.stopPropagation()});af.click(function(){al.stale=true;ah.data_manager.get_more_data(al.low,al.high,ah.mode,al.resolution,{},ah.data_manager.BROAD_DATA_REQ);ah.request_draw()}).dblclick(function(aq){aq.stopPropagation()})}al.predisplay_actions();var ai=(al.low-(this.is_overview?this.view.max_low:this.view.low))*ao;if(this.left_offset){ai-=this.left_offset}ak.css({position:"absolute",top:0,left:ai,height:""});an.append(ak);ah.max_height=Math.max(ah.max_height,ak.height());ah.content_div.css("height",ah.max_height+"px");an.children().css("height",ah.max_height+"px")},_get_tile_bounds:function(af,ag){var ai=af*R*ag,aj=R*ag,ah=(ai+aj<=this.view.max_high?ai+aj:this.view.max_high);return[ai,ah]},tool_region_and_parameters_str:function(ah,af,ai){var ag=this,aj=(ah!==undefined&&af!==undefined&&ai!==undefined?ah+":"+af+"-"+ai:"all");return" - region=["+aj+"], parameters=["+ag.tool.get_param_values().join(", ")+"]"},init_for_tool_data:function(){this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url;this.predraw_init=function(){var ag=this;var af=function(){if(ag.data_manager.size()===0){setTimeout(af,300)}else{ag.data_url=default_data_url;ag.data_query_wait=L;ag.dataset_state_url=converted_datasets_state_url;$.getJSON(ag.dataset_state_url,{dataset_id:ag.dataset_id,hda_ldda:ag.hda_ldda},function(ah){})}};af()}}});var ab=function(ag,af){i.call(this,"label",ag,af,false,{});this.container_div.addClass("label-track")};p(ab.prototype,i.prototype,{init:function(){this.enabled=true},_draw:function(){var ah=this.view,ai=ah.high-ah.low,al=Math.floor(Math.pow(10,Math.floor(Math.log(ai)/Math.log(10)))),af=Math.floor(ah.low/al)*al,aj=this.view.container.width(),ag=$("<div style='position: relative; height: 1.3em;'></div>");while(af<ah.high){var ak=(af-ah.low)/ai*aj;ag.append($("<div class='label'>"+commatize(af)+"</div>").css({position:"absolute",left:ak-1}));af+=al}this.content_div.children(":first").remove();this.content_div.append(ag)}});var A=function(af){N.call(this,"reference",af,{content_div:af.top_labeltrack},false,{});af.reference_track=this;this.left_offset=200;this.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.data_url_extra_params={dbkey:af.dbkey};this.data_manager=new I(B,this,false);this.tile_cache=new c(u)};p(A.prototype,q.prototype,N.prototype,{init:function(){this.enabled=true},draw_tile:function(ap,al,ak,ag,aq){var aj=this,ah=R*ak;if(aq>this.view.canvas_manager.char_width_px){if(ap.data===null){aj.content_div.css("height","0px");return}var ai=this.view.canvas_manager.new_canvas();var ao=ai.getContext("2d");ai.width=Math.ceil(ah*aq+aj.left_offset);ai.height=aj.height_px;ao.font=ao.canvas.manager.default_font;ao.textAlign="center";ap=ap.data;for(var am=0,an=ap.length;am<an;am++){var af=Math.round(am*aq);ao.fillText(ap[am],af+aj.left_offset,10)}return new b(aj,ag,ak,ai,ap)}this.content_div.css("height","0px")}});var j=function(ak,ai,ah,al,af,aj){var ag=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";N.call(this,ak,ai,ah,true,aj);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=al;this.dataset_id=af;this.original_dataset_id=af;this.data_manager=new S(B,this);this.tile_cache=new c(u);this.left_offset=0;this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:ak},{key:"color",label:"Color",type:"color",default_value: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:this.height_px,hidden:true}],saved_values:aj,onchange:function(){ag.set_name(ag.prefs.name);ag.vertical_range=ag.prefs.max_value-ag.prefs.min_value;$("#linetrack_"+ag.dataset_id+"_minval").text(ag.prefs.min_value);$("#linetrack_"+ag.dataset_id+"_maxval").text(ag.prefs.max_value);ag.tile_cache.clear();ag.request_draw()}});this.prefs=this.config.values;this.height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value;this.add_resize_handle()};p(j.prototype,q.prototype,N.prototype,{add_resize_handle:function(){var af=this;var ai=false;var ah=false;var ag=$("<div class='track-resize'>");$(af.container_div).hover(function(){ai=true;ag.show()},function(){ai=false;if(!ah){ag.hide()}});ag.hide().bind("dragstart",function(aj,ak){ah=true;ak.original_height=$(af.content_div).height()}).bind("drag",function(ak,al){var aj=Math.min(Math.max(al.original_height+al.deltaY,af.min_height_px),af.max_height_px);$(af.content_div).css("height",aj);af.height_px=aj;af.request_draw(true)}).bind("dragend",function(aj,ak){af.tile_cache.clear();ah=false;if(!ai){ag.hide()}af.config.values.height=af.height_px}).appendTo(af.container_div)},predraw_init:function(){var af=this;af.vertical_range=undefined;return $.getJSON(af.data_url,{stats:true,chrom:af.view.chrom,low:null,high:null,hda_ldda:af.hda_ldda,dataset_id:af.dataset_id},function(ag){af.container_div.addClass("line-track");var ai=ag.data;if(isNaN(parseFloat(af.prefs.min_value))||isNaN(parseFloat(af.prefs.max_value))){af.prefs.min_value=ai.min;af.prefs.max_value=ai.max;$("#track_"+af.dataset_id+"_minval").val(af.prefs.min_value);$("#track_"+af.dataset_id+"_maxval").val(af.prefs.max_value)}af.vertical_range=af.prefs.max_value-af.prefs.min_value;af.total_frequency=ai.total_frequency;af.container_div.find(".yaxislabel").remove();var aj=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+af.dataset_id+"_minval").text(Z(af.prefs.min_value,3));var ah=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+af.dataset_id+"_maxval").text(Z(af.prefs.max_value,3));ah.css({position:"absolute",top:"24px",left:"10px"});ah.prependTo(af.container_div);aj.css({position:"absolute",bottom:"2px",left:"10px"});aj.prependTo(af.container_div)})},draw_tile:function(ar,ak,aj,ah,aq){if(this.vertical_range===undefined){return}var af=this._get_tile_bounds(ah,aj),al=af[0],ap=af[1],ag=Math.ceil((ap-al)*aq),an=this.height_px;var ai=this.view.canvas_manager.new_canvas();ai.width=ag,ai.height=an;var ao=ai.getContext("2d");var am=new M.LinePainter(ar.data,al,ap,this.prefs,ak);am.draw(ao,ag,an);return new b(this.track,ah,aj,ai,ar.data)}});var e=function(af,al,ag,ak,an,am,ai,aj){var ah=this;this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];N.call(this,af,al,ag,true,am,ai,aj);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:af},{key:"block_color",label:"Block color",type:"color",default_value:get_random_color()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:am,onchange:function(){ah.set_name(ah.prefs.name);ah.tile_cache.clear();ah.request_draw()}});this.prefs=this.config.values;this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=ak;this.dataset_id=an;this.original_dataset_id=an;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_manager=new S(20,this);this.left_offset=200;this.painter=M.LinkedFeaturePainter};p(e.prototype,q.prototype,N.prototype,{postdraw_actions:function(av,af,aw,au){N.prototype.postdraw_actions.call(this,av,au);var ai=this;if(au){var ak=ai.content_div.children();var al=false;for(var aj=ak.length-1,ap=0;aj>=ap;aj--){var ah=$(ak[aj]);if(al){ah.remove()}else{if(ah.children().length!==0){al=true}}}}if(ai.mode=="Histogram"){var ao=-1;for(var aj=0;aj<av.length;aj++){var at=av[aj].max_val;if(at>ao){ao=at}}for(var aj=0;aj<av.length;aj++){var ar=av[aj];if(ar.max_val!==ao){ar.canvas.remove();ai.draw_helper(true,af,ar.index,ar.resolution,ar.canvas.parent(),aw,[],{max:ao})}}}if(ai.filters_manager){var ag=ai.filters_manager.filters;for(var an=0;an<ag.length;an++){ag[an].update_ui_elt()}var am=false,aq;for(var aj=0;aj<av.length;aj++){if(av[aj].data.length){aq=av[aj].data[0];for(var an=0;an<ag.length;an++){if(ag[an].applies_to(aq)){am=true;break}}}}if(ai.filters_available!==am){ai.filters_available=am;if(!ai.filters_available){ai.filters_div.hide()}ai.update_track_icons()}}},update_auto_mode:function(af){if(this.mode=="Auto"){if(af=="no_detail"){af="feature spans"}else{if(af=="summary_tree"){af="coverage histogram"}}this.mode_div.text("Auto ("+af+")")}},incremental_slots:function(aj,ag,ai){var ah=this.view.canvas_manager.dummy_context,af=this.inc_slots[aj];if(!af||(af.mode!==ai)){af=new (s.FeatureSlotter)(aj,ai==="Pack",z,function(ak){return ah.measureText(ak)});af.mode=ai;this.inc_slots[aj]=af}return af.slot_features(ag)},get_summary_tree_data:function(aj,am,ah,av){if(av>ah-am){av=ah-am}var aq=Math.floor((ah-am)/av),au=[],ai=0;var ak=0,al=0,ap,at=0,an=[],ar,ao;var ag=function(ay,ax,az,aw){ay[0]=ax+az*aw;ay[1]=ax+(az+1)*aw};while(at<av&&ak!==aj.length){var af=false;for(;at<av&&!af;at++){ag(an,am,at,aq);for(al=ak;al<aj.length;al++){ap=aj[al].slice(1,3);if(is_overlap(ap,an)){af=true;break}}if(af){break}}data_start_index=al;au[au.length]=ar=[an[0],0];for(;al<aj.length;al++){ap=aj[al].slice(1,3);if(is_overlap(ap,an)){ar[1]++}else{break}}if(ar[1]>ai){ai=ar[1]}at++}return{max:ai,delta:aq,data:au}},draw_tile:function(au,ax,aB,aF,ap,ai){var ay=this,ak=ay._get_tile_bounds(aF,aB),aI=ak[0],ag=ak[1],aw=ag-aI,az=Math.ceil(aw*ap),aO=25,aj=this.left_offset,av,al;if(ax==="Auto"){if(au.dataset_type==="summary_tree"){ax=au.dataset_type}else{if(au.extra_info==="no_detail"||ay.is_overview){ax="no_detail"}else{var aN=au.data;if(this.view.high-this.view.low>J){ax="Squish"}else{ax="Pack"}}}this.update_auto_mode(ax)}if(ax==="summary_tree"||ax==="Histogram"){al=this.summary_draw_height;this.container_div.find(".yaxislabel").remove();var af=$("<div />").addClass("yaxislabel");af.text(au.max);af.css({position:"absolute",top:"24px",left:"10px",color:this.prefs.label_color});af.prependTo(this.container_div);var ah=this.view.canvas_manager.new_canvas();ah.width=az+aj;ah.height=al+T;if(au.dataset_type!="summary_tree"){var aq=this.get_summary_tree_data(au.data,aI,ag,200);if(au.max){aq.max=au.max}au=aq}var aK=new M.SummaryTreePainter(au,aI,ag,this.prefs);var aA=ah.getContext("2d");aA.translate(aj,T);aK.draw(aA,az,al);return new k(ay,aF,aB,ah,au.data,au.max)}var av,an=1;if(ax==="no_detail"||ax==="Squish"||ax==="Pack"){an=this.incremental_slots(ap,au.data,ax);av=this.inc_slots[ap].slots}var ao=[];if(au.data){var ar=this.filters_manager.filters;for(var aC=0,aE=au.data.length;aC<aE;aC++){var am=au.data[aC];var aD=false;var at;for(var aH=0,aM=ar.length;aH<aM;aH++){at=ar[aH];at.update_attrs(am);if(!at.keep(am)){aD=true;break}}if(!aD){ao.push(am)}}}var aL=(this.filters_manager.alpha_filter?new D(this.filters_manager.alpha_filter):null);var aJ=(this.filters_manager.height_filter?new D(this.filters_manager.height_filter):null);var aK=new (this.painter)(ao,aI,ag,this.prefs,ax,aL,aJ,ai);var al=Math.max(ad,aK.get_required_height(an));var ah=this.view.canvas_manager.new_canvas();var aG=null;ah.width=az+aj;ah.height=al;var aA=ah.getContext("2d");aA.fillStyle=this.prefs.block_color;aA.font=aA.canvas.manager.default_font;aA.textAlign="right";this.container_div.find(".yaxislabel").remove();if(au.data){aA.translate(aj,0);aG=aK.draw(aA,az,al,av);aG.translation=-aj}return new P(ay,aF,aB,ah,au.data,ax,au.message,aG)}});var U=function(ak,ah,ag,am,af,aj,al,ai){e.call(this,ak,ah,ag,am,af,aj,al,ai);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:ak},{key:"block_color",label:"Block color",type:"color",default_value: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:aj,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=M.ReadPainter};p(U.prototype,q.prototype,N.prototype,e.prototype);var W=function(aj,ah,ag,al,af,ai,ak){e.call(this,aj,ah,ag,al,af,ai,ak);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:aj},{key:"block_color",label:"Block color",type:"color",default_value: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_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ai,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=M.ReadPainter;this.update_track_icons()};p(W.prototype,q.prototype,N.prototype,e.prototype);X.View=ac;X.DrawableGroup=Q;X.LineTrack=j;X.FeatureTrack=e;X.ReadTrack=W;X.VcfTrack=U};var slotting_module=function(c,b){var e=c("class").extend;var d=2,a=5;b.FeatureSlotter=function(i,h,f,g){this.slots={};this.start_end_dct={};this.w_scale=i;this.include_label=h;this.max_rows=f;this.measureText=g};e(b.FeatureSlotter.prototype,{slot_features:function(m){var p=this.w_scale,s=this.slots,h=this.start_end_dct,y=[],A=[],n=0,z=this.max_rows;for(var w=0,x=m.length;w<x;w++){var l=m[w],o=l[0];if(s[o]!==undefined){n=Math.max(n,s[o]);A.push(s[o])}else{y.push(w)}}var q=function(F,G){for(var E=0;E<=z;E++){var C=false,H=h[E];if(H!==undefined){for(var B=0,D=H.length;B<D;B++){var i=H[B];if(G>i[0]&&F<i[1]){C=true;break}}}if(!C){return E}}return -1};for(var w=0,x=y.length;w<x;w++){var l=m[y[w]],o=l[0],u=l[1],f=l[2],r=l[3],g=Math.floor(u*p),k=Math.ceil(f*p),v=this.measureText(r).width,j;if(r!==undefined&&this.include_label){v+=(d+a);if(g-v>=0){g-=v;j="left"}else{k+=v;j="right"}}var t=q(g,k);if(t>=0){if(h[t]===undefined){h[t]=[]}h[t].push([g,k]);s[o]=t;n=Math.max(n,t)}else{}}return n+1}})};var painters_module=function(i,w){var t=i("class").extend;var o=function(H,z,F,y,E,C){if(C===undefined){C=4}var B=y-z;var A=E-F;var D=Math.floor(Math.sqrt(B*B+A*A)/C);var I=B/D;var G=A/D;var x;for(x=0;x<D;x++,z+=I,F+=G){if(x%2!==0){continue}H.fillRect(z,F,C,1)}};var p=function(A,z,x,D){var C=z-D/2,B=z+D/2,E=x-Math.sqrt(D*3/2);A.beginPath();A.moveTo(C,E);A.lineTo(B,E);A.lineTo(z,x);A.lineTo(C,E);A.strokeStyle=this.fillStyle;A.fill();A.stroke();A.closePath()};var d=function(x){this.default_val=(x?x:1)};d.prototype.gen_val=function(x){return this.default_val};var l=function(z,B,x,y,A){this.data=z;this.view_start=B;this.view_end=x;this.prefs=t({},this.default_prefs,y);this.mode=A};l.prototype.default_prefs={};var u=function(z,B,x,y,A){l.call(this,z,B,x,y,A)};u.prototype.default_prefs={show_counts:false};u.prototype.draw=function(M,z,L){var E=this.view_start,O=this.view_end-this.view_start,N=z/O;var J=this.data.data,I=this.data.delta,G=this.data.max,B=L;delta_x_px=Math.ceil(I*N);M.save();for(var C=0,D=J.length;C<D;C++){var H=Math.floor((J[C][0]-E)*N);var F=J[C][1];if(!F){continue}var K=F/G*L;if(F!==0&&K<1){K=1}M.fillStyle=this.prefs.block_color;M.fillRect(H,B-K,delta_x_px,K);var A=4;if(this.prefs.show_counts&&(M.measureText(F).width+A)<delta_x_px){M.fillStyle=this.prefs.label_color;M.textAlign="center";M.fillText(F,H+(delta_x_px/2),10)}}M.restore()};var b=function(x,B,D,E,z){l.call(this,x,B,D,E,z);if(this.prefs.min_value===undefined){var F=Infinity;for(var y=0,A=this.data.length;y<A;y++){F=Math.min(F,this.data[y][1])}this.prefs.min_value=F}if(this.prefs.max_value===undefined){var C=-Infinity;for(var y=0,A=this.data.length;y<A;y++){C=Math.max(C,this.data[y][1])}this.prefs.max_value=C}};b.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};b.prototype.draw=function(M,L,J){var E=false,G=this.prefs.min_value,C=this.prefs.max_value,I=C-G,x=J,z=this.view_start,K=this.view_end-this.view_start,A=L/K,H=this.mode,S=this.data;M.save();var T=Math.round(J+G/I*J);if(H!=="Intensity"){M.fillStyle="#aaa";M.fillRect(0,T,L,1)}M.beginPath();var Q,D,B;if(S.length>1){B=Math.ceil((S[1][0]-S[0][0])*A)}else{B=10}for(var N=0,O=S.length;N<O;N++){M.fillStyle=this.prefs.color;Q=Math.round((S[N][0]-z)*A);D=S[N][1];var P=false,F=false;if(D===null){if(E&&H==="Filled"){M.lineTo(Q,x)}E=false;continue}if(D<G){F=true;D=G}else{if(D>C){P=true;D=C}}if(H==="Histogram"){D=Math.round(D/I*x);M.fillRect(Q,T,B,-D)}else{if(H==="Intensity"){D=255-Math.floor((D-G)/I*255);M.fillStyle="rgb("+D+","+D+","+D+")";M.fillRect(Q,0,B,x)}else{D=Math.round(x-(D-G)/I*x);if(E){M.lineTo(Q,D)}else{E=true;if(H==="Filled"){M.moveTo(Q,x);M.lineTo(Q,D)}else{M.moveTo(Q,D)}}}}M.fillStyle=this.prefs.overflow_color;if(P||F){var R;if(H==="Histogram"||H==="Intensity"){R=B}else{Q-=2;R=4}if(P){M.fillRect(Q,0,R,3)}if(F){M.fillRect(Q,x-3,R,3)}}M.fillStyle=this.prefs.color}if(H==="Filled"){if(E){M.lineTo(Q,T);M.lineTo(0,T)}M.fill()}else{M.stroke()}M.restore()};var m=function(x){this.feature_positions={};this.slot_height=x;this.translation=0};m.prototype.map_feature_data=function(y,A,x,z){if(!this.feature_positions[A]){this.feature_positions[A]=[]}this.feature_positions[A].push({data:y,x_start:x,x_end:z})};m.prototype.get_feature_data=function(z,D){var C=Math.floor(D/this.slot_height),B;if(!this.feature_positions[C]){return null}z+=this.translation;for(var A=0;A<this.feature_positions[C].length;A++){B=this.feature_positions[C][A];if(z>=B.x_start&&z<=B.x_end){return B.data}}};var n=function(z,C,x,y,B,D,A){l.call(this,z,C,x,y,B);this.alpha_scaler=(D?D:new d());this.height_scaler=(A?A:new d())};n.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};t(n.prototype,{get_required_height:function(y){var x=y_scale=this.get_row_height(),z=this.mode;if(z==="no_detail"||z==="Squish"||z==="Pack"){x=y*y_scale}return x+Math.max(Math.round(y_scale/2),5)},draw:function(J,H,F,E){var P=this.data,C=this.view_start,L=this.view_end;J.save();J.fillStyle=this.prefs.block_color;J.textAlign="right";var G=this.view_end-this.view_start,D=H/G,K=this.get_row_height(),O=new m(K),A;for(var M=0,N=P.length;M<N;M++){var z=P[M],B=z[0],I=z[1],x=z[2],y=(E&&E[B]!==undefined?E[B]:null);if((I<L&&x>C)&&(this.mode=="Dense"||y!==null)){A=this.draw_element(J,this.mode,z,y,C,L,D,K,H);O.map_feature_data(z,y,A[0],A[1])}}J.restore();return O},draw_element:function(D,z,F,B,A,C,E,y,x){console.log("WARNING: Unimplemented function.");return[0,0]}});var c=10,h=3,k=5,v=10,f=1,r=3,e=3,a=9,j=2,g="#ccc";var q=function(z,C,x,y,B,D,A){n.call(this,z,C,x,y,B,D,A)};t(q.prototype,n.prototype,{get_row_height:function(){var y=this.mode,x;if(y==="Dense"){x=c}else{if(y==="no_detail"){x=h}else{if(y==="Squish"){x=k}else{x=v}}}return x},draw_element:function(L,C,U,G,N,af,aj,al,x){var R=U[0],ah=U[1],Z=U[2],P=U[3],aa=Math.floor(Math.max(0,(ah-N)*aj)),M=Math.ceil(Math.min(x,Math.max(0,(Z-N)*aj))),Y=aa,ak=M,X=(C==="Dense"?0:(0+G))*al,K,ad,Q=null,an=null,A=this.prefs.block_color,ac=this.prefs.label_color;L.globalAlpha=this.alpha_scaler.gen_val(U);if(C==="Dense"){G=1}if(C==="no_detail"){L.fillStyle=A;L.fillRect(aa,X+5,M-aa,f)}else{var J=U[4],W=U[5],ab=U[6],B=U[7];if(W&&ab){Q=Math.floor(Math.max(0,(W-N)*aj));an=Math.ceil(Math.min(x,Math.max(0,(ab-N)*aj)))}var ai,S;if(C==="Squish"||C==="Dense"){ai=1;S=e}else{ai=5;S=a}if(!B){if(U.strand){if(U.strand==="+"){L.fillStyle=L.canvas.manager.get_pattern("right_strand_inv")}else{if(U.strand==="-"){L.fillStyle=L.canvas.manager.get_pattern("left_strand_inv")}}}else{L.fillStyle=A}L.fillRect(aa,X,M-aa,S)}else{var I,T;if(C==="Squish"||C==="Dense"){L.fillStyle=g;I=X+Math.floor(e/2)+1;T=1}else{if(J){var I=X;var T=S;if(J==="+"){L.fillStyle=L.canvas.manager.get_pattern("right_strand")}else{if(J==="-"){L.fillStyle=L.canvas.manager.get_pattern("left_strand")}}}else{L.fillStyle=g;I+=(e/2)+1;T=1}}L.fillRect(aa,I,M-aa,T);var D;for(var ag=0,z=B.length;ag<z;ag++){var E=B[ag],y=Math.floor(Math.max(0,(E[0]-N)*aj)),V=Math.ceil(Math.min(x,Math.max((E[1]-N)*aj)));if(y>V){continue}L.fillStyle=A;L.fillRect(y,X+(S-ai)/2+1,V-y,ai);if(Q!==undefined&&ab>W&&!(y>an||V<Q)){var ae=Math.max(y,Q),H=Math.min(V,an);L.fillRect(ae,X+1,H-ae,S);if(B.length==1&&C=="Pack"){if(J==="+"){L.fillStyle=L.canvas.manager.get_pattern("right_strand_inv")}else{if(J==="-"){L.fillStyle=L.canvas.manager.get_pattern("left_strand_inv")}}if(ae+14<H){ae+=2;H-=2}L.fillRect(ae,X+1,H-ae,S)}}}if(C==="Pack"){L.globalAlpha=1;L.fillStyle="white";var F=this.height_scaler.gen_val(U),O=Math.ceil(S*F),am=Math.round((S-O)/2);if(F!==1){L.fillRect(aa,I+1,M-aa,am);L.fillRect(aa,I+S-am+1,M-aa,am)}}}L.globalAlpha=1;if(C==="Pack"&&ah>N){L.fillStyle=ac;if(N===0&&aa-L.measureText(P).width<0){L.textAlign="left";L.fillText(P,M+j,X+8);ak+=L.measureText(P).width+j}else{L.textAlign="right";L.fillText(P,aa-j,X+8);Y-=L.measureText(P).width+j}}}L.globalAlpha=1;return[Y,ak]}});var s=function(A,D,x,z,C,E,B,y){n.call(this,A,D,x,z,C,E,B);this.ref_seq=(y?y.data:null)};s.prototype.default_prefs=t({},n.prototype.default_prefs,{show_insertions:false});t(s.prototype,n.prototype,{get_row_height:function(){var x,y=this.mode;if(y==="Dense"){x=c}else{if(y==="Squish"){x=k}else{x=v;if(this.prefs.show_insertions){x*=2}}}return x},draw_read:function(U,P,L,Z,A,T,I,F,E){U.textAlign="center";var S=this,z=[Z,A],O=0,V=0,R=0,x=U.canvas.manager.char_width_px;var ae=[];if((P==="Pack"||this.mode==="Auto")&&F!==undefined&&L>x){R=Math.round(L/2)}if(!I){I=[[0,F.length]]}for(var M=0,X=I.length;M<X;M++){var J=I[M],B="MIDNSHP=X"[J[0]],N=J[1];if(B==="H"||B==="S"){O-=N}var G=T+O,ad=Math.floor(Math.max(0,(G-Z)*L)),H=Math.floor(Math.max(0,(G+N-Z)*L));if(ad===H){H+=1}switch(B){case"H":break;case"S":case"M":case"=":if(is_overlap([G,G+N],z)){var Q=F.slice(V,V+N);if(R>0){U.fillStyle=this.prefs.block_color;U.fillRect(ad-R,E+1,H-ad,9);U.fillStyle=g;for(var ab=0,y=Q.length;ab<y;ab++){if(this.prefs.show_differences&&this.ref_seq){var K=this.ref_seq[G-Z+ab];if(!K||K.toLowerCase()===Q[ab].toLowerCase()){continue}}if(G+ab>=Z&&G+ab<=A){var ac=Math.floor(Math.max(0,(G+ab-Z)*L));U.fillText(Q[ab],ac,E+9)}}}else{U.fillStyle=this.prefs.block_color;U.fillRect(ad,E+4,H-ad,e)}}V+=N;O+=N;break;case"N":U.fillStyle=g;U.fillRect(ad-R,E+5,H-ad,1);O+=N;break;case"D":U.fillStyle="red";U.fillRect(ad-R,E+4,H-ad,3);O+=N;break;case"P":break;case"I":var Y=ad-R;if(is_overlap([G,G+N],z)){var Q=F.slice(V,V+N);if(this.prefs.show_insertions){var D=ad-(H-ad)/2;if((P==="Pack"||this.mode==="Auto")&&F!==undefined&&L>x){U.fillStyle="yellow";U.fillRect(D-R,E-9,H-ad,9);ae[ae.length]={type:"triangle",data:[Y,E+4,5]};U.fillStyle=g;switch(compute_overlap([G,G+N],z)){case (OVERLAP_START):Q=Q.slice(Z-G);break;case (OVERLAP_END):Q=Q.slice(0,G-A);break;case (CONTAINED_BY):break;case (CONTAINS):Q=Q.slice(Z-G,G-A);break}for(var ab=0,y=Q.length;ab<y;ab++){var ac=Math.floor(Math.max(0,(G+ab-Z)*L));U.fillText(Q[ab],ac-(H-ad)/2,E)}}else{U.fillStyle="yellow";U.fillRect(D,E+(this.mode!=="Dense"?2:5),H-ad,(P!=="Dense"?e:r))}}else{if((P==="Pack"||this.mode==="Auto")&&F!==undefined&&L>x){ae.push({type:"text",data:[Q.length,Y,E+9]})}else{}}}V+=N;break;case"X":V+=N;break}}U.fillStyle="yellow";var aa,C,af;for(var W=0;W<ae.length;W++){aa=ae[W];C=aa.type;af=aa.data;if(C==="text"){U.save();U.font="bold "+U.font;U.fillText(af[0],af[1],af[2]);U.restore()}else{if(C=="triangle"){p(U,af[0],af[1],af[2])}}}},draw_element:function(Q,L,D,A,T,y,H,R,O){var G=D[0],P=D[1],z=D[2],I=D[3],C=Math.floor(Math.max(0,(P-T)*H)),E=Math.ceil(Math.min(O,Math.max(0,(z-T)*H))),B=(L==="Dense"?0:(0+A))*R,U=this.prefs.block_color,F=this.prefs.label_color,N=0;if((L==="Pack"||this.mode==="Auto")&&H>Q.canvas.manager.char_width_px){var N=Math.round(H/2)}Q.fillStyle=U;if(D[5] instanceof Array){var M=Math.floor(Math.max(0,(D[4][0]-T)*H)),K=Math.ceil(Math.min(O,Math.max(0,(D[4][1]-T)*H))),J=Math.floor(Math.max(0,(D[5][0]-T)*H)),x=Math.ceil(Math.min(O,Math.max(0,(D[5][1]-T)*H)));if(D[4][1]>=T&&D[4][0]<=y&&D[4][2]){this.draw_read(Q,L,H,T,y,D[4][0],D[4][2],D[4][3],B)}if(D[5][1]>=T&&D[5][0]<=y&&D[5][2]){this.draw_read(Q,L,H,T,y,D[5][0],D[5][2],D[5][3],B)}if(J>K){Q.fillStyle=g;o(Q,K-N,B+5,J-N,B+5)}}else{Q.fillStyle=U;this.draw_read(Q,L,H,T,y,P,D[4],D[5],B)}if(L==="Pack"&&P>T&&I!=="."){Q.fillStyle=this.prefs.label_color;var S=1;if(S===0&&C-Q.measureText(I).width<0){Q.textAlign="left";Q.fillText(I,E+j-N,B+8)}else{Q.textAlign="right";Q.fillText(I,C-j-N,B+8)}Q.fillStyle=U}return[0,0]}});w.Scaler=d;w.SummaryTreePainter=u;w.LinePainter=b;w.LinkedFeaturePainter=q;w.ReadPainter=s};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("class",class_module);a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window);
\ No newline at end of file
diff -r 4ba5c0b16190a9977fdefa3b4df508d033929903 -r f34a17e508e5bc07d761eeb8c36a3d076ce9ecf1 static/scripts/trackster.js
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -1577,8 +1577,7 @@
// 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),
- container,
- new_track;
+ container;
// If track not in a group, create a group for it and add new track to group. If track
// already in group, add track to group.
@@ -1595,11 +1594,12 @@
else {
container = current_track.container;
}
- if (current_track instanceof FeatureTrack) {
- new_track = new ToolDataFeatureTrack(track_name, view, container, "hda");
- new_track.change_mode(current_track.mode);
- container.add_drawable(new_track);
- }
+
+ // Create and init new track.
+ var new_track = new current_track.constructor(track_name, view, container, "hda");
+ new_track.init_for_tool_data();
+ new_track.change_mode(current_track.mode);
+ container.add_drawable(new_track);
new_track.content_div.text("Starting job.");
// Run tool.
@@ -2316,7 +2316,6 @@
* ----> ReferenceTrack
* ----> FeatureTrack
* -------> ReadTrack
- * -------> ToolDataFeatureTrack
* -------> VcfTrack
*/
var Track = function(name, view, container, show_header, prefs, data_url, data_query_wait) {
@@ -2476,9 +2475,6 @@
else if (this instanceof ReadTrack) {
return "ReadTrack";
}
- else if (this instanceof ToolDataFeatureTrack) {
- return "ToolDataFeatureTrack";
- }
else if (this instanceof VcfTrack) {
return "VcfTrack";
}
@@ -2562,8 +2558,8 @@
predraw_init: function() {}
});
-var TiledTrack = function(name, view, container, show_header, prefs, filters_list, tool_dict, data_url, data_query_wait) {
- Track.call(this, name, view, container, show_header, prefs, data_url, data_query_wait);
+var TiledTrack = function(name, view, container, show_header, prefs, filters_list, tool_dict) {
+ Track.call(this, name, view, container, show_header, prefs);
var track = this,
view = track.view;
@@ -2910,6 +2906,39 @@
region = (chrom !== undefined && low !== undefined && high !== undefined ?
chrom + ":" + low + "-" + high : "all");
return " - region=[" + region + "], parameters=[" + track.tool.get_param_values().join(", ") + "]";
+ },
+ /**
+ * Set up track to receive tool data.
+ */
+ init_for_tool_data: function() {
+ // Set up track to fetch initial data from raw data URL when the dataset--not the converted datasets--
+ // is ready.
+ this.data_url = raw_data_url;
+ this.data_query_wait = 1000;
+ this.dataset_check_url = dataset_state_url;
+
+ /**
+ * Predraw init sets up postdraw init.
+ */
+ this.predraw_init = function() {
+ // Postdraw init: once data has been fetched, reset data url, wait time and start indexing.
+ var track = this;
+ var post_init = function() {
+ if (track.data_manager.size() === 0) {
+ // Track still drawing initial data, so do nothing.
+ setTimeout(post_init, 300);
+ }
+ else {
+ // Track drawing done: reset dataset check, data URL, wait time and get dataset state to start
+ // indexing.
+ track.data_url = default_data_url;
+ track.data_query_wait = DEFAULT_DATA_QUERY_WAIT;
+ track.dataset_state_url = converted_datasets_state_url;
+ $.getJSON(track.dataset_state_url, {dataset_id : track.dataset_id, hda_ldda: track.hda_ldda}, function(track_data) {});
+ }
+ };
+ post_init();
+ }
}
});
@@ -3524,8 +3553,8 @@
}
});
-var VcfTrack = function(name, view, container, hda_ldda, dataset_id, prefs, filters) {
- FeatureTrack.call(this, name, view, container, hda_ldda, dataset_id, prefs, filters);
+var VcfTrack = function(name, view, container, hda_ldda, dataset_id, prefs, filters, tool) {
+ FeatureTrack.call(this, name, view, container, hda_ldda, dataset_id, prefs, filters, tool);
this.config = new DrawableConfig( {
track: this,
@@ -3546,13 +3575,11 @@
});
this.prefs = this.config.values;
-
this.painter = painters.ReadPainter;
};
extend(VcfTrack.prototype, Drawable.prototype, TiledTrack.prototype, FeatureTrack.prototype);
-
var ReadTrack = function (name, view, container, hda_ldda, dataset_id, prefs, filters) {
FeatureTrack.call(this, name, view, container, hda_ldda, dataset_id, prefs, filters);
@@ -3581,44 +3608,6 @@
};
extend(ReadTrack.prototype, Drawable.prototype, TiledTrack.prototype, FeatureTrack.prototype);
-/**
- * Feature track that displays data generated from tool.
- */
-var ToolDataFeatureTrack = function(name, view, container, hda_ldda, dataset_id, prefs, filters) {
- FeatureTrack.call(this, name, view, container, hda_ldda, dataset_id, prefs, filters, {});
-
- // Set up track to fetch initial data from raw data URL when the dataset--not the converted datasets--
- // is ready.
- this.data_url = raw_data_url;
- this.data_query_wait = 1000;
- this.dataset_check_url = dataset_state_url;
-};
-
-extend(ToolDataFeatureTrack.prototype, Drawable.prototype, TiledTrack.prototype, FeatureTrack.prototype, {
- /**
- * For this track type, the predraw init sets up postdraw init.
- */
- predraw_init: function() {
- // Postdraw init: once data has been fetched, reset data url, wait time and start indexing.
- var track = this;
- var post_init = function() {
- if (track.data_manager.size() === 0) {
- // Track still drawing initial data, so do nothing.
- setTimeout(post_init, 300);
- }
- else {
- // Track drawing done: reset dataset check, data URL, wait time and get dataset state to start
- // indexing.
- track.data_url = default_data_url;
- track.data_query_wait = DEFAULT_DATA_QUERY_WAIT;
- track.dataset_state_url = converted_datasets_state_url;
- $.getJSON(track.dataset_state_url, {dataset_id : track.dataset_id, hda_ldda: track.hda_ldda}, function(track_data) {});
- }
- };
- post_init();
- }
-});
-
// Exports
exports.View = View;
diff -r 4ba5c0b16190a9977fdefa3b4df508d033929903 -r f34a17e508e5bc07d761eeb8c36a3d076ce9ecf1 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -125,7 +125,7 @@
view = create_visualization( $("#browser-container"), "${config.get('title') | h}",
"${config.get('vis_id')}", "${config.get('dbkey')}",
JSON.parse('${ h.to_json_string( config.get( 'viewport', dict() ) ) }'),
- JSON.parse('${ h.to_json_string( config['tracks'] ) }'),
+ JSON.parse('${ h.to_json_string( config['tracks'] ).replace("'", "\\'") }'),
JSON.parse('${ h.to_json_string( config['bookmarks'] ) }')
);
init_editor();
diff -r 4ba5c0b16190a9977fdefa3b4df508d033929903 -r f34a17e508e5bc07d761eeb8c36a3d076ce9ecf1 tools/gatk/unified_genotyper.xml
--- a/tools/gatk/unified_genotyper.xml
+++ b/tools/gatk/unified_genotyper.xml
@@ -396,7 +396,7 @@
<data format="txt" name="output_metrics" label="${tool.name} on ${on_string} (metrics)" /><data format="txt" name="output_log" label="${tool.name} on ${on_string} (log)" /></outputs>
- <!-- FIXME! <trackster_conf/> -->
+ <trackster_conf/><tests><test><param name="reference_source_selector" value="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