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
October 2013
- 1 participants
- 226 discussions
commit/galaxy-central: guerler: Add logging information to upload box
by commits-noreply@bitbucket.org 14 Oct '13
by commits-noreply@bitbucket.org 14 Oct '13
14 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7642e520cbb6/
Changeset: 7642e520cbb6
User: guerler
Date: 2013-10-14 19:52:41
Summary: Add logging information to upload box
Affected #: 1 file
diff -r 213edb63be133b214c006e5655fe0e6bee8303f3 -r 7642e520cbb6767b2aba379b1681447c186a00ee static/scripts/utils/galaxy.uploadbox.js
--- a/static/scripts/utils/galaxy.uploadbox.js
+++ b/static/scripts/utils/galaxy.uploadbox.js
@@ -49,6 +49,9 @@
// xml request element
var xhr = null;
+ // file reader
+ var reader = null;
+
// attach to element
$.fn.uploadbox = function(options)
{
@@ -158,6 +161,9 @@
// process an upload, recursive
function process()
{
+ // log
+ console.log("Processing queue..." + queue_length + " (" + queue_running + " / " + queue_pause + ")");
+
// validate
if (queue_length == 0 || queue_pause)
{
@@ -167,6 +173,9 @@
return;
} else
queue_running = true;
+
+ // log
+ console.log("Looking for file...");
// get an identifier from the queue
var index = -1;
@@ -181,6 +190,9 @@
// remove from queue
remove(index)
+
+ // log
+ console.log("Initializing ('" + file.name + "').");
// start
var data = opts.initialize(index, file);
@@ -189,7 +201,7 @@
try
{
// load file read
- var reader = new FileReader();
+ reader = new FileReader();
// identify maximum file size
var filesize = file.size;
@@ -202,6 +214,10 @@
// link load
reader.onload = function(e)
{
+ // file read succesfully
+ console.log("Preparing submission ('" + file.name + "').");
+
+ // sending file
send(index, file, data)
};
@@ -217,6 +233,9 @@
error(index, file, opts.error_default);
};
+ // reading file
+ console.log("Reading ('" + file.name + "').");
+
// read data
reader.readAsDataURL(file);
} else {
@@ -241,10 +260,17 @@
// prepare request
xhr = new XMLHttpRequest();
-
+ xhr.open('POST', opts.url, true);
+ xhr.setRequestHeader('Accept', 'application/json');
+ xhr.setRequestHeader('Cache-Control', 'no-cache');
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+
// captures state changes
xhr.onreadystatechange = function()
{
+ // status change
+ console.log("Status changed: " + xhr.readyState + ".");
+
// check for request completed, server connection closed
if (xhr.readyState != xhr.DONE)
return;
@@ -284,13 +310,12 @@
xhr.upload.index = index;
xhr.upload.file = file;
xhr.upload.addEventListener('progress', progress, false);
+
+ // send request
+ xhr.send(formData);
- // open request
- xhr.open('POST', opts.url, true);
- xhr.setRequestHeader('Accept', 'application/json');
- xhr.setRequestHeader('Cache-Control', 'no-cache');
- xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- xhr.send(formData);
+ // sending file
+ console.log("Sending file ('" + file.name + "').");
}
// success
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: martenson: registration form tweaks, preventing the form to be accidentally submitted multiple times (creating duplicate users), includes user-side basic validation
by commits-noreply@bitbucket.org 14 Oct '13
by commits-noreply@bitbucket.org 14 Oct '13
14 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/213edb63be13/
Changeset: 213edb63be13
User: martenson
Date: 2013-10-14 18:06:34
Summary: registration form tweaks, preventing the form to be accidentally submitted multiple times (creating duplicate users), includes user-side basic validation
Affected #: 2 files
diff -r d46b64f12c5248878baf85b7a764c3e770fb6a09 -r 213edb63be133b214c006e5655fe0e6bee8303f3 static/style/src/less/base.less
--- a/static/style/src/less/base.less
+++ b/static/style/src/less/base.less
@@ -1851,3 +1851,9 @@
.icon-button.chevron-expand {
.sprite(@chevron-expand-bw);
}
+
+// honeypot for registration form
+
+#for_bears {
+ display: none;
+}
diff -r d46b64f12c5248878baf85b7a764c3e770fb6a09 -r 213edb63be133b214c006e5655fe0e6bee8303f3 templates/user/register.mako
--- a/templates/user/register.mako
+++ b/templates/user/register.mako
@@ -37,25 +37,82 @@
subscribe_check_box = CheckboxField( 'subscribe' )
%>
+<script type="text/javascript">
+ $(document).ready(function() {
+
+ function validateString(test_string, type) {
+ var mail_re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+ //var mail_re_RFC822 = /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/;
+ var username_re = /^[a-z0-9\-]{3,255}$/;
+ if (type === 'email') {
+ return mail_re.test(test_string);
+ } else if (type === 'username'){
+ return username_re.test(test_string);
+ }
+ }
+
+ function renderError(message) {
+ if ($(".errormessage").length === 1) {
+ $(".errormessage").html(message)
+ } else {
+ var div = document.createElement("div");
+ div.className = "errormessage"
+ div.innerHTML = message;
+ document.body.insertBefore(div, document.body.firstChild);
+ }
+ }
+
+ $('#registration').bind('submit', function(e) {
+ $('#send').attr('disabled', 'disabled');
+
+ // we need this value to detect submitting at backend
+ var hidden_input = '<input type="hidden" id="create_user_button" name="create_user_button" value="Submit"/>';
+ $("#email_input").before(hidden_input);
+
+ var error_text_email= 'Please enter your valid email address';
+ var error_text_email_long= 'Email cannot be more than 255 characters in length';
+ var error_text_username_characters = 'Public name must contain only lowercase letters, numbers and "-". It also has to be shorter than 255 characters but longer than 3.';
+ var error_text_password_short = 'Please use a password of at least 6 characters';
+ var error_text_password_match = "Passwords don't match";
+
+ var validForm = true;
+
+ var email = $('#email_input').val();
+ var name = $('#name_input').val()
+ if (email.length > 255){ renderError(error_text_email_long); validForm = false;}
+ else if (!validateString(email,"email")){ renderError(error_text_email); validForm = false;}
+ else if (!($('#password_input').val() === $('#password_check_input').val())){ renderError(error_text_password_match); validForm = false;}
+ else if ($('#password_input').val().length < 6 ){ renderError(error_text_password_short); validForm = false;}
+ else if (!(validateString(name,"username"))){ renderError(error_text_username_characters); validForm = false;}
+
+ if (!validForm) {
+ e.preventDefault();
+ // reactivate the button if the form wasn't submitted
+ $('#send').removeAttr('disabled');
+ }
+ });
+ });
+
+</script><div class="toolForm"><form name="registration" id="registration" action="${form_action}" method="post" ><div class="toolFormTitle">Create account</div><div class="form-row"><label>Email address:</label>
- <input type="text" name="email" value="${email | h}" size="40"/>
+ <input id="email_input" type="text" name="email" value="${email | h}" size="40"/><input type="hidden" name="redirect" value="${redirect | h}" size="40"/></div><div class="form-row"><label>Password:</label>
- <input type="password" name="password" value="" size="40"/>
+ <input id="password_input" type="password" name="password" value="" size="40"/></div><div class="form-row"><label>Confirm password:</label>
- <input type="password" name="confirm" value="" size="40"/>
+ <input id="password_check_input" type="password" name="confirm" value="" size="40"/></div><div class="form-row"><label>Public name:</label>
- <input type="text" name="username" size="40" value="${username |h}"/>
+ <input id="name_input" type="text" name="username" size="40" value="${username |h}"/>
%if t.webapp.name == 'galaxy':
<div class="toolParamHelp" style="clear: both;">
Your public name is an identifier that will be used to generate addresses for information
@@ -103,8 +160,12 @@
<input type="hidden" name="user_type_fd_id" value="${trans.security.encode_id( user_type_form_definition.id )}"/>
%endif
%endif
+ <div id="for_bears">
+ If you see this, please leave following field blank.
+ <input type="text" name="please leave this field blank" size="1" value=""/>
+ </div><div class="form-row">
- <input type="submit" name="create_user_button" value="Submit"/>
+ <input type="submit" id="send" name="create_user_button" value="Submit"/></div></form>
%if registration_warning_message:
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: Revert changes from 384240b8cd29 that result in a failure to detect job completion in the drmaa runner on DRMs that do not retain jo
by commits-noreply@bitbucket.org 14 Oct '13
by commits-noreply@bitbucket.org 14 Oct '13
14 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d46b64f12c52/
Changeset: d46b64f12c52
User: natefoo
Date: 2013-10-14 18:00:57
Summary: Revert changes from 384240b8cd29 that result in a failure to detect job completion in the drmaa runner on DRMs that do not retain jo
b information once a job has exited the queue.
Affected #: 1 file
diff -r 02b18fd5432eabf7ba88b87ca0a3f6e348c5c6ba -r d46b64f12c5248878baf85b7a764c3e770fb6a09 lib/galaxy/jobs/runners/drmaa.py
--- a/lib/galaxy/jobs/runners/drmaa.py
+++ b/lib/galaxy/jobs/runners/drmaa.py
@@ -212,9 +212,16 @@
try:
assert external_job_id not in ( None, 'None' ), '(%s/%s) Invalid job id' % ( galaxy_id_tag, external_job_id )
state = self.ds.jobStatus( external_job_id )
- # TODO: probably need to keep track of InvalidJobException count and remove after it exceeds some configurable
- except ( drmaa.DrmCommunicationException, drmaa.InternalException, drmaa.InvalidJobException ), e:
- log.warning( "(%s/%s) job check resulted in %s: %s", galaxy_id_tag, external_job_id, e.__class__.__name__, e )
+ # InternalException was reported to be necessary on some DRMs, but
+ # this could cause failures to be detected as completion! Please
+ # report if you experience problems with this.
+ except ( drmaa.InvalidJobException, drmaa.InternalException ), e:
+ # we should only get here if an orphaned job was put into the queue at app startup
+ log.info( "(%s/%s) job left DRM queue with following message: %s" % ( galaxy_id_tag, external_job_id, e ) )
+ self.work_queue.put( ( self.finish_job, ajs ) )
+ continue
+ except drmaa.DrmCommunicationException, e:
+ log.warning( "(%s/%s) unable to communicate with DRM: %s" % ( galaxy_id_tag, external_job_id, e ))
new_watched.append( ajs )
continue
except Exception, e:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Make communication between Galaxy and the Tool Shed to get status information for installed repositories backward compatible to the 12/20/12 Galaxy release.
by commits-noreply@bitbucket.org 14 Oct '13
by commits-noreply@bitbucket.org 14 Oct '13
14 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/02b18fd5432e/
Changeset: 02b18fd5432e
User: greg
Date: 2013-10-14 17:12:07
Summary: Make communication between Galaxy and the Tool Shed to get status information for installed repositories backward compatible to the 12/20/12 Galaxy release.
Affected #: 2 files
diff -r 8b9c473f66ad117cd6a0ea7f52281e0e35e9d49b -r 02b18fd5432eabf7ba88b87ca0a3f6e348c5c6ba lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py
@@ -9,7 +9,6 @@
import zipfile
import tool_shed.util.shed_util_common as suc
from galaxy.datatypes import checkers
-from urllib2 import HTTPError
log = logging.getLogger( __name__ )
diff -r 8b9c473f66ad117cd6a0ea7f52281e0e35e9d49b -r 02b18fd5432eabf7ba88b87ca0a3f6e348c5c6ba lib/tool_shed/util/shed_util_common.py
--- a/lib/tool_shed/util/shed_util_common.py
+++ b/lib/tool_shed/util/shed_util_common.py
@@ -21,6 +21,7 @@
from tool_shed.util import encoding_util
from tool_shed.util import xml_util
from xml.etree import ElementTree as XmlET
+from urllib2 import HTTPError
from galaxy import eggs
eggs.require( 'mercurial' )
@@ -1232,10 +1233,25 @@
try:
encoded_tool_shed_status_dict = common_util.tool_shed_get( app, tool_shed_url, url )
tool_shed_status_dict = encoding_util.tool_shed_decode( encoded_tool_shed_status_dict )
+ return tool_shed_status_dict
+ except HTTPError, e:
+ # This should handle backward compatility to the Galaxy 12/20/12 release. We used to only handle updates for an installed revision
+ # using a boolean value.
+ log.debug( "Error attempting to get tool shed status for installed repository %s: %s\nAttempting older 'check_for_updates' method.\n" % \
+ ( str( repository.name ), str( e ) ) )
+ url = url_join( tool_shed_url,
+ 'repository/check_for_updates?name=%s&owner=%s&changeset_revision=%s&from_update_manager=True' % \
+ ( repository.name, repository.owner, repository.changeset_revision ) )
+ try:
+ # The value of text will be 'true' or 'false', depending upon whether there is an update available for the installed revision.
+ text = common_util.tool_shed_get( app, tool_shed_url, url )
+ return dict( revision_update=text )
+ except Exception, e:
+ # The required tool shed may be unavailable, so default the revision_update value to 'false'.
+ return dict( revision_update='false' )
except Exception, e:
log.exception( "Error attempting to get tool shed status for installed repository %s: %s" % ( str( repository.name ), str( e ) ) )
return {}
- return tool_shed_status_dict
def get_updated_changeset_revisions( trans, name, owner, changeset_revision ):
"""
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: Update Trackster reference track config. Pack script.
by commits-noreply@bitbucket.org 13 Oct '13
by commits-noreply@bitbucket.org 13 Oct '13
13 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/8b9c473f66ad/
Changeset: 8b9c473f66ad
User: jgoecks
Date: 2013-10-13 23:39:27
Summary: Update Trackster reference track config. Pack script.
Affected #: 2 files
diff -r 7781a13a9ba0adf43cba0b1949fa84fd074c5323 -r 8b9c473f66ad117cd6a0ea7f52281e0e35e9d49b static/scripts/packed/viz/trackster/tracks.js
--- a/static/scripts/packed/viz/trackster/tracks.js
+++ b/static/scripts/packed/viz/trackster/tracks.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","viz/trackster/filters","mvc/data","mvc/tools"],function(ad,y,l,u,M,i,Y,S){var q=ad.extend;var n={};var k=function(ae,af){n[ae.attr("id")]=af};var m=function(ae,ag,ai,ah){ai=".group";var af={};n[ae.attr("id")]=ah;ae.bind("drag",{handle:"."+ag,relative:true},function(aq,ar){var ap=$(this),av=$(this).parent(),am=av.children(),ao=n[$(this).attr("id")],al,ak,at,aj,an;ak=$(this).parents(ai);if(ak.length!==0){at=ak.position().top;aj=at+ak.outerHeight();if(ar.offsetY<at){$(this).insertBefore(ak);var au=n[ak.attr("id")];au.remove_drawable(ao);au.container.add_drawable_before(ao,au);return}else{if(ar.offsetY>aj){$(this).insertAfter(ak);var au=n[ak.attr("id")];au.remove_drawable(ao);au.container.add_drawable(ao);return}}}ak=null;for(an=0;an<am.length;an++){al=$(am.get(an));at=al.position().top;aj=at+al.outerHeight();if(al.is(ai)&&this!==al.get(0)&&ar.offsetY>=at&&ar.offsetY<=aj){if(ar.offsetY-at<aj-ar.offsetY){al.find(".content-div").prepend(this)}else{al.find(".content-div").append(this)}if(ao.container){ao.container.remove_drawable(ao)}n[al.attr("id")].add_drawable(ao);return}}for(an=0;an<am.length;an++){al=$(am.get(an));if(ar.offsetY<al.position().top&&!(al.hasClass("reference-track")||al.hasClass("intro"))){break}}if(an===am.length){if(this!==am.get(an-1)){av.append(this);n[av.attr("id")].move_drawable(ao,an)}}else{if(this!==am.get(an)){$(this).insertBefore(am.get(an));n[av.attr("id")].move_drawable(ao,(ar.deltaY>0?an-1:an))}}}).bind("dragstart",function(){af["border-top"]=ae.css("border-top");af["border-bottom"]=ae.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(af)})};var ab=16,H=9,F=20,B=100,J=12000,T=400,L=5000,x=100,o="Cannot display dataset due to an error. ",K="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",G="No data for this chrom/contig.",w="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",z="Tool cannot be rerun: ",b="Loading data...",V="Ready for display",R=10,I=20,C=["Histogram","Line","Filled","Intensity"];function W(af,ae){if(!ae){ae=0}var ag=Math.pow(10,ae);return Math.round(af*ag)/ag}var r=function(af,ae,ah){if(!r.id_counter){r.id_counter=0}this.id=r.id_counter++;this.name=ah.name;this.view=af;this.container=ae;this.config=new j({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ah.prefs,onchange:function(){this.track.set_name(this.track.config.get("values").name)}});this.prefs=this.config.get("values");this.drag_handle_class=ah.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ai){ai.stopPropagation()});var ag=this;this.container_div.hover(function(){ag.icons_div.show()},function(){ag.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};r.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ae){if(ae.content_visible){ae.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ae.hide_contents();ae.content_visible=false}else{ae.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ae.content_visible=true;ae.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(af){var ae=new a({model:af.config});ae.render()}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ae){$(".tooltip").remove();ae.remove()}}];q(r.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(ae){},to_dict:function(){},set_name:function(ae){this.old_name=this.name;this.name=ae;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ae=this.view;this.container_div.hide(0,function(){$(this).remove();ae.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(af,ak,aj,ai,ae,ah){var ag=this;this.action_icons[af]=$("<a/>").attr("href","javascript:void(0);").attr("title",ak).addClass("icon-button").addClass(aj).tooltip().click(function(){ai(ag)}).appendTo(this.icons_div);if(ah){this.action_icons[af].hide()}},build_action_icons:function(ae){var ag;for(var af=0;af<ae.length;af++){ag=ae[af];this.add_action_icon(ag.name,ag.title,ag.css_class,ag.on_click_fn,ag.prepend,ag.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var A=function(af,ae,ag){r.call(this,af,ae,ag);this.obj_type=ag.obj_type;this.drawables=[]};q(A.prototype,r.prototype,{unpack_drawables:function(ag){this.drawables=[];var af;for(var ae=0;ae<ag.length;ae++){af=p(ag[ae],this.view,this);this.add_drawable(af)}},init:function(){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae].init()}},_draw:function(ae){for(var af=0;af<this.drawables.length;af++){this.drawables[af]._draw(ae)}},to_dict:function(){var af=[];for(var ae=0;ae<this.drawables.length;ae++){af.push(this.drawables[ae].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:af}},add_drawable:function(ae){this.drawables.push(ae);ae.container=this;this.changed()},add_drawable_before:function(ag,ae){this.changed();var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables.splice(af,0,ag);return true}return false},replace_drawable:function(ag,ae,af){var ah=this.drawables.indexOf(ag);if(ah!==-1){this.drawables[ah]=ae;if(af){ag.container_div.replaceWith(ae.container_div)}this.changed()}return ah},remove_drawable:function(af){var ae=this.drawables.indexOf(af);if(ae!==-1){this.drawables.splice(ae,1);af.container=null;this.changed();return true}return false},move_drawable:function(af,ag){var ae=this.drawables.indexOf(af);if(ae!==-1){this.drawables.splice(ae,1);this.drawables.splice(ag,0,af);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(ah){var ae=this.drawables.slice(0),af=[],ag;while(ae.length!==0){ag=ae.shift();if(ag instanceof ah){af.push(ag)}else{if(ag.drawables){ae=ae.concat(ag.drawables)}}}return af}});var Q=function(af,ae,ah){q(ah,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});A.call(this,af,ae,ah);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);k(this.container_div,this);k(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ah){this.unpack_drawables(ah.drawables)}if("filters" in ah){var ag=this.filters_manager;this.filters_manager=new i.FiltersManager(this,ah.filters);ag.parent_div.replaceWith(this.filters_manager.parent_div);if(ah.filters.visible){this.setup_multitrack_filtering()}}};q(Q.prototype,r.prototype,A.prototype,{action_icons_def:[r.prototype.action_icons_def[0],r.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ae){$(".tooltip").remove();ae.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ae){if(ae.filters_manager.visible()){ae.filters_manager.clear_filters();ae._restore_filter_managers()}else{ae.setup_multitrack_filtering();ae.request_draw({clear_tile_cache:true})}ae.filters_manager.toggle()}},r.prototype.action_icons_def[2]],build_container_div:function(){var ae=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ae)}return ae},build_header_div:function(){var ae=$("<div/>").addClass("track-header");ae.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ae);return ae},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ag=this.drawables.length;if(ag===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ag===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var an,am,ak,aq=true,ai=this.drawables[0].get_type(),ae=0;for(an=0;an<ag;an++){ak=this.drawables[an];if(ak.get_type()!==ai){can_composite=false;break}if(ak instanceof d){ae++}}if(aq||ae===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tooltip").remove()}if(ae>1&&ae===this.drawables.length){var ar={},af;ak=this.drawables[0];for(am=0;am<ak.filters_manager.filters.length;am++){af=ak.filters_manager.filters[am];ar[af.name]=[af]}for(an=1;an<this.drawables.length;an++){ak=this.drawables[an];for(am=0;am<ak.filters_manager.filters.length;am++){af=ak.filters_manager.filters[am];if(af.name in ar){ar[af.name].push(af)}}}this.filters_manager.remove_all();var ah,aj,al,ao;for(var ap in ar){ah=ar[ap];if(ah.length===ae){aj=new i.NumberFilter({name:ah[0].name,index:ah[0].index});this.filters_manager.add_filter(aj)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae].filters_manager=this.saved_filters_managers[ae]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ae=0;ae<this.drawables.length;ae++){drawable=this.drawables[ae];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var af=new f(this.view,this.view,{name:this.name,drawables:this.drawables});var ae=this.container.replace_drawable(this,af,true);af.request_draw()},add_drawable:function(ae){A.prototype.add_drawable.call(this,ae);this.update_icons()},remove_drawable:function(ae){A.prototype.remove_drawable.call(this,ae);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ae=q(A.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ae},request_draw:function(ae){ad.each(this.drawables,function(af){af.request_draw(ae)})}});var Z=Backbone.View.extend({initialize:function(ae){q(ae,{obj_type:"View"});A.call(this,"View",ae.container,ae);this.chrom=null;this.vis_id=ae.vis_id;this.dbkey=ae.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new y.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=new j({track:this,params:[{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"}],saved_values:ae.prefs,onchange:function(){track.request_redraw({clear_tile_cache:true})}})},render:function(){this.requested_redraw=false;var ag=this.container,ae=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ag);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ag);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ag);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;k(this.viewport_container,ae);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ah=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){y.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",{"f-dbkey":ae.dbkey},function(ai){ad.each(ai,function(aj){ae.add_drawable(p(aj,ae,ae))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var af=function(ai){if(ai.type==="focusout"||(ai.keyCode||ai.which)===13||(ai.keyCode||ai.which)===27){if((ai.keyCode||ai.which)!==27){ae.go_to($(this).val())}$(this).hide();$(this).val("");ae.location_span.show();ae.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",af).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ae.location_span.hide();ae.chrom_select.hide();ae.nav_input.val(ae.chrom+":"+ae.low+"-"+ae.high);ae.nav_input.css("display","inline-block");ae.nav_input.select();ae.nav_input.focus();ae.nav_input.autocomplete({source:function(ak,ai){var al=[],aj=$.map(ae.get_tracks(d),function(am){return am.data_manager.search_features(ak.term).success(function(an){al=al.concat(an)})});$.when.apply($,aj).done(function(){ai($.map(al,function(am){return{label:am[0],value:am[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ae.zoom_out();ae.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ae.zoom_in();ae.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ae.change_chrom(ae.chrom_select.val())});this.browser_content_div.click(function(ai){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ai){ae.zoom_in(ai.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ai,aj){this.current_x=aj.offsetX}).bind("drag",function(ai,ak){var al=ak.offsetX-this.current_x;this.current_x=ak.offsetX;var aj=Math.round(al/ae.viewport_container.width()*(ae.max_high-ae.max_low));ae.move_delta(-aj)});this.overview_close.click(function(){ae.reset_overview()});this.viewport_container.bind("draginit",function(ai,aj){if(ai.clientX>ae.viewport_container.width()-16){return false}}).bind("dragstart",function(ai,aj){aj.original_low=ae.low;aj.current_height=ai.clientY;aj.current_x=aj.offsetX}).bind("drag",function(ak,am){var ai=$(this);var an=am.offsetX-am.current_x;var aj=ai.scrollTop()-(ak.clientY-am.current_height);ai.scrollTop(aj);am.current_height=ak.clientY;am.current_x=am.offsetX;var al=Math.round(an/ae.viewport_container.width()*(ae.high-ae.low));ae.move_delta(al)}).bind("mousewheel",function(ak,am,aj,ai){if(aj){aj*=50;var al=Math.round(-aj/ae.viewport_container.width()*(ae.high-ae.low));ae.move_delta(al)}});this.top_labeltrack.bind("dragstart",function(ai,aj){return $("<div />").css({height:ae.browser_content_div.height()+ae.top_labeltrack.height()+ae.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(am,an){$(an.proxy).css({left:Math.min(am.pageX,an.startX)-ae.container.offset().left,width:Math.abs(am.pageX-an.startX)});var aj=Math.min(am.pageX,an.startX)-ae.container.offset().left,ai=Math.max(am.pageX,an.startX)-ae.container.offset().left,al=(ae.high-ae.low),ak=ae.viewport_container.width();ae.update_location(Math.round(aj/ak*al)+ae.low,Math.round(ai/ak*al)+ae.low)}).bind("dragend",function(an,ao){var aj=Math.min(an.pageX,ao.startX),ai=Math.max(an.pageX,ao.startX),al=(ae.high-ae.low),ak=ae.viewport_container.width(),am=ae.low;ae.low=Math.round(aj/ak*al)+am;ae.high=Math.round(ai/ak*al)+am;$(ao.proxy).remove();ae.request_redraw()});this.add_label_track(new X(this,{content_div:this.top_labeltrack}));this.add_label_track(new X(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ae.resize_window()},500)});$(document).bind("redraw",function(){ae.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ae){return this.config.get("values")[ae.toLowerCase()+"_color"]||this.config.get("values")["n_color"]}});q(Z.prototype,A.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(af,ah,ae,ai){if(this.timer){clearTimeout(this.timer)}if(ai){var ag=this;this.timer=setTimeout(function(){ag.trigger("navigate",af+":"+ah+"-"+ae)},500)}else{view.trigger("navigate",af+":"+ah+"-"+ae)}},update_location:function(ae,ag){this.location_span.text(commatize(ae)+" - "+commatize(ag));this.nav_input.val(this.chrom+":"+commatize(ae)+"-"+commatize(ag));var af=view.chrom_select.val();if(af!==""){this.trigger_navigate(af,view.low,view.high,true)}},load_chroms:function(ag){ag.num=x;var ae=this,af=$.Deferred();$.ajax({url:galaxy_config.root+"api/genomes/"+this.dbkey,data:ag,dataType:"json",success:function(ai){if(ai.chrom_info.length===0){return}if(ai.reference){var aj=new D(ae);ae.add_label_track(aj);ae.reference_track=aj}ae.chrom_data=ai.chrom_info;var am='<option value="">Select Chrom/Contig</option>';for(var al=0,ah=ae.chrom_data.length;al<ah;al++){var ak=ae.chrom_data[al].chrom;am+='<option value="'+ak+'">'+ak+"</option>"}if(ai.prev_chroms){am+='<option value="previous">Previous '+x+"</option>"}if(ai.next_chroms){am+='<option value="next">Next '+x+"</option>"}ae.chrom_select.html(am);ae.chrom_start_index=ai.start_index;af.resolve(ai.chrom_info)},error:function(){alert("Could not load chroms for this dbkey:",ae.dbkey)}});return af},change_chrom:function(aj,af,al){var ag=this;if(!ag.chrom_data){ag.load_chroms_deferred.then(function(){ag.change_chrom(aj,af,al)});return}if(!aj||aj==="None"){return}if(aj==="previous"){ag.load_chroms({low:this.chrom_start_index-x});return}if(aj==="next"){ag.load_chroms({low:this.chrom_start_index+x});return}var ak=$.grep(ag.chrom_data,function(am,an){return am.chrom===aj})[0];if(ak===undefined){ag.load_chroms({chrom:aj},function(){ag.change_chrom(aj,af,al)});return}else{if(aj!==ag.chrom){ag.chrom=aj;ag.chrom_select.val(ag.chrom);ag.max_high=ak.len-1;ag.reset();for(var ai=0,ae=ag.drawables.length;ai<ae;ai++){var ah=ag.drawables[ai];if(ah.init){ah.init()}}if(ag.reference_track){ag.reference_track.init()}}if(af&&al){ag.low=Math.max(af,0);ag.high=Math.min(al,ag.max_high)}else{ag.low=0;ag.high=ag.max_high}ag.reset_overview();ag.request_redraw()}},go_to:function(ai){ai=ai.replace(/,/g,"");ai=ai.replace(/:|\-/g," ");var af=ai.split(/\s+/),ah=af[0],ag=(af[1]?parseInt(af[1],10):null),ae=(af[2]?parseInt(af[2],10):null);if(!ae){ag=ag-15;ae=ag+15}this.change_chrom(ah,ag,ae)},move_fraction:function(ag){var ae=this;var af=ae.high-ae.low;this.move_delta(ag*af)},move_delta:function(ah){var ae=this;var ag=ae.high-ae.low;if(ae.low-ah<ae.max_low){ae.low=ae.max_low;ae.high=ae.max_low+ag}else{if(ae.high-ah>ae.max_high){ae.high=ae.max_high;ae.low=ae.max_high-ag}else{ae.high-=ah;ae.low-=ah}}ae.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ae.request_redraw()},200);var af=ae.chrom_select.val();this.trigger_navigate(af,ae.low,ae.high,true)},add_drawable:function(ae){A.prototype.add_drawable.call(this,ae);ae.init();this.changed();this.update_intro_div()},add_label_track:function(ae){ae.view=this;ae.init();this.label_tracks.push(ae)},remove_drawable:function(ag,af){A.prototype.remove_drawable.call(this,ag);if(af){var ae=this;ag.container_div.hide(0,function(){$(this).remove();ae.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(af,ag){var ae=this,ah=(ag?[ag]:ae.drawables);ad.each(ah,function(ai){var aj=ad.find(ae.tracks_to_be_redrawn,function(ak){return ak[0]===ai});if(aj){aj[1]=af}else{ae.tracks_to_be_redrawn.push([ai,af])}});if(!this.requested_redraw){requestAnimationFrame(function(){ae._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ae=this.low,ai=this.high;if(ae<this.max_low){ae=this.max_low}if(ai>this.max_high){ai=this.max_high}var af=this.high-this.low;if(this.high!==0&&af<this.min_separation){ai=ae+this.min_separation}this.low=Math.floor(ae);this.high=Math.ceil(ai);this.update_location(this.low,this.high);this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var ah=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var aj=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ag=13;this.overview_box.css({left:ah,width:Math.max(ag,aj)}).show();if(aj<ag){this.overview_box.css("left",ah-(ag-aj)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ah,width:aj})}ad.each(this.tracks_to_be_redrawn,function(am){var ak=am[0],al=am[1];if(ak){ak._draw(al)}});this.tracks_to_be_redrawn=[];ad.each(this.label_tracks,function(ak){ak._draw()})},zoom_in:function(af,ag){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ah=this.high-this.low,ai=ah/2+this.low,ae=(ah/this.zoom_factor)/2;if(af){ai=af/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ai-ae);this.high=Math.round(ai+ae);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var af=this.high-this.low,ag=af/2+this.low,ae=(af*this.zoom_factor)/2;this.low=Math.round(ag-ae);this.high=Math.round(ag+ae);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ag){if(this.overview_drawable){if(this.overview_drawable.dataset.id===ag.dataset.id){return}this.overview_viewport.find(".track").remove()}var af=ag.copy({content_div:this.overview_viewport}),ae=this;af.header_div.hide();af.is_overview=true;ae.overview_drawable=af;this.overview_drawable.postdraw_actions=function(){ae.overview_highlight.show().height(ae.overview_drawable.content_div.height());ae.overview_viewport.height(ae.overview_drawable.content_div.height()+ae.overview_box.outerHeight());ae.overview_close.show();ae.resize_window()};ae.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var s=S.Tool.extend({defaults:{track:null},initialize:function(ae){if(ae.tool_state!==undefined){this.set("hidden",ae.tool_state.hidden)}this.remove_inputs(["data","hidden_data","conditional"])},state_dict:function(ae){return ad.extend(this.get_inputs_dict(),{hidden:!this.is_visible()})}});var v=Backbone.View.extend({events:{"change input":"update_value"},render:function(){var ag=this.$el.addClass("param-row"),ah=this.model;var ae=$("<div>").addClass("param-label").text(ah.get("label")).appendTo(ag);var af=$("<div/>").addClass("param-input").html(ah.get("html")).appendTo(ag);af.find(":input").val(ah.get("value"));$("<div style='clear: both;'/>").appendTo(ag)},update_value:function(ae){this.model.set_value($(ae.target).val())}});var ac=Backbone.View.extend({initialize:function(ae){this.model.on("change:hidden",this.set_visible,this)},render:function(){var af=this;tool=this.model,parent_div=this.$el.addClass("dynamic-tool").hide();parent_div.bind("drag",function(aj){aj.stopPropagation()}).click(function(aj){aj.stopPropagation()}).bind("dblclick",function(aj){aj.stopPropagation()}).keydown(function(aj){aj.stopPropagation()});var ag=$("<div class='tool-name'>").appendTo(parent_div).text(tool.get("name"));tool.get("inputs").each(function(ak){var aj=new v({model:ak});aj.render();parent_div.append(aj.$el)});parent_div.find("input").click(function(){$(this).select()});var ah=$("<div>").addClass("param-row").appendTo(parent_div);var ai=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ah);var ae=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ah);ae.click(function(){af.run_on_region()});ai.click(function(){af.run_on_dataset()});if(tool.is_visible()){this.$el.show()}},set_visible:function(){if(this.model.is_visible()){this.$el.show()}else{this.$el.hide()}},update_params:function(){for(var ae=0;ae<this.params.length;ae++){this.params[ae].update_value()}},run_on_dataset:function(){var ae=this.model;this.run({target_dataset_id:this.model.get("track").dataset.id,action:"rerun",tool_id:ae.id},null,function(af){Galaxy.modal.show({title:ae.get("name")+" is Running",body:ae.get("name")+" is running on the complete dataset. Tool outputs are in dataset's history.",buttons:{Close:function(){Galaxy.modal.hide()}}})})},run_on_region:function(){var af=this.model.get("track"),ai=this.model,ak=new y.GenomeRegion({chrom:af.view.chrom,start:af.view.low,end:af.view.high}),al={target_dataset_id:af.dataset.id,action:"rerun",tool_id:ai.id,regions:[ak.toJSON()]},aj=af,an=al.tool_id+aj.tool_region_and_parameters_str(ak),ae;if(aj.container===view){var am=new Q(view,view,{name:this.name});var ah=aj.container.replace_drawable(aj,am,false);am.container_div.insertBefore(aj.view.content_div.children()[ah]);am.add_drawable(aj);aj.container_div.appendTo(am.content_div);ae=am}else{ae=aj.container}var ag=new aj.constructor(view,ae,{name:an,hda_ldda:"hda"});ag.init_for_tool_data();ag.change_mode(aj.mode);ag.set_filters_manager(aj.filters_manager.copy(ag));ag.update_icons();ae.add_drawable(ag);ag.tiles_div.text("Starting job.");this.run(al,ag,function(ao){ag.set_dataset(new Y.Dataset(ao));ag.tiles_div.text("Running job.");ag.init()})},run:function(ae,ag,ah){ae.inputs=this.model.get_inputs_dict();var af=new l.ServerStateDeferred({ajax_settings:{url:galaxy_config.root+"api/tools",data:JSON.stringify(ae),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ai){return ai!=="pending"}});$.when(af.go()).then(function(ai){if(ai==="no converter"){ag.container_div.addClass("error");ag.content_div.text(K)}else{if(ai.error){ag.container_div.addClass("error");ag.content_div.text(z+ai.message)}else{ah(ai)}}})}});var E=function(ae,af){M.Scaler.call(this,af);this.filter=ae};E.prototype.gen_val=function(ae){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(ae[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var j=Backbone.Model.extend({initialize:function(af){var ae={};ad.each(af.params,function(ag){ae[ag.key]=ag.default_value});if(af.saved_values){ad.each(this.get("params"),function(ag){if(ag.key in af.saved_values){ae[ag.key]=af.saved_values[ag.key]}})}this.set("values",ae);if(af.onchange){this.track=af.track;this.on("change:values",af.onchange,this)}},set_param_default_value:function(af,ae){var ag=ad.find(this.get("params"),function(ah){return ah.key===af});if(ag){ag.default_value=ae}},set_param_value:function(ae,af){var ag=ad.find(this.get("params"),function(ah){return ah.key===ae});if(ag){if(typeof af==="string"||af instanceof String){if(af.trim()===""){af=ag.default_value}else{if(ag.type==="float"){af=parseFloat(af)}else{if(ag.type==="int"){af=parseInt(af,10)}}}}}if(this.get("values")[ae]!==af){this.get("values")[ae]=af;this.trigger("change:values");return true}else{return false}}});var a=Backbone.View.extend({render:function(){var al=this.model;var ae=$("<div />");var ak;function aj(aq,am){for(var av=0;av<aq.length;av++){ak=aq[av];if(ak.hidden){continue}var ao="param_"+av;var az=al.get("values")[ak.key];var aB=$("<div class='form-row' />").appendTo(am);aB.append($("<label />").attr("for",ao).text(ak.label+":"));if(ak.type==="bool"){aB.append($('<input type="checkbox" />').attr("id",ao).attr("name",ao).attr("checked",az))}else{if(ak.type==="text"){aB.append($('<input type="text"/>').attr("id",ao).val(az).click(function(){$(this).select()}))}else{if(ak.type==="select"){var ax=$("<select />").attr("id",ao);for(var at=0;at<ak.options.length;at++){$("<option/>").text(ak.options[at].label).attr("value",ak.options[at].value).appendTo(ax)}ax.val(az);aB.append(ax)}else{if(ak.type==="color"){var aA=$("<div/>").appendTo(aB),aw=$("<input />").attr("id",ao).attr("name",ao).val(az).css("float","left").appendTo(aA).click(function(aD){$(".tooltip").removeClass("in");var aC=$(this).siblings(".tooltip").addClass("in");aC.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top+Galaxy.modal.scrollTop()-($(aC).height()/2)+($(this).height()/2)}).show();aC.click(function(aE){aE.stopPropagation()});$(document).bind("click.color-picker",function(){aC.hide();$(document).unbind("click.color-picker")});aD.stopPropagation()}),au=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(aA).attr("title","Set new random color").tooltip(),ay=$("<div class='tooltip right' style='position: absolute;' />").appendTo(aA).hide(),ap=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(ay),an=$("<div class='tooltip-arrow'></div>").appendTo(ay),ar=$.farbtastic(ap,{width:100,height:100,callback:aw,color:az});aA.append($("<div/>").css("clear","both"));(function(aC){au.click(function(){aC.setColor(l.get_random_color())})})(ar)}else{aB.append($("<input />").attr("id",ao).attr("name",ao).val(az))}}}}if(ak.help){aB.append($("<div class='help'/>").text(ak.help))}}}aj(al.get("params"),ae);var af=this,ai=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ag=function(){af.update_from_form($(Galaxy.modal.el));Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ah=function(am){if((am.keyCode||am.which)===27){ai()}else{if((am.keyCode||am.which)===13){ag()}}};$(window).bind("keypress.check_enter_esc",ah);Galaxy.modal.show({title:"Configure",body:ae,buttons:{Cancel:ai,Ok:ag}})},update_from_form:function(ae){var af=this.model;var ag=false;ad.each(af.get("params"),function(aj,ah){if(!aj.hidden){var ak="param_"+ah;var ai=ae.find("#"+ak).val();if(aj.type==="bool"){ai=ae.find("#"+ak).is(":checked")}ag=af.set_param_value(aj.key,ai)||ag}})}});var c=function(ae,ah,ai,af,ag){this.track=ae;this.region=ah;this.low=ah.get("start");this.high=ah.get("end");this.w_scale=ai;this.canvas=af;this.html_elt=$("<div class='track-tile'/>").append(af);this.data=ag;this.stale=false};c.prototype.predisplay_actions=function(){};var N=function(ae,ah,ai,af,ag){c.call(this,ae,ah,ai,af,ag)};N.prototype.predisplay_actions=function(){};var P=function(ah,ao,aq,ag,aj,ak,ar,af,an){c.call(this,ah,ao,aq,ag,aj);this.mode=ak;this.all_slotted=af;this.feature_mapper=an;this.has_icons=false;if(ar){this.has_icons=true;var al=this;ag=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:F-1,width:ag.width}).prependTo(this.html_elt);var am=new y.GenomeRegion({chrom:ah.view.chrom,start:this.low,end:this.high}),ap=aj.length,ai=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ap+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ae=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ap+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ai.click(function(){al.stale=true;ah.data_manager.get_more_data(am,ah.mode,1/al.w_scale,{},ah.data_manager.DEEP_DATA_REQ);$(".tooltip").hide();ah.request_draw()}).dblclick(function(at){at.stopPropagation()});ae.click(function(){al.stale=true;ah.data_manager.get_more_data(am,ah.mode,1/al.w_scale,{},ah.data_manager.BROAD_DATA_REQ);$(".tooltip").hide();ah.request_draw()}).dblclick(function(at){at.stopPropagation()})}};q(P.prototype,c.prototype);P.prototype.predisplay_actions=function(){var af=this,ae={};if(af.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(aq){if(!this.hovered){return}var al=$(this).offset(),ap=aq.pageX-al.left,ao=aq.pageY-al.top,av=af.feature_mapper.get_feature_data(ap,ao),am=(av?av[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!am||$(this).attr("id")!==am.toString()){$(this).remove()}});if(av){var ah=ae[am];if(!ah){var am=av[0],ar={name:av[3],start:av[1],end:av[2],strand:av[4]},ak=af.track.filters_manager.filters,aj;for(var an=0;an<ak.length;an++){aj=ak[an];ar[aj.name]=av[aj.index]}var ah=$("<div/>").attr("id",am).addClass("feature-popup"),aw=$("<table/>"),au,at,ax;for(au in ar){at=ar[au];ax=$("<tr/>").appendTo(aw);$("<th/>").appendTo(ax).text(au);$("<td/>").attr("align","left").appendTo(ax).text(typeof(at)==="number"?W(at,2):at)}ah.append($("<div class='feature-popup-inner'>").append(aw));ae[am]=ah}ah.appendTo($(this).parents(".track-content").children(".overlay"));var ai=ap+parseInt(af.html_elt.css("left"),10)-ah.width()/2,ag=ao+parseInt(af.html_elt.css("top"),10)+7;ah.css("left",ai+"px").css("top",ag+"px")}else{if(!aq.isPropagationStopped()){aq.stopPropagation();$(this).siblings().each(function(){$(this).trigger(aq)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(af,ae,ag){q(ag,{drag_handle_class:"draghandle"});r.call(this,af,ae,ag);this.dataset=null;if(ag.dataset){this.dataset=(ag.dataset instanceof Backbone.Model?ag.dataset:Y.Dataset.findOrCreate(ag.dataset))}this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ag?ag.data_query_wait:L);this.data_manager=("data_manager" in ag?ag.data_manager:new y.GenomeDataManager({dataset:this.dataset,genome:new y.Genome({key:af.dbkey,chroms_info:{chrom_info:af.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ag)||ag.resize){this.add_resize_handle()}}};q(g.prototype,r.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},r.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ae){ae.view.set_overview(ae)}},r.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ae){if(ae.filters_manager.visible()){ae.filters_manager.clear_filters()}else{ae.filters_manager.init_filters()}ae.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ae){ae.tool.toggle();if(ae.tool.is_visible()){ae.set_name(ae.name+ae.tool_region_and_parameters_str())}else{ae.revert_name()}$(".tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ae){var ah='<strong>Tool</strong>: <%= track.tool.name %><br/><strong>Dataset</strong>: <%= track.name %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ag=ad.template(ah,{track:ae});var aj=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},af=function(){var al=$('select[name="regions"] option:selected').val(),an,ak=new y.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),am=ad.map($(".bookmark"),function(ao){return new y.GenomeRegion({from_str:$(ao).children(".position").text()})});if(al==="cur"){an=[ak]}else{if(al==="bookmarks"){an=am}else{an=[ak].concat(am)}}Galaxy.modal.hide();window.location.href=galaxy_config.root+"visualization/sweepster?"+$.param({dataset_id:ae.dataset.id,hda_ldda:ae.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(an).toJSON())})},ai=function(ak){if((ak.keyCode||ak.which)===27){aj()}else{if((ak.keyCode||ak.which)===13){af()}}};Galaxy.modal.show({title:"Visualize tool parameter space and output from different parameter settings?",body:ag,buttons:{No:aj,Yes:af}})}},r.prototype.action_icons_def[2]],can_draw:function(){return this.dataset&&r.prototype.can_draw.call(this)},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ae=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ae)}this.name_div=$("<div/>").addClass("track-name").appendTo(ae).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ae},set_dataset:function(ae){this.dataset=ae;this.data_manager.set("dataset",ae)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ae=this;var ah=false;var ag=false;var af=$("<div class='track-resize'>");$(ae.container_div).hover(function(){if(ae.content_visible){ah=true;af.show()}},function(){ah=false;if(!ag){af.hide()}});af.hide().bind("dragstart",function(ai,aj){ag=true;aj.original_height=$(ae.content_div).height()}).bind("drag",function(aj,ak){var ai=Math.min(Math.max(ak.original_height+ak.deltaY,ae.min_height_px),ae.max_height_px);$(ae.tiles_div).css("height",ai);ae.visible_height_px=(ae.max_height_px===ai?0:ai);ae.on_resize()}).bind("dragend",function(ai,aj){ae.tile_cache.clear();ag=false;if(!ah){af.hide()}ae.config.get("values").height=ae.visible_height_px;ae.changed()}).appendTo(ae.container_div)},set_display_modes:function(ah,ak){this.display_modes=ah;this.mode=(ak?ak:(this.config&&this.config.get("values")["mode"]?this.config.get("values")["mode"]:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var af=this,ai={};for(var ag=0,ae=af.display_modes.length;ag<ae;ag++){var aj=af.display_modes[ag];ai[aj]=function(al){return function(){af.change_mode(al);af.icons_div.show();af.container_div.mouseleave(function(){af.icons_div.hide()})}}(aj)}make_popupmenu(this.action_icons.mode_icon,ai)},build_action_icons:function(){r.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof X){return"LabelTrack"}else{if(this instanceof D){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof U){return"ReadTrack"}else{if(this instanceof aa){return"VariantTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof d){return"FeatureTrack"}}}}}}}return""},init:function(ag){var af=this;af.enabled=false;af.tile_cache.clear();af.data_manager.clear();af.tiles_div.css("height","auto");af.tiles_div.text("").children().remove();af.container_div.removeClass("nodata error pending");if(!af.dataset.id){return}var ae=$.Deferred(),ah={hda_ldda:af.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:af.view.chrom,retry:ag};$.getJSON(this.dataset.url(),ah,function(ai){if(!ai||ai==="error"||ai.kind==="error"){af.container_div.addClass("error");af.tiles_div.text(o);if(ai.message){af.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){Galaxy.modal.show({title:"Trackster Error",body:"<pre>"+ai.message+"</pre>",buttons:{Close:function(){Galaxy.modal.hide()}}})}));af.tiles_div.append($("<span/>").text(" "));af.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){af.init(true)}))}}else{if(ai==="no converter"){af.container_div.addClass("error");af.tiles_div.text(K)}else{if(ai==="no data"||(ai.data!==undefined&&(ai.data===null||ai.data.length===0))){af.container_div.addClass("nodata");af.tiles_div.text(G)}else{if(ai==="pending"){af.container_div.addClass("pending");af.tiles_div.html(w);setTimeout(function(){af.init()},af.data_query_wait)}else{if(ai==="data"||ai.status==="data"){if(ai.valid_chroms){af.valid_chroms=ai.valid_chroms;af.update_icons()}af.tiles_div.text(V);if(af.view.chrom){af.tiles_div.text("");af.tiles_div.css("height",af.visible_height_px+"px");af.enabled=true;$.when.apply($,af.predraw_init()).done(function(){ae.resolve();af.container_div.removeClass("nodata error pending");af.request_draw()})}else{ae.resolve()}}}}}}});this.update_icons();return ae},predraw_init:function(){var ae=this;return $.getJSON(ae.dataset.url(),{data_type:"data",stats:true,chrom:ae.view.chrom,low:0,high:ae.view.max_high,hda_ldda:ae.dataset.get("hda_ldda")},function(af){ae.container_div.addClass("line-track");var ah=af.data;if(ah&&ah.min&&ah.max){var ag=ah.min,ai=ah.max;ag=Math.floor(Math.min(0,Math.max(ag,ah.mean-2*ah.sd)));ai=Math.ceil(Math.max(0,Math.min(ai,ah.mean+2*ah.sd)));ae.config.set_param_default_value("min_value",ag);ae.config.set_param_default_value("max_value",ai);ae.prefs.min_value=ag;ae.prefs.max_value=ai}})},get_drawables:function(){return this}});var O=function(ag,af,ai){g.call(this,ag,af,ai);var ae=this;m(ae.container_div,ae.drag_handle_class,".group",ae);this.filters_manager=new i.FiltersManager(this,("filters" in ai?ai.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=(ai.tool?new s(ad.extend(ai.tool,{track:this,tool_state:ai.tool_state})):null);this.tile_cache=new y.Cache(R);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){var ah=new ac({model:this.tool});ah.render();this.dynamic_tool_div=ah.$el;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ai.mode){this.change_mode(ai.mode)}};q(O.prototype,r.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ae){$(".tooltip").remove();ae.slotters[ae.view.resolution_px_b].max_rows*=2;ae.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ae){var af=this.to_dict();q(af,{data_manager:this.data_manager});var ag=new this.constructor(this.view,ae,af);ag.change_mode(this.mode);ag.enabled=this.enabled;return ag},set_filters_manager:function(ae){this.filters_manager=ae;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ae=this;return $.getJSON(ae.dataset.url(),{data_type:"data",stats:true,chrom:ae.view.chrom,low:0,high:ae.view.max_high,hda_ldda:ae.dataset.get("hda_ldda")},function(af){var ah=af.data;if(isNaN(parseFloat(ae.prefs.min_value))||isNaN(parseFloat(ae.prefs.max_value))){var ag=ah.min,ai=ah.max;ag=Math.floor(Math.min(0,Math.max(ag,ah.mean-2*ah.sd)));ai=Math.ceil(Math.max(0,Math.min(ai,ah.mean+2*ah.sd)));ae.prefs.min_value=ag;ae.prefs.max_value=ai}})},change_mode:function(af){var ae=this;ae.mode=af;ae.config.get("values")["mode"]=af;if(af==="Auto"){this.data_manager.clear()}ae.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ae.mode+")");return ae},update_icons:function(){var ae=this;if(ae.filters_available){ae.action_icons.filters_icon.show()}else{ae.action_icons.filters_icon.hide()}if(ae.tool){ae.action_icons.tools_icon.show();ae.action_icons.param_space_viz_icon.show()}else{ae.action_icons.tools_icon.hide();ae.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(af,ae){return af+"_"+ae},request_draw:function(ae){if(ae&&ae.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ae,this)},before_draw:function(){this.max_height_px=0},_draw:function(at){if(!this.can_draw()){return}var ap=at&&at.clear_after,an=this.view.low,ai=this.view.high,al=ai-an,af=this.view.container.width(),ar=this.view.resolution_px_b,ah=1/ar;if(this.is_overview){an=this.view.max_low;ai=this.view.max_high;ar=af/(view.max_high-view.max_low);ah=1/ar}this.before_draw();this.tiles_div.children().addClass("remove");var ae=Math.floor(an/(ah*T)),am,ao,aj,ak=[],aq=[];while((ae*T*ah)<ai){am=Math.floor(ae*T*ah);ao=new y.GenomeRegion({chrom:this.view.chrom,start:am,end:Math.min(am+Math.ceil(T*ah),this.view.max_high)});aj=this.draw_helper(ao,ar,at);ak.push(aj);$.when(aj).then(function(au){aq.push(au)});ae+=1}if(!ap){this.tiles_div.children(".remove").removeClass("remove").remove()}var ag=this;$.when.apply($,ak).then(function(){ag.tiles_div.children(".remove").remove();aq=ad.filter(aq,function(au){return au!==null});if(aq.length!==0){ag.postdraw_actions(aq,af,ar,ap)}})},_add_yaxis_label:function(ah,aj){var af=this,ai=(ah==="max"?"top":"bottom"),ak=(ah==="max"?"max":"min"),ae=(ah==="max"?"max_value":"min_value"),aj=aj||function(){af.request_draw({clear_tile_cache:true})},ag=this.container_div.find(".yaxislabel."+ai);if(ag.length!==0){ag.text(af.prefs[ae])}else{ag=$("<div/>").text(af.prefs[ae]).make_text_editable({num_cols:12,on_finish:function(al){$(".tooltip").remove();af.config.set_param_value(ae,al);aj()},help_text:"Set "+ak+" value"}).addClass("yaxislabel "+ai).css("color",this.prefs.label_color);this.container_div.prepend(ag)}},postdraw_actions:function(ah,ai,ak,ae){var ag=ad.filter(ah,function(al){return(al instanceof N)});if(ag.length>0){this.max_height_px=0;var af=this;ad.each(ah,function(al){if(!(al instanceof N)){al.html_elt.remove();af.draw_helper(al.region,ak,{force:true,mode:"Coverage"})}});af._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var aj=ad.find(ah,function(al){return al.has_icons});if(aj){ad.each(ah,function(al){if(!al.has_icons){al.html_elt.css("padding-top",F)}})}}},get_mode:function(ae){return this.mode},update_auto_mode:function(ae){},_get_drawables:function(){return[this]},draw_helper:function(an,aq,ar){if(!ar){ar={}}var af=ar.force,ap=!(ar.data_fetch===false),ak=ar.mode||this.mode,ah=1/aq,ag=this,ai=this._get_drawables(),ao=this._gen_tile_cache_key(aq,an),aj=function(at){return(at&&"track" in at)};var al=(af?undefined:ag.tile_cache.get_elt(ao));if(al){if(aj(al)){ag.show_tile(al,aq)}return al}if(!ap){return null}var am=function(){var at=(ad.find(C,function(av){return av===ak})?"Coverage":ak);var au=ad.map(ai,function(av){return av.data_manager.get_data(an,at,ah,ag.data_url_extra_params)});if(view.reference_track){au.push(view.reference_track.data_manager.get_data(an,ak,ah,view.reference_track.data_url_extra_params))}return au};var ae=$.Deferred();ag.tile_cache.set_elt(ao,ae);$.when.apply($,am()).then(function(){var at=am(),ay=at,aE;if(view.reference_track){aE=view.reference_track.data_manager.subset_entry(at.pop(),an)}var az=[],aw=[];ad.each(ai,function(aJ,aG){var aI=aJ.mode,aH=ay[aG];if(aI==="Auto"){aI=aJ.get_mode(aH);aJ.update_auto_mode(aI)}az.push(aI);aw.push(aJ.get_canvas_height(aH,aI,aq,au))});var ax=ag.view.canvas_manager.new_canvas(),aA=an.get("start"),aF=an.get("end"),av=0,au=Math.ceil((aF-aA)*aq)+ag.left_offset,aC=ad.max(aw),aB;ax.width=au;ax.height=(ar.height||aC);var aD=ax.getContext("2d");aD.translate(ag.left_offset,0);if(ai.length>1){aD.globalAlpha=0.5;aD.globalCompositeOperation="source-over"}ad.each(ai,function(aH,aG){aB=aH.draw_tile(ay[aG],aD,az[aG],an,aq,aE)});if(aB!==undefined){ag.tile_cache.set_elt(ao,aB);ag.show_tile(aB,aq)}ae.resolve(aB)});return ae},get_canvas_height:function(ae,ag,ah,af){return this.visible_height_px},_draw_line_track_tile:function(ae,ag,aj,ai,ak){var ah=ag.canvas,af=new M.LinePainter(ae.data,ai.get("start"),ai.get("end"),this.prefs,aj);af.draw(ag,ah.width,ah.height,ak);return new N(this,ai,ak,ah,ae.data)},draw_tile:function(ae,af,ai,ah,aj,ag){},show_tile:function(ag,aj){var af=this,ae=ag.html_elt;ag.predisplay_actions();var ai=(ag.low-(this.is_overview?this.view.max_low:this.view.low))*aj;if(this.left_offset){ai-=this.left_offset}ae.css({position:"absolute",top:0,left:ai});if(ae.hasClass("remove")){ae.removeClass("remove")}else{this.tiles_div.append(ae)}this.max_height_px=Math.max(this.max_height_px,$(ag.canvas).height());ae.parent().children().css("height",this.max_height_px+"px");var ah=this.max_height_px;if(this.visible_height_px!==0){ah=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",ah+"px")},tool_region_and_parameters_str:function(ah){var ae=this,ag=(ah!==undefined?ah.toString():"all"),af=ad.values(ae.tool.get_inputs_dict()).join(", ");return" - region=["+ag+"], parameters=["+af+"]"},data_and_mode_compatible:function(ae,af){if(af==="Auto"){return true}else{if(af==="Coverage"){return ae.dataset_type==="bigwig"}else{if(ae.dataset_type==="bigwig"||ae.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ae){if(ae.message||ae.extra_info==="no_detail"){return false}else{if(ae.dataset_type==="bigwig"){return(ae.data[1][0]-ae.data[0][0]===1)}}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state"}});var X=function(af,ae){var ag={resize:false};g.call(this,af,ae,ag);this.container_div.addClass("label-track")};q(X.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ai){var ag=this.view,ah=ag.high-ag.low,al=Math.floor(Math.pow(10,Math.floor(Math.log(ah)/Math.log(10)))),ae=Math.floor(ag.low/al)*al,aj=this.view.container.width(),af=$("<div style='position: relative; height: 1.3em;'></div>");while(ae<ag.high){var ak=(ae-ag.low)/ah*aj;af.append($("<div class='label'>"+commatize(ae)+"</div>").css({position:"absolute",left:ak-1}));ae+=al}this.content_div.children(":first").remove();this.content_div.append(af)}});var f=function(af,ae,ai){this.display_modes=C;O.call(this,af,ae,ai);this.drawables=[];if("drawables" in ai){var ah;for(var ag=0;ag<ai.drawables.length;ag++){ah=ai.drawables[ag];this.drawables[ag]=p(ah,af,null);if(ah.left_offset>this.left_offset){this.left_offset=ah.left_offset}}this.enabled=true}ad.each(this.drawables,function(aj){if(aj instanceof d||aj instanceof U){aj.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};q(f.prototype,O.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ae){$(".tooltip").remove();ae.show_group()}}].concat(O.prototype.action_icons_def),to_dict:A.prototype.to_dict,add_drawable:A.prototype.add_drawable,unpack_drawables:A.prototype.unpack_drawables,change_mode:function(ae){O.prototype.change_mode.call(this,ae);for(var af=0;af<this.drawables.length;af++){this.drawables[af].change_mode(ae)}},init:function(){var ag=[];for(var af=0;af<this.drawables.length;af++){ag.push(this.drawables[af].init())}var ae=this;$.when.apply($,ag).then(function(){ae.enabled=true;ae.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:r.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var ah=new Q(this.view,this.container,{name:this.name}),ae;for(var ag=0;ag<this.drawables.length;ag++){ae=this.drawables[ag];ae.update_icons();ah.add_drawable(ae);ae.container=ah;ah.content_div.append(ae.container_div)}var af=this.container.replace_drawable(this,ah,true);ah.request_draw({clear_tile_cache:true})},before_draw:function(){O.prototype.before_draw.call(this);var af=ad.min(ad.map(this.drawables,function(ag){return ag.prefs.min_value})),ae=ad.max(ad.map(this.drawables,function(ag){return ag.prefs.max_value}));this.prefs.min_value=af;this.prefs.max_value=ae;ad.each(this.drawables,function(ag){ag.prefs.min_value=af;ag.prefs.max_value=ae})},update_all_min_max:function(){var ae=this;ad.each(this.drawables,function(af){af.prefs.min_value=ae.prefs.min_value;af.prefs.max_value=ae.prefs.max_value});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(ak,ae,an,aj){O.prototype.postdraw_actions.call(this,ak,ae,an,aj);var ai=-1;for(var ag=0;ag<ak.length;ag++){var al=ak[ag].html_elt.find("canvas").height();if(al>ai){ai=al}}for(var ag=0;ag<ak.length;ag++){var ah=ak[ag];if(ah.html_elt.find("canvas").height()!==ai){this.draw_helper(ah.region,an,{force:true,height:ai});ah.html_elt.remove()}}var af=this,am=function(){af.update_all_min_max()};this._add_yaxis_label("min",am);this._add_yaxis_label("max",am)}});var D=function(ae){O.call(this,ae,{content_div:ae.top_labeltrack},{resize:false});this.visible_height_px=12;this.left_offset=ae.canvas_manager.char_width_px;this.container_div.addClass("reference-track");this.data_url=galaxy_config.root+"api/genomes/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new y.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};q(D.prototype,r.prototype,O.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:r.prototype.can_draw,draw_helper:function(af,ag,ae){if(ag>this.view.canvas_manager.char_width_px){this.tiles_div.show();return O.prototype.draw_helper.call(this,af,ag,ae)}else{this.tiles_div.hide();return null}},can_subset:function(ae){return true},draw_tile:function(ag,am,ah,aj,an){var af=this.data_manager.subset_entry(ag,aj),al=af.data;var ae=am.canvas;am.font=am.canvas.manager.default_font;am.textAlign="center";for(var ai=0,ak=al.length;ai<ak;ai++){am.fillStyle=this.view.get_base_color(al[ai]);am.fillText(al[ai],Math.floor(ai*an),10)}return new c(this,aj,an,ae,af)}});var h=function(ag,af,ah){var ae=this;this.display_modes=C;this.mode="Histogram";O.call(this,ag,af,ah);this.config=new j({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:l.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:30,hidden:true}],saved_values:ah.prefs,onchange:function(){ae.set_name(ae.prefs.name);ae.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.get("values");this.visible_height_px=this.prefs.height};q(h.prototype,r.prototype,O.prototype,{before_draw:function(){},draw_tile:function(ae,af,ah,ag,ai){return this._draw_line_track_tile(ae,af,ah,ag,ai)},can_subset:function(ae){return(ae.data[1][0]-ae.data[0][0]===1)},postdraw_actions:function(af,ag,ah,ae){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var t=function(ag,af,ah){var ae=this;this.display_modes=["Heatmap"];this.mode="Heatmap";O.call(this,ag,af,ah);this.config=new j({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:ah.prefs,onchange:function(){ae.set_name(ae.prefs.name);this.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.get("values");this.visible_height_px=this.prefs.height};q(t.prototype,r.prototype,O.prototype,{draw_tile:function(ae,ag,aj,ai,ak){var ah=ag.canvas,af=new M.DiagonalHeatmapPainter(ae.data,ai.get("start"),ai.get("end"),this.prefs,aj);af.draw(ag,ah.width,ah.height,ak);return new c(this,ai,ak,ah,ae.data)}});var d=function(ah,ag,aj){var af=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];O.call(this,ah,ag,aj);var ai=l.get_random_color(),ae=l.get_random_color([ai,"#FFFFFF"]);this.config=new j({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ai},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ae},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:aj.prefs,onchange:function(){af.set_name(af.prefs.name);af.set_painter_from_config();af.request_draw({clear_tile_cache:true})}});this.prefs=this.config.get("values");this.visible_height_px=this.prefs.height;this.container_div.addClass("feature-track");this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};q(d.prototype,r.prototype,O.prototype,{set_painter_from_config:function(){if(this.config.get("values")["connector_style"]==="arcs"){this.painter=M.ArcLinkedFeaturePainter}else{this.painter=M.LinkedFeaturePainter}},postdraw_actions:function(ao,ag,ap,an){O.prototype.postdraw_actions.call(this,ao,ag,ap,an);var ai=this,aj;if(ai.filters_manager){var ah=ai.filters_manager.filters;for(var al=0;al<ah.length;al++){ah[al].update_ui_elt()}var ak=false,am,af;for(aj=0;aj<ao.length;aj++){if(ao[aj].data.length){am=ao[aj].data[0];for(var al=0;al<ah.length;al++){af=ah[al];if(af.applies_to(am)&&af.min!==af.max){ak=true;break}}}}if(ai.filters_available!==ak){ai.filters_available=ak;if(!ai.filters_available){ai.filters_manager.hide()}ai.update_icons()}}if(ao[0] instanceof P){var ae=true;for(aj=0;aj<ao.length;aj++){if(!ao[aj].all_slotted){ae=false;break}}if(!ae){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ae){if(this.mode==="Auto"){if(ae==="no_detail"){ae="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ae+")")}},incremental_slots:function(ai,ae,ah){var af=this.view.canvas_manager.dummy_context,ag=this.slotters[ai];if(!ag||(ag.mode!==ah)){ag=new (u.FeatureSlotter)(ai,ah,B,function(aj){return af.measureText(aj)});this.slotters[ai]=ag}return ag.slot_features(ae)},get_mode:function(ae){if(ae.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>J){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ae,ai,aj,af){if(ai==="Coverage"||ae.dataset_type==="bigwig"){return this.summary_draw_height}else{var ah=this.incremental_slots(aj,ae.data,ai);var ag=new (this.painter)(null,null,null,this.prefs,ai);return Math.max(ab,ag.get_required_height(ah,af))}},draw_tile:function(ao,at,aq,ah,al,ag){var ar=this,af=at.canvas,az=ah.get("start"),ae=ah.get("end"),ai=this.left_offset;if(ao.dataset_type==="bigwig"){return this._draw_line_track_tile(ao,at,aq,ah,al)}var ak=[],ap=this.slotters[al].slots;all_slotted=true;if(ao.data){var am=this.filters_manager.filters;for(var au=0,aw=ao.data.length;au<aw;au++){var aj=ao.data[au];var av=false;var an;for(var ay=0,aD=am.length;ay<aD;ay++){an=am[ay];an.update_attrs(aj);if(!an.keep(aj)){av=true;break}}if(!av){ak.push(aj);if(!(aj[0] in ap)){all_slotted=false}}}}var aC=(this.filters_manager.alpha_filter?new E(this.filters_manager.alpha_filter):null),aA=(this.filters_manager.height_filter?new E(this.filters_manager.height_filter):null),aB=new (this.painter)(ak,az,ae,this.prefs,aq,aC,aA,ag,function(aE){return ar.view.get_base_color(aE)});var ax=null;at.fillStyle=this.prefs.block_color;at.font=at.canvas.manager.default_font;at.textAlign="right";if(ao.data){ax=aB.draw(at,af.width,af.height,al,ap);ax.translation=-ai}return new P(ar,ah,al,af,ao.data,aq,ao.message,all_slotted,ax)}});var aa=function(af,ae,ag){this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];O.call(this,af,ae,ag);this.config=new j({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Histogram color",type:"color",default_value:l.get_random_color()},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.get("values");this.painter=M.VariantPainter;this.summary_draw_height=30;this.left_offset=30};q(aa.prototype,r.prototype,O.prototype,{draw_tile:function(ae,ah,aj,ai,ak){if(ae.dataset_type==="bigwig"){return this._draw_line_track_tile(ae,ah,"Histogram",ai,ak)}else{var ag=this.view,af=new (this.painter)(ae.data,ai.get("start"),ai.get("end"),this.prefs,aj,function(al){return ag.get_base_color(al)});af.draw(ah,ah.canvas.width,ah.canvas.height,ak);return new c(this,ai,ak,ah.canvas,ae.data)}},get_canvas_height:function(ae,ai,aj,ag){if(ae.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(af===0&&ae.data.length!==0){af=ae.data[0][7].match(/,/g);if(af===null){af=1}else{af=af.length+1}}var ah=new (this.painter)(null,null,null,this.prefs,ai);return ah.get_required_height(af)}},predraw_init:function(){var ae=[g.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ae.push(this.dataset.fetch())}return ae},postdraw_actions:function(ai,aj,al,af){O.prototype.postdraw_actions.call(this,ai,aj,al,af);var ah=ad.filter(ai,function(am){return(am instanceof N)});var ag=this.dataset.get_metadata("sample_names");if(ah.length===0&&this.prefs.show_labels&&ag){var ae;if(this.container_div.find(".yaxislabel.variant").length===0){ae=this.prefs.summary_height/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ae+"px",top:(this.prefs.summary_height-ae)/2+"px"}));if(this.prefs.show_sample_data){var ak=ag.join("<br/>");this.tiles_div.prepend($("<div/>").html(ak).addClass("yaxislabel variant top sample").css({top:this.prefs.summary_height+2,}))}}ae=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ae,"line-height":ae});$(this.tiles_div).find(".yaxislabel").css("color",this.prefs.label_color)}else{this.container_div.find(".yaxislabel.variant").remove()}}});var U=function(ag,af,ai){d.call(this,ag,af,ai);var ah=l.get_random_color(),ae=l.get_random_color([ah,"#ffffff"]);this.config=new j({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:ah},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ae},{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},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"}],saved_values:ai.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.get("values");this.painter=(ag.reference_track?M.RefBasedReadPainter:M.ReadPainter);this.update_icons()};q(U.prototype,r.prototype,O.prototype,d.prototype);var e={CompositeTrack:f,DrawableGroup:Q,DiagonalHeatmapTrack:t,FeatureTrack:d,LineTrack:h,ReadTrack:U,VariantTrack:aa,VcfTrack:aa};var p=function(ag,af,ae){if("copy" in ag){return ag.copy(ae)}else{var ah=ag.obj_type;if(!ah){ah=ag.track_type}return new e[ah](af,ae,ag)}};return{TracksterView:Z,DrawableGroup:Q,LineTrack:h,FeatureTrack:d,DiagonalHeatmapTrack:t,ReadTrack:U,VariantTrack:aa,CompositeTrack:f,object_from_template:p}});
\ No newline at end of file
+define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","viz/trackster/filters","mvc/data","mvc/tools"],function(ab,y,l,u,L,i,X,R){var q=ab.extend;var n={};var k=function(ac,ad){n[ac.attr("id")]=ad};var m=function(ac,ae,ag,af){ag=".group";var ad={};n[ac.attr("id")]=af;ac.bind("drag",{handle:"."+ae,relative:true},function(ao,ap){var an=$(this),at=$(this).parent(),ak=at.children(),am=n[$(this).attr("id")],aj,ai,aq,ah,al;ai=$(this).parents(ag);if(ai.length!==0){aq=ai.position().top;ah=aq+ai.outerHeight();var ar=n[ai.attr("id")];if(ap.offsetY<aq){$(this).insertBefore(ai);ar.remove_drawable(am);ar.container.add_drawable_before(am,ar);return}else{if(ap.offsetY>ah){$(this).insertAfter(ai);ar.remove_drawable(am);ar.container.add_drawable(am);return}}}ai=null;for(al=0;al<ak.length;al++){aj=$(ak.get(al));aq=aj.position().top;ah=aq+aj.outerHeight();if(aj.is(ag)&&this!==aj.get(0)&&ap.offsetY>=aq&&ap.offsetY<=ah){if(ap.offsetY-aq<ah-ap.offsetY){aj.find(".content-div").prepend(this)}else{aj.find(".content-div").append(this)}if(am.container){am.container.remove_drawable(am)}n[aj.attr("id")].add_drawable(am);return}}for(al=0;al<ak.length;al++){aj=$(ak.get(al));if(ap.offsetY<aj.position().top&&!(aj.hasClass("reference-track")||aj.hasClass("intro"))){break}}if(al===ak.length){if(this!==ak.get(al-1)){at.append(this);n[at.attr("id")].move_drawable(am,al)}}else{if(this!==ak.get(al)){$(this).insertBefore(ak.get(al));n[at.attr("id")].move_drawable(am,(ap.deltaY>0?al-1:al))}}}).bind("dragstart",function(){ad["border-top"]=ac.css("border-top");ad["border-bottom"]=ac.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ad)})};var F=20,B=100,I=12000,S=400,K=5000,x=100,o="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",G="No data for this chrom/contig.",w="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",z="Tool cannot be rerun: ",b="Loading data...",U="Ready for display",Q=10,H=20,C=["Histogram","Line","Filled","Intensity"];function V(ad,ac){if(!ac){ac=0}var ae=Math.pow(10,ac);return Math.round(ad*ae)/ae}var r=function(ad,ac,af){if(!r.id_counter){r.id_counter=0}this.id=r.id_counter++;this.view=ad;this.container=ac;this.drag_handle_class=af.drag_handle_class;this.is_overview=false;this.action_icons={};this.config=new j({params:this.config_params,onchange:this.config_onchange,saved_values:af.prefs});this.prefs=this.config.get("values");if(!this.prefs.name){this.prefs.name=af.name}if(this.config_onchange){this.config.on("change:values",this.config_onchange,this)}this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ag){ag.stopPropagation()});var ae=this;this.container_div.hover(function(){ae.icons_div.show()},function(){ae.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};r.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ac){if(ac.prefs.content_visible){ac.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ac.hide_contents();ac.prefs.content_visible=false}else{ac.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ac.prefs.content_visible=true;ac.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ad){var ac=new a({model:ad.config});ac.render()}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ac){$(".tooltip").remove();ac.remove()}}];q(r.prototype,{config_params:[{key:"name",label:"Name",type:"text",default_value:""},{key:"content_visible",type:"bool",default_value:true,hidden:true}],config_onchange:function(){this.track.set_name(this.track.config.get("values").name)},init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.prefs.content_visible){return true}return false},request_draw:function(){},_draw:function(ac){},to_dict:function(){},set_name:function(ac){this.old_name=this.prefs.name;this.prefs.name=ac;this.name_div.text(this.prefs.name)},revert_name:function(){if(this.old_name){this.prefs.name=this.old_name;this.name_div.text(this.prefs.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ac=this.view;this.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ad,ai,ah,ag,ac,af){var ae=this;this.action_icons[ad]=$("<a/>").attr("title",ai).addClass("icon-button").addClass(ah).tooltip().click(function(){ag(ae)}).appendTo(this.icons_div);if(af){this.action_icons[ad].hide()}},build_action_icons:function(ac){var ae;for(var ad=0;ad<ac.length;ad++){ae=ac[ad];this.add_action_icon(ae.name,ae.title,ae.css_class,ae.on_click_fn,ae.prepend,ae.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var A=function(ad,ac,ae){r.call(this,ad,ac,ae);this.obj_type=ae.obj_type;this.drawables=[]};q(A.prototype,r.prototype,{unpack_drawables:function(ae){this.drawables=[];var ad;for(var ac=0;ac<ae.length;ac++){ad=p(ae[ac],this.view,this);this.add_drawable(ad)}},init:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].init()}},_draw:function(ac){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad]._draw(ac)}},to_dict:function(){var ad=[];for(var ac=0;ac<this.drawables.length;ac++){ad.push(this.drawables[ac].to_dict())}return{prefs:this.prefs,obj_type:this.obj_type,drawables:ad}},add_drawable:function(ac){this.drawables.push(ac);ac.container=this;this.changed()},add_drawable_before:function(ae,ac){this.changed();var ad=this.drawables.indexOf(ac);if(ad!==-1){this.drawables.splice(ad,0,ae);return true}return false},replace_drawable:function(ae,ac,ad){var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables[af]=ac;if(ad){ae.container_div.replaceWith(ac.container_div)}this.changed()}return af},remove_drawable:function(ad){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);ad.container=null;this.changed();return true}return false},move_drawable:function(ad,ae){var ac=this.drawables.indexOf(ad);if(ac!==-1){this.drawables.splice(ac,1);this.drawables.splice(ae,0,ad);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(af){var ac=this.drawables.slice(0),ad=[],ae;while(ac.length!==0){ae=ac.shift();if(ae instanceof af){ad.push(ae)}else{if(ae.drawables){ac=ac.concat(ae.drawables)}}}return ad}});var P=function(ad,ac,af){q(af,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});A.call(this,ad,ac,af);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);k(this.container_div,this);k(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in af){this.unpack_drawables(af.drawables)}if("filters" in af){var ae=this.filters_manager;this.filters_manager=new i.FiltersManager(this,af.filters);ae.parent_div.replaceWith(this.filters_manager.parent_div);if(af.filters.visible){this.setup_multitrack_filtering()}}};q(P.prototype,r.prototype,A.prototype,{action_icons_def:[r.prototype.action_icons_def[0],r.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ac){$(".tooltip").remove();ac.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters();ac._restore_filter_managers()}else{ac.setup_multitrack_filtering();ac.request_draw({clear_tile_cache:true})}ac.filters_manager.toggle()}},r.prototype.action_icons_def[2]],build_container_div:function(){var ac=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ac)}return ac},build_header_div:function(){var ac=$("<div/>").addClass("track-header");ac.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.prefs.name).appendTo(ac);return ac},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ae=this.drawables.length;if(ae===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ae===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var al,ak,ai,ao=true,ag=this.drawables[0].get_type(),ac=0;for(al=0;al<ae;al++){ai=this.drawables[al];if(ai.get_type()!==ag){can_composite=false;break}if(ai instanceof d){ac++}}if(ao||ac===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tooltip").remove()}if(ac>1&&ac===this.drawables.length){var ap={},ad;ai=this.drawables[0];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];ap[ad.name]=[ad]}for(al=1;al<this.drawables.length;al++){ai=this.drawables[al];for(ak=0;ak<ai.filters_manager.filters.length;ak++){ad=ai.filters_manager.filters[ak];if(ad.name in ap){ap[ad.name].push(ad)}}}this.filters_manager.remove_all();var af,ah,aj,am;for(var an in ap){af=ap[an];if(af.length===ac){ah=new i.NumberFilter({name:af[0].name,index:af[0].index});this.filters_manager.add_filter(ah)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ac=0;ac<this.drawables.length;ac++){this.drawables[ac].filters_manager=this.saved_filters_managers[ac]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ac=0;ac<this.drawables.length;ac++){drawable=this.drawables[ac];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ad=new f(this.view,this.view,{name:this.prefs.name,drawables:this.drawables});var ac=this.container.replace_drawable(this,ad,true);ad.request_draw()},add_drawable:function(ac){A.prototype.add_drawable.call(this,ac);this.update_icons()},remove_drawable:function(ac){A.prototype.remove_drawable.call(this,ac);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ac=q(A.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ac},request_draw:function(ac){ab.each(this.drawables,function(ad){ad.request_draw(ac)})}});var Y=Backbone.View.extend({initialize:function(ac){q(ac,{obj_type:"View"});A.call(this,"View",ac.container,ac);this.chrom=null;this.vis_id=ac.vis_id;this.dbkey=ac.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.render();this.canvas_manager=new y.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=new j({track:this,params:[{key:"a_color",label:"A Color",type:"color",default_value:"#FF0000"},{key:"c_color",label:"C Color",type:"color",default_value:"#00FF00"},{key:"g_color",label:"G Color",type:"color",default_value:"#0000FF"},{key:"t_color",label:"T Color",type:"color",default_value:"#FF00FF"},{key:"n_color",label:"N Color",type:"color",default_value:"#AAAAAA"}],saved_values:ac.prefs,onchange:function(){track.request_redraw({clear_tile_cache:true})}})},render:function(){this.requested_redraw=false;var ae=this.container,ac=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ae);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ae);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ae);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;k(this.viewport_container,ac);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var af=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){y.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",{"f-dbkey":ac.dbkey},function(ag){ab.each(ag,function(ah){ac.add_drawable(p(ah,ac,ac))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a/>").attr("title","Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ad=function(ag){if(ag.type==="focusout"||(ag.keyCode||ag.which)===13||(ag.keyCode||ag.which)===27){if((ag.keyCode||ag.which)!==27){ac.go_to($(this).val())}$(this).hide();$(this).val("");ac.location_span.show();ac.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ad).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ac.location_span.hide();ac.chrom_select.hide();ac.nav_input.val(ac.chrom+":"+ac.low+"-"+ac.high);ac.nav_input.css("display","inline-block");ac.nav_input.select();ac.nav_input.focus();ac.nav_input.autocomplete({source:function(ai,ag){var aj=[],ah=$.map(ac.get_tracks(d),function(ak){return ak.data_manager.search_features(ai.term).success(function(al){aj=aj.concat(al)})});$.when.apply($,ah).done(function(){ag($.map(aj,function(ak){return{label:ak[0],value:ak[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ac.zoom_out();ac.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ac.zoom_in();ac.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ac.change_chrom(ac.chrom_select.val())});this.browser_content_div.click(function(ag){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ag){ac.zoom_in(ag.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ag,ah){this.current_x=ah.offsetX}).bind("drag",function(ag,ai){var aj=ai.offsetX-this.current_x;this.current_x=ai.offsetX;var ah=Math.round(aj/ac.viewport_container.width()*(ac.max_high-ac.max_low));ac.move_delta(-ah)});this.overview_close.click(function(){ac.reset_overview()});this.viewport_container.bind("draginit",function(ag,ah){if(ag.clientX>ac.viewport_container.width()-16){return false}}).bind("dragstart",function(ag,ah){ah.original_low=ac.low;ah.current_height=ag.clientY;ah.current_x=ah.offsetX}).bind("drag",function(ai,ak){var ag=$(this);var al=ak.offsetX-ak.current_x;var ah=ag.scrollTop()-(ai.clientY-ak.current_height);ag.scrollTop(ah);ak.current_height=ai.clientY;ak.current_x=ak.offsetX;var aj=Math.round(al/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}).bind("mousewheel",function(ai,ak,ah,ag){if(ah){ah*=50;var aj=Math.round(-ah/ac.viewport_container.width()*(ac.high-ac.low));ac.move_delta(aj)}});this.top_labeltrack.bind("dragstart",function(ag,ah){return $("<div />").css({height:ac.browser_content_div.height()+ac.top_labeltrack.height()+ac.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ak,al){$(al.proxy).css({left:Math.min(ak.pageX,al.startX)-ac.container.offset().left,width:Math.abs(ak.pageX-al.startX)});var ah=Math.min(ak.pageX,al.startX)-ac.container.offset().left,ag=Math.max(ak.pageX,al.startX)-ac.container.offset().left,aj=(ac.high-ac.low),ai=ac.viewport_container.width();ac.update_location(Math.round(ah/ai*aj)+ac.low,Math.round(ag/ai*aj)+ac.low)}).bind("dragend",function(al,am){var ah=Math.min(al.pageX,am.startX),ag=Math.max(al.pageX,am.startX),aj=(ac.high-ac.low),ai=ac.viewport_container.width(),ak=ac.low;ac.low=Math.round(ah/ai*aj)+ak;ac.high=Math.round(ag/ai*aj)+ak;$(am.proxy).remove();ac.request_redraw()});this.add_label_track(new W(this,{content_div:this.top_labeltrack}));this.add_label_track(new W(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ac.resize_window()},500)});$(document).bind("redraw",function(){ac.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ac){return this.config.get("values")[ac.toLowerCase()+"_color"]||this.config.get("values").n_color}});q(Y.prototype,A.prototype,{changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ad,af,ac,ag){if(this.timer){clearTimeout(this.timer)}if(ag){var ae=this;this.timer=setTimeout(function(){ae.trigger("navigate",ad+":"+af+"-"+ac)},500)}else{view.trigger("navigate",ad+":"+af+"-"+ac)}},update_location:function(ac,ae){this.location_span.text(commatize(ac)+" - "+commatize(ae));this.nav_input.val(this.chrom+":"+commatize(ac)+"-"+commatize(ae));var ad=view.chrom_select.val();if(ad!==""){this.trigger_navigate(ad,view.low,view.high,true)}},load_chroms:function(ae){ae.num=x;var ac=this,ad=$.Deferred();$.ajax({url:galaxy_config.root+"api/genomes/"+this.dbkey,data:ae,dataType:"json",success:function(ag){if(ag.chrom_info.length===0){return}if(ag.reference){var ah=new D(ac);ac.add_label_track(ah);ac.reference_track=ah}ac.chrom_data=ag.chrom_info;var ak='<option value="">Select Chrom/Contig</option>';for(var aj=0,af=ac.chrom_data.length;aj<af;aj++){var ai=ac.chrom_data[aj].chrom;ak+='<option value="'+ai+'">'+ai+"</option>"}if(ag.prev_chroms){ak+='<option value="previous">Previous '+x+"</option>"}if(ag.next_chroms){ak+='<option value="next">Next '+x+"</option>"}ac.chrom_select.html(ak);ac.chrom_start_index=ag.start_index;ad.resolve(ag.chrom_info)},error:function(){alert("Could not load chroms for this dbkey:",ac.dbkey)}});return ad},change_chrom:function(ah,ad,aj){var ae=this;if(!ae.chrom_data){ae.load_chroms_deferred.then(function(){ae.change_chrom(ah,ad,aj)});return}if(!ah||ah==="None"){return}if(ah==="previous"){ae.load_chroms({low:this.chrom_start_index-x});return}if(ah==="next"){ae.load_chroms({low:this.chrom_start_index+x});return}var ai=$.grep(ae.chrom_data,function(ak,al){return ak.chrom===ah})[0];if(ai===undefined){ae.load_chroms({chrom:ah},function(){ae.change_chrom(ah,ad,aj)});return}else{if(ah!==ae.chrom){ae.chrom=ah;ae.chrom_select.val(ae.chrom);ae.max_high=ai.len-1;ae.reset();for(var ag=0,ac=ae.drawables.length;ag<ac;ag++){var af=ae.drawables[ag];if(af.init){af.init()}}if(ae.reference_track){ae.reference_track.init()}}if(ad&&aj){ae.low=Math.max(ad,0);ae.high=Math.min(aj,ae.max_high)}else{ae.low=0;ae.high=ae.max_high}ae.reset_overview();ae.request_redraw()}},go_to:function(ag){ag=ag.replace(/,/g,"");ag=ag.replace(/:|\-/g," ");var ad=ag.split(/\s+/),af=ad[0],ae=(ad[1]?parseInt(ad[1],10):null),ac=(ad[2]?parseInt(ad[2],10):null);if(!ac){ae=ae-15;ac=ae+15}this.change_chrom(af,ae,ac)},move_fraction:function(ae){var ac=this;var ad=ac.high-ac.low;this.move_delta(ae*ad)},move_delta:function(af){var ac=this;var ae=ac.high-ac.low;if(ac.low-af<ac.max_low){ac.low=ac.max_low;ac.high=ac.max_low+ae}else{if(ac.high-af>ac.max_high){ac.high=ac.max_high;ac.low=ac.max_high-ae}else{ac.high-=af;ac.low-=af}}ac.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ac.request_redraw()},200);var ad=ac.chrom_select.val();this.trigger_navigate(ad,ac.low,ac.high,true)},add_drawable:function(ac){A.prototype.add_drawable.call(this,ac);ac.init();this.changed();this.update_intro_div()},add_label_track:function(ac){ac.view=this;ac.init();this.label_tracks.push(ac)},remove_drawable:function(ae,ad){A.prototype.remove_drawable.call(this,ae);if(ad){var ac=this;ae.container_div.hide(0,function(){$(this).remove();ac.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ad,ae){var ac=this,af=(ae?[ae]:ac.drawables);ab.each(af,function(ag){var ah=ab.find(ac.tracks_to_be_redrawn,function(ai){return ai[0]===ag});if(ah){ah[1]=ad}else{ac.tracks_to_be_redrawn.push([ag,ad])}});if(!this.requested_redraw){requestAnimationFrame(function(){ac._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ac=this.low,ag=this.high;if(ac<this.max_low){ac=this.max_low}if(ag>this.max_high){ag=this.max_high}var ad=this.high-this.low;if(this.high!==0&&ad<this.min_separation){ag=ac+this.min_separation}this.low=Math.floor(ac);this.high=Math.ceil(ag);this.update_location(this.low,this.high);this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var af=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ah=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=13;this.overview_box.css({left:af,width:Math.max(ae,ah)}).show();if(ah<ae){this.overview_box.css("left",af-(ae-ah)/2)}if(this.overview_highlight){this.overview_highlight.css({left:af,width:ah})}ab.each(this.tracks_to_be_redrawn,function(ak){var ai=ak[0],aj=ak[1];if(ai){ai._draw(aj)}});this.tracks_to_be_redrawn=[];ab.each(this.label_tracks,function(ai){ai._draw()})},zoom_in:function(ad,ae){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var af=this.high-this.low,ag=af/2+this.low,ac=(af/this.zoom_factor)/2;if(ad){ag=ad/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ag-ac);this.high=Math.round(ag+ac);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ad=this.high-this.low,ae=ad/2+this.low,ac=(ad*this.zoom_factor)/2;this.low=Math.round(ae-ac);this.high=Math.round(ae+ac);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ae){if(this.overview_drawable){if(this.overview_drawable.dataset.id===ae.dataset.id){return}this.overview_viewport.find(".track").remove()}var ad=ae.copy({content_div:this.overview_viewport}),ac=this;ad.header_div.hide();ad.is_overview=true;ac.overview_drawable=ad;this.overview_drawable.postdraw_actions=function(){ac.overview_highlight.show().height(ac.overview_drawable.content_div.height());ac.overview_viewport.height(ac.overview_drawable.content_div.height()+ac.overview_box.outerHeight());ac.overview_close.show();ac.resize_window()};ac.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tooltip").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var s=R.Tool.extend({defaults:{track:null},initialize:function(ac){if(ac.tool_state!==undefined){this.set("hidden",ac.tool_state.hidden)}this.remove_inputs(["data","hidden_data","conditional"])},state_dict:function(ac){return ab.extend(this.get_inputs_dict(),{hidden:!this.is_visible()})}});var v=Backbone.View.extend({events:{"change input":"update_value"},render:function(){var ae=this.$el.addClass("param-row"),af=this.model;var ac=$("<div>").addClass("param-label").text(af.get("label")).appendTo(ae);var ad=$("<div/>").addClass("param-input").html(af.get("html")).appendTo(ae);ad.find(":input").val(af.get("value"));$("<div style='clear: both;'/>").appendTo(ae)},update_value:function(ac){this.model.set_value($(ac.target).val())}});var aa=Backbone.View.extend({initialize:function(ac){this.model.on("change:hidden",this.set_visible,this)},render:function(){var ad=this;tool=this.model,parent_div=this.$el.addClass("dynamic-tool").hide();parent_div.bind("drag",function(ah){ah.stopPropagation()}).click(function(ah){ah.stopPropagation()}).bind("dblclick",function(ah){ah.stopPropagation()}).keydown(function(ah){ah.stopPropagation()});var ae=$("<div class='tool-name'>").appendTo(parent_div).text(tool.get("name"));tool.get("inputs").each(function(ai){var ah=new v({model:ai});ah.render();parent_div.append(ah.$el)});parent_div.find("input").click(function(){$(this).select()});var af=$("<div>").addClass("param-row").appendTo(parent_div);var ag=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(af);var ac=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(af);ac.click(function(){ad.run_on_region()});ag.click(function(){ad.run_on_dataset()});if(tool.is_visible()){this.$el.show()}},set_visible:function(){if(this.model.is_visible()){this.$el.show()}else{this.$el.hide()}},update_params:function(){for(var ac=0;ac<this.params.length;ac++){this.params[ac].update_value()}},run_on_dataset:function(){var ac=this.model;this.run({target_dataset_id:this.model.get("track").dataset.id,action:"rerun",tool_id:ac.id},null,function(ad){Galaxy.modal.show({title:ac.get("name")+" is Running",body:ac.get("name")+" is running on the complete dataset. Tool outputs are in dataset's history.",buttons:{Close:function(){Galaxy.modal.hide()}}})})},run_on_region:function(){var ad=this.model.get("track"),ag=this.model,ai=new y.GenomeRegion({chrom:ad.view.chrom,start:ad.view.low,end:ad.view.high}),aj={target_dataset_id:ad.dataset.id,action:"rerun",tool_id:ag.id,regions:[ai.toJSON()]},ah=ad,al=aj.tool_id+ah.tool_region_and_parameters_str(ai),ac;if(ah.container===view){var ak=new P(view,view,{name:this.prefs.name});var af=ah.container.replace_drawable(ah,ak,false);ak.container_div.insertBefore(ah.view.content_div.children()[af]);ak.add_drawable(ah);ah.container_div.appendTo(ak.content_div);ac=ak}else{ac=ah.container}var ae=new ah.constructor(view,ac,{name:al,hda_ldda:"hda"});ae.init_for_tool_data();ae.change_mode(ah.mode);ae.set_filters_manager(ah.filters_manager.copy(ae));ae.update_icons();ac.add_drawable(ae);ae.tiles_div.text("Starting job.");this.run(aj,ae,function(am){ae.set_dataset(new X.Dataset(am));ae.tiles_div.text("Running job.");ae.init()})},run:function(ac,ae,af){ac.inputs=this.model.get_inputs_dict();var ad=new l.ServerStateDeferred({ajax_settings:{url:galaxy_config.root+"api/tools",data:JSON.stringify(ac),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ag){return ag!=="pending"}});$.when(ad.go()).then(function(ag){if(ag==="no converter"){ae.container_div.addClass("error");ae.content_div.text(J)}else{if(ag.error){ae.container_div.addClass("error");ae.content_div.text(z+ag.message)}else{af(ag)}}})}});var E=function(ac,ad){L.Scaler.call(this,ad);this.filter=ac};E.prototype.gen_val=function(ac){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ac[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var j=Backbone.Model.extend({initialize:function(ad){var ac={};ab.each(ad.params,function(ae){ac[ae.key]=ae.default_value});if(ad.saved_values){ab.each(this.get("params"),function(ae){if(ae.key in ad.saved_values){ac[ae.key]=ad.saved_values[ae.key]}})}this.set("values",ac)},set_param_default_value:function(ad,ac){var ae=ab.find(this.get("params"),function(af){return af.key===ad});if(ae){ae.default_value=ac}},set_param_value:function(ac,ad){var ae=ab.find(this.get("params"),function(af){return af.key===ac});if(ae){if(typeof ad==="string"||ad instanceof String){if(ad.trim()===""){ad=ae.default_value}else{if(ae.type==="float"){ad=parseFloat(ad)}else{if(ae.type==="int"){ad=parseInt(ad,10)}}}}}if(this.get("values")[ac]!==ad){this.get("values")[ac]=ad;this.trigger("change:values");return true}else{return false}}});var a=Backbone.View.extend({render:function(){var aj=this.model;var ac=$("<div/>").keydown(function(ak){ak.stopPropagation()});var ai;function ah(ao,ak){for(var at=0;at<ao.length;at++){ai=ao[at];if(ai.hidden){continue}var am="param_"+at;var ax=aj.get("values")[ai.key];var az=$("<div class='form-row' />").appendTo(ak);az.append($("<label />").attr("for",am).text(ai.label+":"));if(ai.type==="bool"){az.append($('<input type="checkbox" />').attr("id",am).attr("name",am).attr("checked",ax))}else{if(ai.type==="text"){az.append($('<input type="text"/>').attr("id",am).val(ax).click(function(){$(this).select()}))}else{if(ai.type==="select"){var av=$("<select />").attr("id",am);for(var aq=0;aq<ai.options.length;aq++){$("<option/>").text(ai.options[aq].label).attr("value",ai.options[aq].value).appendTo(av)}av.val(ax);az.append(av)}else{if(ai.type==="color"){var ay=$("<div/>").appendTo(az),au=$("<input />").attr("id",am).attr("name",am).val(ax).css("float","left").appendTo(ay).click(function(aB){$(".tooltip").removeClass("in");var aA=$(this).siblings(".tooltip").addClass("in");aA.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top+Galaxy.modal.scrollTop()-($(aA).height()/2)+($(this).height()/2)}).show();aA.click(function(aC){aC.stopPropagation()});$(document).bind("click.color-picker",function(){aA.hide();$(document).unbind("click.color-picker")});aB.stopPropagation()}),ar=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(ay).attr("title","Set new random color").tooltip(),aw=$("<div class='tooltip right' style='position: absolute;' />").appendTo(ay).hide(),an=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(aw),al=$("<div class='tooltip-arrow'></div>").appendTo(aw),ap=$.farbtastic(an,{width:100,height:100,callback:au,color:ax});ay.append($("<div/>").css("clear","both"));(function(aA){ar.click(function(){aA.setColor(l.get_random_color())})})(ap)}else{az.append($("<input />").attr("id",am).attr("name",am).val(ax))}}}}if(ai.help){az.append($("<div class='help'/>").text(ai.help))}}}ah(aj.get("params"),ac);var ad=this,ag=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ae=function(){ad.update_from_form($(Galaxy.modal.el));Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},af=function(ak){if((ak.keyCode||ak.which)===27){ag()}else{if((ak.keyCode||ak.which)===13){ae()}}};$(window).bind("keypress.check_enter_esc",af);Galaxy.modal.show({title:"Configure",body:ac,buttons:{Cancel:ag,Ok:ae}})},update_from_form:function(ac){var ad=this.model;var ae=false;ab.each(ad.get("params"),function(ah,af){if(!ah.hidden){var ai="param_"+af;var ag=ac.find("#"+ai).val();if(ah.type==="bool"){ag=ac.find("#"+ai).is(":checked")}ae=ad.set_param_value(ah.key,ag)||ae}})}});var c=function(ac,af,ag,ad,ae){this.track=ac;this.region=af;this.low=af.get("start");this.high=af.get("end");this.w_scale=ag;this.canvas=ad;this.html_elt=$("<div class='track-tile'/>").append(ad);this.data=ae;this.stale=false};c.prototype.predisplay_actions=function(){};var M=function(ac,af,ag,ad,ae){c.call(this,ac,af,ag,ad,ae)};M.prototype.predisplay_actions=function(){};var O=function(af,am,ao,ae,ah,ai,ap,ad,al){c.call(this,af,am,ao,ae,ah);this.mode=ai;this.all_slotted=ad;this.feature_mapper=al;this.has_icons=false;if(ap){this.has_icons=true;var aj=this;ae=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:F,width:ae.width}).prependTo(this.html_elt);var ak=new y.GenomeRegion({chrom:af.view.chrom,start:this.low,end:this.high}),an=ah.length,ag=$("<a/>").addClass("icon more-down").attr("title","For speed, only the first "+an+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ac=$("<a/>").addClass("icon more-across").attr("title","For speed, only the first "+an+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ag.click(function(){aj.stale=true;af.data_manager.get_more_data(ak,af.mode,1/aj.w_scale,{},af.data_manager.DEEP_DATA_REQ);$(".tooltip").hide();af.request_draw()}).dblclick(function(aq){aq.stopPropagation()});ac.click(function(){aj.stale=true;af.data_manager.get_more_data(ak,af.mode,1/aj.w_scale,{},af.data_manager.BROAD_DATA_REQ);$(".tooltip").hide();af.request_draw()}).dblclick(function(aq){aq.stopPropagation()})}};q(O.prototype,c.prototype);O.prototype.predisplay_actions=function(){var ad=this,ac={};if(ad.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ao){if(!this.hovered){return}var aj=$(this).offset(),an=ao.pageX-aj.left,am=ao.pageY-aj.top,at=ad.feature_mapper.get_feature_data(an,am),ak=(at?at[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!ak||$(this).attr("id")!==ak.toString()){$(this).remove()}});if(at){var af=ac[ak];if(!af){var ap={name:at[3],start:at[1],end:at[2],strand:at[4]},ai=ad.track.filters_manager.filters,ah;for(var al=0;al<ai.length;al++){ah=ai[al];ap[ah.name]=at[ah.index]}af=$("<div/>").attr("id",ak).addClass("feature-popup");var au=$("<table/>"),ar,aq,av;for(ar in ap){aq=ap[ar];av=$("<tr/>").appendTo(au);$("<th/>").appendTo(av).text(ar);$("<td/>").attr("align","left").appendTo(av).text(typeof(aq)==="number"?V(aq,2):aq)}af.append($("<div class='feature-popup-inner'>").append(au));ac[ak]=af}af.appendTo($(this).parents(".track-content").children(".overlay"));var ag=an+parseInt(ad.html_elt.css("left"),10)-af.width()/2,ae=am+parseInt(ad.html_elt.css("top"),10)+7;af.css("left",ag+"px").css("top",ae+"px")}else{if(!ao.isPropagationStopped()){ao.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ao)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(ad,ac,ae){q(ae,{drag_handle_class:"draghandle"});r.call(this,ad,ac,ae);this.dataset=null;if(ae.dataset){this.dataset=(ae.dataset instanceof Backbone.Model?ae.dataset:X.Dataset.findOrCreate(ae.dataset))}this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ae?ae.data_query_wait:K);this.data_manager=("data_manager" in ae?ae.data_manager:new y.GenomeDataManager({dataset:this.dataset,genome:new y.Genome({key:ad.dbkey,chroms_info:{chrom_info:ad.chrom_data}}),data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=this.prefs.height;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ae)||ae.resize){this.add_resize_handle()}}};q(g.prototype,r.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},r.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ac){ac.view.set_overview(ac)}},r.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ac){if(ac.filters_manager.visible()){ac.filters_manager.clear_filters()}else{ac.filters_manager.init_filters()}ac.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ac){ac.tool.toggle();if(ac.tool.is_visible()){ac.set_name(ac.name+ac.tool_region_and_parameters_str())}else{ac.revert_name()}$(".tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ac){var af='<strong>Tool</strong>: <%= track.tool.name %><br/><strong>Dataset</strong>: <%= track.name %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ae=ab.template(af,{track:ac});var ah=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ad=function(){var aj=$('select[name="regions"] option:selected').val(),al,ai=new y.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ak=ab.map($(".bookmark"),function(am){return new y.GenomeRegion({from_str:$(am).children(".position").text()})});if(aj==="cur"){al=[ai]}else{if(aj==="bookmarks"){al=ak}else{al=[ai].concat(ak)}}Galaxy.modal.hide();window.location.href=galaxy_config.root+"visualization/sweepster?"+$.param({dataset_id:ac.dataset.id,hda_ldda:ac.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(al).toJSON())})},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ad()}}};Galaxy.modal.show({title:"Visualize tool parameter space and output from different parameter settings?",body:ae,buttons:{No:ah,Yes:ad}})}},r.prototype.action_icons_def[2]],can_draw:function(){return this.dataset&&r.prototype.can_draw.call(this)},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ac=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ac)}this.name_div=$("<div/>").addClass("track-name").appendTo(ac).text(this.prefs.name).attr("id",this.prefs.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ac},set_dataset:function(ac){this.dataset=ac;this.data_manager.set("dataset",ac)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ac=this;var af=false;var ae=false;var ad=$("<div class='track-resize'>");$(ac.container_div).hover(function(){if(ac.prefs.content_visible){af=true;ad.show()}},function(){af=false;if(!ae){ad.hide()}});ad.hide().bind("dragstart",function(ag,ah){ae=true;ah.original_height=$(ac.content_div).height()}).bind("drag",function(ah,ai){var ag=Math.min(Math.max(ai.original_height+ai.deltaY,ac.min_height_px),ac.max_height_px);$(ac.tiles_div).css("height",ag);ac.visible_height_px=(ac.max_height_px===ag?0:ag);ac.on_resize()}).bind("dragend",function(ag,ah){ac.tile_cache.clear();ae=false;if(!af){ad.hide()}ac.config.get("values").height=ac.visible_height_px;ac.changed()}).appendTo(ac.container_div)},set_display_modes:function(af,ai){this.display_modes=af;this.mode=(ai?ai:(this.config&&this.config.get("values").mode?this.config.get("values").mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ad=this,ag={};for(var ae=0,ac=ad.display_modes.length;ae<ac;ae++){var ah=ad.display_modes[ae];ag[ah]=function(aj){return function(){ad.change_mode(aj);ad.icons_div.show();ad.container_div.mouseleave(function(){ad.icons_div.hide()})}}(ah)}make_popupmenu(this.action_icons.mode_icon,ag)},build_action_icons:function(){r.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof W){return"LabelTrack"}else{if(this instanceof D){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof d){return"FeatureTrack"}}}}}}}return""},init:function(ae){var ad=this;ad.enabled=false;ad.tile_cache.clear();ad.data_manager.clear();ad.tiles_div.css("height","auto");ad.tiles_div.text("").children().remove();ad.container_div.removeClass("nodata error pending");if(!ad.dataset.id){return}var ac=$.Deferred(),af={hda_ldda:ad.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ad.view.chrom,retry:ae};$.getJSON(this.dataset.url(),af,function(ag){if(!ag||ag==="error"||ag.kind==="error"){ad.container_div.addClass("error");ad.tiles_div.text(o);if(ag.message){ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){Galaxy.modal.show({title:"Trackster Error",body:"<pre>"+ag.message+"</pre>",buttons:{Close:function(){Galaxy.modal.hide()}}})}));ad.tiles_div.append($("<span/>").text(" "));ad.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ad.init(true)}))}}else{if(ag==="no converter"){ad.container_div.addClass("error");ad.tiles_div.text(J)}else{if(ag==="no data"||(ag.data!==undefined&&(ag.data===null||ag.data.length===0))){ad.container_div.addClass("nodata");ad.tiles_div.text(G)}else{if(ag==="pending"){ad.container_div.addClass("pending");ad.tiles_div.html(w);setTimeout(function(){ad.init()},ad.data_query_wait)}else{if(ag==="data"||ag.status==="data"){if(ag.valid_chroms){ad.valid_chroms=ag.valid_chroms;ad.update_icons()}ad.tiles_div.text(U);if(ad.view.chrom){ad.tiles_div.text("");ad.tiles_div.css("height",ad.visible_height_px+"px");ad.enabled=true;$.when.apply($,ad.predraw_init()).done(function(){ac.resolve();ad.container_div.removeClass("nodata error pending");ad.request_draw()})}else{ac.resolve()}}}}}}});this.update_icons();return ac},predraw_init:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){ac.container_div.addClass("line-track");var af=ad.data;if(af&&af.min&&af.max){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.config.set_param_default_value("min_value",ae);ac.config.set_param_default_value("max_value",ag);ac.prefs.min_value=ae;ac.prefs.max_value=ag}})},get_drawables:function(){return this}});var N=function(ae,ad,ag){g.call(this,ae,ad,ag);var ac=this;m(ac.container_div,ac.drag_handle_class,".group",ac);this.filters_manager=new i.FiltersManager(this,("filters" in ag?ag.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=(ag.tool?new s(ab.extend(ag.tool,{track:this,tool_state:ag.tool_state})):null);this.tile_cache=new y.Cache(Q);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){var af=new aa({model:this.tool});af.render();this.dynamic_tool_div=af.$el;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);if(!this.prefs.content_visible){this.tiles_div.hide()}this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ag.mode){this.change_mode(ag.mode)}};q(N.prototype,r.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ac){$(".tooltip").remove();ac.slotters[ac.view.resolution_px_b].max_rows*=2;ac.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ac){var ad=this.to_dict();q(ad,{data_manager:this.data_manager});var ae=new this.constructor(this.view,ac,ad);ae.change_mode(this.mode);ae.enabled=this.enabled;return ae},set_filters_manager:function(ac){this.filters_manager=ac;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),dataset:{id:this.dataset.id,hda_ldda:this.dataset.get("hda_ldda")},prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},set_min_max:function(){var ac=this;return $.getJSON(ac.dataset.url(),{data_type:"data",stats:true,chrom:ac.view.chrom,low:0,high:ac.view.max_high,hda_ldda:ac.dataset.get("hda_ldda")},function(ad){var af=ad.data;if(isNaN(parseFloat(ac.prefs.min_value))||isNaN(parseFloat(ac.prefs.max_value))){var ae=af.min,ag=af.max;ae=Math.floor(Math.min(0,Math.max(ae,af.mean-2*af.sd)));ag=Math.ceil(Math.max(0,Math.min(ag,af.mean+2*af.sd)));ac.prefs.min_value=ae;ac.prefs.max_value=ag}})},change_mode:function(ad){var ac=this;ac.mode=ad;ac.config.get("values").mode=ad;if(ad==="Auto"){this.data_manager.clear()}ac.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ac.mode+")");return ac},update_icons:function(){var ac=this;if(ac.filters_available){ac.action_icons.filters_icon.show()}else{ac.action_icons.filters_icon.hide()}if(ac.tool){ac.action_icons.tools_icon.show();ac.action_icons.param_space_viz_icon.show()}else{ac.action_icons.tools_icon.hide();ac.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ad,ac){return ad+"_"+ac},request_draw:function(ac){if(ac&&ac.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ac,this)},before_draw:function(){this.max_height_px=0},_draw:function(aq){if(!this.can_draw()){return}var an=aq&&aq.clear_after,al=this.view.low,ag=this.view.high,aj=ag-al,ad=this.view.container.width(),ap=this.view.resolution_px_b,af=1/ap;if(this.is_overview){al=this.view.max_low;ag=this.view.max_high;ap=ad/(view.max_high-view.max_low);af=1/ap}this.before_draw();this.tiles_div.children().addClass("remove");var ac=Math.floor(al/(af*S)),ak,am,ah,ai=[],ao=[];while((ac*S*af)<ag){ak=Math.floor(ac*S*af);am=new y.GenomeRegion({chrom:this.view.chrom,start:ak,end:Math.min(ak+Math.ceil(S*af),this.view.max_high)});ah=this.draw_helper(am,ap,aq);ai.push(ah);$.when(ah).then(function(ar){ao.push(ar)});ac+=1}if(!an){this.tiles_div.children(".remove").removeClass("remove").remove()}var ae=this;$.when.apply($,ai).then(function(){ae.tiles_div.children(".remove").remove();ao=ab.filter(ao,function(ar){return ar!==null});if(ao.length!==0){ae.postdraw_actions(ao,ad,ap,an)}})},_add_yaxis_label:function(af,ah){var ad=this,ag=(af==="max"?"top":"bottom"),ai=(af==="max"?"max":"min"),ac=(af==="max"?"max_value":"min_value"),ae=this.container_div.find(".yaxislabel."+ag);ah=ah||function(){ad.request_draw({clear_tile_cache:true})};if(ae.length!==0){ae.text(ad.prefs[ac])}else{ae=$("<div/>").text(ad.prefs[ac]).make_text_editable({num_cols:12,on_finish:function(aj){$(".tooltip").remove();ad.config.set_param_value(ac,aj);ah()},help_text:"Set "+ai+" value"}).addClass("yaxislabel "+ag).css("color",this.prefs.label_color);this.container_div.prepend(ae)}},postdraw_actions:function(af,ag,ai,ac){var ae=ab.filter(af,function(aj){return(aj instanceof M)});if(ae.length>0){this.max_height_px=0;var ad=this;ab.each(af,function(aj){if(!(aj instanceof M)){aj.html_elt.remove();ad.draw_helper(aj.region,ai,{force:true,mode:"Coverage"})}});ad._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ah=ab.find(af,function(aj){return aj.has_icons});if(ah){ab.each(af,function(aj){if(!aj.has_icons){aj.html_elt.css("padding-top",F)}})}}},get_mode:function(ac){return this.mode},update_auto_mode:function(ac){},_get_drawables:function(){return[this]},draw_helper:function(al,an,ao){if(!ao){ao={}}var ad=ao.force,ai=ao.mode||this.mode,af=1/an,ae=this,ag=this._get_drawables(),am=this._gen_tile_cache_key(an,al),ah=function(ap){return(ap&&"track" in ap)};var aj=(ad?undefined:ae.tile_cache.get_elt(am));if(aj){if(ah(aj)){ae.show_tile(aj,an)}return aj}if(ao.data_fetch===false){return null}var ak=function(){var ap=(ab.find(C,function(ar){return ar===ai})?"Coverage":ai);var aq=ab.map(ag,function(ar){return ar.data_manager.get_data(al,ap,af,ae.data_url_extra_params)});if(view.reference_track){aq.push(view.reference_track.data_manager.get_data(al,ai,af,view.reference_track.data_url_extra_params))}return aq};var ac=$.Deferred();ae.tile_cache.set_elt(am,ac);$.when.apply($,ak()).then(function(){var ap=ak(),av=ap,aB;if(view.reference_track){aB=view.reference_track.data_manager.subset_entry(ap.pop(),al)}var aw=[],at=[];ab.each(ag,function(aG,aD){var aF=aG.mode,aE=av[aD];if(aF==="Auto"){aF=aG.get_mode(aE);aG.update_auto_mode(aF)}aw.push(aF);at.push(aG.get_canvas_height(aE,aF,an,aq))});var au=ae.view.canvas_manager.new_canvas(),ax=al.get("start"),aC=al.get("end"),ar=0,aq=Math.ceil((aC-ax)*an)+ae.left_offset,az=ab.max(at),ay;au.width=aq;au.height=(ao.height||az);var aA=au.getContext("2d");aA.translate(ae.left_offset,0);if(ag.length>1){aA.globalAlpha=0.5;aA.globalCompositeOperation="source-over"}ab.each(ag,function(aE,aD){ay=aE.draw_tile(av[aD],aA,aw[aD],al,an,aB)});if(ay!==undefined){ae.tile_cache.set_elt(am,ay);ae.show_tile(ay,an)}ac.resolve(ay)});return ac},get_canvas_height:function(ac,ae,af,ad){return this.visible_height_px},_draw_line_track_tile:function(ac,ae,ah,ag,ai){var af=ae.canvas,ad=new L.LinePainter(ac.data,ag.get("start"),ag.get("end"),this.prefs,ah);ad.draw(ae,af.width,af.height,ai);return new M(this,ag,ai,af,ac.data)},draw_tile:function(ac,ad,ag,af,ah,ae){},show_tile:function(ae,ah){var ad=this,ac=ae.html_elt;ae.predisplay_actions();var ag=(ae.low-(this.is_overview?this.view.max_low:this.view.low))*ah;if(this.left_offset){ag-=this.left_offset}ac.css({position:"absolute",top:0,left:ag});if(ac.hasClass("remove")){ac.removeClass("remove")}else{this.tiles_div.append(ac)}this.max_height_px=Math.max(this.max_height_px,$(ae.canvas).height());ac.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},tool_region_and_parameters_str:function(af){var ac=this,ae=(af!==undefined?af.toString():"all"),ad=ab.values(ac.tool.get_inputs_dict()).join(", ");return" - region=["+ae+"], parameters=["+ad+"]"},data_and_mode_compatible:function(ac,ad){if(ad==="Auto"){return true}else{if(ad==="Coverage"){return ac.dataset_type==="bigwig"}else{if(ac.dataset_type==="bigwig"||ac.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ac){if(ac.message||ac.extra_info==="no_detail"){return false}else{if(ac.dataset_type==="bigwig"){return(ac.data[1][0]-ac.data[0][0]===1)}}return true},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state"}});var W=function(ad,ac){var ae={resize:false};g.call(this,ad,ac,ae);this.container_div.addClass("label-track")};q(W.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ag){var ae=this.view,af=ae.high-ae.low,aj=Math.floor(Math.pow(10,Math.floor(Math.log(af)/Math.log(10)))),ac=Math.floor(ae.low/aj)*aj,ah=this.view.container.width(),ad=$("<div style='position: relative; height: 1.3em;'></div>");while(ac<ae.high){var ai=(ac-ae.low)/af*ah;ad.append($("<div class='label'>"+commatize(ac)+"</div>").css({position:"absolute",left:ai-1}));ac+=aj}this.content_div.children(":first").remove();this.content_div.append(ad)}});var f=function(ad,ac,ag){N.call(this,ad,ac,ag);this.drawables=[];if("drawables" in ag){var af;for(var ae=0;ae<ag.drawables.length;ae++){af=ag.drawables[ae];this.drawables[ae]=p(af,ad,null);if(af.left_offset>this.left_offset){this.left_offset=af.left_offset}}this.enabled=true}ab.each(this.drawables,function(ah){if(ah instanceof d||ah instanceof T){ah.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};q(f.prototype,N.prototype,{display_modes:C,action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ac){$(".tooltip").remove();ac.show_group()}}].concat(N.prototype.action_icons_def),to_dict:A.prototype.to_dict,add_drawable:A.prototype.add_drawable,unpack_drawables:A.prototype.unpack_drawables,change_mode:function(ac){N.prototype.change_mode.call(this,ac);for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].change_mode(ac)}},init:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].init())}var ac=this;$.when.apply($,ae).then(function(){ac.enabled=true;ac.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:r.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var af=new P(this.view,this.container,{name:this.prefs.name}),ac;for(var ae=0;ae<this.drawables.length;ae++){ac=this.drawables[ae];ac.update_icons();af.add_drawable(ac);ac.container=af;af.content_div.append(ac.container_div)}var ad=this.container.replace_drawable(this,af,true);af.request_draw({clear_tile_cache:true})},before_draw:function(){N.prototype.before_draw.call(this);var ad=ab.min(ab.map(this.drawables,function(ae){return ae.prefs.min_value})),ac=ab.max(ab.map(this.drawables,function(ae){return ae.prefs.max_value}));this.prefs.min_value=ad;this.prefs.max_value=ac;ab.each(this.drawables,function(ae){ae.prefs.min_value=ad;ae.prefs.max_value=ac})},update_all_min_max:function(){var ac=this;ab.each(this.drawables,function(ad){ad.prefs.min_value=ac.prefs.min_value;ad.prefs.max_value=ac.prefs.max_value});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(ai,ac,al,ah){N.prototype.postdraw_actions.call(this,ai,ac,al,ah);var ag=-1,ae;for(ae=0;ae<ai.length;ae++){var aj=ai[ae].html_elt.find("canvas").height();if(aj>ag){ag=aj}}for(ae=0;ae<ai.length;ae++){var af=ai[ae];if(af.html_elt.find("canvas").height()!==ag){this.draw_helper(af.region,al,{force:true,height:ag});af.html_elt.remove()}}var ad=this,ak=function(){ad.update_all_min_max()};this._add_yaxis_label("min",ak);this._add_yaxis_label("max",ak)}});var D=function(ac){N.call(this,ac,{content_div:ac.top_labeltrack},{resize:false});this.left_offset=ac.canvas_manager.char_width_px;this.container_div.addClass("reference-track");this.data_url=galaxy_config.root+"api/genomes/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new y.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};q(D.prototype,r.prototype,N.prototype,{config_params:ab.union(r.prototype.config_params,[{key:"height",type:"int",default_value:13,hidden:true}]),build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:r.prototype.can_draw,draw_helper:function(ad,ae,ac){if(ae>this.view.canvas_manager.char_width_px){this.tiles_div.show();return N.prototype.draw_helper.call(this,ad,ae,ac)}else{this.tiles_div.hide();return null}},can_subset:function(ac){return true},draw_tile:function(ae,ak,af,ah,al){var ad=this.data_manager.subset_entry(ae,ah),aj=ad.data;var ac=ak.canvas;ak.font=ak.canvas.manager.default_font;ak.textAlign="center";for(var ag=0,ai=aj.length;ag<ai;ag++){ak.fillStyle=this.view.get_base_color(aj[ag]);ak.fillText(aj[ag],Math.floor(ag*al),10)}return new c(this,ah,al,ac,ad)}});var h=function(ad,ac,ae){this.mode="Histogram";N.call(this,ad,ac,ae)};q(h.prototype,r.prototype,N.prototype,{display_modes:C,config_params:ab.union(r.prototype.config_params,[{key:"color",label:"Color",type:"color",default_value:l.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:30,hidden:true}]),config_onchange:function(){this.set_name(this.prefs.name);this.request_draw({clear_tile_cache:true})},before_draw:function(){},draw_tile:function(ac,ad,af,ae,ag){return this._draw_line_track_tile(ac,ad,af,ae,ag)},can_subset:function(ac){return(ac.data[1][0]-ac.data[0][0]===1)},postdraw_actions:function(ad,ae,af,ac){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var t=function(ad,ac,ae){this.mode="Heatmap";N.call(this,ad,ac,ae)};q(t.prototype,r.prototype,N.prototype,{display_modes:["Heatmap"],config_params:ab.union(r.prototype.config_params,[{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}]),config_onchange:function(){this.set_name(this.prefs.name);this.request_draw({clear_tile_cache:true})},draw_tile:function(ac,ae,ah,ag,ai){var af=ae.canvas,ad=new L.DiagonalHeatmapPainter(ac.data,ag.get("start"),ag.get("end"),this.prefs,ah);ad.draw(ae,af.width,af.height,ai);return new c(this,ag,ai,af,ac.data)}});var d=function(ad,ac,ae){N.call(this,ad,ac,ae);this.container_div.addClass("feature-track");this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};q(d.prototype,r.prototype,N.prototype,{display_modes:["Auto","Coverage","Dense","Squish","Pack"],config_params:ab.union(r.prototype.config_params,[{key:"block_color",label:"Block color",type:"color",default_value:l.get_random_color()},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:l.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,help:"Show the number of items in each bin when drawing summary histogram"},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.prefs.name);this.set_painter_from_config();this.request_draw({clear_tile_cache:true})},set_painter_from_config:function(){if(this.config.get("values").connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},postdraw_actions:function(am,ae,an,al){N.prototype.postdraw_actions.call(this,am,ae,an,al);var ag=this,ah;if(ag.filters_manager){var af=ag.filters_manager.filters,aj;for(aj=0;aj<af.length;aj++){af[aj].update_ui_elt()}var ai=false,ak,ad;for(ah=0;ah<am.length;ah++){if(am[ah].data.length){ak=am[ah].data[0];for(aj=0;aj<af.length;aj++){ad=af[aj];if(ad.applies_to(ak)&&ad.min!==ad.max){ai=true;break}}}}if(ag.filters_available!==ai){ag.filters_available=ai;if(!ag.filters_available){ag.filters_manager.hide()}ag.update_icons()}}if(am[0] instanceof O){var ac=true;for(ah=0;ah<am.length;ah++){if(!am[ah].all_slotted){ac=false;break}}if(!ac){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ac){if(this.mode==="Auto"){if(ac==="no_detail"){ac="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ac+")")}},incremental_slots:function(ag,ac,af){var ad=this.view.canvas_manager.dummy_context,ae=this.slotters[ag];if(!ae||(ae.mode!==af)){ae=new (u.FeatureSlotter)(ag,af,B,function(ah){return ad.measureText(ah)});this.slotters[ag]=ae}return ae.slot_features(ac)},get_mode:function(ac){if(ac.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}return mode},get_canvas_height:function(ac,ag,ah,ad){if(ag==="Coverage"||ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var af=this.incremental_slots(ah,ac.data,ag);var ae=new (this.painter)(null,null,null,this.prefs,ag);return Math.max(this.min_height_px,ae.get_required_height(af,ad))}},draw_tile:function(am,aq,ao,af,aj,ae){var ap=this,ad=aq.canvas,ax=af.get("start"),ac=af.get("end"),ag=this.left_offset;if(am.dataset_type==="bigwig"){return this._draw_line_track_tile(am,aq,ao,af,aj)}var ai=[],an=this.slotters[aj].slots;all_slotted=true;if(am.data){var ak=this.filters_manager.filters;for(var ar=0,au=am.data.length;ar<au;ar++){var ah=am.data[ar];var at=false;var al;for(var aw=0,aB=ak.length;aw<aB;aw++){al=ak[aw];al.update_attrs(ah);if(!al.keep(ah)){at=true;break}}if(!at){ai.push(ah);if(!(ah[0] in an)){all_slotted=false}}}}var aA=(this.filters_manager.alpha_filter?new E(this.filters_manager.alpha_filter):null),ay=(this.filters_manager.height_filter?new E(this.filters_manager.height_filter):null),az=new (this.painter)(ai,ax,ac,this.prefs,ao,aA,ay,ae,function(aC){return ap.view.get_base_color(aC)});var av=null;aq.fillStyle=this.prefs.block_color;aq.font=aq.canvas.manager.default_font;aq.textAlign="right";if(am.data){av=az.draw(aq,ad.width,ad.height,aj,an);av.translation=-ag}return new O(ap,af,aj,ad,am.data,ao,am.message,all_slotted,av)}});var Z=function(ad,ac,ae){N.call(this,ad,ac,ae);this.painter=L.VariantPainter;this.summary_draw_height=30;this.left_offset=30};q(Z.prototype,r.prototype,N.prototype,{display_modes:["Auto","Coverage","Dense","Squish","Pack"],config_params:ab.union(r.prototype.config_params,[{key:"color",label:"Histogram color",type:"color",default_value:l.get_random_color()},{key:"show_sample_data",label:"Show sample data",type:"bool",default_value:true},{key:"show_labels",label:"Show summary and sample labels",type:"bool",default_value:true},{key:"summary_height",label:"Locus summary height",type:"float",default_value:20},{key:"mode",type:"string",default_value:this.mode,hidden:true}]),config_onchange:function(){this.set_name(this.prefs.name);this.request_draw({clear_tile_cache:true})},draw_tile:function(ac,af,ah,ag,ai){if(ac.dataset_type==="bigwig"){return this._draw_line_track_tile(ac,af,"Histogram",ag,ai)}else{var ae=this.view,ad=new (this.painter)(ac.data,ag.get("start"),ag.get("end"),this.prefs,ah,function(aj){return ae.get_base_color(aj)});ad.draw(af,af.canvas.width,af.canvas.height,ai);return new c(this,ag,ai,af.canvas,ac.data)}},get_canvas_height:function(ac,ag,ah,ae){if(ac.dataset_type==="bigwig"){return this.summary_draw_height}else{var ad=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ad===0&&ac.data.length!==0){ad=ac.data[0][7].match(/,/g);if(ad===null){ad=1}else{ad=ad.length+1}}var af=new (this.painter)(null,null,null,this.prefs,ag);return af.get_required_height(ad)}},predraw_init:function(){var ac=[g.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ac.push(this.dataset.fetch())}return ac},postdraw_actions:function(ag,ah,aj,ad){N.prototype.postdraw_actions.call(this,ag,ah,aj,ad);var af=ab.filter(ag,function(ak){return(ak instanceof M)});var ae=this.dataset.get_metadata("sample_names");if(af.length===0&&this.prefs.show_labels&&ae){var ac;if(this.container_div.find(".yaxislabel.variant").length===0){ac=this.prefs.summary_height/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ac+"px",top:(this.prefs.summary_height-ac)/2+"px"}));if(this.prefs.show_sample_data){var ai=ae.join("<br/>");this.tiles_div.prepend($("<div/>").html(ai).addClass("yaxislabel variant top sample").css({top:this.prefs.summary_height+2,}))}}ac=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ac,"line-height":ac});$(this.tiles_div).find(".yaxislabel").css("color",this.prefs.label_color)}else{this.container_div.find(".yaxislabel.variant").remove()}}});var T=function(ad,ac,ae){d.call(this,ad,ac,ae);this.painter=(ad.reference_track?L.RefBasedReadPainter:L.ReadPainter);this.update_icons()};q(T.prototype,r.prototype,N.prototype,d.prototype,{config_params:ab.union(r.prototype.config_params,[{key:"block_color",label:"Block and sense strand color",type:"color",default_value:l.get_random_color()},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:l.get_random_color()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_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},{key:"min_value",label:"Histogram minimum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"max_value",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"height",type:"int",default_value:0,hidden:true}]),config_onchange:function(){this.set_name(this.prefs.name);this.request_draw({clear_tile_cache:true})}});var e={CompositeTrack:f,DrawableGroup:P,DiagonalHeatmapTrack:t,FeatureTrack:d,LineTrack:h,ReadTrack:T,VariantTrack:Z,VcfTrack:Z};var p=function(ae,ad,ac){if("copy" in ae){return ae.copy(ac)}else{var af=ae.obj_type;if(!af){af=ae.track_type}return new e[af](ad,ac,ae)}};return{TracksterView:Y,DrawableGroup:P,LineTrack:h,FeatureTrack:d,DiagonalHeatmapTrack:t,ReadTrack:T,VariantTrack:Z,CompositeTrack:f,object_from_template:p}});
\ No newline at end of file
diff -r 7781a13a9ba0adf43cba0b1949fa84fd074c5323 -r 8b9c473f66ad117cd6a0ea7f52281e0e35e9d49b static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -3754,9 +3754,9 @@
this.hide_contents();
};
extend(ReferenceTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
- config_params: [
- { name: 'height', default: 13 }
- ],
+ config_params: _.union( Drawable.prototype.config_params, [
+ { key: 'height', type: 'int', default_value: 13, hidden: true }
+ ] ),
build_header_div: function() {},
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
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f938aac3397b/
Changeset: f938aac3397b
User: jgoecks
Date: 2013-10-13 22:28:13
Summary: Trackster: fold content_visible flag into config.
Affected #: 1 file
diff -r 5c10579e88db53ed05013c4314573d3919d72e17 -r f938aac3397bfd12da241b3f60daecf90574d0ec static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -207,6 +207,11 @@
this.name = obj_dict.name;
this.view = view;
this.container = container;
+ this.drag_handle_class = obj_dict.drag_handle_class;
+ this.is_overview = false;
+ this.action_icons = {};
+
+ // Set up drawable configuration.
this.config = new Config({
params: this.config_params,
onchange: this.config_onchange,
@@ -216,12 +221,6 @@
this.config.on('change:values', this.config_onchange, this);
}
this.prefs = this.config.get('values');
- this.drag_handle_class = obj_dict.drag_handle_class;
- this.is_overview = false;
- this.action_icons = {};
-
- // FIXME: this should be a saved setting
- this.content_visible = true;
// Build Drawable HTML and behaviors.
this.container_div = this.build_container_div();
@@ -258,13 +257,14 @@
title: "Hide/show content",
css_class: "toggle",
on_click_fn: function(drawable) {
- if ( drawable.content_visible ) {
+ if ( drawable.prefs.content_visible ) {
drawable.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");
drawable.hide_contents();
- drawable.content_visible = false;
- } else {
+ drawable.prefs.content_visible = false;
+ }
+ else {
drawable.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");
- drawable.content_visible = true;
+ drawable.prefs.content_visible = true;
drawable.show_contents();
}
}
@@ -296,7 +296,8 @@
extend(Drawable.prototype, {
config_params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name }
+ { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ { key: 'content_visible', type: 'bool', default_value: true, hidden: true }
],
config_onchange: function() {
@@ -310,7 +311,7 @@
},
can_draw: function() {
- if (this.enabled && this.content_visible) {
+ if (this.enabled && this.prefs.content_visible) {
return true;
}
@@ -2541,7 +2542,7 @@
var drag_control = $( "<div class='track-resize'>" );
// Control shows on hover over track, stays while dragging
$(track.container_div).hover( function() {
- if ( track.content_visible ) {
+ if ( track.prefs.content_visible ) {
in_handle = true;
drag_control.show();
}
@@ -2831,6 +2832,9 @@
// Add tiles_div, overlay_div to content_div.
this.tiles_div = $("<div/>").addClass("tiles").appendTo(this.content_div);
+ if (!this.prefs.content_visible) {
+ this.tiles_div.hide();
+ }
this.overlay_div = $("<div/>").addClass("overlay").appendTo(this.content_div);
if (obj_dict.mode) {
@@ -3808,14 +3812,13 @@
extend(LineTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
display_modes: CONTINUOUS_DATA_MODES,
- config_params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ config_params: _.union( Drawable.prototype.config_params, [
{ key: 'color', label: 'Color', type: 'color', default_value: util.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: 30, hidden: true }
- ],
+ ] ),
config_onchange: function() {
this.set_name(this.prefs.name);
@@ -3863,15 +3866,14 @@
extend(DiagonalHeatmapTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
display_modes: ["Heatmap"],
- config_params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ config_params: _.union( Drawable.prototype.config_params, [
{ key: 'pos_color', label: 'Positive Color', type: 'color', default_value: "#FF8C00" },
{ key: 'neg_color', label: 'Negative Color', type: 'color', default_value: "#4169E1" },
{ key: 'min_value', label: 'Min Value', type: 'float', default_value: -1 },
{ key: 'max_value', label: 'Max Value', type: 'float', default_value: 1 },
{ key: 'mode', type: 'string', default_value: this.mode, hidden: true },
{ key: 'height', type: 'int', default_value: 500, hidden: true }
- ],
+ ] ),
config_onchange: function() {
this.set_name(this.prefs.name);
@@ -3908,8 +3910,7 @@
extend(FeatureTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
display_modes: ["Auto", "Coverage", "Dense", "Squish", "Pack"],
- config_params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ config_params: _.union( Drawable.prototype.config_params, [
{ key: 'block_color', label: 'Block color', type: 'color', default_value: util.get_random_color() },
{ key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: util.get_random_color() },
{ key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' },
@@ -3921,7 +3922,7 @@
options: [ { label: 'Line with arrows', value: 'fishbone' }, { label: 'Arcs', value: 'arcs' } ] },
{ key: 'mode', type: 'string', default_value: this.mode, hidden: true },
{ key: 'height', type: 'int', default_value: 0, hidden: true}
- ],
+ ] ),
config_onchange: function() {
this.set_name(this.prefs.name);
@@ -4207,14 +4208,13 @@
extend(VariantTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
display_modes: ["Auto", "Coverage", "Dense", "Squish", "Pack"],
- config_params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ config_params: _.union( Drawable.prototype.config_params, [
{ key: 'color', label: 'Histogram color', type: 'color', default_value: util.get_random_color() },
{ key: 'show_sample_data', label: 'Show sample data', type: 'bool', default_value: true },
{ key: 'show_labels', label: 'Show summary and sample labels', type: 'bool', default_value: true },
{ key: 'summary_height', label: 'Locus summary height', type: 'float', default_value: 20 },
{ key: 'mode', type: 'string', default_value: this.mode, hidden: true }
- ],
+ ] ),
config_onchange: function() {
this.set_name(this.prefs.name);
@@ -4352,8 +4352,7 @@
};
extend(ReadTrack.prototype, Drawable.prototype, TiledTrack.prototype, FeatureTrack.prototype, {
- config_params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ config_params: _.union( Drawable.prototype.config_params, [
{ key: 'block_color', label: 'Block and sense strand color', type: 'color', default_value: util.get_random_color() },
{ key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: util.get_random_color() },
{ key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' },
@@ -4364,7 +4363,7 @@
{ key: 'min_value', label: 'Histogram minimum', type: 'float', default_value: null, help: 'clear value to set automatically' },
{ key: 'max_value', label: 'Histogram maximum', type: 'float', default_value: null, help: 'clear value to set automatically' },
{ key: 'height', type: 'int', default_value: 0, hidden: true}
- ],
+ ] ),
config_onchange: function() {
this.set_name(this.prefs.name);
https://bitbucket.org/galaxy/galaxy-central/commits/ae23a7b44e3e/
Changeset: ae23a7b44e3e
User: jgoecks
Date: 2013-10-13 23:00:27
Summary: Trackster: fold name attribute into object preferences.
Affected #: 2 files
diff -r f938aac3397bfd12da241b3f60daecf90574d0ec -r ae23a7b44e3eb1679cd4befd5f26a0c514649554 lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -1082,7 +1082,6 @@
return {
"dataset_id": trans.security.decode_id( dataset_dict['id'] ),
"hda_ldda": dataset_dict.get('hda_ldda', 'hda'),
- "name": track_dict['name'],
"track_type": track_dict['track_type'],
"prefs": track_dict['prefs'],
"mode": track_dict['mode'],
@@ -1101,7 +1100,6 @@
drawable = unpack_collection( drawable_json )
unpacked_drawables.append( drawable )
return {
- "name": collection_json.get( 'name', '' ),
"obj_type": collection_json[ 'obj_type' ],
"drawables": unpacked_drawables,
"prefs": collection_json.get( 'prefs' , [] ),
@@ -1192,7 +1190,6 @@
return {
"track_type": dataset.datatype.track_type,
"dataset": trans.security.encode_dict_ids( dataset.to_dict() ),
- "name": track_dict['name'],
"prefs": prefs,
"mode": track_dict.get( 'mode', 'Auto' ),
"filters": track_dict.get( 'filters', { 'filters' : track_data_provider.get_filters() } ),
@@ -1208,7 +1205,6 @@
else:
drawables.append( pack_collection( drawable_dict ) )
return {
- 'name': collection_dict.get( 'name', 'dummy' ),
'obj_type': collection_dict[ 'obj_type' ],
'drawables': drawables,
'prefs': collection_dict.get( 'prefs', [] ),
diff -r f938aac3397bfd12da241b3f60daecf90574d0ec -r ae23a7b44e3eb1679cd4befd5f26a0c514649554 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -204,23 +204,28 @@
var Drawable = function(view, container, obj_dict) {
if (!Drawable.id_counter) { Drawable.id_counter = 0; }
this.id = Drawable.id_counter++;
- this.name = obj_dict.name;
this.view = view;
this.container = container;
this.drag_handle_class = obj_dict.drag_handle_class;
this.is_overview = false;
this.action_icons = {};
- // Set up drawable configuration.
+ // -- Set up drawable configuration. --
+
this.config = new Config({
params: this.config_params,
onchange: this.config_onchange,
saved_values: obj_dict.prefs
});
+ this.prefs = this.config.get('values');
+
+ // If there's no saved name, use object name.
+ if (!this.prefs.name) {
+ this.prefs.name = obj_dict.name;
+ }
if (this.config_onchange) {
this.config.on('change:values', this.config_onchange, this);
}
- this.prefs = this.config.get('values');
// Build Drawable HTML and behaviors.
this.container_div = this.build_container_div();
@@ -296,7 +301,7 @@
extend(Drawable.prototype, {
config_params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ { key: 'name', label: 'Name', type: 'text', default_value: '' },
{ key: 'content_visible', type: 'bool', default_value: true, hidden: true }
],
@@ -332,9 +337,9 @@
* Set drawable name.
*/
set_name: function(new_name) {
- this.old_name = this.name;
- this.name = new_name;
- this.name_div.text(this.name);
+ this.old_name = this.prefs.name;
+ this.prefs.name = new_name;
+ this.name_div.text(this.prefs.name);
},
/**
@@ -342,8 +347,8 @@
*/
revert_name: function() {
if (this.old_name) {
- this.name = this.old_name;
- this.name_div.text(this.name);
+ this.prefs.name = this.old_name;
+ this.name_div.text(this.prefs.name);
}
},
@@ -473,7 +478,6 @@
dictified_drawables.push(this.drawables[i].to_dict());
}
return {
- name: this.name,
prefs: this.prefs,
obj_type: this.obj_type,
drawables: dictified_drawables
@@ -669,7 +673,7 @@
build_header_div: function() {
var header_div = $("<div/>").addClass("track-header");
header_div.append($("<div/>").addClass(this.drag_handle_class));
- this.name_div = $("<div/>").addClass("track-name").text(this.name).appendTo(header_div);
+ this.name_div = $("<div/>").addClass("track-name").text(this.prefs.name).appendTo(header_div);
return header_div;
},
@@ -830,7 +834,7 @@
*/
show_composite_track: function() {
var composite_track = new CompositeTrack(this.view, this.view, {
- name: this.name,
+ name: this.prefs.name,
drawables: this.drawables
});
var index = this.container.replace_drawable(this, composite_track, true);
@@ -1792,7 +1796,7 @@
// already in group, add track to group.
if (current_track.container === view) {
// Create new group.
- var group = new DrawableGroup(view, view, { name: this.name });
+ var group = new DrawableGroup(view, view, { name: this.prefs.name });
// Replace track with group.
var index = current_track.container.replace_drawable(current_track, group, false);
@@ -2512,8 +2516,8 @@
build_header_div: function() {
var header_div = $("<div class='track-header'/>");
if (this.view.editor) { this.drag_div = $("<div/>").addClass(this.drag_handle_class).appendTo(header_div); }
- this.name_div = $("<div/>").addClass("track-name").appendTo(header_div).text(this.name)
- .attr( "id", this.name.replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase() );
+ this.name_div = $("<div/>").addClass("track-name").appendTo(header_div).text(this.prefs.name)
+ .attr( "id", this.prefs.name.replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase() );
return header_div;
},
@@ -2889,7 +2893,6 @@
to_dict: function() {
return {
track_type: this.get_type(),
- name: this.name,
dataset: {
id: this.dataset.id,
hda_ldda: this.dataset.get('hda_ldda')
@@ -3643,7 +3646,7 @@
show_group: function() {
// Create group with individual tracks.
var group = new DrawableGroup(this.view, this.container, {
- name: this.name
+ name: this.prefs.name
}),
track;
for (var i = 0; i < this.drawables.length; i++) {
https://bitbucket.org/galaxy/galaxy-central/commits/7781a13a9ba0/
Changeset: 7781a13a9ba0
User: jgoecks
Date: 2013-10-13 23:09:39
Summary: Trackster: prevent inadvertent keyboard navigation when configuring track.
Affected #: 1 file
diff -r ae23a7b44e3eb1679cd4befd5f26a0c514649554 -r 7781a13a9ba0adf43cba0b1949fa84fd074c5323 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -1986,7 +1986,11 @@
//
var track_config = this.model;
- var container = $("<div />");
+
+ // Prevent propagation of keydown events to viz to avoid inadvertent navigation.
+ var container = $("<div/>").keydown(function(e) {
+ e.stopPropagation();
+ });
var param;
// Function to process parameters recursively
function handle_params( params, container ) {
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
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5b1e3adfafb4/
Changeset: 5b1e3adfafb4
User: jgoecks
Date: 2013-10-12 03:59:34
Summary: Trackster: clean up link attributes.
Affected #: 1 file
diff -r 34ff4b571205e3d28adcf2d553e6aa0c15364d94 -r 5b1e3adfafb419eb8b3ec61af04a00604b02712c static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -367,7 +367,7 @@
*/
add_action_icon: function(name, title, css_class, on_click_fn, prepend, hide) {
var drawable = this;
- this.action_icons[name] = $("<a/>").attr("href", "").attr("title", title)
+ this.action_icons[name] = $("<a/>").attr("title", title)
.addClass("icon-button").addClass(css_class).tooltip()
.click( function() { on_click_fn(drawable); } )
.appendTo(this.icons_div);
@@ -942,7 +942,10 @@
// Overview (scrollbar and overview plot) at bottom
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", "").attr("title", "Close overview").addClass("icon-button overview-close tooltip").hide().appendTo(this.overview_viewport);
+ this.overview_close = $("<a/>").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);
https://bitbucket.org/galaxy/galaxy-central/commits/a7837763dbaf/
Changeset: a7837763dbaf
User: jgoecks
Date: 2013-10-13 21:39:08
Summary: Trackster: simplify constructor and config logic using object attributes.
Affected #: 1 file
diff -r 5b1e3adfafb419eb8b3ec61af04a00604b02712c -r a7837763dbaf2ec540a39c6d0c24bfae5645a1f4 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -208,15 +208,13 @@
this.view = view;
this.container = container;
this.config = new Config({
- track: this,
- params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name }
- ],
- saved_values: obj_dict.prefs,
- onchange: function() {
- this.track.set_name(this.track.config.get('values').name);
- }
+ params: this.config_params,
+ onchange: this.config_onchange,
+ saved_values: obj_dict.prefs
});
+ if (this.config_onchange) {
+ this.config.on('change:values', this.config_onchange, this);
+ }
this.prefs = this.config.get('values');
this.drag_handle_class = obj_dict.drag_handle_class;
this.is_overview = false;
@@ -297,10 +295,20 @@
];
extend(Drawable.prototype, {
+ config_params: [
+ { key: 'name', label: 'Name', type: 'text', default_value: this.name }
+ ],
+
+ config_onchange: function() {
+ this.track.set_name(this.track.config.get('values').name);
+ },
+
init: function() {},
+
changed: function() {
this.view.changed();
},
+
can_draw: function() {
if (this.enabled && this.content_visible) {
return true;
@@ -308,6 +316,7 @@
return false;
},
+
request_draw: function() {},
_draw: function(options) {},
@@ -1909,13 +1918,6 @@
}
this.set('values', values);
-
- // HACK: to make onchange work as written, attach track at the
- // top level of model and call onchange on custom event.
- if (options.onchange) {
- this.track = options.track;
- this.on('change:values', options.onchange, this);
- }
},
/**
@@ -2161,7 +2163,7 @@
canvas = this.html_elt.children()[0],
message_div = $("<div/>").addClass("tile-message")
// -1 to account for border.
- .css({'height': ERROR_PADDING-1, 'width': canvas.width}).prependTo(this.html_elt);
+ .css({'height': ERROR_PADDING, 'width': canvas.width}).prependTo(this.html_elt);
// Handle message; only message currently is that only the first N elements are displayed.
var tile_region = new visualization.GenomeRegion({
@@ -2170,10 +2172,10 @@
end: this.high
}),
num_features = data.length,
- more_down_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-down")
+ more_down_icon = $("<a/>").addClass("icon more-down")
.attr("title", "For speed, only the first " + num_features + " features in this region were obtained from server. Click to get more data including depth")
.tooltip().appendTo(message_div),
- more_across_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-across")
+ more_across_icon = $("<a/>").addClass("icon more-across")
.attr("title", "For speed, only the first " + num_features + " features in this region were obtained from server. Click to get more data excluding depth")
.tooltip().appendTo(message_div);
@@ -2356,7 +2358,7 @@
// Height attributes: min height, max height, and visible height.
this.min_height_px = 16;
this.max_height_px = 800;
- this.visible_height_px = 0;
+ this.visible_height_px = this.prefs.height;
//
// Create content div, which is where track is displayed, and add to container if available.
@@ -3529,7 +3531,6 @@
* bigwig data for now.
*/
var CompositeTrack = function(view, container, obj_dict) {
- this.display_modes = CONTINUOUS_DATA_MODES;
TiledTrack.call(this, view, container, obj_dict);
// Init drawables; each drawable is a copy so that config/preferences
@@ -3564,6 +3565,8 @@
};
extend(CompositeTrack.prototype, TiledTrack.prototype, {
+ display_modes: CONTINUOUS_DATA_MODES,
+
action_icons_def:
[
// Create composite track from group's tracks.
@@ -3728,7 +3731,6 @@
var ReferenceTrack = function (view) {
TiledTrack.call(this, view, { content_div: view.top_labeltrack }, { resize: false });
- this.visible_height_px = 13;
// Use offset to ensure that bases at tile edges are drawn.
this.left_offset = view.canvas_manager.char_width_px;
this.container_div.addClass("reference-track");
@@ -3741,6 +3743,10 @@
this.hide_contents();
};
extend(ReferenceTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
+ config_params: [
+ { name: 'height', default: 13 }
+ ],
+
build_header_div: function() {},
init: function() {
@@ -3796,33 +3802,25 @@
* Track displays continuous/numerical data. Track expects position data in 1-based format, i.e. wiggle format.
*/
var LineTrack = function (view, container, obj_dict) {
- var track = this;
- this.display_modes = CONTINUOUS_DATA_MODES;
this.mode = "Histogram";
TiledTrack.call(this, view, container, obj_dict);
-
- // Define track configuration
- this.config = new Config( {
- track: this,
- params: [
+};
+extend(LineTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
+ display_modes: CONTINUOUS_DATA_MODES,
+
+ config_params: [
{ key: 'name', label: 'Name', type: 'text', default_value: this.name },
{ key: 'color', label: 'Color', type: 'color', default_value: util.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: 30, hidden: true }
- ],
- saved_values: obj_dict.prefs,
- onchange: function() {
- track.set_name(track.prefs.name);
- track.request_redraw({ clear_tile_cache: true });
- }
- });
-
- this.prefs = this.config.get('values');
- this.visible_height_px = this.prefs.height;
-};
-extend(LineTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
+ ],
+
+ config_onchange: function() {
+ this.set_name(this.prefs.name);
+ this.request_draw({ clear_tile_cache: true });
+ },
/**
* Actions to be taken before drawing.
@@ -3854,35 +3852,32 @@
}
});
+/**
+ * Diagonal heatmap for showing interactions data.
+ */
var DiagonalHeatmapTrack = function (view, container, obj_dict) {
- var track = this;
- this.display_modes = ["Heatmap"];
this.mode = "Heatmap";
TiledTrack.call(this, view, container, obj_dict);
-
- // Define track configuration
- this.config = new Config( {
- track: this,
- params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
- { key: 'pos_color', label: 'Positive Color', type: 'color', default_value: "#FF8C00" },
- { key: 'neg_color', label: 'Negative Color', type: 'color', default_value: "#4169E1" },
- { key: 'min_value', label: 'Min Value', type: 'float', default_value: -1 },
- { key: 'max_value', label: 'Max Value', type: 'float', default_value: 1 },
- { key: 'mode', type: 'string', default_value: this.mode, hidden: true },
- { key: 'height', type: 'int', default_value: 500, hidden: true }
- ],
- saved_values: obj_dict.prefs,
- onchange: function() {
- track.set_name(track.prefs.name);
- this.request_redraw({ clear_tile_cache: true });
- }
- });
-
- this.prefs = this.config.get('values');
- this.visible_height_px = this.prefs.height;
};
+
extend(DiagonalHeatmapTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
+ display_modes: ["Heatmap"],
+
+ config_params: [
+ { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ { key: 'pos_color', label: 'Positive Color', type: 'color', default_value: "#FF8C00" },
+ { key: 'neg_color', label: 'Negative Color', type: 'color', default_value: "#4169E1" },
+ { key: 'min_value', label: 'Min Value', type: 'float', default_value: -1 },
+ { key: 'max_value', label: 'Max Value', type: 'float', default_value: 1 },
+ { key: 'mode', type: 'string', default_value: this.mode, hidden: true },
+ { key: 'height', type: 'int', default_value: 500, hidden: true }
+ ],
+
+ config_onchange: function() {
+ this.set_name(this.prefs.name);
+ this.request_draw({ clear_tile_cache: true });
+ },
+
/**
* Draw tile.
*/
@@ -3900,51 +3895,8 @@
* A track that displays features/regions. Track expects position data in BED format, i.e. 0-based, half-open.
*/
var FeatureTrack = function(view, container, obj_dict) {
- //
- // Preinitialization: do things that need to be done before calling Track and TiledTrack
- // initialization code.
- //
- var track = this;
- this.display_modes = ["Auto", "Coverage", "Dense", "Squish", "Pack"];
-
- //
- // Initialization.
- //
TiledTrack.call(this, view, container, obj_dict);
-
- // Define and restore track configuration.
- var
- block_color = util.get_random_color(),
- reverse_strand_color = util.get_random_color( [ block_color, "#FFFFFF" ] );
- this.config = new Config( {
- track: this,
- params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
- { key: 'block_color', label: 'Block color', type: 'color', default_value: block_color },
- { key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: reverse_strand_color },
- { key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' },
- { key: 'show_counts', label: 'Show summary counts', type: 'bool', default_value: true,
- help: 'Show the number of items in each bin when drawing summary histogram' },
- { key: 'min_value', label: 'Histogram minimum', type: 'float', default_value: null, help: 'clear value to set automatically' },
- { key: 'max_value', label: 'Histogram maximum', type: 'float', default_value: null, help: 'clear value to set automatically' },
- { key: 'connector_style', label: 'Connector style', type: 'select', default_value: 'fishbones',
- options: [ { label: 'Line with arrows', value: 'fishbone' }, { label: 'Arcs', value: 'arcs' } ] },
- { key: 'mode', type: 'string', default_value: this.mode, hidden: true },
- { key: 'height', type: 'int', default_value: this.visible_height_px, hidden: true}
- ],
- saved_values: obj_dict.prefs,
- onchange: function() {
- track.set_name(track.prefs.name);
- track.set_painter_from_config();
- track.request_draw({ clear_tile_cache: true });
- }
- });
- this.prefs = this.config.get('values');
- this.visible_height_px = this.prefs.height;
-
this.container_div.addClass( "feature-track" );
- this.show_labels_scale = 0.001;
- this.showing_details = false;
this.summary_draw_height = 30;
this.slotters = {};
this.start_end_dct = {};
@@ -3954,6 +3906,28 @@
this.set_painter_from_config();
};
extend(FeatureTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
+ display_modes: ["Auto", "Coverage", "Dense", "Squish", "Pack"],
+
+ config_params: [
+ { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ { key: 'block_color', label: 'Block color', type: 'color', default_value: util.get_random_color() },
+ { key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: util.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,
+ help: 'Show the number of items in each bin when drawing summary histogram' },
+ { key: 'min_value', label: 'Histogram minimum', type: 'float', default_value: null, help: 'clear value to set automatically' },
+ { key: 'max_value', label: 'Histogram maximum', type: 'float', default_value: null, help: 'clear value to set automatically' },
+ { key: 'connector_style', label: 'Connector style', type: 'select', default_value: 'fishbones',
+ options: [ { label: 'Line with arrows', value: 'fishbone' }, { label: 'Arcs', value: 'arcs' } ] },
+ { key: 'mode', type: 'string', default_value: this.mode, hidden: true },
+ { key: 'height', type: 'int', default_value: 0, hidden: true}
+ ],
+
+ config_onchange: function() {
+ this.set_name(this.prefs.name);
+ this.set_painter_from_config();
+ this.request_draw({ clear_tile_cache: true });
+ },
set_painter_from_config: function() {
if ( this.config.get('values').connector_style === 'arcs' ) {
@@ -4221,27 +4195,7 @@
* Displays variant data.
*/
var VariantTrack = function(view, container, obj_dict) {
- this.display_modes = ["Auto", "Coverage", "Dense", "Squish", "Pack"];
TiledTrack.call(this, view, container, obj_dict);
-
- this.config = new Config( {
- track: this,
- params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
- { key: 'color', label: 'Histogram color', type: 'color', default_value: util.get_random_color() },
- { key: 'show_sample_data', label: 'Show sample data', type: 'bool', default_value: true },
- { key: 'show_labels', label: 'Show summary and sample labels', type: 'bool', default_value: true },
- { key: 'summary_height', label: 'Locus summary height', type: 'float', default_value: 20 },
- { key: 'mode', type: 'string', default_value: this.mode, hidden: true }
- ],
- saved_values: obj_dict.prefs,
- onchange: function() {
- this.track.set_name(this.track.prefs.name);
- this.track.request_draw({ clear_tile_cache: true });
- }
- });
- this.prefs = this.config.get('values');
-
this.painter = painters.VariantPainter;
this.summary_draw_height = 30;
@@ -4251,6 +4205,22 @@
};
extend(VariantTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
+ display_modes: ["Auto", "Coverage", "Dense", "Squish", "Pack"],
+
+ config_params: [
+ { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ { key: 'color', label: 'Histogram color', type: 'color', default_value: util.get_random_color() },
+ { key: 'show_sample_data', label: 'Show sample data', type: 'bool', default_value: true },
+ { key: 'show_labels', label: 'Show summary and sample labels', type: 'bool', default_value: true },
+ { key: 'summary_height', label: 'Locus summary height', type: 'float', default_value: 20 },
+ { key: 'mode', type: 'string', default_value: this.mode, hidden: true }
+ ],
+
+ config_onchange: function() {
+ this.set_name(this.prefs.name);
+ this.request_draw({ clear_tile_cache: true });
+ },
+
/**
* Draw tile.
*/
@@ -4375,39 +4345,32 @@
* Track that displays mapped reads. Track expects position data in 1-based, closed format, i.e. SAM/BAM format.
*/
var ReadTrack = function (view, container, obj_dict) {
- FeatureTrack.call(this, view, container, obj_dict);
-
- var
- block_color = util.get_random_color(),
- reverse_strand_color = util.get_random_color( [ block_color, "#ffffff" ] );
- this.config = new Config( {
- track: this,
- params: [
- { key: 'name', label: 'Name', type: 'text', default_value: this.name },
- { key: 'block_color', label: 'Block and sense strand color', type: 'color', default_value: block_color },
- { key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: reverse_strand_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 },
- { key: 'min_value', label: 'Histogram minimum', type: 'float', default_value: null, help: 'clear value to set automatically' },
- { key: 'max_value', label: 'Histogram maximum', type: 'float', default_value: null, help: 'clear value to set automatically' }
- ],
- saved_values: obj_dict.prefs,
- onchange: function() {
- this.track.set_name(this.track.prefs.name);
- this.track.request_draw({ clear_tile_cache: true });
- }
- });
- this.prefs = this.config.get('values');
-
+ FeatureTrack.call(this, view, container, obj_dict);
// Choose painter based on whether there is reference data.
this.painter = (view.reference_track ? painters.RefBasedReadPainter : painters.ReadPainter);
-
this.update_icons();
};
-extend(ReadTrack.prototype, Drawable.prototype, TiledTrack.prototype, FeatureTrack.prototype);
+
+extend(ReadTrack.prototype, Drawable.prototype, TiledTrack.prototype, FeatureTrack.prototype, {
+ config_params: [
+ { key: 'name', label: 'Name', type: 'text', default_value: this.name },
+ { key: 'block_color', label: 'Block and sense strand color', type: 'color', default_value: util.get_random_color() },
+ { key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: util.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 },
+ { key: 'min_value', label: 'Histogram minimum', type: 'float', default_value: null, help: 'clear value to set automatically' },
+ { key: 'max_value', label: 'Histogram maximum', type: 'float', default_value: null, help: 'clear value to set automatically' },
+ { key: 'height', type: 'int', default_value: 0, hidden: true}
+ ],
+
+ config_onchange: function() {
+ this.set_name(this.prefs.name);
+ this.request_draw({ clear_tile_cache: true });
+ }
+});
/**
* Objects that can be added to a view.
https://bitbucket.org/galaxy/galaxy-central/commits/5c10579e88db/
Changeset: 5c10579e88db
User: jgoecks
Date: 2013-10-13 21:46:27
Summary: Automated merge.
Affected #: 1 file
diff -r a7837763dbaf2ec540a39c6d0c24bfae5645a1f4 -r 5c10579e88db53ed05013c4314573d3919d72e17 static/scripts/utils/galaxy.uploadbox.js
--- a/static/scripts/utils/galaxy.uploadbox.js
+++ b/static/scripts/utils/galaxy.uploadbox.js
@@ -46,6 +46,9 @@
// element
var el = null;
+ // xml request element
+ var xhr = null;
+
// attach to element
$.fn.uploadbox = function(options)
{
@@ -237,7 +240,7 @@
formData.append(opts.paramname, file, file.name);
// prepare request
- var xhr = new XMLHttpRequest();
+ xhr = new XMLHttpRequest();
// captures state changes
xhr.onreadystatechange = function()
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
12 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7eeb3d1065bf/
Changeset: 7eeb3d1065bf
User: guerler
Date: 2013-10-12 19:07:00
Summary: Fix upload box plugin
Affected #: 1 file
diff -r 34ff4b571205e3d28adcf2d553e6aa0c15364d94 -r 7eeb3d1065bf27497a2effeee135cd288edb8218 static/scripts/utils/galaxy.uploadbox.js
--- a/static/scripts/utils/galaxy.uploadbox.js
+++ b/static/scripts/utils/galaxy.uploadbox.js
@@ -46,6 +46,9 @@
// element
var el = null;
+ // xml request element
+ var xhr = null;
+
// attach to element
$.fn.uploadbox = function(options)
{
@@ -237,7 +240,7 @@
formData.append(opts.paramname, file, file.name);
// prepare request
- var xhr = new XMLHttpRequest();
+ xhr = new XMLHttpRequest();
// captures state changes
xhr.onreadystatechange = function()
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: JSHint-driven Trackster code cleanup.
by commits-noreply@bitbucket.org 11 Oct '13
by commits-noreply@bitbucket.org 11 Oct '13
11 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/34ff4b571205/
Changeset: 34ff4b571205
User: jgoecks
Date: 2013-10-11 23:27:18
Summary: JSHint-driven Trackster code cleanup.
Affected #: 1 file
diff -r 1eb4d4077a91914f0f3df70d9ce39d1087744f26 -r 34ff4b571205e3d28adcf2d553e6aa0c15364d94 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -59,10 +59,10 @@
if (container.length !== 0) {
top = container.position().top;
bottom = top + container.outerHeight();
+ var cur_container = html_elt_js_obj_dict[container.attr("id")];
if (d.offsetY < top) {
// Moving above container.
$(this).insertBefore(container);
- var cur_container = html_elt_js_obj_dict[container.attr("id")];
cur_container.remove_drawable(this_obj);
cur_container.container.add_drawable_before(this_obj, cur_container);
return;
@@ -70,7 +70,6 @@
else if (d.offsetY > bottom) {
// Moving below container.
$(this).insertAfter(container);
- var cur_container = html_elt_js_obj_dict[container.attr("id")];
cur_container.remove_drawable(this_obj);
cur_container.container.add_drawable(this_obj);
return;
@@ -368,7 +367,7 @@
*/
add_action_icon: function(name, title, css_class, on_click_fn, prepend, hide) {
var drawable = this;
- this.action_icons[name] = $("<a/>").attr("href", "javascript:void(0);").attr("title", title)
+ this.action_icons[name] = $("<a/>").attr("href", "").attr("title", title)
.addClass("icon-button").addClass(css_class).tooltip()
.click( function() { on_click_fn(drawable); } )
.appendTo(this.icons_div);
@@ -943,7 +942,7 @@
// Overview (scrollbar and overview plot) at bottom
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_close = $("<a/>").attr("href", "").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);
@@ -1129,7 +1128,7 @@
},
get_base_color: function(base) {
- return this.config.get('values')[ base.toLowerCase() + '_color' ] || this.config.get('values')[ 'n_color' ];
+ return this.config.get('values')[ base.toLowerCase() + '_color' ] || this.config.get('values').n_color;
}
});
@@ -2246,8 +2245,7 @@
var popup = popups[feature_uid];
if (!popup) {
// Create feature's popup element.
- var feature_uid = feature_data[0],
- feature_dict = {
+ var feature_dict = {
name: feature_data[3],
start: feature_data[1],
end: feature_data[2],
@@ -2263,8 +2261,8 @@
}
// Build popup.
- var popup = $("<div/>").attr("id", feature_uid).addClass("feature-popup"),
- table = $("<table/>"),
+ popup = $("<div/>").attr("id", feature_uid).addClass("feature-popup");
+ var table = $("<table/>"),
key, value, row;
for (key in feature_dict) {
value = feature_dict[key];
@@ -2572,8 +2570,8 @@
// Set modes, init mode.
this.display_modes = new_modes;
this.mode = (init_mode ? init_mode :
- (this.config && this.config.get('values')['mode'] ?
- this.config.get('values')['mode'] : this.display_modes[0])
+ (this.config && this.config.get('values').mode ?
+ this.config.get('values').mode : this.display_modes[0])
);
this.action_icons.mode_icon.attr("title", "Set display mode (now: " + this.mode + ")");
@@ -2927,7 +2925,7 @@
var track = this;
// TODO: is it necessary to store the mode in two places (.mode and track_config)?
track.mode = new_mode;
- track.config.get('values')['mode'] = new_mode;
+ track.config.get('values').mode = new_mode;
// FIXME: find a better way to get Auto data w/o clearing cache; using mode in the
// data manager would work if Auto data were checked for compatibility when a specific
// mode is chosen.
@@ -3045,7 +3043,7 @@
// Draw tiles.
while ( ( tile_index * TILE_SIZE * resolution ) < high ) {
// Get tile region.
- tile_low = Math.floor(tile_index * TILE_SIZE * resolution)
+ tile_low = Math.floor(tile_index * TILE_SIZE * resolution);
tile_region = new visualization.GenomeRegion({
chrom: this.view.chrom,
start: tile_low,
@@ -3089,12 +3087,13 @@
css_class = (type === 'max' ? 'top' : 'bottom'),
text = (type === 'max' ? 'max' : 'min'),
pref_name = (type === 'max' ? 'max_value' : 'min_value'),
- // Default action for on_change is to redraw track.
- on_change = on_change || function() {
- track.request_draw({ clear_tile_cache: true });
- },
label = this.container_div.find(".yaxislabel." + css_class);
+ // Default action for on_change is to redraw track.
+ on_change = on_change || function() {
+ track.request_draw({ clear_tile_cache: true });
+ };
+
if (label.length !== 0) {
// Label already exists, so update value.
label.text(track.prefs[pref_name]);
@@ -3198,8 +3197,6 @@
if (!options) { options = {}; }
var force = options.force,
- // Fetch data as long as data_fetch option is not set to false.
- data_fetch = !( options.data_fetch === false ),
mode = options.mode || this.mode,
resolution = 1 / w_scale,
@@ -3219,7 +3216,7 @@
}
// If not fetching data, nothing more to do because data is needed to draw tile.
- if (!data_fetch) { return null; }
+ if (options.data_fetch === false) { return null; }
// Function that returns data/Deferreds needed to draw tile.
var get_tile_data = function() {
@@ -3696,15 +3693,15 @@
TiledTrack.prototype.postdraw_actions.call(this, tiles, width, w_scale, clear_after);
// All tiles must be the same height in order to draw LineTracks, so redraw tiles as needed.
- var max_height = -1;
- for (var i = 0; i < tiles.length; i++) {
+ var max_height = -1, i;
+ for (i = 0; i < tiles.length; i++) {
var height = tiles[i].html_elt.find("canvas").height();
if (height > max_height) {
max_height = height;
}
}
- for (var i = 0; i < tiles.length; i++) {
+ for (i = 0; i < tiles.length; i++) {
var tile = tiles[i];
if (tile.html_elt.find("canvas").height() !== max_height) {
this.draw_helper(tile.region, w_scale, { force: true, height: max_height } );
@@ -3722,6 +3719,9 @@
}
});
+/**
+ * Displays reference genome data.
+ */
var ReferenceTrack = function (view) {
TiledTrack.call(this, view, { content_div: view.top_labeltrack }, { resize: false });
@@ -3953,7 +3953,7 @@
extend(FeatureTrack.prototype, Drawable.prototype, TiledTrack.prototype, {
set_painter_from_config: function() {
- if ( this.config.get('values')['connector_style'] === 'arcs' ) {
+ if ( this.config.get('values').connector_style === 'arcs' ) {
this.painter = painters.ArcLinkedFeaturePainter;
} else {
this.painter = painters.LinkedFeaturePainter;
@@ -3999,8 +3999,9 @@
// Update filtering UI.
if (track.filters_manager) {
- var filters = track.filters_manager.filters;
- for (var f = 0; f < filters.length; f++) {
+ var filters = track.filters_manager.filters,
+ f;
+ for (f = 0; f < filters.length; f++) {
filters[f].update_ui_elt();
}
@@ -4012,7 +4013,7 @@
for (i = 0; i < tiles.length; i++) {
if (tiles[i].data.length) {
example_feature = tiles[i].data[0];
- for (var f = 0; f < filters.length; f++) {
+ for (f = 0; f < filters.length; f++) {
filter = filters[f];
if ( filter.applies_to(example_feature) &&
filter.min !== filter.max ) {
@@ -4214,7 +4215,7 @@
});
/**
- * Track for displaying variant data.
+ * Displays variant data.
*/
var VariantTrack = function(view, container, obj_dict) {
this.display_modes = ["Auto", "Coverage", "Dense", "Squish", "Pack"];
@@ -4453,5 +4454,4 @@
object_from_template: object_from_template
};
-// End trackster_module encapsulation
});
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
11 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1eb4d4077a91/
Changeset: 1eb4d4077a91
User: jgoecks
Date: 2013-10-11 22:34:28
Summary: More trackster cleanup.
Affected #: 3 files
diff -r 1c714b4bea0794266dfaa10491ff8d80163aee19 -r 1eb4d4077a91914f0f3df70d9ce39d1087744f26 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -145,19 +145,12 @@
* Init constants & functions used throughout trackster.
*/
var
- // Minimum height of a track's contents; this must correspond to the .track-content's minimum height.
- MIN_TRACK_HEIGHT = 16,
- // FIXME: font size may not be static
- CHAR_HEIGHT_PX = 9,
// Padding at the top of tracks for error messages
ERROR_PADDING = 20,
// Maximum number of rows un a slotted track
MAX_FEATURE_DEPTH = 100,
// Minimum width for window for squish to be used.
MIN_SQUISH_VIEW_WIDTH = 12000,
-
- // Other constants.
-
// Number of pixels per tile, not including left offset.
TILE_SIZE = 400,
DEFAULT_DATA_QUERY_WAIT = 5000,
@@ -3732,7 +3725,7 @@
var ReferenceTrack = function (view) {
TiledTrack.call(this, view, { content_div: view.top_labeltrack }, { resize: false });
- this.visible_height_px = 12;
+ this.visible_height_px = 13;
// Use offset to ensure that bases at tile edges are drawn.
this.left_offset = view.canvas_manager.char_width_px;
this.container_div.addClass("reference-track");
@@ -4139,7 +4132,7 @@
// HACK: use dummy painter to get required height. Painter should be extended so that get_required_height
// works as a static function.
var dummy_painter = new (this.painter)(null, null, null, this.prefs, mode);
- return Math.max(MIN_TRACK_HEIGHT, dummy_painter.get_required_height(rows_required, canvas_width) );
+ return Math.max(this.min_height_px, dummy_painter.get_required_height(rows_required, canvas_width) );
}
},
diff -r 1c714b4bea0794266dfaa10491ff8d80163aee19 -r 1eb4d4077a91914f0f3df70d9ce39d1087744f26 static/style/blue/trackster.css
--- a/static/style/blue/trackster.css
+++ b/static/style/blue/trackster.css
@@ -42,7 +42,7 @@
.label-track{font-size:10px;border:none;padding:0;margin:0;height:1.5em;overflow:hidden}
.label-track .label{border-left:solid #999 1px;padding:1px;padding-bottom:2px;display:inline-block}
.label-track .track-content{border:none}
-.reference-track{border:none;margin:0;padding:0}
+.reference-track{border:none;margin:0;padding:0;line-height:1}
.right-float{float:right;margin-left:5px}
.top-labeltrack{position:relative;border-bottom:solid #999 1px}
.nav-labeltrack{border-top:solid #999 1px;border-bottom:solid #333 1px}
diff -r 1c714b4bea0794266dfaa10491ff8d80163aee19 -r 1eb4d4077a91914f0f3df70d9ce39d1087744f26 static/style/src/less/trackster.less
--- a/static/style/src/less/trackster.less
+++ b/static/style/src/less/trackster.less
@@ -283,6 +283,8 @@
border: none;
margin: 0;
padding: 0;
+ // Override Galaxy defaults.
+ line-height: 1;
}
.right-float {
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