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: Fix for removed galaxy.css
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/1c714b4bea07/
Changeset: 1c714b4bea07
User: guerler
Date: 2013-10-11 22:09:16
Summary: Fix for removed galaxy.css
Affected #: 6 files
diff -r a221a2734261849a49a0f42af6473d4fed06075d -r 1c714b4bea0794266dfaa10491ff8d80163aee19 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -82,20 +82,13 @@
},
- // events
- events :
- {
- 'mouseover' : 'event_mouseover',
- 'mouseleave' : 'event_mouseleave'
- },
-
// mouse over
- event_mouseover : function (e)
+ event_dragover : function (e)
{
},
// mouse left
- event_mouseleave : function (e)
+ event_dragleave : function (e)
{
},
@@ -420,8 +413,8 @@
var self = this;
this.uploadbox = this.$el.uploadbox(
{
- dragover : self.event_mouseover,
- dragleave : self.event_mouseleave,
+ dragover : function() { self.event_dragover() },
+ dragleave : function() { self.event_dragleave() },
announce : function(index, file, message) { self.event_announce(index, file, message) },
initialize : function(index, file, message) { return self.event_initialize(index, file, message) },
success : function(index, file, message) { self.event_success(index, file, message) },
diff -r a221a2734261849a49a0f42af6473d4fed06075d -r 1c714b4bea0794266dfaa10491ff8d80163aee19 static/scripts/packed/galaxy.upload.js
--- a/static/scripts/packed/galaxy.upload.js
+++ b/static/scripts/packed/galaxy.upload.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","galaxy.master","utils/galaxy.utils","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,d,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{auto:"Auto-detect"},state:{init:"fa-icon-trash",queued:"fa-icon-spinner fa-icon-spin",running:"__running__",success:"fa-icon-ok",error:"fa-icon-warning-sign"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}var e=this;this.button_show=new d.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){e.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show);var e=this;c.jsonFromUrl(galaxy_config.root+"api/datatypes",function(g){for(key in g){var f=g[key];e.select_extension[f]=f}})},events:{mouseover:"event_mouseover",mouseleave:"event_mouseleave"},event_mouseover:function(f){},event_mouseleave:function(f){},event_announce:function(f,g,i){var j="#upload-"+f;$(this.el).find("tbody:last").append(this.template_row(j,this.select_extension));var h=this.get_upload_item(f);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var e=this;h.find("#symbol").on("click",function(){e.event_remove(f)});this.event_progress(f,g,0);this.counter.announce++;this.update_screen()},event_initialize:function(g,h,k){this.button_show.number(this.counter.announce);var i=this.get_upload_item(g);var l=i.find("#symbol");l.addClass(this.state.running);var e=Galaxy.currHistoryPanel.model.get("id");var f=i.find("#extension").val();var j=i.find("#space_to_tabs").is(":checked");this.uploadbox.configure({url:galaxy_config.root+"api/tools/",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey="?";tool_input.file_type=f;tool_input["files_0|NAME"]=h.name;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=j;data={};data.history_id=e;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refresh()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.upload()},event_pause:function(){if(this.counter.running==0){return}this.uploadbox.pause();$("#upload-info").html("Queueing will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Upload:function(){f.event_upload()},Pause:function(){f.event_pause()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()}},height:"350"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:f.event_mouseover,dragleave:f.event_mouseleave,announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{e=e*10;f="b"}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select")}else{this.modal.disableButton("Select")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(g,f){var e='<tr id="'+g.substr(1)+'" class="upload-item"><td><div id="title" class="title"></div></td><td><div id="size" class="size"></div></td><td><select id="extension" class="extension">';for(key in f){e+='<option value="'+key+'">'+f[key]+"</option>"}e+='</select></td><td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}});
\ No newline at end of file
+define(["galaxy.modal","galaxy.master","utils/galaxy.utils","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,d,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{auto:"Auto-detect"},state:{init:"fa-icon-trash",queued:"fa-icon-spinner fa-icon-spin",running:"__running__",success:"fa-icon-ok",error:"fa-icon-warning-sign"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}var e=this;this.button_show=new d.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){e.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show);var e=this;c.jsonFromUrl(galaxy_config.root+"api/datatypes",function(g){for(key in g){var f=g[key];e.select_extension[f]=f}})},event_dragover:function(f){},event_dragleave:function(f){},event_announce:function(f,g,i){var j="#upload-"+f;$(this.el).find("tbody:last").append(this.template_row(j,this.select_extension));var h=this.get_upload_item(f);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var e=this;h.find("#symbol").on("click",function(){e.event_remove(f)});this.event_progress(f,g,0);this.counter.announce++;this.update_screen()},event_initialize:function(g,h,k){this.button_show.number(this.counter.announce);var i=this.get_upload_item(g);var l=i.find("#symbol");l.addClass(this.state.running);var e=Galaxy.currHistoryPanel.model.get("id");var f=i.find("#extension").val();var j=i.find("#space_to_tabs").is(":checked");this.uploadbox.configure({url:galaxy_config.root+"api/tools/",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey="?";tool_input.file_type=f;tool_input["files_0|NAME"]=h.name;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=j;data={};data.history_id=e;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refresh()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.upload()},event_pause:function(){if(this.counter.running==0){return}this.uploadbox.pause();$("#upload-info").html("Queueing will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Upload:function(){f.event_upload()},Pause:function(){f.event_pause()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()}},height:"350"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:function(){f.event_dragover()},dragleave:function(){f.event_dragleave()},announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{e=e*10;f="b"}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select")}else{this.modal.disableButton("Select")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(g,f){var e='<tr id="'+g.substr(1)+'" class="upload-item"><td><div id="title" class="title"></div></td><td><div id="size" class="size"></div></td><td><select id="extension" class="extension">';for(key in f){e+='<option value="'+key+'">'+f[key]+"</option>"}e+='</select></td><td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}});
\ No newline at end of file
diff -r a221a2734261849a49a0f42af6473d4fed06075d -r 1c714b4bea0794266dfaa10491ff8d80163aee19 static/scripts/packed/utils/galaxy.uploadbox.js
--- a/static/scripts/packed/utils/galaxy.uploadbox.js
+++ b/static/scripts/packed/utils/galaxy.uploadbox.js
@@ -1,1 +1,1 @@
-(function(d){jQuery.event.props.push("dataTransfer");var h={url:"",paramname:"content",maxfilesize:250,maxfilenumber:20,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(j,k,l){alert(l)},complete:function(){},error_filesize:"File exceeds 250MB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_server:"The server is unavailable.",error_toomany:"You can only queue <20 files per upload session."};var b={};var f={};var g=0;var i=0;var e=false;var a=false;var c=null;d.fn.uploadbox=function(z){b=d.extend({},h,z);c=this;c.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');c.on("drop",m);c.on("dragover",n);c.on("dragleave",u);d("#uploadbox_input").change(function(A){w(A.target.files);d(this).val("")});function m(A){if(!A.dataTransfer){return}w(A.dataTransfer.files);A.preventDefault();return false}function n(A){A.preventDefault();b.dragover.call(A)}function u(A){A.stopPropagation();b.dragleave.call(A)}function j(A){if(A.lengthComputable){b.progress(this.index,this.file,Math.round((A.loaded*100)/A.total))}}function w(C){if(e){return}for(var B=0;B<C.length;B++){if(i>=b.maxfilenumber){break}var A=String(g++);f[A]=C[B];b.announce(A,f[A],"");i++}}function p(A){if(f[A]){delete f[A];i--}}function k(){if(i==0||a){a=false;e=false;b.complete();return}else{e=true}var D=-1;for(var F in f){D=F;break}var E=f[D];p(D);var H=b.initialize(D,E);try{var B=new FileReader();var C=E.size;var A=1048576*b.maxfilesize;B.index=D;if(C<A){B.onload=function(I){o(D,E,H)};B.onerror=function(I){s(D,E,b.error_default)};B.onabort=function(I){s(D,E,b.error_default)};B.readAsDataURL(E)}else{s(D,E,b.error_filesize)}}catch(G){s(D,E,G)}}function o(A,C,D){var E=new FormData();for(var B in D){E.append(B,D[B])}E.append(b.paramname,C,C.name);var F=new XMLHttpRequest();F.onreadystatechange=function(){if(F.readyState!=F.DONE){return}var G=null;if(F.responseText){try{G=jQuery.parseJSON(F.responseText)}catch(H){G=F.responseText}}if(F.status<200||F.status>299){var I=F.statusText;if(!F.statusText){if(F.status==0){I=b.error_server}else{I=b.error_default}}s(A,C,I+" ("+F.status+")")}else{v(A,C,G)}};F.upload.index=A;F.upload.file=C;F.upload.addEventListener("progress",j,false);F.open("POST",b.url,true);F.setRequestHeader("Accept","application/json");F.setRequestHeader("Cache-Control","no-cache");F.setRequestHeader("X-Requested-With","XMLHttpRequest");F.send(E)}function v(A,B,C){b.success(A,B,C);k()}function s(A,B,C){b.error(A,B,C);k()}function t(){d("#uploadbox_input").trigger("click")}function r(A){for(A in f){p(A)}}function y(){if(!e){e=true;k()}}function x(){a=true}function l(A){b=d.extend({},b,A);return b}function q(){return window.File&&window.FileReader&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:t,remove:p,upload:y,pause:x,reset:r,configure:l,compatible:q}}})(jQuery);
\ No newline at end of file
+(function(d){jQuery.event.props.push("dataTransfer");var h={url:"",paramname:"content",maxfilesize:2048,maxfilenumber:20,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(j,k,l){alert(l)},complete:function(){},error_filesize:"File exceeds 2GB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_server:"The server is unavailable.",error_toomany:"You can only queue <20 files per upload session."};var b={};var f={};var g=0;var i=0;var e=false;var a=false;var c=null;d.fn.uploadbox=function(z){b=d.extend({},h,z);c=this;c.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');c.on("drop",m);c.on("dragover",n);c.on("dragleave",u);d("#uploadbox_input").change(function(A){w(A.target.files);d(this).val("")});function m(A){if(!A.dataTransfer){return}w(A.dataTransfer.files);A.preventDefault();return false}function n(A){A.preventDefault();b.dragover.call(A)}function u(A){A.stopPropagation();b.dragleave.call(A)}function j(A){if(A.lengthComputable){b.progress(this.index,this.file,Math.round((A.loaded*100)/A.total))}}function w(C){if(e){return}for(var B=0;B<C.length;B++){if(i>=b.maxfilenumber){break}var A=String(g++);f[A]=C[B];b.announce(A,f[A],"");i++}}function p(A){if(f[A]){delete f[A];i--}}function k(){if(i==0||a){a=false;e=false;b.complete();return}else{e=true}var D=-1;for(var F in f){D=F;break}var E=f[D];p(D);var H=b.initialize(D,E);try{var B=new FileReader();var C=E.size;var A=1048576*b.maxfilesize;B.index=D;if(C<A){B.onload=function(I){o(D,E,H)};B.onerror=function(I){s(D,E,b.error_default)};B.onabort=function(I){s(D,E,b.error_default)};B.readAsDataURL(E)}else{s(D,E,b.error_filesize)}}catch(G){s(D,E,G)}}function o(A,C,D){var E=new FormData();for(var B in D){E.append(B,D[B])}E.append(b.paramname,C,C.name);var F=new XMLHttpRequest();F.onreadystatechange=function(){if(F.readyState!=F.DONE){return}var G=null;if(F.responseText){try{G=jQuery.parseJSON(F.responseText)}catch(H){G=F.responseText}}if(F.status<200||F.status>299){var I=F.statusText;if(!F.statusText){if(F.status==0){I=b.error_server}else{I=b.error_default}}s(A,C,I+" ("+F.status+")")}else{v(A,C,G)}};F.upload.index=A;F.upload.file=C;F.upload.addEventListener("progress",j,false);F.open("POST",b.url,true);F.setRequestHeader("Accept","application/json");F.setRequestHeader("Cache-Control","no-cache");F.setRequestHeader("X-Requested-With","XMLHttpRequest");F.send(E)}function v(A,B,C){b.success(A,B,C);k()}function s(A,B,C){b.error(A,B,C);k()}function t(){d("#uploadbox_input").trigger("click")}function r(A){for(A in f){p(A)}}function y(){if(!e){e=true;k()}}function x(){a=true}function l(A){b=d.extend({},b,A);return b}function q(){return window.File&&window.FileReader&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:t,remove:p,upload:y,pause:x,reset:r,configure:l,compatible:q}}})(jQuery);
\ No newline at end of file
diff -r a221a2734261849a49a0f42af6473d4fed06075d -r 1c714b4bea0794266dfaa10491ff8d80163aee19 static/scripts/packed/viz/trackster.js
--- a/static/scripts/packed/viz/trackster.js
+++ b/static/scripts/packed/viz/trackster.js
@@ -1,1 +1,1 @@
-var ui=null;var view=null;var browser_router=null;require(["utils/galaxy.css","libs/jquery/jstorage","libs/jquery/jquery.event.drag","libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel","libs/jquery/jquery-ui","libs/jquery/select2","libs/farbtastic","libs/jquery/jquery.form","libs/jquery/jquery.rating","mvc/ui"],function(a){a.load_file("static/style/jquery.rating.css");a.load_file("static/style/autocomplete_tagging.css");a.load_file("static/style/jquery-ui/smoothness/jquery-ui.css");a.load_file("static/style/library.css");a.load_file("static/style/trackster.css")});define(["libs/backbone/backbone-relational","viz/visualization","viz/trackster_ui"],function(c,a,b){var d=Backbone.View.extend({initialize:function(){ui=new b.TracksterUI(galaxy_config.root);ui.createButtonMenu();ui.buttonMenu.$el.attr("style","float: right");$("#center .unified-panel-header-inner").append(ui.buttonMenu.$el);$("#right .unified-panel-title").append("Bookmarks");$("#right .unified-panel-icons").append("<a id='add-bookmark-button' class='icon-button menu-button plus-button' href='javascript:void(0);' title='Add bookmark'></a>");$("#right-border").click(function(){view.resize_window()});force_right_panel("hide");if(galaxy_config.app.id){this.view_existing()}else{this.view_new()}},set_up_router:function(e){browser_router=new a.TrackBrowserRouter(e);Backbone.history.start()},view_existing:function(){var e=galaxy_config.app.viz_config;view=ui.create_visualization({container:$("#center .unified-panel-body"),name:e.title,vis_id:e.vis_id,dbkey:e.dbkey},e.viewport,e.tracks,e.bookmarks,true);this.init_editor()},view_new:function(){var e=this;$.ajax({url:galaxy_config.root+"api/genomes?chrom_info=True",data:{},error:function(){alert("Couldn't create new browser.")},success:function(f){Galaxy.modal.show({title:"New Visualization",body:e.template_view_new(f),buttons:{Cancel:function(){window.location=galaxy_config.root+"visualization/list"},Create:function(){e.create_browser($("#new-title").val(),$("#new-dbkey").val());Galaxy.modal.hide()}}});if(galaxy_config.app.default_dbkey){$("#new-dbkey option[value='"+galaxy_config.app.default_dbkey+"']").attr("selected",true)}$("#new-title").focus();$("select[name='dbkey']").select2();$("#overlay").css("overflow","auto")}})},template_view_new:function(e){var g='<form id="new-browser-form" action="javascript:void(0);" method="post" onsubmit="return false;"><div class="form-row"><label for="new-title">Browser name:</label><div class="form-row-input"><input type="text" name="title" id="new-title" value="Unnamed"></input></div><div style="clear: both;"></div></div><div class="form-row"><label for="new-dbkey">Reference genome build (dbkey): </label><div class="form-row-input"><select name="dbkey" id="new-dbkey">';for(var f in e){g+='<option value="'+e[f][1]+'">'+e[f][0]+"</option>"}g+='</select></div><div style="clear: both;"></div></div><div class="form-row">Is the build not listed here? <a href="'+galaxy_config.root+'user/dbkeys?use_panels=True">Add a Custom Build</a></div></form>';return g},create_browser:function(f,e){$(document).trigger("convert_to_values");view=ui.create_visualization({container:$("#center .unified-panel-body"),name:f,dbkey:e},galaxy_config.app.gene_region);this.init_editor();view.editor=true},init_editor:function(){$("#center .unified-panel-title").text(view.name+" ("+view.dbkey+")");if(galaxy_config.app.add_dataset){$.ajax({url:galaxy_config.root+"api/datasets/"+galaxy_config.app.add_dataset,data:{hda_ldda:"hda",data_type:"track_config"},dataType:"json",success:function(e){view.add_drawable(b.object_from_template(e,view,view))}})}$("#add-bookmark-button").click(function(){var f=view.chrom+":"+view.low+"-"+view.high,e="Bookmark description";return ui.add_bookmark(f,e,true)});ui.init_keyboard_nav(view);this.set_up_router({view:view})}});return{GalaxyApp:d}});
\ No newline at end of file
+var ui=null;var view=null;var browser_router=null;require(["utils/galaxy.utils","libs/jquery/jstorage","libs/jquery/jquery.event.drag","libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel","libs/jquery/jquery-ui","libs/jquery/select2","libs/farbtastic","libs/jquery/jquery.form","libs/jquery/jquery.rating","mvc/ui"],function(a){a.cssLoadFile("static/style/jquery.rating.css");a.cssLoadFile("static/style/autocomplete_tagging.css");a.cssLoadFile("static/style/jquery-ui/smoothness/jquery-ui.css");a.cssLoadFile("static/style/library.css");a.cssLoadFile("static/style/trackster.css")});define(["libs/backbone/backbone-relational","viz/visualization","viz/trackster_ui"],function(c,a,b){var d=Backbone.View.extend({initialize:function(){ui=new b.TracksterUI(galaxy_config.root);ui.createButtonMenu();ui.buttonMenu.$el.attr("style","float: right");$("#center .unified-panel-header-inner").append(ui.buttonMenu.$el);$("#right .unified-panel-title").append("Bookmarks");$("#right .unified-panel-icons").append("<a id='add-bookmark-button' class='icon-button menu-button plus-button' href='javascript:void(0);' title='Add bookmark'></a>");$("#right-border").click(function(){view.resize_window()});force_right_panel("hide");if(galaxy_config.app.id){this.view_existing()}else{this.view_new()}},set_up_router:function(e){browser_router=new a.TrackBrowserRouter(e);Backbone.history.start()},view_existing:function(){var e=galaxy_config.app.viz_config;view=ui.create_visualization({container:$("#center .unified-panel-body"),name:e.title,vis_id:e.vis_id,dbkey:e.dbkey},e.viewport,e.tracks,e.bookmarks,true);this.init_editor()},view_new:function(){var e=this;$.ajax({url:galaxy_config.root+"api/genomes?chrom_info=True",data:{},error:function(){alert("Couldn't create new browser.")},success:function(f){Galaxy.modal.show({title:"New Visualization",body:e.template_view_new(f),buttons:{Cancel:function(){window.location=galaxy_config.root+"visualization/list"},Create:function(){e.create_browser($("#new-title").val(),$("#new-dbkey").val());Galaxy.modal.hide()}}});if(galaxy_config.app.default_dbkey){$("#new-dbkey option[value='"+galaxy_config.app.default_dbkey+"']").attr("selected",true)}$("#new-title").focus();$("select[name='dbkey']").select2();$("#overlay").css("overflow","auto")}})},template_view_new:function(e){var g='<form id="new-browser-form" action="javascript:void(0);" method="post" onsubmit="return false;"><div class="form-row"><label for="new-title">Browser name:</label><div class="form-row-input"><input type="text" name="title" id="new-title" value="Unnamed"></input></div><div style="clear: both;"></div></div><div class="form-row"><label for="new-dbkey">Reference genome build (dbkey): </label><div class="form-row-input"><select name="dbkey" id="new-dbkey">';for(var f in e){g+='<option value="'+e[f][1]+'">'+e[f][0]+"</option>"}g+='</select></div><div style="clear: both;"></div></div><div class="form-row">Is the build not listed here? <a href="'+galaxy_config.root+'user/dbkeys?use_panels=True">Add a Custom Build</a></div></form>';return g},create_browser:function(f,e){$(document).trigger("convert_to_values");view=ui.create_visualization({container:$("#center .unified-panel-body"),name:f,dbkey:e},galaxy_config.app.gene_region);this.init_editor();view.editor=true},init_editor:function(){$("#center .unified-panel-title").text(view.name+" ("+view.dbkey+")");if(galaxy_config.app.add_dataset){$.ajax({url:galaxy_config.root+"api/datasets/"+galaxy_config.app.add_dataset,data:{hda_ldda:"hda",data_type:"track_config"},dataType:"json",success:function(e){view.add_drawable(b.object_from_template(e,view,view))}})}$("#add-bookmark-button").click(function(){var f=view.chrom+":"+view.low+"-"+view.high,e="Bookmark description";return ui.add_bookmark(f,e,true)});ui.init_keyboard_nav(view);this.set_up_router({view:view})}});return{GalaxyApp:d}});
\ No newline at end of file
diff -r a221a2734261849a49a0f42af6473d4fed06075d -r 1c714b4bea0794266dfaa10491ff8d80163aee19 static/scripts/utils/galaxy.uploadbox.js
--- a/static/scripts/utils/galaxy.uploadbox.js
+++ b/static/scripts/utils/galaxy.uploadbox.js
@@ -11,7 +11,7 @@
{
url : '',
paramname : 'content',
- maxfilesize : 250,
+ maxfilesize : 2048,
maxfilenumber : 20,
dragover : function() {},
dragleave : function() {},
@@ -21,7 +21,7 @@
success : function() {},
error : function(index, file, message) { alert(message); },
complete : function() {},
- error_filesize : "File exceeds 250MB. Please use an FTP client.",
+ error_filesize : "File exceeds 2GB. Please use an FTP client.",
error_default : "Please make sure the file is available.",
error_server : "The server is unavailable.",
error_toomany : "You can only queue <20 files per upload session."
diff -r a221a2734261849a49a0f42af6473d4fed06075d -r 1c714b4bea0794266dfaa10491ff8d80163aee19 static/scripts/viz/trackster.js
--- a/static/scripts/viz/trackster.js
+++ b/static/scripts/viz/trackster.js
@@ -7,7 +7,7 @@
require(
[
// load js libraries
- 'utils/galaxy.css',
+ 'utils/galaxy.utils',
'libs/jquery/jstorage',
'libs/jquery/jquery.event.drag',
'libs/jquery/jquery.event.hover',
@@ -18,14 +18,14 @@
'libs/jquery/jquery.form',
'libs/jquery/jquery.rating',
'mvc/ui'
-], function(css)
+], function(mod_utils)
{
// load css
- css.load_file("static/style/jquery.rating.css");
- css.load_file("static/style/autocomplete_tagging.css");
- css.load_file("static/style/jquery-ui/smoothness/jquery-ui.css");
- css.load_file("static/style/library.css");
- css.load_file("static/style/trackster.css");
+ mod_utils.cssLoadFile("static/style/jquery.rating.css");
+ mod_utils.cssLoadFile("static/style/autocomplete_tagging.css");
+ mod_utils.cssLoadFile("static/style/jquery-ui/smoothness/jquery-ui.css");
+ mod_utils.cssLoadFile("static/style/library.css");
+ mod_utils.cssLoadFile("static/style/trackster.css");
});
// trackster viewer
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dan: Better handling of creating peek for tabular files when metadata is missing.
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/a221a2734261/
Changeset: a221a2734261
User: dan
Date: 2013-10-11 21:03:13
Summary: Better handling of creating peek for tabular files when metadata is missing.
Affected #: 1 file
diff -r 4eb6fc99fda92e240a1efaaf169c26effa70d429 -r a221a2734261849a49a0f42af6473d4fed06075d lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py
+++ b/lib/galaxy/datatypes/tabular.py
@@ -33,8 +33,6 @@
MetadataElement( name="column_types", default=[], desc="Column types", param=metadata.ColumnTypesParameter, readonly=True, visible=False, no_value=[] )
MetadataElement( name="column_names", default=[], desc="Column names", readonly=True, visible=False, optional=True, no_value=[] )
- def init_meta( self, dataset, copy_from=None ):
- data.Text.init_meta( self, dataset, copy_from=copy_from )
def set_meta( self, dataset, overwrite = True, skip = None, max_data_lines = 100000, max_guess_type_data_lines = None, **kwd ):
"""
Tries to determine the number of columns as well as those columns that
@@ -199,10 +197,13 @@
if not column_names and dataset.metadata.column_names:
column_names = dataset.metadata.column_names
- column_headers = [None] * dataset.metadata.columns
+ columns = dataset.metadata.columns
+ if columns is None:
+ columns = dataset.metadata.spec.columns.no_value
+ column_headers = [None] * columns
# fill in empty headers with data from column_names
- for i in range( min( dataset.metadata.columns, len( column_names ) ) ):
+ for i in range( min( columns, len( column_names ) ) ):
if column_headers[i] is None and column_names[i] is not None:
column_headers[i] = column_names[i]
@@ -213,7 +214,7 @@
i = int( getattr( dataset.metadata, name ) ) - 1
except:
i = -1
- if 0 <= i < dataset.metadata.columns and column_headers[i] is None:
+ if 0 <= i < columns and column_headers[i] is None:
column_headers[i] = column_parameter_alias.get(name, name)
out.append( '<tr>' )
@@ -236,13 +237,16 @@
try:
if not dataset.peek:
dataset.set_peek()
+ columns = dataset.metadata.columns
+ if columns is None:
+ columns = dataset.metadata.spec.columns.no_value
for line in dataset.peek.splitlines():
if line.startswith( tuple( skipchars ) ):
out.append( '<tr><td colspan="100%%">%s</td></tr>' % escape( line ) )
elif line:
elems = line.split( '\t' )
# we may have an invalid comment line or invalid data
- if len( elems ) != dataset.metadata.columns:
+ if len( elems ) != columns:
out.append( '<tr><td colspan="100%%">%s</td></tr>' % escape( line ) )
else:
out.append( '<tr>' )
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/4eb6fc99fda9/
Changeset: 4eb6fc99fda9
User: guerler
Date: 2013-10-11 20:58:57
Summary: Deactivate upload icon
Affected #: 1 file
diff -r b694170a3ad6017079a552c91bb2fd89ca1493ad -r 4eb6fc99fda92e240a1efaaf169c26effa70d429 templates/base/base_panels.mako
--- a/templates/base/base_panels.mako
+++ b/templates/base/base_panels.mako
@@ -107,7 +107,7 @@
Galaxy.master = new master.GalaxyMaster();
Galaxy.frame_manager = new frame.GalaxyFrameManager();
Galaxy.modal = new modal.GalaxyModal();
- Galaxy.upload = new upload.GalaxyUpload();
+ ##Galaxy.upload = new upload.GalaxyUpload();
});
</script></%def>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Adjustments for IE10, upload front end
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/b694170a3ad6/
Changeset: b694170a3ad6
User: guerler
Date: 2013-10-11 20:57:45
Summary: Adjustments for IE10, upload front end
Affected #: 5 files
diff -r 2157b57ca8e49985cc9c0139a9cf771115e12934 -r b694170a3ad6017079a552c91bb2fd89ca1493ad static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -529,7 +529,7 @@
'<th>Size</th>' +
'<th>Type</th>' +
'<th>Space→Tab</th>' +
- '<th>Progress</th>' +
+ '<th>Status</th>' +
'<th></th>' +
'</tr>' +
'</thead>' +
@@ -546,7 +546,7 @@
'<td><div id="title" class="title"></div></td>' +
'<td><div id="size" class="size"></div></td>' +
'<td>' +
- '<select id="extension">';
+ '<select id="extension" class="extension">';
// add file types to selection
for (key in select_extension)
diff -r 2157b57ca8e49985cc9c0139a9cf771115e12934 -r b694170a3ad6017079a552c91bb2fd89ca1493ad static/scripts/packed/galaxy.upload.js
--- a/static/scripts/packed/galaxy.upload.js
+++ b/static/scripts/packed/galaxy.upload.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","galaxy.master","utils/galaxy.utils","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,d,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{auto:"Auto-detect"},state:{init:"fa-icon-trash",queued:"fa-icon-spinner fa-icon-spin",running:"__running__",success:"fa-icon-ok",error:"fa-icon-warning-sign"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}var e=this;this.button_show=new d.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){e.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show);var e=this;c.jsonFromUrl(galaxy_config.root+"api/datatypes",function(g){for(key in g){var f=g[key];e.select_extension[f]=f}})},events:{mouseover:"event_mouseover",mouseleave:"event_mouseleave"},event_mouseover:function(f){},event_mouseleave:function(f){},event_announce:function(f,g,i){var j="#upload-"+f;$(this.el).find("tbody:last").append(this.template_row(j,this.select_extension));var h=this.get_upload_item(f);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var e=this;h.find("#symbol").on("click",function(){e.event_remove(f)});this.event_progress(f,g,0);this.counter.announce++;this.update_screen()},event_initialize:function(g,h,k){this.button_show.number(this.counter.announce);var i=this.get_upload_item(g);var l=i.find("#symbol");l.addClass(this.state.running);var e=Galaxy.currHistoryPanel.model.get("id");var f=i.find("#extension").val();var j=i.find("#space_to_tabs").is(":checked");this.uploadbox.configure({url:galaxy_config.root+"api/tools/",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey="?";tool_input.file_type=f;tool_input["files_0|NAME"]=h.name;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=j;data={};data.history_id=e;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refresh()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.upload()},event_pause:function(){if(this.counter.running==0){return}this.uploadbox.pause();$("#upload-info").html("Queueing will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Upload:function(){f.event_upload()},Pause:function(){f.event_pause()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()}},height:"350"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:f.event_mouseover,dragleave:f.event_mouseleave,announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{e=e*10;f="b"}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select")}else{this.modal.disableButton("Select")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Space→Tab</th><th>Progress</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(g,f){var e='<tr id="'+g.substr(1)+'" class="upload-item"><td><div id="title" class="title"></div></td><td><div id="size" class="size"></div></td><td><select id="extension">';for(key in f){e+='<option value="'+key+'">'+f[key]+"</option>"}e+='</select></td><td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}});
\ No newline at end of file
+define(["galaxy.modal","galaxy.master","utils/galaxy.utils","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,d,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{auto:"Auto-detect"},state:{init:"fa-icon-trash",queued:"fa-icon-spinner fa-icon-spin",running:"__running__",success:"fa-icon-ok",error:"fa-icon-warning-sign"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}var e=this;this.button_show=new d.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){e.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show);var e=this;c.jsonFromUrl(galaxy_config.root+"api/datatypes",function(g){for(key in g){var f=g[key];e.select_extension[f]=f}})},events:{mouseover:"event_mouseover",mouseleave:"event_mouseleave"},event_mouseover:function(f){},event_mouseleave:function(f){},event_announce:function(f,g,i){var j="#upload-"+f;$(this.el).find("tbody:last").append(this.template_row(j,this.select_extension));var h=this.get_upload_item(f);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var e=this;h.find("#symbol").on("click",function(){e.event_remove(f)});this.event_progress(f,g,0);this.counter.announce++;this.update_screen()},event_initialize:function(g,h,k){this.button_show.number(this.counter.announce);var i=this.get_upload_item(g);var l=i.find("#symbol");l.addClass(this.state.running);var e=Galaxy.currHistoryPanel.model.get("id");var f=i.find("#extension").val();var j=i.find("#space_to_tabs").is(":checked");this.uploadbox.configure({url:galaxy_config.root+"api/tools/",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey="?";tool_input.file_type=f;tool_input["files_0|NAME"]=h.name;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=j;data={};data.history_id=e;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refresh()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.upload()},event_pause:function(){if(this.counter.running==0){return}this.uploadbox.pause();$("#upload-info").html("Queueing will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Upload:function(){f.event_upload()},Pause:function(){f.event_pause()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()}},height:"350"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:f.event_mouseover,dragleave:f.event_mouseleave,announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{e=e*10;f="b"}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select")}else{this.modal.disableButton("Select")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(g,f){var e='<tr id="'+g.substr(1)+'" class="upload-item"><td><div id="title" class="title"></div></td><td><div id="size" class="size"></div></td><td><select id="extension" class="extension">';for(key in f){e+='<option value="'+key+'">'+f[key]+"</option>"}e+='</select></td><td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}});
\ No newline at end of file
diff -r 2157b57ca8e49985cc9c0139a9cf771115e12934 -r b694170a3ad6017079a552c91bb2fd89ca1493ad static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1125,11 +1125,12 @@
.galaxy-frame .frame .f-pin{left:6px;top:1px}
.galaxy-frame .frame .f-resize{background:#fff;width:16px;height:16px;color:#2c3143;right:0px;bottom:0px;text-align:center;line-height:16px;border:0px}
.upload-info{font-weight:normal;text-align:center}
-.upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px}.upload-box .table{width:100%}
+.upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%}
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px;paddign:0px}
-.upload-box .title{width:120px;word-wrap:break-word;font-size:11px}
-.upload-box .size{white-space:nowrap}
+.upload-box .title{width:130px;word-wrap:break-word;font-size:11px}
+.upload-box .extension{width:100px;font-size:11px}
+.upload-box .size{width:60px;white-space:nowrap}
.upload-box .info{width:130px;font-size:11px}.upload-box .info .progress{top:1px;position:relative;width:100%;padding:0px;margin:0px}.upload-box .info .progress .progress-bar{border-radius:inherit;-moz-border-radius:inherit}
.upload-box .info .progress .percentage{position:absolute;text-align:center;width:100%;color:#fff}
.upload-box .symbol{cursor:pointer}
diff -r 2157b57ca8e49985cc9c0139a9cf771115e12934 -r b694170a3ad6017079a552c91bb2fd89ca1493ad static/style/src/less/upload.less
--- a/static/style/src/less/upload.less
+++ b/static/style/src/less/upload.less
@@ -16,6 +16,8 @@
border-radius : @border-radius-large;
border : 1px dashed @btn-default-border;
padding : 10px;
+ overflow-x : hidden;
+ -ms-overflow-style: none;
.table {
width : 100%;
@@ -32,12 +34,18 @@
}
.title {
- width: 120px;
+ width: 130px;
word-wrap: break-word;
font-size : @font-size-small;
}
+ .extension {
+ width: 100px;
+ font-size : @font-size-small;
+ }
+
.size {
+ width: 60px;
white-space: nowrap;
}
diff -r 2157b57ca8e49985cc9c0139a9cf771115e12934 -r b694170a3ad6017079a552c91bb2fd89ca1493ad templates/base/base_panels.mako
--- a/templates/base/base_panels.mako
+++ b/templates/base/base_panels.mako
@@ -107,7 +107,7 @@
Galaxy.master = new master.GalaxyMaster();
Galaxy.frame_manager = new frame.GalaxyFrameManager();
Galaxy.modal = new modal.GalaxyModal();
- ##Galaxy.upload = new upload.GalaxyUpload();
+ Galaxy.upload = new upload.GalaxyUpload();
});
</script></%def>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Add datatypes to api and connect with file type selector of the upload front end
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/2157b57ca8e4/
Changeset: 2157b57ca8e4
User: guerler
Date: 2013-10-11 20:29:38
Summary: Add datatypes to api and connect with file type selector of the upload front end
Affected #: 14 files
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 lib/galaxy/webapps/galaxy/api/datatypes.py
--- /dev/null
+++ b/lib/galaxy/webapps/galaxy/api/datatypes.py
@@ -0,0 +1,25 @@
+"""
+API operations allowing clients to determine datatype supported by Galaxy.
+"""
+
+from galaxy import web
+from galaxy.web.base.controller import BaseAPIController
+from galaxy.datatypes.registry import Registry
+
+import logging
+log = logging.getLogger( __name__ )
+
+class DatatypesController( BaseAPIController ):
+ @web.expose_api
+ def index( self, trans, **kwd ):
+ """
+ GET /api/datatypes
+ Return an object containing datatypes.
+ """
+ try:
+ return trans.app.datatypes_registry.upload_file_formats
+
+ except Exception, exception:
+ log.error( 'could not get datatypes: %s', str( exception ), exc_info=True )
+ trans.response.status = 500
+ return { 'error': str( exception ) }
\ No newline at end of file
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -162,6 +162,7 @@
webapp.mapper.resource( 'workflow', 'workflows', path_prefix='/api' )
webapp.mapper.resource_with_deleted( 'history', 'histories', path_prefix='/api' )
webapp.mapper.resource( 'configuration', 'configuration', path_prefix='/api' )
+ webapp.mapper.resource( 'datatype', 'datatypes', path_prefix='/api' )
#webapp.mapper.connect( 'run_workflow', '/api/workflow/{workflow_id}/library/{library_id}', controller='workflows', action='run', workflow_id=None, library_id=None, conditions=dict(method=["GET"]) )
webapp.mapper.resource( 'search', 'search', path_prefix='/api' )
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -3,7 +3,7 @@
*/
// dependencies
-define(["galaxy.modal", "galaxy.master", "utils/galaxy.uploadbox", "libs/backbone/backbone-relational"], function(mod_modal, mod_master) {
+define(["galaxy.modal", "galaxy.master", "utils/galaxy.utils", "utils/galaxy.uploadbox", "libs/backbone/backbone-relational"], function(mod_modal, mod_master, mod_util) {
// galaxy upload
var GalaxyUpload = Backbone.View.extend(
@@ -69,6 +69,17 @@
// add to master
Galaxy.master.prepend(this.button_show);
+
+ // load extension
+ var self = this;
+ mod_util.jsonFromUrl(galaxy_config.root + "api/datatypes",
+ function(datatypes) {
+ for (key in datatypes) {
+ var filetype = datatypes[key];
+ self.select_extension[filetype] = filetype;
+ }
+ });
+
},
// events
@@ -294,9 +305,20 @@
if (this.counter.running == 0)
return;
- // initiate upload procedure in plugin
+ // request pause
this.uploadbox.pause();
-
+
+ // set html content
+ $('#upload-info').html('Queueing will pause after completing the current file...');
+ },
+
+ // queue is done
+ event_complete: function()
+ {
+ // update running
+ this.counter.running = 0;
+ this.update_screen();
+
// switch icons for new uploads
var items = $(this.el).find('.upload-item');
var self = this;
@@ -314,17 +336,6 @@
$(this).find('#space_to_tabs').attr('disabled', false);
}
});
-
- // set html content
- $('#upload-info').html('Queueing will pause after completing the current file.');
- },
-
- // queue is done
- event_complete: function()
- {
- // update running
- this.counter.running = 0;
- this.update_screen();
},
// remove all
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/packed/galaxy.upload.js
--- a/static/scripts/packed/galaxy.upload.js
+++ b/static/scripts/packed/galaxy.upload.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","galaxy.master","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{auto:"Auto-detect"},state:{init:"fa-icon-trash",queued:"fa-icon-spinner fa-icon-spin",running:"__running__",success:"fa-icon-ok",error:"fa-icon-warning-sign"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var d=this;window.setTimeout(function(){d.initialize()},500);return}var d=this;this.button_show=new c.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){d.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show)},events:{mouseover:"event_mouseover",mouseleave:"event_mouseleave"},event_mouseover:function(d){},event_mouseleave:function(d){},event_announce:function(e,f,h){var i="#upload-"+e;$(this.el).find("tbody:last").append(this.template_row(i,this.select_extension));var g=this.get_upload_item(e);g.fadeIn();g.find("#title").html(f.name);g.find("#size").html(this.size_to_string(f.size));var d=this;g.find("#symbol").on("click",function(){d.event_remove(e)});this.event_progress(e,f,0);this.counter.announce++;this.update_screen()},event_initialize:function(f,g,j){this.button_show.number(this.counter.announce);var h=this.get_upload_item(f);var k=h.find("#symbol");k.addClass(this.state.running);var d=Galaxy.currHistoryPanel.model.get("id");var e=h.find("#extension").val();var i=h.find("#space_to_tabs").is(":checked");this.uploadbox.configure({url:galaxy_config.root+"api/tools/",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey="?";tool_input.file_type=e;tool_input["files_0|NAME"]=g.name;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=i;data={};data.history_id=d;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(e,f,h){var g=this.get_upload_item(e);var d=parseInt(h);g.find(".progress-bar").css({width:d+"%"});if(d!=100){g.find("#percentage").html(d+"%")}else{g.find("#percentage").html("Adding to history...")}},event_success:function(d,e,g){Galaxy.currHistoryPanel.refresh();this.event_progress(d,e,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var f=this.get_upload_item(d);f.addClass("success");f.find("#percentage").html("100%");var h=f.find("#symbol");h.removeClass(this.state.running);h.removeClass(this.state.queued);h.addClass(this.state.success)},event_error:function(d,e,g){this.event_progress(d,e,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var f=this.get_upload_item(d);f.addClass("danger");f.find(".progress").remove();f.find("#info").html("<strong>Failed: </strong>"+g).show();var h=f.find("#symbol");h.removeClass(this.state.running);h.removeClass(this.state.queued);h.addClass(this.state.error)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var e=$(this.el).find(".upload-item");var d=this;e.each(function(){var f=$(this).find("#symbol");if(f.hasClass(d.state.init)){f.removeClass(d.state.init);f.addClass(d.state.queued);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.upload()},event_pause:function(){if(this.counter.running==0){return}this.uploadbox.pause();var e=$(this.el).find(".upload-item");var d=this;e.each(function(){var f=$(this).find("#symbol");if(f.hasClass(d.state.queued)&&!f.hasClass(d.state.running)){f.removeClass(d.state.queued);f.addClass(d.state.init);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_complete:function(){this.counter.running=0;this.update_screen()},event_reset:function(){if(this.counter.running==0){var d=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){d.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(d){var e=this.get_upload_item(d);var f=e.find("#symbol");if(f.hasClass(this.state.init)||f.hasClass(this.state.success)||f.hasClass(this.state.error)){if(e.hasClass("success")){this.counter.success--}else{if(e.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(d);e.remove()}},event_show:function(f){f.preventDefault();if(!this.modal){var d=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){d.uploadbox.select()},Upload:function(){d.event_upload()},Pause:function(){d.event_pause()},Reset:function(){d.event_reset()},Close:function(){d.modal.hide()}},height:"350"});this.setElement("#upload-box");var d=this;this.uploadbox=this.$el.uploadbox({dragover:d.event_mouseover,dragleave:d.event_mouseleave,announce:function(e,g,h){d.event_announce(e,g,h)},initialize:function(e,g,h){return d.event_initialize(e,g,h)},success:function(e,g,h){d.event_success(e,g,h)},progress:function(e,g,h){d.event_progress(e,g,h)},error:function(e,g,h){d.event_error(e,g,h)},complete:function(){d.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(d){return $(this.el).find("#upload-"+d)},size_to_string:function(d){var e="";if(d>=100000000000){d=d/100000000000;e="TB"}else{if(d>=100000000){d=d/100000000;e="GB"}else{if(d>=100000){d=d/100000;e="MB"}else{if(d>=100){d=d/100;e="KB"}else{d=d*10;e="b"}}}}return"<strong>"+(Math.round(d)/10)+"</strong> "+e},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select")}else{this.modal.disableButton("Select")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(e,d){return'<div id="'+e+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Space→Tab</th><th>Progress</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+d+'" class="upload-info"></h6>'},template_row:function(f,e){var d='<tr id="'+f.substr(1)+'" class="upload-item"><td><div id="title" class="title"></div></td><td><div id="size" class="size"></div></td><td><select id="extension">';for(key in e){d+='<option value="'+key+'">'+e[key]+"</option>"}d+='</select></td><td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return d}});return{GalaxyUpload:a}});
\ No newline at end of file
+define(["galaxy.modal","galaxy.master","utils/galaxy.utils","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,d,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{auto:"Auto-detect"},state:{init:"fa-icon-trash",queued:"fa-icon-spinner fa-icon-spin",running:"__running__",success:"fa-icon-ok",error:"fa-icon-warning-sign"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}var e=this;this.button_show=new d.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){e.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show);var e=this;c.jsonFromUrl(galaxy_config.root+"api/datatypes",function(g){for(key in g){var f=g[key];e.select_extension[f]=f}})},events:{mouseover:"event_mouseover",mouseleave:"event_mouseleave"},event_mouseover:function(f){},event_mouseleave:function(f){},event_announce:function(f,g,i){var j="#upload-"+f;$(this.el).find("tbody:last").append(this.template_row(j,this.select_extension));var h=this.get_upload_item(f);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var e=this;h.find("#symbol").on("click",function(){e.event_remove(f)});this.event_progress(f,g,0);this.counter.announce++;this.update_screen()},event_initialize:function(g,h,k){this.button_show.number(this.counter.announce);var i=this.get_upload_item(g);var l=i.find("#symbol");l.addClass(this.state.running);var e=Galaxy.currHistoryPanel.model.get("id");var f=i.find("#extension").val();var j=i.find("#space_to_tabs").is(":checked");this.uploadbox.configure({url:galaxy_config.root+"api/tools/",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey="?";tool_input.file_type=f;tool_input["files_0|NAME"]=h.name;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=j;data={};data.history_id=e;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refresh()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.upload()},event_pause:function(){if(this.counter.running==0){return}this.uploadbox.pause();$("#upload-info").html("Queueing will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Upload:function(){f.event_upload()},Pause:function(){f.event_pause()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()}},height:"350"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:f.event_mouseover,dragleave:f.event_mouseleave,announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{e=e*10;f="b"}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select")}else{this.modal.disableButton("Select")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Space→Tab</th><th>Progress</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(g,f){var e='<tr id="'+g.substr(1)+'" class="upload-item"><td><div id="title" class="title"></div></td><td><div id="size" class="size"></div></td><td><select id="extension">';for(key in f){e+='<option value="'+key+'">'+f[key]+"</option>"}e+='</select></td><td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}});
\ No newline at end of file
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/packed/utils/galaxy.css.js
--- a/static/scripts/packed/utils/galaxy.css.js
+++ /dev/null
@@ -1,1 +0,0 @@
-define(["libs/underscore"],function(a){function b(g,d){var e=$('<div class="'+g+'"></div>');e.appendTo(":eq(0)");var f=e.css(d);e.remove();return f}function c(d){if(!$('link[href^="'+d+'"]').length){$('<link href="'+galaxy_config.root+d+'" rel="stylesheet">').appendTo("head")}}return{load_file:c,get_attribute:b}});
\ No newline at end of file
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/packed/utils/galaxy.uploadbox.js
--- a/static/scripts/packed/utils/galaxy.uploadbox.js
+++ b/static/scripts/packed/utils/galaxy.uploadbox.js
@@ -1,1 +1,1 @@
-(function(g){jQuery.event.props.push("dataTransfer");var c={url:"",paramname:"content",maxfilesize:250,maxfilenumber:20,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(i,j,k){alert(k)},complete:function(){},error_filesize:"File exceeds 250MB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_toomany:"You can only queue <20 files per upload session."};var f={};var a={};var b=0;var d=0;var h=false;var e=null;g.fn.uploadbox=function(y){f=g.extend({},c,y);e=this;e.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');e.on("drop",l);e.on("dragover",m);e.on("dragleave",t);g("#uploadbox_input").change(function(z){v(z.target.files);g(this).val("")});function l(z){if(!z.dataTransfer){return}v(z.dataTransfer.files);z.preventDefault();return false}function m(z){z.preventDefault();f.dragover.call(z)}function t(z){z.stopPropagation();f.dragleave.call(z)}function i(z){if(z.lengthComputable){f.progress(this.index,this.file,Math.round((z.loaded*100)/z.total))}}function v(B){if(h){return}for(var A=0;A<B.length;A++){if(d>=f.maxfilenumber){break}var z=String(b++);a[z]=B[A];f.announce(z,a[z],"");d++}}function o(z){if(a[z]){delete a[z];d--}}function j(){if(d==0||!h){h=false;f.complete();return}else{h=true}var C=-1;for(var E in a){C=E;break}var D=a[C];o(C);var G=f.initialize(C,D);try{var A=new FileReader();var B=D.size;var z=1048576*f.maxfilesize;A.index=C;if(B<z){A.onload=function(H){n(C,D,G)};A.onerror=function(H){r(C,D,f.error_default)};A.readAsDataURL(D)}else{r(C,D,f.error_filesize)}}catch(F){r(C,D,F)}}function n(z,B,C){var D=new FormData();for(var A in C){D.append(A,C[A])}D.append(f.paramname,B,B.name);var E=new XMLHttpRequest();E.onloadend=function(){var F=null;if(E.responseText){try{F=jQuery.parseJSON(E.responseText)}catch(G){F=E.responseText}}if(E.status<200||E.status>299){var H=E.statusText;if(!E.statusText){H=f.error_default}r(z,B,H+" (Server Code "+E.status+")")}else{u(z,B,F)}};E.upload.index=z;E.upload.file=B;E.upload.addEventListener("progress",i,false);E.open("POST",f.url,true);E.setRequestHeader("Accept","application/json");E.setRequestHeader("Cache-Control","no-cache");E.setRequestHeader("X-Requested-With","XMLHttpRequest");E.send(D)}function u(z,A,B){f.success(z,A,B);j()}function r(z,A,B){f.error(z,A,B);j()}function s(){g("#uploadbox_input").trigger("click")}function q(z){for(z in a){o(z)}}function x(){if(!h){h=true;j()}}function w(){h=false}function k(z){f=g.extend({},f,z);return f}function p(){return window.File&&window.FileReader&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:s,remove:o,upload:x,pause:w,reset:q,configure:k,compatible:p}}})(jQuery);
\ No newline at end of file
+(function(d){jQuery.event.props.push("dataTransfer");var h={url:"",paramname:"content",maxfilesize:250,maxfilenumber:20,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(j,k,l){alert(l)},complete:function(){},error_filesize:"File exceeds 250MB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_server:"The server is unavailable.",error_toomany:"You can only queue <20 files per upload session."};var b={};var f={};var g=0;var i=0;var e=false;var a=false;var c=null;d.fn.uploadbox=function(z){b=d.extend({},h,z);c=this;c.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');c.on("drop",m);c.on("dragover",n);c.on("dragleave",u);d("#uploadbox_input").change(function(A){w(A.target.files);d(this).val("")});function m(A){if(!A.dataTransfer){return}w(A.dataTransfer.files);A.preventDefault();return false}function n(A){A.preventDefault();b.dragover.call(A)}function u(A){A.stopPropagation();b.dragleave.call(A)}function j(A){if(A.lengthComputable){b.progress(this.index,this.file,Math.round((A.loaded*100)/A.total))}}function w(C){if(e){return}for(var B=0;B<C.length;B++){if(i>=b.maxfilenumber){break}var A=String(g++);f[A]=C[B];b.announce(A,f[A],"");i++}}function p(A){if(f[A]){delete f[A];i--}}function k(){if(i==0||a){a=false;e=false;b.complete();return}else{e=true}var D=-1;for(var F in f){D=F;break}var E=f[D];p(D);var H=b.initialize(D,E);try{var B=new FileReader();var C=E.size;var A=1048576*b.maxfilesize;B.index=D;if(C<A){B.onload=function(I){o(D,E,H)};B.onerror=function(I){s(D,E,b.error_default)};B.onabort=function(I){s(D,E,b.error_default)};B.readAsDataURL(E)}else{s(D,E,b.error_filesize)}}catch(G){s(D,E,G)}}function o(A,C,D){var E=new FormData();for(var B in D){E.append(B,D[B])}E.append(b.paramname,C,C.name);var F=new XMLHttpRequest();F.onreadystatechange=function(){if(F.readyState!=F.DONE){return}var G=null;if(F.responseText){try{G=jQuery.parseJSON(F.responseText)}catch(H){G=F.responseText}}if(F.status<200||F.status>299){var I=F.statusText;if(!F.statusText){if(F.status==0){I=b.error_server}else{I=b.error_default}}s(A,C,I+" ("+F.status+")")}else{v(A,C,G)}};F.upload.index=A;F.upload.file=C;F.upload.addEventListener("progress",j,false);F.open("POST",b.url,true);F.setRequestHeader("Accept","application/json");F.setRequestHeader("Cache-Control","no-cache");F.setRequestHeader("X-Requested-With","XMLHttpRequest");F.send(E)}function v(A,B,C){b.success(A,B,C);k()}function s(A,B,C){b.error(A,B,C);k()}function t(){d("#uploadbox_input").trigger("click")}function r(A){for(A in f){p(A)}}function y(){if(!e){e=true;k()}}function x(){a=true}function l(A){b=d.extend({},b,A);return b}function q(){return window.File&&window.FileReader&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:t,remove:p,upload:y,pause:x,reset:r,configure:l,compatible:q}}})(jQuery);
\ No newline at end of file
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/packed/utils/galaxy.utils.js
--- /dev/null
+++ b/static/scripts/packed/utils/galaxy.utils.js
@@ -0,0 +1,1 @@
+define(["libs/underscore"],function(c){function d(g,f,e){var h=new XMLHttpRequest();h.open("GET",g,true);h.setRequestHeader("Accept","application/json");h.setRequestHeader("Cache-Control","no-cache");h.setRequestHeader("X-Requested-With","XMLHttpRequest");h.onloadend=function(){var i=h.status;if(i==200){try{response=jQuery.parseJSON(h.responseText)}catch(j){response=h.responseText}f&&f(response)}else{e&&e(i)}};h.send()}function b(h,e){var f=$('<div class="'+h+'"></div>');f.appendTo(":eq(0)");var g=f.css(e);f.remove();return g}function a(e){if(!$('link[href^="'+e+'"]').length){$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}}return{cssLoadFile:a,cssGetAttribute:b,jsonFromUrl:d}});
\ No newline at end of file
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 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"))-ah.width()/2,ag=ao+parseInt(af.html_elt.css("top"))+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){var 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(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
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/packed/viz/visualization.js
--- a/static/scripts/packed/viz/visualization.js
+++ b/static/scripts/packed/viz/visualization.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","mvc/data","viz/trackster/util","utils/config"],function(s,i,l,o){var a=function(u,x,w,v){$.ajax({url:u,data:w,error:function(){alert("Grid failed")},success:function(y){Galaxy.modal.show({title:"Select datasets for new tracks",body:y,buttons:{Cancel:function(){Galaxy.modal.hide()},Add:function(){var z=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var A={data_type:"track_config",hda_ldda:"hda"},B=$(this).val();if($(this).attr("name")!=="id"){A.hda_ldda="ldda"}z[z.length]=$.ajax({url:x+"/"+B,data:A,dataType:"json"})});$.when.apply($,z).then(function(){var A=(arguments[0] instanceof Array?$.map(arguments,function(B){return B[0]}):[arguments[0]]);v(A)});Galaxy.modal.hide()}}})}})};var j=function(u){return("promise" in u)};var f=function(u){this.default_font=u!==undefined?u:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};s.extend(f.prototype,{load_pattern:function(u,y){var v=this.patterns,w=this.dummy_context,x=new Image();x.src=galaxy_config.root+"static/images"+y;x.onload=function(){v[u]=w.createPattern(x,"repeat")}},get_pattern:function(u){return this.patterns[u]},new_canvas:function(){var u=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(u)}u.manager=this;return u}});var q=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(u){this.clear()},get_elt:function(w){var x=this.attributes.obj_cache,y=this.attributes.key_ary,v=w.toString(),u=s.indexOf(y,function(z){return z.toString()===v});if(u!==-1){if(x[v].stale){y.splice(u,1);delete x[v]}else{this.move_key_to_end(w,u)}}return x[v]},set_elt:function(w,y){var z=this.attributes.obj_cache,A=this.attributes.key_ary,v=w.toString(),x=this.attributes.num_elements;if(!z[v]){if(A.length>=x){var u=A.shift();delete z[u.toString()]}A.push(w)}z[v]=y;return y},move_key_to_end:function(v,u){this.attributes.key_ary.splice(u,1);this.attributes.key_ary.push(v)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length},most_recently_added:function(){return this.size()===0?null:this.attributes.key_ary[this.attributes.key_ary.length-1]}});var d=q.extend({defaults:s.extend({},q.prototype.defaults,{dataset:null,genome:null,init_data:null,min_region_size:200,filters_manager:null,data_type:"data",data_mode_compatible:function(u,v){return true},can_subset:function(u){return false}}),initialize:function(u){q.prototype.initialize.call(this);var v=this.get("init_data");if(v){this.add_data(v)}},add_data:function(u){if(this.get("num_elements")<u.length){this.set("num_elements",u.length)}var v=this;s.each(u,function(w){v.set_data(w.region,w)})},data_is_ready:function(){var x=this.get("dataset"),w=$.Deferred(),u=(this.get("data_type")==="raw_data"?"state":this.get("data_type")==="data"?"converted_datasets_state":"error"),v=new l.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:x.get("hda_ldda"),data_type:u},dataType:"json"},interval:5000,success_fn:function(y){return y!=="pending"}});$.when(v.go()).then(function(y){w.resolve(y==="ok"||y==="data")});return w},search_features:function(u){var v=this.get("dataset"),w={query:u,hda_ldda:v.get("hda_ldda"),data_type:"features"};return $.getJSON(v.url(),w)},load_data:function(C,B,v,A){var y=this.get("dataset"),x={data_type:this.get("data_type"),chrom:C.get("chrom"),low:C.get("start"),high:C.get("end"),mode:B,resolution:v,hda_ldda:y.get("hda_ldda")};$.extend(x,A);var E=this.get("filters_manager");if(E){var F=[];var u=E.filters;for(var z=0;z<u.length;z++){F.push(u[z].name)}x.filter_cols=JSON.stringify(F)}var w=this,D=$.getJSON(y.url(),x,function(G){G.region=C;w.set_data(C,G)});this.set_data(C,D);return D},get_data:function(B,A,w,y){var C=this.get_elt(B);if(C&&(j(C)||this.get("data_mode_compatible")(C,A))){return C}var D=this.get("key_ary"),u=this.get("obj_cache"),v,z;for(var x=0;x<D.length;x++){v=D[x];if(v.contains(B)){z=true;C=u[v.toString()];if(j(C)||(this.get("data_mode_compatible")(C,A)&&this.get("can_subset")(C))){this.move_key_to_end(v,x);if(!j(C)){var F=this.subset_entry(C,B);this.set(B,F);C=F}return C}}}if(!z&&B.length()<this.attributes.min_region_size){var E=this.most_recently_added(),B=B.copy();if(!E||(B.get("start")>E.get("start"))){B.set("end",B.get("start")+this.attributes.min_region_size)}else{B.set("start",B.get("end")-this.attributes.min_region_size)}B.set("genome",this.attributes.genome);B.trim()}return this.load_data(B,A,w,y)},set_data:function(v,u){this.set_elt(v,u)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(C,B,x,A,y){var E=this._mark_stale(C);if(!(E&&this.get("data_mode_compatible")(E,B))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var w=C.get("start");if(y===this.DEEP_DATA_REQ){$.extend(A,{start_val:E.data.length+1})}else{if(y===this.BROAD_DATA_REQ){w=(E.max_high?E.max_high:E.data[E.data.length-1][2])+1}}var D=C.copy().set("start",w);var v=this,z=this.load_data(D,B,x,A),u=$.Deferred();this.set_data(C,u);$.when(z).then(function(F){if(F.data){F.data=E.data.concat(F.data);if(F.max_low){F.max_low=E.max_low}if(F.message){F.message=F.message.replace(/[0-9]+/,F.data.length)}}v.set_data(C,F);u.resolve(F)});return u},can_get_more_detailed_data:function(v){var u=this.get_elt(v);return(u.dataset_type==="bigwig"&&u.data.length<8000)},get_more_detailed_data:function(x,z,v,y,w){var u=this._mark_stale(x);if(!u){console.log("ERROR getting more detailed data: no current data");return}if(!w){w={}}if(u.dataset_type==="bigwig"){w.num_samples=1000*y}return this.load_data(x,z,v,w)},_mark_stale:function(v){var u=this.get_elt(v);if(!u){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),v.toString())}u.stale=true;return u},get_genome_wide_data:function(u){var w=this,y=true,x=s.map(u.get("chroms_info").chrom_info,function(A){var z=w.get_elt(new g({chrom:A.chrom,start:0,end:A.len}));if(!z){y=false}return z});if(y){return x}var v=$.Deferred();$.getJSON(this.get("dataset").url(),{data_type:"genome_data"},function(z){w.add_data(z.data);v.resolve(z.data)});return v},subset_entry:function(w,x){var u={bigwig:function(y,z){return s.filter(y,function(A){return A[0]>=z.get("start")&&A[0]<=z.get("end")})},refseq:function(z,A){var B=A.get("start")-w.region.get("start"),y=w.data.length-(w.region.get("end")-A.get("end"));return w.data.slice(B,y)}};var v=w.data;if(!w.region.same(x)&&w.dataset_type in u){v=u[w.dataset_type](w.data,x)}return{region:x,data:v,dataset_type:w.dataset_type}}});var p=d.extend({initialize:function(u){var v=new Backbone.Model();v.urlRoot=u.data_url;this.set("dataset",v)},load_data:function(w,x,u,v){return(w.length()<=100000?d.prototype.load_data.call(this,w,x,u,v):{data:null,region:w})}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(u){this.id=u.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(u){var v=s.find(this.get_chroms_info(),function(w){return w.chrom===u});return new g({chrom:v.chrom,end:v.len})},get_chrom_len:function(u){return s.find(this.get_chroms_info(),function(v){return v.chrom===u}).len}});var g=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,str_val:null,genome:null},same:function(u){return this.attributes.chrom===u.get("chrom")&&this.attributes.start===u.get("start")&&this.attributes.end===u.get("end")},initialize:function(v){if(v.from_str){var x=v.from_str.split(":"),w=x[0],u=x[1].split("-");this.set({chrom:w,start:parseInt(u[0],10),end:parseInt(u[1],10)})}this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end");this.on("change",function(){this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},this)},copy:function(){return new g({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.attributes.str_val},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(B){var v=this.get("chrom"),A=B.get("chrom"),z=this.get("start"),x=B.get("start"),y=this.get("end"),w=B.get("end"),u;if(v&&A&&v!==A){return g.overlap_results.DIF_CHROMS}if(z<x){if(y<x){u=g.overlap_results.BEFORE}else{if(y<w){u=g.overlap_results.OVERLAP_START}else{u=g.overlap_results.CONTAINS}}}else{if(z>x){if(z>w){u=g.overlap_results.AFTER}else{if(y<=w){u=g.overlap_results.CONTAINED_BY}else{u=g.overlap_results.OVERLAP_END}}}else{u=(y>=w?g.overlap_results.CONTAINS:g.overlap_results.CONTAINED_BY)}}return u},trim:function(u){if(this.attributes.start<0){this.attributes.start=0}if(this.attributes.genome){var v=this.attributes.genome.get_chrom_len(this.attributes.chrom);if(this.attributes.end>v){this.attributes.end=v-1}}return this},contains:function(u){return this.compute_overlap(u)===g.overlap_results.CONTAINS},overlaps:function(u){return s.intersection([this.compute_overlap(u)],[g.overlap_results.DIF_CHROMS,g.overlap_results.BEFORE,g.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var m=Backbone.Collection.extend({model:g});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:g}]});var r=Backbone.Collection.extend({model:e});var t=Backbone.RelationalModel.extend({relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:i.Dataset}],initialize:function(u){this.set("config",o.ConfigSettingCollection.from_config_dict(u.prefs));this.get("config").add([{key:"name",value:this.get("name")},{key:"color"}]);var v=this.get("preloaded_data");if(v){v=v.data}else{v=[]}this.set("data_manager",new d({dataset:this.get("dataset"),init_data:v}))}});var n=Backbone.RelationalModel.extend({defaults:{title:"",type:""},url:galaxy_config.root+"visualization/save",save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=n.extend({defaults:s.extend({},n.prototype.defaults,{dbkey:"",tracks:null,bookmarks:null,viewport:null}),relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:t}],add_tracks:function(u){this.get("tracks").add(u)}});var b=Backbone.Model.extend({});var h=Backbone.Router.extend({initialize:function(v){this.view=v.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var u=this;u.view.on("navigate",function(w){u.navigate(w)})},change_location:function(u){this.view.go_to(u)}});return{BackboneTrack:t,BrowserBookmark:e,BrowserBookmarkCollection:r,Cache:q,CanvasManager:f,Genome:c,GenomeDataManager:d,GenomeRegion:g,GenomeRegionCollection:m,GenomeVisualization:k,GenomeReferenceDataManager:p,TrackBrowserRouter:h,TrackConfig:b,Visualization:n,select_datasets:a}});
\ No newline at end of file
+define(["libs/underscore","mvc/data","viz/trackster/util","utils/config"],function(s,i,l,o){var a=function(u,x,w,v){$.ajax({url:u,data:w,error:function(){alert("Grid failed")},success:function(y){Galaxy.modal.show({title:"Select datasets for new tracks",body:y,buttons:{Cancel:function(){Galaxy.modal.hide()},Add:function(){var z=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var A={data_type:"track_config",hda_ldda:"hda"},B=$(this).val();if($(this).attr("name")!=="id"){A.hda_ldda="ldda"}z[z.length]=$.ajax({url:x+"/"+B,data:A,dataType:"json"})});$.when.apply($,z).then(function(){var A=(arguments[0] instanceof Array?$.map(arguments,function(B){return B[0]}):[arguments[0]]);v(A)});Galaxy.modal.hide()}}})}})};var j=function(u){return("promise" in u)};var f=function(u){this.default_font=u!==undefined?u:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};s.extend(f.prototype,{load_pattern:function(u,y){var v=this.patterns,w=this.dummy_context,x=new Image();x.src=galaxy_config.root+"static/images"+y;x.onload=function(){v[u]=w.createPattern(x,"repeat")}},get_pattern:function(u){return this.patterns[u]},new_canvas:function(){var u=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(u)}u.manager=this;return u}});var q=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(u){this.clear()},get_elt:function(w){var x=this.attributes.obj_cache,y=this.attributes.key_ary,v=w.toString(),u=s.indexOf(y,function(z){return z.toString()===v});if(u!==-1){if(x[v].stale){y.splice(u,1);delete x[v]}else{this.move_key_to_end(w,u)}}return x[v]},set_elt:function(w,y){var z=this.attributes.obj_cache,A=this.attributes.key_ary,v=w.toString(),x=this.attributes.num_elements;if(!z[v]){if(A.length>=x){var u=A.shift();delete z[u.toString()]}A.push(w)}z[v]=y;return y},move_key_to_end:function(v,u){this.attributes.key_ary.splice(u,1);this.attributes.key_ary.push(v)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length},most_recently_added:function(){return this.size()===0?null:this.attributes.key_ary[this.attributes.key_ary.length-1]}});var d=q.extend({defaults:s.extend({},q.prototype.defaults,{dataset:null,genome:null,init_data:null,min_region_size:200,filters_manager:null,data_type:"data",data_mode_compatible:function(u,v){return true},can_subset:function(u){return false}}),initialize:function(u){q.prototype.initialize.call(this);var v=this.get("init_data");if(v){this.add_data(v)}},add_data:function(u){if(this.get("num_elements")<u.length){this.set("num_elements",u.length)}var v=this;s.each(u,function(w){v.set_data(w.region,w)})},data_is_ready:function(){var x=this.get("dataset"),w=$.Deferred(),u=(this.get("data_type")==="raw_data"?"state":this.get("data_type")==="data"?"converted_datasets_state":"error"),v=new l.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:x.get("hda_ldda"),data_type:u},dataType:"json"},interval:5000,success_fn:function(y){return y!=="pending"}});$.when(v.go()).then(function(y){w.resolve(y==="ok"||y==="data")});return w},search_features:function(u){var v=this.get("dataset"),w={query:u,hda_ldda:v.get("hda_ldda"),data_type:"features"};return $.getJSON(v.url(),w)},load_data:function(C,B,v,A){var y=this.get("dataset"),x={data_type:this.get("data_type"),chrom:C.get("chrom"),low:C.get("start"),high:C.get("end"),mode:B,resolution:v,hda_ldda:y.get("hda_ldda")};$.extend(x,A);var E=this.get("filters_manager");if(E){var F=[];var u=E.filters;for(var z=0;z<u.length;z++){F.push(u[z].name)}x.filter_cols=JSON.stringify(F)}var w=this,D=$.getJSON(y.url(),x,function(G){G.region=C;w.set_data(C,G)});this.set_data(C,D);return D},get_data:function(B,A,w,y){var C=this.get_elt(B);if(C&&(j(C)||this.get("data_mode_compatible")(C,A))){return C}var D=this.get("key_ary"),u=this.get("obj_cache"),v,z;for(var x=0;x<D.length;x++){v=D[x];if(v.contains(B)){z=true;C=u[v.toString()];if(j(C)||(this.get("data_mode_compatible")(C,A)&&this.get("can_subset")(C))){this.move_key_to_end(v,x);if(!j(C)){var F=this.subset_entry(C,B);this.set(B,F);C=F}return C}}}if(!z&&B.length()<this.attributes.min_region_size){B=B.copy();var E=this.most_recently_added();if(!E||(B.get("start")>E.get("start"))){B.set("end",B.get("start")+this.attributes.min_region_size)}else{B.set("start",B.get("end")-this.attributes.min_region_size)}B.set("genome",this.attributes.genome);B.trim()}return this.load_data(B,A,w,y)},set_data:function(v,u){this.set_elt(v,u)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(C,B,x,A,y){var E=this._mark_stale(C);if(!(E&&this.get("data_mode_compatible")(E,B))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var w=C.get("start");if(y===this.DEEP_DATA_REQ){$.extend(A,{start_val:E.data.length+1})}else{if(y===this.BROAD_DATA_REQ){w=(E.max_high?E.max_high:E.data[E.data.length-1][2])+1}}var D=C.copy().set("start",w);var v=this,z=this.load_data(D,B,x,A),u=$.Deferred();this.set_data(C,u);$.when(z).then(function(F){if(F.data){F.data=E.data.concat(F.data);if(F.max_low){F.max_low=E.max_low}if(F.message){F.message=F.message.replace(/[0-9]+/,F.data.length)}}v.set_data(C,F);u.resolve(F)});return u},can_get_more_detailed_data:function(v){var u=this.get_elt(v);return(u.dataset_type==="bigwig"&&u.data.length<8000)},get_more_detailed_data:function(x,z,v,y,w){var u=this._mark_stale(x);if(!u){console.log("ERROR getting more detailed data: no current data");return}if(!w){w={}}if(u.dataset_type==="bigwig"){w.num_samples=1000*y}return this.load_data(x,z,v,w)},_mark_stale:function(v){var u=this.get_elt(v);if(!u){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),v.toString())}u.stale=true;return u},get_genome_wide_data:function(u){var w=this,y=true,x=s.map(u.get("chroms_info").chrom_info,function(A){var z=w.get_elt(new g({chrom:A.chrom,start:0,end:A.len}));if(!z){y=false}return z});if(y){return x}var v=$.Deferred();$.getJSON(this.get("dataset").url(),{data_type:"genome_data"},function(z){w.add_data(z.data);v.resolve(z.data)});return v},subset_entry:function(w,x){var u={bigwig:function(y,z){return s.filter(y,function(A){return A[0]>=z.get("start")&&A[0]<=z.get("end")})},refseq:function(z,A){var B=A.get("start")-w.region.get("start"),y=w.data.length-(w.region.get("end")-A.get("end"));return w.data.slice(B,y)}};var v=w.data;if(!w.region.same(x)&&w.dataset_type in u){v=u[w.dataset_type](w.data,x)}return{region:x,data:v,dataset_type:w.dataset_type}}});var p=d.extend({initialize:function(u){var v=new Backbone.Model();v.urlRoot=u.data_url;this.set("dataset",v)},load_data:function(w,x,u,v){return(w.length()<=100000?d.prototype.load_data.call(this,w,x,u,v):{data:null,region:w})}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(u){this.id=u.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(u){var v=s.find(this.get_chroms_info(),function(w){return w.chrom===u});return new g({chrom:v.chrom,end:v.len})},get_chrom_len:function(u){return s.find(this.get_chroms_info(),function(v){return v.chrom===u}).len}});var g=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,str_val:null,genome:null},same:function(u){return this.attributes.chrom===u.get("chrom")&&this.attributes.start===u.get("start")&&this.attributes.end===u.get("end")},initialize:function(v){if(v.from_str){var x=v.from_str.split(":"),w=x[0],u=x[1].split("-");this.set({chrom:w,start:parseInt(u[0],10),end:parseInt(u[1],10)})}this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end");this.on("change",function(){this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},this)},copy:function(){return new g({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.attributes.str_val},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(B){var v=this.get("chrom"),A=B.get("chrom"),z=this.get("start"),x=B.get("start"),y=this.get("end"),w=B.get("end"),u;if(v&&A&&v!==A){return g.overlap_results.DIF_CHROMS}if(z<x){if(y<x){u=g.overlap_results.BEFORE}else{if(y<w){u=g.overlap_results.OVERLAP_START}else{u=g.overlap_results.CONTAINS}}}else{if(z>x){if(z>w){u=g.overlap_results.AFTER}else{if(y<=w){u=g.overlap_results.CONTAINED_BY}else{u=g.overlap_results.OVERLAP_END}}}else{u=(y>=w?g.overlap_results.CONTAINS:g.overlap_results.CONTAINED_BY)}}return u},trim:function(u){if(this.attributes.start<0){this.attributes.start=0}if(this.attributes.genome){var v=this.attributes.genome.get_chrom_len(this.attributes.chrom);if(this.attributes.end>v){this.attributes.end=v-1}}return this},contains:function(u){return this.compute_overlap(u)===g.overlap_results.CONTAINS},overlaps:function(u){return s.intersection([this.compute_overlap(u)],[g.overlap_results.DIF_CHROMS,g.overlap_results.BEFORE,g.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var m=Backbone.Collection.extend({model:g});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:g}]});var r=Backbone.Collection.extend({model:e});var t=Backbone.RelationalModel.extend({relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:i.Dataset}],initialize:function(u){this.set("config",o.ConfigSettingCollection.from_config_dict(u.prefs));this.get("config").add([{key:"name",value:this.get("name")},{key:"color"}]);var v=this.get("preloaded_data");if(v){v=v.data}else{v=[]}this.set("data_manager",new d({dataset:this.get("dataset"),init_data:v}))}});var n=Backbone.RelationalModel.extend({defaults:{title:"",type:""},url:galaxy_config.root+"visualization/save",save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=n.extend({defaults:s.extend({},n.prototype.defaults,{dbkey:"",tracks:null,bookmarks:null,viewport:null}),relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:t}],add_tracks:function(u){this.get("tracks").add(u)}});var b=Backbone.Model.extend({});var h=Backbone.Router.extend({initialize:function(v){this.view=v.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var u=this;u.view.on("navigate",function(w){u.navigate(w)})},change_location:function(u){this.view.go_to(u)}});return{BackboneTrack:t,BrowserBookmark:e,BrowserBookmarkCollection:r,Cache:q,CanvasManager:f,Genome:c,GenomeDataManager:d,GenomeRegion:g,GenomeRegionCollection:m,GenomeVisualization:k,GenomeReferenceDataManager:p,TrackBrowserRouter:h,TrackConfig:b,Visualization:n,select_datasets:a}});
\ No newline at end of file
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/utils/galaxy.css.js
--- a/static/scripts/utils/galaxy.css.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Galaxy CSS utilities
-*/
-
-// dependencies
-define(["libs/underscore"], function(_) {
-
-// get css value
-function get_attribute (classname, name)
-{
- // place dummy element
- var el = $('<div class="' + classname + '"></div>');
-
- // required append
- el.appendTo(':eq(0)');
-
- // get value
- var value = el.css(name);
-
- // remove element
- el.remove();
-
- // return css value
- return value;
-}
-
-// load css
-function load_file (url)
-{
- // check if css is already available
- if (!$('link[href^="' + url + '"]').length)
- $('<link href="' + galaxy_config.root + url + '" rel="stylesheet">').appendTo('head');
-};
-
-// return
-return {
- load_file : load_file,
- get_attribute : get_attribute
-};
-
-});
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/utils/galaxy.uploadbox.js
--- a/static/scripts/utils/galaxy.uploadbox.js
+++ b/static/scripts/utils/galaxy.uploadbox.js
@@ -41,6 +41,7 @@
// indicates if queue is currently running
var queue_running = false;
+ var queue_pause = false;
// element
var el = null;
@@ -155,8 +156,9 @@
function process()
{
// validate
- if (queue_length == 0 || !queue_running)
+ if (queue_length == 0 || queue_pause)
{
+ queue_pause = false;
queue_running = false;
opts.complete();
return;
@@ -338,8 +340,8 @@
// pause upload process
function pause()
{
- // set global status variable to false
- queue_running = false;
+ // request pause
+ queue_pause = true;
}
// set options
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/scripts/utils/galaxy.utils.js
--- /dev/null
+++ b/static/scripts/utils/galaxy.utils.js
@@ -0,0 +1,73 @@
+/**
+ * Galaxy utilities comprises small functions, which at this point
+ * do not require their own classes/files
+*/
+
+// dependencies
+define(["libs/underscore"], function(_) {
+
+// generic function to recieve json from url
+function jsonFromUrl (url, successHandler, errorHandler) {
+
+ // open url
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', url, true);
+
+ // configure request
+ xhr.setRequestHeader('Accept', 'application/json');
+ xhr.setRequestHeader('Cache-Control', 'no-cache');
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+
+ // on completion
+ xhr.onloadend = function() {
+ var status = xhr.status;
+ if (status == 200) {
+ try
+ {
+ response = jQuery.parseJSON(xhr.responseText);
+ } catch (e) {
+ response = xhr.responseText;
+ }
+ successHandler && successHandler(response);
+ } else {
+ errorHandler && errorHandler(status);
+ }
+ };
+
+ // submit request
+ xhr.send();
+};
+
+// get css value
+function cssGetAttribute (classname, name) {
+ // place dummy element
+ var el = $('<div class="' + classname + '"></div>');
+
+ // required append
+ el.appendTo(':eq(0)');
+
+ // get value
+ var value = el.css(name);
+
+ // remove element
+ el.remove();
+
+ // return css value
+ return value;
+};
+
+// load css
+function cssLoadFile (url) {
+ // check if css is already available
+ if (!$('link[href^="' + url + '"]').length)
+ $('<link href="' + galaxy_config.root + url + '" rel="stylesheet">').appendTo('head');
+};
+
+// return
+return {
+ cssLoadFile : cssLoadFile,
+ cssGetAttribute : cssGetAttribute,
+ jsonFromUrl : jsonFromUrl
+};
+
+});
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1125,10 +1125,10 @@
.galaxy-frame .frame .f-pin{left:6px;top:1px}
.galaxy-frame .frame .f-resize{background:#fff;width:16px;height:16px;color:#2c3143;right:0px;bottom:0px;text-align:center;line-height:16px;border:0px}
.upload-info{font-weight:normal;text-align:center}
-.upload-box{width:100%;height:90%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px}.upload-box .table{width:100%}
+.upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px}.upload-box .table{width:100%}
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px;paddign:0px}
-.upload-box .title{width:150px;word-wrap:break-word;font-size:11px}
+.upload-box .title{width:120px;word-wrap:break-word;font-size:11px}
.upload-box .size{white-space:nowrap}
.upload-box .info{width:130px;font-size:11px}.upload-box .info .progress{top:1px;position:relative;width:100%;padding:0px;margin:0px}.upload-box .info .progress .progress-bar{border-radius:inherit;-moz-border-radius:inherit}
.upload-box .info .progress .percentage{position:absolute;text-align:center;width:100%;color:#fff}
diff -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 -r 2157b57ca8e49985cc9c0139a9cf771115e12934 static/style/src/less/upload.less
--- a/static/style/src/less/upload.less
+++ b/static/style/src/less/upload.less
@@ -7,7 +7,7 @@
.upload-box
{
width : 100%;
- height : 90%;
+ height : 95%;
text-align : center;
overflow : scroll;
font-size : @font-size-base;
@@ -32,7 +32,7 @@
}
.title {
- width: 150px;
+ width: 120px;
word-wrap: break-word;
font-size : @font-size-small;
}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dan: Unicodify dependency installation stderr and stdout
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/ac7e402af32e/
Changeset: ac7e402af32e
User: dan
Date: 2013-10-11 19:01:22
Summary: Unicodify dependency installation stderr and stdout
Affected #: 1 file
diff -r 40164a7bdea9ab383f18c82394cdb9b45bd1c50e -r ac7e402af32e98cb9a0a1e5d88f75db16dc78281 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -8,6 +8,7 @@
import shutil
import td_common_util
from contextlib import contextmanager
+from galaxy.util import unicodify
from galaxy.util.template import fill_template
from galaxy import eggs
@@ -82,9 +83,9 @@
if output.return_code:
tool_dependency.status = app.model.ToolDependency.installation_status.ERROR
if output.stderr:
- tool_dependency.error_message = str( output.stderr )[ :32768 ]
+ tool_dependency.error_message = unicodify( str( output.stderr )[ :32768 ] )
elif output.stdout:
- tool_dependency.error_message = str( output.stdout )[ :32768 ]
+ tool_dependency.error_message = unicodify( str( output.stdout )[ :32768 ] )
else:
tool_dependency.error_message = "Unknown error occurred executing shell command %s, return_code: %s" % ( str( cmd ), str( output.return_code ) )
sa_session.add( tool_dependency )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/58912b536756/
Changeset: 58912b536756
User: guerler
Date: 2013-10-11 18:04:26
Summary: Use state event listener to queue uploads
Affected #: 2 files
diff -r 6634ab26b76f8da657157e8373dc5424d0b89435 -r 58912b5367565cd73078eefab4cccb5d14b88814 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -186,10 +186,7 @@
// success
event_success : function(index, file, message)
- {
- // update galaxy history
- Galaxy.currHistoryPanel.refresh();
-
+ {
// make sure progress is shown correctly
this.event_progress(index, file, 100);
@@ -217,6 +214,9 @@
sy.removeClass(this.state.running);
sy.removeClass(this.state.queued);
sy.addClass(this.state.success);
+
+ // update galaxy history
+ Galaxy.currHistoryPanel.refresh();
},
// error
@@ -314,6 +314,9 @@
$(this).find('#space_to_tabs').attr('disabled', false);
}
});
+
+ // set html content
+ $('#upload-info').html('Queueing will pause after completing the current file.');
},
// queue is done
diff -r 6634ab26b76f8da657157e8373dc5424d0b89435 -r 58912b5367565cd73078eefab4cccb5d14b88814 static/scripts/utils/galaxy.uploadbox.js
--- a/static/scripts/utils/galaxy.uploadbox.js
+++ b/static/scripts/utils/galaxy.uploadbox.js
@@ -23,6 +23,7 @@
complete : function() {},
error_filesize : "File exceeds 250MB. Please use an FTP client.",
error_default : "Please make sure the file is available.",
+ error_server : "The server is unavailable.",
error_toomany : "You can only queue <20 files per upload session."
}
@@ -39,7 +40,7 @@
var queue_length = 0;
// indicates if queue is currently running
- var queue_status = false;
+ var queue_running = false;
// element
var el = null;
@@ -114,7 +115,7 @@
function add(files)
{
// only allow adding file if current batch is complete
- if (queue_status)
+ if (queue_running)
return;
for (var i = 0; i < files.length; i++)
@@ -154,13 +155,13 @@
function process()
{
// validate
- if (queue_length == 0 || !queue_status)
+ if (queue_length == 0 || !queue_running)
{
- queue_status = false;
+ queue_running = false;
opts.complete();
return;
} else
- queue_status = true;
+ queue_running = true;
// get an identifier from the queue
var index = -1;
@@ -204,6 +205,12 @@
{
error(index, file, opts.error_default);
};
+
+ // link abort
+ reader.onabort = function(e)
+ {
+ error(index, file, opts.error_default);
+ };
// read data
reader.readAsDataURL(file);
@@ -230,9 +237,13 @@
// prepare request
var xhr = new XMLHttpRequest();
- // onloadend
- xhr.onloadend = function()
+ // captures state changes
+ xhr.onreadystatechange = function()
{
+ // check for request completed, server connection closed
+ if (xhr.readyState != xhr.DONE)
+ return;
+
// retrieve response
var response = null;
if (xhr.responseText)
@@ -250,16 +261,20 @@
{
// format error
var text = xhr.statusText;
- if (!xhr.statusText)
- text = opts.error_default;
+ if (!xhr.statusText) {
+ if (xhr.status == 0)
+ text = opts.error_server;
+ else
+ text = opts.error_default;
+ }
// request error
- error(index, file, text + " (Server Code " + xhr.status + ")");
+ error(index, file, text + " (" + xhr.status + ")");
} else
// parse response
success(index, file, response);
}
-
+
// prepare upload progress
xhr.upload.index = index;
xhr.upload.file = file;
@@ -313,9 +328,9 @@
// initiate upload process
function upload()
{
- if (!queue_status)
+ if (!queue_running)
{
- queue_status = true;
+ queue_running = true;
process();
}
}
@@ -324,7 +339,7 @@
function pause()
{
// set global status variable to false
- queue_status = false;
+ queue_running = false;
}
// set options
https://bitbucket.org/galaxy/galaxy-central/commits/40164a7bdea9/
Changeset: 40164a7bdea9
User: guerler
Date: 2013-10-11 18:12:19
Summary: Merge
Affected #: 2 files
diff -r 58912b5367565cd73078eefab4cccb5d14b88814 -r 40164a7bdea9ab383f18c82394cdb9b45bd1c50e static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -1614,7 +1614,7 @@
initialize: function(options) {
// Restore tool visibility from state.
if (options.tool_state !== undefined) {
- this.set('hidden', options.tool_state.hidden)
+ this.set('hidden', options.tool_state.hidden);
}
// FIXME: need to restore tool values from options.tool_state
@@ -2291,8 +2291,8 @@
// parseInt strips "px" from left, top measurements. +7 so that mouse pointer does not
// overlap popup.
var
- popupX = offsetX + parseInt( tile.html_elt.css("left") ) - popup.width() / 2,
- popupY = offsetY + parseInt( tile.html_elt.css("top") ) + 7;
+ popupX = offsetX + parseInt( tile.html_elt.css("left"), 10 ) - popup.width() / 2,
+ popupY = offsetY + parseInt( tile.html_elt.css("top"), 10 ) + 7;
popup.css("left", popupX + "px").css("top", popupY + "px");
}
else if (!e.isPropagationStopped()) {
@@ -2715,20 +2715,24 @@
})
);
}
- } else if (result === "no converter") {
+ }
+ else if (result === "no converter") {
track.container_div.addClass("error");
track.tiles_div.text(DATA_NOCONVERTER);
- } else if (result === "no data" || (result.data !== undefined && (result.data === null || result.data.length === 0))) {
+ }
+ else if (result === "no data" || (result.data !== undefined && (result.data === null || result.data.length === 0))) {
track.container_div.addClass("nodata");
track.tiles_div.text(DATA_NONE);
- } else if (result === "pending") {
+ }
+ else if (result === "pending") {
track.container_div.addClass("pending");
track.tiles_div.html(DATA_PENDING);
//$("<img/>").attr("src", image_path + "/yui/rel_interstitial_loading.gif").appendTo(track.tiles_div);
setTimeout(function() { track.init(); }, track.data_query_wait);
- } else if (result === "data" || result['status'] === "data") {
- if (result['valid_chroms']) {
- track.valid_chroms = result['valid_chroms'];
+ }
+ else if (result === "data" || result.status === "data") {
+ if (result.valid_chroms) {
+ track.valid_chroms = result.valid_chroms;
track.update_icons();
}
track.tiles_div.text(DATA_OK);
@@ -3276,7 +3280,7 @@
}
drawing_modes.push(mode);
drawing_heights.push(d.get_canvas_height(data, mode, w_scale, width));
- })
+ });
var canvas = track.view.canvas_manager.new_canvas(),
tile_low = region.get('start'),
@@ -4062,10 +4066,9 @@
/**
* Update track interface to show display mode being used.
*/
- update_auto_mode: function( mode ) {
- var mode;
- if ( this.mode === "Auto" ) {
- if ( mode === "no_detail" ) {
+ update_auto_mode: function(mode) {
+ if (this.mode === "Auto") {
+ if (mode === "no_detail") {
mode = "feature spans";
}
this.action_icons.mode_icon.attr("title", "Set display mode (now: Auto/" + mode + ")");
@@ -4436,10 +4439,10 @@
else {
// Template is a dictionary.
var
- drawable_type = template['obj_type'];
+ drawable_type = template.obj_type;
// For backward compatibility:
if (!drawable_type) {
- drawable_type = template['track_type'];
+ drawable_type = template.track_type;
}
return new addable_objects[ drawable_type ](view, container, template);
}
diff -r 58912b5367565cd73078eefab4cccb5d14b88814 -r 40164a7bdea9ab383f18c82394cdb9b45bd1c50e static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -1,5 +1,4 @@
-define( ["libs/underscore", "mvc/data", "viz/trackster/util", "utils/config"],
- function(_, data_mod, util_mod, config_mod) {
+define( ["libs/underscore", "mvc/data", "viz/trackster/util", "utils/config"], function(_, data_mod, util_mod, config_mod) {
/**
* Model, view, and controller objects for Galaxy visualization framework.
@@ -409,10 +408,11 @@
// This would prevent bad extensions when zooming in/out while still preserving the behavior
// below.
+ // Use copy of region to avoid changing actual region.
+ region = region.copy();
+
// Use heuristic to extend region: extend relative to last data request.
- var last_request = this.most_recently_added(),
- // Use copy of region to avoid changing actual region.
- region = region.copy();
+ var last_request = this.most_recently_added();
if (!last_request || (region.get('start') > last_request.get('start'))) {
// This request is after the last request, so extend right.
region.set('end', region.get('start') + this.attributes.min_region_size);
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: Visualization framework: 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/929576b077c9/
Changeset: 929576b077c9
User: jgoecks
Date: 2013-10-11 18:03:55
Summary: Visualization framework: code cleanup.
Affected #: 2 files
diff -r 6634ab26b76f8da657157e8373dc5424d0b89435 -r 929576b077c9e92ebfe26ae8730de791a7d4a759 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -1614,7 +1614,7 @@
initialize: function(options) {
// Restore tool visibility from state.
if (options.tool_state !== undefined) {
- this.set('hidden', options.tool_state.hidden)
+ this.set('hidden', options.tool_state.hidden);
}
// FIXME: need to restore tool values from options.tool_state
@@ -2291,8 +2291,8 @@
// parseInt strips "px" from left, top measurements. +7 so that mouse pointer does not
// overlap popup.
var
- popupX = offsetX + parseInt( tile.html_elt.css("left") ) - popup.width() / 2,
- popupY = offsetY + parseInt( tile.html_elt.css("top") ) + 7;
+ popupX = offsetX + parseInt( tile.html_elt.css("left"), 10 ) - popup.width() / 2,
+ popupY = offsetY + parseInt( tile.html_elt.css("top"), 10 ) + 7;
popup.css("left", popupX + "px").css("top", popupY + "px");
}
else if (!e.isPropagationStopped()) {
@@ -2715,20 +2715,24 @@
})
);
}
- } else if (result === "no converter") {
+ }
+ else if (result === "no converter") {
track.container_div.addClass("error");
track.tiles_div.text(DATA_NOCONVERTER);
- } else if (result === "no data" || (result.data !== undefined && (result.data === null || result.data.length === 0))) {
+ }
+ else if (result === "no data" || (result.data !== undefined && (result.data === null || result.data.length === 0))) {
track.container_div.addClass("nodata");
track.tiles_div.text(DATA_NONE);
- } else if (result === "pending") {
+ }
+ else if (result === "pending") {
track.container_div.addClass("pending");
track.tiles_div.html(DATA_PENDING);
//$("<img/>").attr("src", image_path + "/yui/rel_interstitial_loading.gif").appendTo(track.tiles_div);
setTimeout(function() { track.init(); }, track.data_query_wait);
- } else if (result === "data" || result['status'] === "data") {
- if (result['valid_chroms']) {
- track.valid_chroms = result['valid_chroms'];
+ }
+ else if (result === "data" || result.status === "data") {
+ if (result.valid_chroms) {
+ track.valid_chroms = result.valid_chroms;
track.update_icons();
}
track.tiles_div.text(DATA_OK);
@@ -3276,7 +3280,7 @@
}
drawing_modes.push(mode);
drawing_heights.push(d.get_canvas_height(data, mode, w_scale, width));
- })
+ });
var canvas = track.view.canvas_manager.new_canvas(),
tile_low = region.get('start'),
@@ -4062,10 +4066,9 @@
/**
* Update track interface to show display mode being used.
*/
- update_auto_mode: function( mode ) {
- var mode;
- if ( this.mode === "Auto" ) {
- if ( mode === "no_detail" ) {
+ update_auto_mode: function(mode) {
+ if (this.mode === "Auto") {
+ if (mode === "no_detail") {
mode = "feature spans";
}
this.action_icons.mode_icon.attr("title", "Set display mode (now: Auto/" + mode + ")");
@@ -4436,10 +4439,10 @@
else {
// Template is a dictionary.
var
- drawable_type = template['obj_type'];
+ drawable_type = template.obj_type;
// For backward compatibility:
if (!drawable_type) {
- drawable_type = template['track_type'];
+ drawable_type = template.track_type;
}
return new addable_objects[ drawable_type ](view, container, template);
}
diff -r 6634ab26b76f8da657157e8373dc5424d0b89435 -r 929576b077c9e92ebfe26ae8730de791a7d4a759 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -1,5 +1,4 @@
-define( ["libs/underscore", "mvc/data", "viz/trackster/util", "utils/config"],
- function(_, data_mod, util_mod, config_mod) {
+define( ["libs/underscore", "mvc/data", "viz/trackster/util", "utils/config"], function(_, data_mod, util_mod, config_mod) {
/**
* Model, view, and controller objects for Galaxy visualization framework.
@@ -409,10 +408,11 @@
// This would prevent bad extensions when zooming in/out while still preserving the behavior
// below.
+ // Use copy of region to avoid changing actual region.
+ region = region.copy();
+
// Use heuristic to extend region: extend relative to last data request.
- var last_request = this.most_recently_added(),
- // Use copy of region to avoid changing actual region.
- region = region.copy();
+ var last_request = this.most_recently_added();
if (!last_request || (region.get('start') > last_request.get('start'))) {
// This request is after the last request, so extend right.
region.set('end', region.get('start') + this.attributes.min_region_size);
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: Trackster: (a) fix bug that unintentionally modified drawing region; (b) more reference track cleanup; (c) remove console logging statements. Pack scripts.
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/6634ab26b76f/
Changeset: 6634ab26b76f
User: jgoecks
Date: 2013-10-11 17:53:13
Summary: Trackster: (a) fix bug that unintentionally modified drawing region; (b) more reference track cleanup; (c) remove console logging statements. Pack scripts.
Affected #: 8 files
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 static/scripts/packed/galaxy.modal.js
--- a/static/scripts/packed/galaxy.modal.js
+++ b/static/scripts/packed/galaxy.modal.js
@@ -1,1 +1,1 @@
-define(["libs/backbone/backbone-relational"],function(){var a=Backbone.View.extend({elMain:"#everything",optionsDefaults:{title:"galaxy-modal",body:"No content available."},initialize:function(b){if(b){this.create(b)}},show:function(c){this.initialize(c);var b=(this.$el).find(".modal-body");b.css("max-height",$(document).height()/2);if(this.visible){this.$el.show()}else{this.$el.fadeIn("fast")}this.visible=true},hide:function(){this.$el.fadeOut("fast");this.visible=false},create:function(c){c=_.defaults(c,this.optionsDefault);if(c.body=="progress"){c.body='<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>'}if(this.$el){this.$el.remove()}this.setElement(this.template(c.title));var b=(this.$el).find(".modal-body");var e=(this.$el).find(".modal-footer");var d=(this.$el).find(".buttons");b.append($(c.body));if(c.height){b.css("height",c.height)}if(c.buttons){$.each(c.buttons,function(f,g){d.append($('<button id="'+String(f).toLowerCase()+'"></button>').text(f).click(g)).append(" ")})}else{e.hide()}$(this.elMain).append($(this.el))},enable:function(b){$(this.el).find("#"+String(b).toLowerCase()).prop("disabled",false)},disable:function(b){$(this.el).find("#"+String(b).toLowerCase()).prop("disabled",true)},scrollTop:function(){return $(this.el).find(".modal-body").scrollTop()},template:function(b){return'<div class="modal in"><div class="modal-backdrop in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><span><h3 class="title">'+b+'</h3></span></div><div class="modal-body"></div><div class="modal-footer"><div class="buttons" style="float: right;"></div></div></div</div></div>'}});return{GalaxyModal:a}});
\ No newline at end of file
+define(["libs/backbone/backbone-relational"],function(){var a=Backbone.View.extend({elMain:"#everything",optionsDefault:{title:"galaxy-modal",body:"",backdrop:true},options:{},initialize:function(b){if(b){this.create(b)}},show:function(b){this.initialize(b);var c=$(document).height()/2;this.$body.css("max-height",c);if(this.options.height){this.$body.css("height",Math.min(this.options.height,c))}if(this.options.height){this.$body.css("overflow","hidden")}if(this.visible){this.$el.show()}else{this.$el.fadeIn("fast")}this.visible=true},hide:function(){this.$el.fadeOut("fast");this.visible=false},create:function(c){this.options=_.defaults(c,this.optionsDefault);if(this.options.body=="progress"){this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')}if(this.$el){this.$el.remove()}this.setElement(this.template(this.options.title));this.$body=(this.$el).find(".modal-body");this.$footer=(this.$el).find(".modal-footer");this.$buttons=(this.$el).find(".buttons");this.$backdrop=(this.$el).find(".modal-backdrop");this.$body.html(this.options.body);this.$body.css("min-width",this.$body.width());if(!this.options.backdrop){this.$backdrop.removeClass("in")}if(this.options.buttons){var b=this;$.each(this.options.buttons,function(d,e){b.$buttons.append($('<button id="'+String(d).toLowerCase()+'"></button>').text(d).click(e)).append(" ")})}else{this.$footer.hide()}$(this.elMain).append($(this.el))},enableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",false)},disableButton:function(b){this.$buttons.find("#"+String(b).toLowerCase()).prop("disabled",true)},scrollTop:function(){return this.$body.scrollTop()},template:function(b){return'<div class="modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+b+'</h4></div><div class="modal-body"></div><div class="modal-footer"><div class="buttons" style="float: right;"></div></div></div</div></div>'}});return{GalaxyModal:a}});
\ No newline at end of file
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 static/scripts/packed/galaxy.upload.js
--- a/static/scripts/packed/galaxy.upload.js
+++ b/static/scripts/packed/galaxy.upload.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","galaxy.master","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{"":"Auto-detect",bed:"bed",ab1:"ab1"},state:{init:"fa-icon-trash",done:"fa-icon-caret-down"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var d=this;window.setTimeout(function(){d.initialize()},500);return}var d=this;this.button_show=new c.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){d.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show)},events:{mouseover:"event_mouseover",mouseleave:"event_mouseleave"},event_mouseover:function(d){},event_mouseleave:function(d){},event_announce:function(e,f,h){var i="#upload-"+e;$(this.el).append(this.template_file(i,this.select_extension));var g=this.get_upload_item(e);g.fadeIn();g.find(".title").html(f.name);var d=this;g.find(".symbol").on("click",function(){d.event_remove(e)});this.event_progress(e,f,0);this.counter.announce++;this.update_screen()},event_initialize:function(d,e,g){this.button_show.number(this.counter.announce);var f=this.get_upload_item(d);var h={source:"upload",space_to_tabs:f.find("#space_to_tabs").is(":checked"),extension:f.find("#extension").val()};return h},event_progress:function(e,f,h){var g=this.get_upload_item(e);var d=parseInt(h);g.find(".progress-bar").css({width:d+"%"});g.find(".info").html(d+"% of "+this.size_to_string(f.size))},event_success:function(d,e,g){Galaxy.currHistoryPanel.refresh();this.event_progress(d,e,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var f=this.get_upload_item(d);f.addClass("panel-success");f.removeClass("panel-default");var h=f.find(".symbol");h.removeClass("fa-icon-spin");h.removeClass("fa-icon-spinner");h.addClass(this.state.done)},event_error:function(d,e,g){this.event_progress(d,e,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var f=this.get_upload_item(d);f.addClass("panel-danger");f.removeClass("panel-default");f.find(".progress").remove();f.find(".error").html("<strong>Failed:</strong> "+g);var h=f.find(".symbol");h.removeClass("fa-icon-spin");h.removeClass("fa-icon-spinner");h.addClass(this.state.done)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var e=this;$(this.el).find(".symbol").each(function(){if($(this).hasClass(e.state.init)){$(this).removeClass(e.state.init);$(this).addClass("fa-icon-spinner");$(this).addClass("fa-icon-spin")}});$(this.el).find(".panel-body").hide();this.counter.running=this.counter.announce;this.update_screen();var d=Galaxy.currHistoryPanel.model.get("id");this.uploadbox.configure({url:galaxy_config.root+"api/histories/"+d+"/contents"});this.uploadbox.upload()},event_complete:function(){this.counter.running=0;this.update_screen()},event_reset:function(){if(this.counter.running==0){var d=$(this.el).find(".panel");d.fadeOut({complete:function(){d.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(d){var e=this.get_upload_item(d);var f=e.find(".symbol");if(f.hasClass(this.state.init)||f.hasClass(this.state.done)){if(e.hasClass("panel-default")){this.counter.announce--}else{if(e.hasClass("panel-success")){this.counter.success--}else{if(e.hasClass("panel-danger")){this.counter.error--}}}this.update_screen();this.uploadbox.remove(d);e.remove()}},event_show:function(f){f.preventDefault();if(!this.modal){var d=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box"),buttons:{Select:function(){d.uploadbox.select()},Upload:function(){d.event_upload()},Reset:function(){d.event_reset()},Close:function(){d.modal.hide()}},height:"250px"});this.setElement("#upload-box");var d=this;this.uploadbox=this.$el.uploadbox({dragover:d.event_mouseover,dragleave:d.event_mouseleave,announce:function(e,g,h){d.event_announce(e,g,h)},initialize:function(e,g,h){return d.event_initialize(e,g,h)},success:function(e,g,h){d.event_success(e,g,h)},progress:function(e,g,h){d.event_progress(e,g,h)},error:function(e,g,h){d.event_error(e,g,h)},complete:function(){d.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(d){return $(this.el).find("#upload-"+d)},size_to_string:function(d){var e="";if(d>=100000000000){d=d/100000000000;e="TB"}else{if(d>=100000000){d=d/100000000;e="GB"}else{if(d>=100000){d=d/100000;e="MB"}else{if(d>=100){d=d/100;e="KB"}else{d=d*10;e="b"}}}}return"<strong>"+(Math.round(d)/10)+"</strong> "+e},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enable("Reset")}else{this.modal.disable("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enable("Upload")}else{this.modal.disable("Upload")}if(this.counter.running==0){this.modal.enable("Select")}else{this.modal.disable("Select")}},template:function(d){return'<div id="'+d+'" class="upload-box"></div><h6 id="upload-info" class="upload-info"></h6>'},template_file:function(f,e){var d='<div id="'+f.substr(1)+'" class="panel panel-default"><div class="panel-heading"><h5 class="title"></h5><h5 class="info"></h5><div class="symbol '+this.state.init+'"></div></div><div class="panel-body"><div class="menu">Select file type: <select id="extension">';for(key in e){d+='<option value="'+key+'">'+e[key]+"</option>"}d+='</select>, <span>Convert space to tabs: <input id="space_to_tabs" type="checkbox"></input></span></div></div><div class="panel-footer"><div class="progress"><div class="progress-bar progress-bar-success"></div></div><h6 class="error"></h6></div></div>';return d}});return{GalaxyUpload:a}});
\ No newline at end of file
+define(["galaxy.modal","galaxy.master","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:{auto:"Auto-detect"},state:{init:"fa-icon-trash",queued:"fa-icon-spinner fa-icon-spin",running:"__running__",success:"fa-icon-ok",error:"fa-icon-warning-sign"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var d=this;window.setTimeout(function(){d.initialize()},500);return}var d=this;this.button_show=new c.GalaxyMasterIcon({icon:"fa-icon-upload",tooltip:"Upload Files",on_click:function(f){d.event_show(f)},with_number:true});Galaxy.master.prepend(this.button_show)},events:{mouseover:"event_mouseover",mouseleave:"event_mouseleave"},event_mouseover:function(d){},event_mouseleave:function(d){},event_announce:function(e,f,h){var i="#upload-"+e;$(this.el).find("tbody:last").append(this.template_row(i,this.select_extension));var g=this.get_upload_item(e);g.fadeIn();g.find("#title").html(f.name);g.find("#size").html(this.size_to_string(f.size));var d=this;g.find("#symbol").on("click",function(){d.event_remove(e)});this.event_progress(e,f,0);this.counter.announce++;this.update_screen()},event_initialize:function(f,g,j){this.button_show.number(this.counter.announce);var h=this.get_upload_item(f);var k=h.find("#symbol");k.addClass(this.state.running);var d=Galaxy.currHistoryPanel.model.get("id");var e=h.find("#extension").val();var i=h.find("#space_to_tabs").is(":checked");this.uploadbox.configure({url:galaxy_config.root+"api/tools/",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey="?";tool_input.file_type=e;tool_input["files_0|NAME"]=g.name;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=i;data={};data.history_id=d;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(e,f,h){var g=this.get_upload_item(e);var d=parseInt(h);g.find(".progress-bar").css({width:d+"%"});if(d!=100){g.find("#percentage").html(d+"%")}else{g.find("#percentage").html("Adding to history...")}},event_success:function(d,e,g){Galaxy.currHistoryPanel.refresh();this.event_progress(d,e,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var f=this.get_upload_item(d);f.addClass("success");f.find("#percentage").html("100%");var h=f.find("#symbol");h.removeClass(this.state.running);h.removeClass(this.state.queued);h.addClass(this.state.success)},event_error:function(d,e,g){this.event_progress(d,e,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var f=this.get_upload_item(d);f.addClass("danger");f.find(".progress").remove();f.find("#info").html("<strong>Failed: </strong>"+g).show();var h=f.find("#symbol");h.removeClass(this.state.running);h.removeClass(this.state.queued);h.addClass(this.state.error)},event_upload:function(){if(this.counter.announce==0||this.counter.running>0){return}var e=$(this.el).find(".upload-item");var d=this;e.each(function(){var f=$(this).find("#symbol");if(f.hasClass(d.state.init)){f.removeClass(d.state.init);f.addClass(d.state.queued);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.upload()},event_pause:function(){if(this.counter.running==0){return}this.uploadbox.pause();var e=$(this.el).find(".upload-item");var d=this;e.each(function(){var f=$(this).find("#symbol");if(f.hasClass(d.state.queued)&&!f.hasClass(d.state.running)){f.removeClass(d.state.queued);f.addClass(d.state.init);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_complete:function(){this.counter.running=0;this.update_screen()},event_reset:function(){if(this.counter.running==0){var d=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){d.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(d){var e=this.get_upload_item(d);var f=e.find("#symbol");if(f.hasClass(this.state.init)||f.hasClass(this.state.success)||f.hasClass(this.state.error)){if(e.hasClass("success")){this.counter.success--}else{if(e.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(d);e.remove()}},event_show:function(f){f.preventDefault();if(!this.modal){var d=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){d.uploadbox.select()},Upload:function(){d.event_upload()},Pause:function(){d.event_pause()},Reset:function(){d.event_reset()},Close:function(){d.modal.hide()}},height:"350"});this.setElement("#upload-box");var d=this;this.uploadbox=this.$el.uploadbox({dragover:d.event_mouseover,dragleave:d.event_mouseleave,announce:function(e,g,h){d.event_announce(e,g,h)},initialize:function(e,g,h){return d.event_initialize(e,g,h)},success:function(e,g,h){d.event_success(e,g,h)},progress:function(e,g,h){d.event_progress(e,g,h)},error:function(e,g,h){d.event_error(e,g,h)},complete:function(){d.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(d){return $(this.el).find("#upload-"+d)},size_to_string:function(d){var e="";if(d>=100000000000){d=d/100000000000;e="TB"}else{if(d>=100000000){d=d/100000000;e="GB"}else{if(d>=100000){d=d/100000;e="MB"}else{if(d>=100){d=d/100;e="KB"}else{d=d*10;e="b"}}}}return"<strong>"+(Math.round(d)/10)+"</strong> "+e},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select")}else{this.modal.disableButton("Select")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(e,d){return'<div id="'+e+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Space→Tab</th><th>Progress</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+d+'" class="upload-info"></h6>'},template_row:function(f,e){var d='<tr id="'+f.substr(1)+'" class="upload-item"><td><div id="title" class="title"></div></td><td><div id="size" class="size"></div></td><td><select id="extension">';for(key in e){d+='<option value="'+key+'">'+e[key]+"</option>"}d+='</select></td><td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return d}});return{GalaxyUpload:a}});
\ No newline at end of file
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 static/scripts/packed/mvc/data.js
--- a/static/scripts/packed/mvc/data.js
+++ b/static/scripts/packed/mvc/data.js
@@ -1,1 +1,1 @@
-define(["libs/backbone/backbone-relational"],function(){var d=Backbone.RelationalModel.extend({});var e=Backbone.RelationalModel.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this.on("change",this._set_metadata,this)},_set_metadata:function(){var i=new d();_.each(_.keys(this.attributes),function(j){if(j.indexOf("metadata_")===0){var l=j.split("metadata_")[1];i.set(l,this.attributes[j]);delete this.attributes[j]}},this);this.set("metadata",i,{silent:true})},get_metadata:function(i){return this.attributes.metadata.get(i)},urlRoot:galaxy_config.root+"api/datasets"});var c=e.extend({defaults:_.extend({},e.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(i){e.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0)},get_next_chunk:function(){if(this.attributes.at_eof){return null}var i=this,j=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:i.attributes.chunk_index++}).success(function(k){var l;if(k.ck_data!==""){l=k}else{i.attributes.at_eof=true;l=null}j.resolve(l)});return j}});var g=Backbone.Collection.extend({model:e});var f=Backbone.View.extend({initialize:function(i){new b(i)},render:function(){var m=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(m);var i=this.model.get_metadata("column_names");if(i){m.append("<tr><th>"+i.join("</th><th>")+"</th></tr>")}var k=this.model.get("first_data_chunk");if(k){this._renderChunk(k)}var j=this,n=_.find(this.$el.parents(),function(o){return $(o).css("overflow")==="auto"}),l=false;if(!n){n=window}n=$(n);n.scroll(function(){if(!l&&(j.$el.height()-n.scrollTop()-n.height()<=0)){l=true;$.when(j.model.get_next_chunk()).then(function(o){if(o){j._renderChunk(o);l=false}})}});$("#loading_indicator").ajaxStart(function(){$(this).show()}).ajaxStop(function(){$(this).hide()})},_renderCell:function(l,i,m){var j=$("<td>").text(l);var k=this.model.get_metadata("column_types");if(m!==undefined){j.attr("colspan",m).addClass("stringalign")}else{if(k!==undefined&&i<k.length){if(k[i]==="str"||k==="list"){j.addClass("stringalign")}}}return j},_renderRow:function(i){var j=i.split("\t"),l=$("<tr>"),k=this.model.get_metadata("columns");if(j.length===k){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this)}else{if(j.length>k){_.each(j.slice(0,k-1),function(n,m){l.append(this._renderCell(n,m))},this);l.append(this._renderCell(j.slice(k-1).join("\t"),k-1))}else{if(k>5&&j.length===k-1){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this);l.append($("<td>"))}else{l.append(this._renderCell(i,0,k))}}}return l},_renderChunk:function(i){var j=this.$el.find("table");_.each(i.ck_data.split("\n"),function(k,l){j.append(this._renderRow(k))},this)}});var b=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(k){var j=k.model.attributes;var m=k.model.attributes.metadata.attributes;if(typeof j.data_type!=="undefined"){this.data_type=j.data_type}else{console.log("TabularButtonTrackster : Data type missing.")}if(this.data_type=="bed"){if(typeof m.chromCol!=="undefined"||typeof m.startCol!=="undefined"||typeof m.endCol!=="undefined"){this.col.chrom=m.chromCol-1;this.col.start=m.startCol-1;this.col.end=m.endCol-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.")}}if(this.data_type=="vcf"){function l(o,p){for(var n=0;n<p.length;n++){if(p[n].match(o)){return n}}return -1}this.col.chrom=l("Chrom",m.column_names);this.col.start=l("Pos",m.column_names);this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.")}}if(this.col.chrom===null){console.log("TabularButtonTrackster : Chromosome column undefined.");return}if(typeof k.model.attributes.id==="undefined"){console.log("TabularButtonTrackster : Dataset identification is missing.")}else{this.dataset_id=k.model.attributes.id}if(typeof k.model.attributes.url_viz==="undefined"){console.log("TabularButtonTrackster : Url for visualization controller is missing.")}else{this.url_viz=k.model.attributes.url_viz}if(typeof k.model.attributes.genome_build!=="undefined"){this.genome_build=k.model.attributes.genome_build}var i=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.$el.append(i.render().$el);$("#btn_viz").hide()},events:{"mouseover tr":"btn_viz_show",mouseleave:"btn_viz_hide"},btn_viz_show:function(n){function m(s){return !isNaN(parseFloat(s))&&isFinite(s)}if(this.col.chrom===null){return}var r=$(n.target).parent();var o=r.children().eq(this.col.chrom).html();var i=r.children().eq(this.col.start).html();var k=this.col.end?r.children().eq(this.col.end).html():i;if(!o.match("^#")&&o!==""&&m(i)){var q={dataset_id:this.dataset_id,gene_region:o+":"+i+"-"+k};var l=r.offset();var j=l.left-10;var p=l.top-$(window).scrollTop();$("#btn_viz").css({position:"fixed",top:p+"px",left:j+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,q,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},btn_viz_hide:function(){$("#btn_viz").hide()},create_trackster_action:function(i,k,j){return function(){var l={};if(j){l["f-dbkey"]=j}$.ajax({url:i+"/list_tracks?"+$.param(l),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(m){var n=window.parent;n.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.Galaxy.modal.hide()},"View in saved visualization":function(){n.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:m,buttons:{Cancel:function(){n.Galaxy.modal.hide()},"Add to visualization":function(){$(n.document).find("input[name=id]:checked").each(function(){n.Galaxy.modal.hide();var o=$(this).val();k.id=o;n.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:i+"/trackster?"+$.param(k)})})}}})},"View in new visualization":function(){n.Galaxy.modal.hide();var o=i+"/trackster?"+$.param(k);n.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:o})}}})}});return false}}});var a=function(l,j,m,i){var k=new j({model:new l(m)});k.render();if(i){i.append(k.$el)}return k};var h=function(k,i){var j=$("<div/>").appendTo(i);return new f({el:j,model:new c(k)}).render()};return{Dataset:e,TabularDataset:c,DatasetCollection:g,TabularDatasetChunkedView:f,createTabularDatasetChunkedView:h}});
\ No newline at end of file
+define(["libs/backbone/backbone-relational"],function(){var d=Backbone.RelationalModel.extend({});var e=Backbone.RelationalModel.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this.on("change",this._set_metadata,this)},_set_metadata:function(){var i=new d();_.each(_.keys(this.attributes),function(j){if(j.indexOf("metadata_")===0){var l=j.split("metadata_")[1];i.set(l,this.attributes[j]);delete this.attributes[j]}},this);this.set("metadata",i,{silent:true})},get_metadata:function(i){return this.attributes.metadata.get(i)},urlRoot:galaxy_config.root+"api/datasets"});var c=e.extend({defaults:_.extend({},e.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(i){e.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0)},get_next_chunk:function(){if(this.attributes.at_eof){return null}var i=this,j=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:i.attributes.chunk_index++}).success(function(k){var l;if(k.ck_data!==""){l=k}else{i.attributes.at_eof=true;l=null}j.resolve(l)});return j}});var g=Backbone.Collection.extend({model:e});var f=Backbone.View.extend({initialize:function(i){new b(i)},render:function(){var m=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(m);var i=this.model.get_metadata("column_names");if(i){m.append("<tr><th>"+i.join("</th><th>")+"</th></tr>")}var k=this.model.get("first_data_chunk");if(k){this._renderChunk(k)}var j=this,n=_.find(this.$el.parents(),function(o){return $(o).css("overflow")==="auto"}),l=false;if(!n){n=window}n=$(n);n.scroll(function(){if(!l&&(j.$el.height()-n.scrollTop()-n.height()<=0)){l=true;$.when(j.model.get_next_chunk()).then(function(o){if(o){j._renderChunk(o);l=false}})}});$("#loading_indicator").ajaxStart(function(){$(this).show()}).ajaxStop(function(){$(this).hide()})},_renderCell:function(l,i,m){var j=$("<td>").text(l);var k=this.model.get_metadata("column_types");if(m!==undefined){j.attr("colspan",m).addClass("stringalign")}else{if(k){if(i<k.length){if(k[i]==="str"||k==="list"){j.addClass("stringalign")}}}}return j},_renderRow:function(i){var j=i.split("\t"),l=$("<tr>"),k=this.model.get_metadata("columns");if(j.length===k){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this)}else{if(j.length>k){_.each(j.slice(0,k-1),function(n,m){l.append(this._renderCell(n,m))},this);l.append(this._renderCell(j.slice(k-1).join("\t"),k-1))}else{if(k>5&&j.length===k-1){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this);l.append($("<td>"))}else{l.append(this._renderCell(i,0,k))}}}return l},_renderChunk:function(i){var j=this.$el.find("table");_.each(i.ck_data.split("\n"),function(k,l){j.append(this._renderRow(k))},this)}});var b=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(k){var j=k.model.attributes;var m=k.model.attributes.metadata.attributes;if(typeof j.data_type!=="undefined"){this.data_type=j.data_type}else{console.log("TabularButtonTrackster : Data type missing.")}if(this.data_type=="bed"){if(typeof m.chromCol!=="undefined"||typeof m.startCol!=="undefined"||typeof m.endCol!=="undefined"){this.col.chrom=m.chromCol-1;this.col.start=m.startCol-1;this.col.end=m.endCol-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.")}}if(this.data_type=="vcf"){function l(o,p){for(var n=0;n<p.length;n++){if(p[n].match(o)){return n}}return -1}this.col.chrom=l("Chrom",m.column_names);this.col.start=l("Pos",m.column_names);this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.")}}if(this.col.chrom===null){console.log("TabularButtonTrackster : Chromosome column undefined.");return}if(typeof k.model.attributes.id==="undefined"){console.log("TabularButtonTrackster : Dataset identification is missing.")}else{this.dataset_id=k.model.attributes.id}if(typeof k.model.attributes.url_viz==="undefined"){console.log("TabularButtonTrackster : Url for visualization controller is missing.")}else{this.url_viz=k.model.attributes.url_viz}if(typeof k.model.attributes.genome_build!=="undefined"){this.genome_build=k.model.attributes.genome_build}var i=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.$el.append(i.render().$el);$("#btn_viz").hide()},events:{"mouseover tr":"btn_viz_show",mouseleave:"btn_viz_hide"},btn_viz_show:function(n){function m(s){return !isNaN(parseFloat(s))&&isFinite(s)}if(this.col.chrom===null){return}var r=$(n.target).parent();var o=r.children().eq(this.col.chrom).html();var i=r.children().eq(this.col.start).html();var k=this.col.end?r.children().eq(this.col.end).html():i;if(!o.match("^#")&&o!==""&&m(i)){var q={dataset_id:this.dataset_id,gene_region:o+":"+i+"-"+k};var l=r.offset();var j=l.left-10;var p=l.top-$(window).scrollTop();$("#btn_viz").css({position:"fixed",top:p+"px",left:j+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,q,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},btn_viz_hide:function(){$("#btn_viz").hide()},create_trackster_action:function(i,k,j){return function(){var l={};if(j){l["f-dbkey"]=j}$.ajax({url:i+"/list_tracks?"+$.param(l),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(m){var n=window.parent;n.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.Galaxy.modal.hide()},"View in saved visualization":function(){n.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:m,buttons:{Cancel:function(){n.Galaxy.modal.hide()},"Add to visualization":function(){$(n.document).find("input[name=id]:checked").each(function(){n.Galaxy.modal.hide();var o=$(this).val();k.id=o;n.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:i+"/trackster?"+$.param(k)})})}}})},"View in new visualization":function(){n.Galaxy.modal.hide();var o=i+"/trackster?"+$.param(k);n.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:o})}}})}});return false}}});var a=function(l,j,m,i){var k=new j({model:new l(m)});k.render();if(i){i.append(k.$el)}return k};var h=function(k,i){var j=$("<div/>").appendTo(i);return new f({el:j,model:new c(k)}).render()};return{Dataset:e,TabularDataset:c,DatasetCollection:g,TabularDatasetChunkedView:f,createTabularDatasetChunkedView:h}});
\ No newline at end of file
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 static/scripts/packed/utils/galaxy.uploadbox.js
--- a/static/scripts/packed/utils/galaxy.uploadbox.js
+++ b/static/scripts/packed/utils/galaxy.uploadbox.js
@@ -1,1 +1,1 @@
-(function(g){jQuery.event.props.push("dataTransfer");var c={url:"",paramname:"content",maxfilesize:250,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(i,j,k){alert(k)},complete:function(){},error_browser:"Your browser does not support drag-and-drop file uploads.",error_filesize:"This file is too large (>250MB). Please use an FTP client to upload it.",error_default:"Please make sure the file is available."};var f={};var a={};var b=0;var d=0;var h=false;var e=null;g.fn.uploadbox=function(x){f=g.extend({},c,x);e=this;e.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');e.on("drop",l);e.on("dragover",m);e.on("dragleave",t);g("#uploadbox_input").change(function(y){v(y.target.files);g(this).val("")});function l(y){if(!y.dataTransfer){return}v(y.dataTransfer.files);y.preventDefault();return false}function m(y){y.preventDefault();f.dragover.call(y)}function t(y){y.stopPropagation();f.dragleave.call(y)}function i(y){if(y.lengthComputable){f.progress(this.index,this.file,Math.round((y.loaded*100)/y.total))}}function v(A){if(h){return}for(var z=0;z<A.length;z++){var y=String(b++);a[y]=A[z];d++;f.announce(y,a[y],"")}}function o(y){if(a[y]){delete a[y];d--}}function j(){if(d==0){h=false;f.complete();return}else{h=true}var B=-1;for(var D in a){B=D;break}var C=a[B];o(B);var F=f.initialize(B,C);try{var z=new FileReader();var A=C.size;var y=1048576*f.maxfilesize;z.index=B;if(A<y){z.onload=function(G){n(B,C,F)};z.onerror=function(G){r(B,C,f.error_default)};z.readAsDataURL(C)}else{r(B,C,f.error_filesize)}}catch(E){r(B,C,E)}}function n(y,A,B){var C=new FormData();for(var z in B){C.append(z,B[z])}C.append(f.paramname,A,A.name);var D=new XMLHttpRequest();D.upload.index=y;D.upload.file=A;D.upload.addEventListener("progress",i,false);D.open("POST",f.url,true);D.setRequestHeader("Accept","application/json");D.setRequestHeader("Cache-Control","no-cache");D.setRequestHeader("X-Requested-With","XMLHttpRequest");D.send(C);D.onloadend=function(){var E=null;if(D.responseText){try{E=jQuery.parseJSON(D.responseText)}catch(F){E=D.responseText}}if(D.status<200||D.status>299){var G=D.statusText;if(!D.statusText){G=f.error_default}r(y,A,G+" (Server Code "+D.status+")")}else{u(y,A,E)}}}function u(y,z,A){f.success(y,z,A);j()}function r(y,z,A){f.error(y,z,A);j()}function s(){g("#uploadbox_input").trigger("click")}function q(y){for(y in a){o(y)}}function w(){if(!h){j()}}function k(y){f=g.extend({},f,y);return f}function p(){return window.File&&window.FileReader&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:s,remove:o,upload:w,reset:q,configure:k,compatible:p}}})(jQuery);
\ No newline at end of file
+(function(g){jQuery.event.props.push("dataTransfer");var c={url:"",paramname:"content",maxfilesize:250,maxfilenumber:20,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(i,j,k){alert(k)},complete:function(){},error_filesize:"File exceeds 250MB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_toomany:"You can only queue <20 files per upload session."};var f={};var a={};var b=0;var d=0;var h=false;var e=null;g.fn.uploadbox=function(y){f=g.extend({},c,y);e=this;e.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');e.on("drop",l);e.on("dragover",m);e.on("dragleave",t);g("#uploadbox_input").change(function(z){v(z.target.files);g(this).val("")});function l(z){if(!z.dataTransfer){return}v(z.dataTransfer.files);z.preventDefault();return false}function m(z){z.preventDefault();f.dragover.call(z)}function t(z){z.stopPropagation();f.dragleave.call(z)}function i(z){if(z.lengthComputable){f.progress(this.index,this.file,Math.round((z.loaded*100)/z.total))}}function v(B){if(h){return}for(var A=0;A<B.length;A++){if(d>=f.maxfilenumber){break}var z=String(b++);a[z]=B[A];f.announce(z,a[z],"");d++}}function o(z){if(a[z]){delete a[z];d--}}function j(){if(d==0||!h){h=false;f.complete();return}else{h=true}var C=-1;for(var E in a){C=E;break}var D=a[C];o(C);var G=f.initialize(C,D);try{var A=new FileReader();var B=D.size;var z=1048576*f.maxfilesize;A.index=C;if(B<z){A.onload=function(H){n(C,D,G)};A.onerror=function(H){r(C,D,f.error_default)};A.readAsDataURL(D)}else{r(C,D,f.error_filesize)}}catch(F){r(C,D,F)}}function n(z,B,C){var D=new FormData();for(var A in C){D.append(A,C[A])}D.append(f.paramname,B,B.name);var E=new XMLHttpRequest();E.onloadend=function(){var F=null;if(E.responseText){try{F=jQuery.parseJSON(E.responseText)}catch(G){F=E.responseText}}if(E.status<200||E.status>299){var H=E.statusText;if(!E.statusText){H=f.error_default}r(z,B,H+" (Server Code "+E.status+")")}else{u(z,B,F)}};E.upload.index=z;E.upload.file=B;E.upload.addEventListener("progress",i,false);E.open("POST",f.url,true);E.setRequestHeader("Accept","application/json");E.setRequestHeader("Cache-Control","no-cache");E.setRequestHeader("X-Requested-With","XMLHttpRequest");E.send(D)}function u(z,A,B){f.success(z,A,B);j()}function r(z,A,B){f.error(z,A,B);j()}function s(){g("#uploadbox_input").trigger("click")}function q(z){for(z in a){o(z)}}function x(){if(!h){h=true;j()}}function w(){h=false}function k(z){f=g.extend({},f,z);return f}function p(){return window.File&&window.FileReader&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:s,remove:o,upload:x,pause:w,reset:q,configure:k,compatible:p}}})(jQuery);
\ No newline at end of file
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 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(ac,w,j,s,L,h,X,R){var o=ac.extend;var l={};var i=function(ad,ae){l[ad.attr("id")]=ae};var k=function(ad,af,ah,ag){ah=".group";var ae={};l[ad.attr("id")]=ag;ad.bind("drag",{handle:"."+af,relative:true},function(ap,aq){var ao=$(this),au=$(this).parent(),al=au.children(),an=l[$(this).attr("id")],ak,aj,ar,ai,am;aj=$(this).parents(ah);if(aj.length!==0){ar=aj.position().top;ai=ar+aj.outerHeight();if(aq.offsetY<ar){$(this).insertBefore(aj);var at=l[aj.attr("id")];at.remove_drawable(an);at.container.add_drawable_before(an,at);return}else{if(aq.offsetY>ai){$(this).insertAfter(aj);var at=l[aj.attr("id")];at.remove_drawable(an);at.container.add_drawable(an);return}}}aj=null;for(am=0;am<al.length;am++){ak=$(al.get(am));ar=ak.position().top;ai=ar+ak.outerHeight();if(ak.is(ah)&&this!==ak.get(0)&&aq.offsetY>=ar&&aq.offsetY<=ai){if(aq.offsetY-ar<ai-aq.offsetY){ak.find(".content-div").prepend(this)}else{ak.find(".content-div").append(this)}if(an.container){an.container.remove_drawable(an)}l[ak.attr("id")].add_drawable(an);return}}for(am=0;am<al.length;am++){ak=$(al.get(am));if(aq.offsetY<ak.position().top&&!(ak.hasClass("reference-track")||ak.hasClass("intro"))){break}}if(am===al.length){if(this!==al.get(am-1)){au.append(this);l[au.attr("id")].move_drawable(an,am)}}else{if(this!==al.get(am)){$(this).insertBefore(al.get(am));l[au.attr("id")].move_drawable(an,(aq.deltaY>0?am-1:am))}}}).bind("dragstart",function(){ae["border-top"]=ad.css("border-top");ae["border-bottom"]=ad.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ae)})};var aa=16,G=9,D=20,z=100,I=12000,S=400,K=5000,v=100,m="Cannot display dataset due to an error. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",u="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",x="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",Q=10,H=20,A=["Histogram","Line","Filled","Intensity"];function V(ae,ad){if(!ad){ad=0}var af=Math.pow(10,ad);return Math.round(ae*af)/af}var p=function(ae,ad,ag){if(!p.id_counter){p.id_counter=0}this.id=p.id_counter++;this.name=ag.name;this.view=ae;this.container=ad;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ag.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(ah){ah.stopPropagation()});var af=this;this.container_div.hover(function(){af.icons_div.show()},function(){af.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};p.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ad){if(ad.content_visible){ad.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ad.hide_contents();ad.content_visible=false}else{ad.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ad.content_visible=true;ad.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ae){var ag=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ad=function(){ae.config.update_from_form($(Galaxy.modal.el));Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},af=function(ah){if((ah.keyCode||ah.which)===27){ag()}else{if((ah.keyCode||ah.which)===13){ad()}}};$(window).bind("keypress.check_enter_esc",af);Galaxy.modal.show({title:"Configure",body:ae.config.build_form(),buttons:{Cancel:ag,Ok:ad}})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ad){$(".tooltip").remove();ad.remove()}}];o(p.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(ad){},to_dict:function(){},set_name:function(ad){this.old_name=this.name;this.name=ad;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 ad=this.view;this.container_div.hide(0,function(){$(this).remove();ad.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ae,aj,ai,ah,ad,ag){var af=this;this.action_icons[ae]=$("<a/>").attr("href","javascript:void(0);").attr("title",aj).addClass("icon-button").addClass(ai).tooltip().click(function(){ah(af)}).appendTo(this.icons_div);if(ag){this.action_icons[ae].hide()}},build_action_icons:function(ad){var af;for(var ae=0;ae<ad.length;ae++){af=ad[ae];this.add_action_icon(af.name,af.title,af.css_class,af.on_click_fn,af.prepend,af.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var y=function(ae,ad,af){p.call(this,ae,ad,af);this.obj_type=af.obj_type;this.drawables=[]};o(y.prototype,p.prototype,{unpack_drawables:function(af){this.drawables=[];var ae;for(var ad=0;ad<af.length;ad++){ae=n(af[ad],this.view,this);this.add_drawable(ae)}},init:function(){for(var ad=0;ad<this.drawables.length;ad++){this.drawables[ad].init()}},_draw:function(ad){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae]._draw(ad)}},to_dict:function(){var ae=[];for(var ad=0;ad<this.drawables.length;ad++){ae.push(this.drawables[ad].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ae}},add_drawable:function(ad){this.drawables.push(ad);ad.container=this;this.changed()},add_drawable_before:function(af,ad){this.changed();var ae=this.drawables.indexOf(ad);if(ae!==-1){this.drawables.splice(ae,0,af);return true}return false},replace_drawable:function(af,ad,ae){var ag=this.drawables.indexOf(af);if(ag!==-1){this.drawables[ag]=ad;if(ae){af.container_div.replaceWith(ad.container_div)}this.changed()}return ag},remove_drawable:function(ae){var ad=this.drawables.indexOf(ae);if(ad!==-1){this.drawables.splice(ad,1);ae.container=null;this.changed();return true}return false},move_drawable:function(ae,af){var ad=this.drawables.indexOf(ae);if(ad!==-1){this.drawables.splice(ad,1);this.drawables.splice(af,0,ae);this.changed();return true}return false},get_drawables:function(){return this.drawables},get_tracks:function(ag){var ad=this.drawables.slice(0),ae=[],af;while(ad.length!==0){af=ad.shift();if(af instanceof ag){ae.push(af)}else{if(af.drawables){ad=ad.concat(af.drawables)}}}return ae}});var P=function(ae,ad,ag){o(ag,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});y.call(this,ae,ad,ag);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);i(this.container_div,this);i(this.content_div,this);k(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new h.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ag){this.unpack_drawables(ag.drawables)}if("filters" in ag){var af=this.filters_manager;this.filters_manager=new h.FiltersManager(this,ag.filters);af.parent_div.replaceWith(this.filters_manager.parent_div);if(ag.filters.visible){this.setup_multitrack_filtering()}}};o(P.prototype,p.prototype,y.prototype,{action_icons_def:[p.prototype.action_icons_def[0],p.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ad){$(".tooltip").remove();ad.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ad){if(ad.filters_manager.visible()){ad.filters_manager.clear_filters();ad._restore_filter_managers()}else{ad.setup_multitrack_filtering();ad.request_draw({clear_tile_cache:true})}ad.filters_manager.toggle()}},p.prototype.action_icons_def[2]],build_container_div:function(){var ad=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ad)}return ad},build_header_div:function(){var ad=$("<div/>").addClass("track-header");ad.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ad);return ad},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var af=this.drawables.length;if(af===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(af===1){if(this.drawables[0] instanceof e){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var am,al,aj,ap=true,ah=this.drawables[0].get_type(),ad=0;for(am=0;am<af;am++){aj=this.drawables[am];if(aj.get_type()!==ah){can_composite=false;break}if(aj instanceof c){ad++}}if(ap||ad===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tooltip").remove()}if(ad>1&&ad===this.drawables.length){var aq={},ae;aj=this.drawables[0];for(al=0;al<aj.filters_manager.filters.length;al++){ae=aj.filters_manager.filters[al];aq[ae.name]=[ae]}for(am=1;am<this.drawables.length;am++){aj=this.drawables[am];for(al=0;al<aj.filters_manager.filters.length;al++){ae=aj.filters_manager.filters[al];if(ae.name in aq){aq[ae.name].push(ae)}}}this.filters_manager.remove_all();var ag,ai,ak,an;for(var ao in aq){ag=aq[ao];if(ag.length===ad){ai=new h.NumberFilter({name:ag[0].name,index:ag[0].index});this.filters_manager.add_filter(ai)}}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 ad=0;ad<this.drawables.length;ad++){this.drawables[ad].filters_manager=this.saved_filters_managers[ad]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ad=0;ad<this.drawables.length;ad++){drawable=this.drawables[ad];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ae=new e(this.view,this.view,{name:this.name,drawables:this.drawables});var ad=this.container.replace_drawable(this,ae,true);ae.request_draw()},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);this.update_icons()},remove_drawable:function(ad){y.prototype.remove_drawable.call(this,ad);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ad=o(y.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ad},request_draw:function(ad){ac.each(this.drawables,function(ae){ae.request_draw(ad)})}});var Y=Backbone.View.extend({initialize:function(ad){o(ad,{obj_type:"View"});y.call(this,"View",ad.container,ad);this.chrom=null;this.vis_id=ad.vis_id;this.dbkey=ad.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 w.CanvasManager(this.container.get(0).ownerDocument);this.reset();this.config=new F({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:ad.prefs,onchange:function(){track.request_redraw({clear_tile_cache:true})}})},render:function(){this.requested_redraw=false;var af=this.container,ad=this;this.top_container=$("<div/>").addClass("top-container").appendTo(af);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(af);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(af);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;i(this.viewport_container,ad);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ag=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){w.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",{"f-dbkey":ad.dbkey},function(ah){ac.each(ah,function(ai){ad.add_drawable(n(ai,ad,ad))})})});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 ae=function(ah){if(ah.type==="focusout"||(ah.keyCode||ah.which)===13||(ah.keyCode||ah.which)===27){if((ah.keyCode||ah.which)!==27){ad.go_to($(this).val())}$(this).hide();$(this).val("");ad.location_span.show();ad.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ae).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(){ad.location_span.hide();ad.chrom_select.hide();ad.nav_input.val(ad.chrom+":"+ad.low+"-"+ad.high);ad.nav_input.css("display","inline-block");ad.nav_input.select();ad.nav_input.focus();ad.nav_input.autocomplete({source:function(aj,ah){var ak=[],ai=$.map(ad.get_tracks(c),function(al){return al.data_manager.search_features(aj.term).success(function(am){ak=ak.concat(am)})});$.when.apply($,ai).done(function(){ah($.map(ak,function(al){return{label:al[0],value:al[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(){ad.zoom_out();ad.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ad.zoom_in();ad.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ad.change_chrom(ad.chrom_select.val())});this.browser_content_div.click(function(ah){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ah){ad.zoom_in(ah.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ah,ai){this.current_x=ai.offsetX}).bind("drag",function(ah,aj){var ak=aj.offsetX-this.current_x;this.current_x=aj.offsetX;var ai=Math.round(ak/ad.viewport_container.width()*(ad.max_high-ad.max_low));ad.move_delta(-ai)});this.overview_close.click(function(){ad.reset_overview()});this.viewport_container.bind("draginit",function(ah,ai){if(ah.clientX>ad.viewport_container.width()-16){return false}}).bind("dragstart",function(ah,ai){ai.original_low=ad.low;ai.current_height=ah.clientY;ai.current_x=ai.offsetX}).bind("drag",function(aj,al){var ah=$(this);var am=al.offsetX-al.current_x;var ai=ah.scrollTop()-(aj.clientY-al.current_height);ah.scrollTop(ai);al.current_height=aj.clientY;al.current_x=al.offsetX;var ak=Math.round(am/ad.viewport_container.width()*(ad.high-ad.low));ad.move_delta(ak)}).bind("mousewheel",function(aj,al,ai,ah){if(ai){ai*=50;var ak=Math.round(-ai/ad.viewport_container.width()*(ad.high-ad.low));ad.move_delta(ak)}});this.top_labeltrack.bind("dragstart",function(ah,ai){return $("<div />").css({height:ad.browser_content_div.height()+ad.top_labeltrack.height()+ad.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(al,am){$(am.proxy).css({left:Math.min(al.pageX,am.startX)-ad.container.offset().left,width:Math.abs(al.pageX-am.startX)});var ai=Math.min(al.pageX,am.startX)-ad.container.offset().left,ah=Math.max(al.pageX,am.startX)-ad.container.offset().left,ak=(ad.high-ad.low),aj=ad.viewport_container.width();ad.update_location(Math.round(ai/aj*ak)+ad.low,Math.round(ah/aj*ak)+ad.low)}).bind("dragend",function(am,an){var ai=Math.min(am.pageX,an.startX),ah=Math.max(am.pageX,an.startX),ak=(ad.high-ad.low),aj=ad.viewport_container.width(),al=ad.low;ad.low=Math.round(ai/aj*ak)+al;ad.high=Math.round(ah/aj*ak)+al;$(an.proxy).remove();ad.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(){ad.resize_window()},500)});$(document).bind("redraw",function(){ad.redraw()});this.reset();$(window).trigger("resize")},get_base_color:function(ad){return this.config.values[ad.toLowerCase()+"_color"]||this.config.values.n_color}});o(Y.prototype,y.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(ae,ag,ad,ah){if(this.timer){clearTimeout(this.timer)}if(ah){var af=this;this.timer=setTimeout(function(){af.trigger("navigate",ae+":"+ag+"-"+ad)},500)}else{view.trigger("navigate",ae+":"+ag+"-"+ad)}},update_location:function(ad,af){this.location_span.text(commatize(ad)+" - "+commatize(af));this.nav_input.val(this.chrom+":"+commatize(ad)+"-"+commatize(af));var ae=view.chrom_select.val();if(ae!==""){this.trigger_navigate(ae,view.low,view.high,true)}},load_chroms:function(af){af.num=v;var ad=this,ae=$.Deferred();$.ajax({url:galaxy_config.root+"api/genomes/"+this.dbkey,data:af,dataType:"json",success:function(ah){if(ah.chrom_info.length===0){return}if(ah.reference){ad.add_label_track(new B(ad))}ad.chrom_data=ah.chrom_info;var ak='<option value="">Select Chrom/Contig</option>';for(var aj=0,ag=ad.chrom_data.length;aj<ag;aj++){var ai=ad.chrom_data[aj].chrom;ak+='<option value="'+ai+'">'+ai+"</option>"}if(ah.prev_chroms){ak+='<option value="previous">Previous '+v+"</option>"}if(ah.next_chroms){ak+='<option value="next">Next '+v+"</option>"}ad.chrom_select.html(ak);ad.chrom_start_index=ah.start_index;ae.resolve(ah.chrom_info)},error:function(){alert("Could not load chroms for this dbkey:",ad.dbkey)}});return ae},change_chrom:function(ai,ae,ak){var af=this;if(!af.chrom_data){af.load_chroms_deferred.then(function(){af.change_chrom(ai,ae,ak)});return}if(!ai||ai==="None"){return}if(ai==="previous"){af.load_chroms({low:this.chrom_start_index-v});return}if(ai==="next"){af.load_chroms({low:this.chrom_start_index+v});return}var aj=$.grep(af.chrom_data,function(al,am){return al.chrom===ai})[0];if(aj===undefined){af.load_chroms({chrom:ai},function(){af.change_chrom(ai,ae,ak)});return}else{if(ai!==af.chrom){af.chrom=ai;af.chrom_select.val(af.chrom);af.max_high=aj.len-1;af.reset();for(var ah=0,ad=af.drawables.length;ah<ad;ah++){var ag=af.drawables[ah];if(ag.init){ag.init()}}if(af.reference_track){af.reference_track.init()}}if(ae&&ak){af.low=Math.max(ae,0);af.high=Math.min(ak,af.max_high)}else{af.low=0;af.high=af.max_high}af.reset_overview();af.request_redraw()}},go_to:function(ah){ah=ah.replace(/,/g,"");ah=ah.replace(/:|\-/g," ");var ae=ah.split(/\s+/),ag=ae[0],af=(ae[1]?parseInt(ae[1],10):null),ad=(ae[2]?parseInt(ae[2],10):null);if(!ad){af=af-15;ad=af+15}this.change_chrom(ag,af,ad)},move_fraction:function(af){var ad=this;var ae=ad.high-ad.low;this.move_delta(af*ae)},move_delta:function(ag){var ad=this;var af=ad.high-ad.low;if(ad.low-ag<ad.max_low){ad.low=ad.max_low;ad.high=ad.max_low+af}else{if(ad.high-ag>ad.max_high){ad.high=ad.max_high;ad.low=ad.max_high-af}else{ad.high-=ag;ad.low-=ag}}ad.request_redraw({data_fetch:false});if(this.redraw_on_move_fn){clearTimeout(this.redraw_on_move_fn)}this.redraw_on_move_fn=setTimeout(function(){ad.request_redraw()},200);var ae=ad.chrom_select.val();this.trigger_navigate(ae,ad.low,ad.high,true)},add_drawable:function(ad){y.prototype.add_drawable.call(this,ad);ad.init();this.changed();this.update_intro_div()},add_label_track:function(ad){ad.view=this;ad.init();this.label_tracks.push(ad)},remove_drawable:function(af,ae){y.prototype.remove_drawable.call(this,af);if(ae){var ad=this;af.container_div.hide(0,function(){$(this).remove();ad.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ae,af){var ad=this,ag=(af?[af]:ad.drawables);ac.each(ag,function(ah){var ai=ac.find(ad.tracks_to_be_redrawn,function(aj){return aj[0]===ah});if(ai){ai[1]=ae}else{ad.tracks_to_be_redrawn.push([ah,ae])}});if(!this.requested_redraw){requestAnimationFrame(function(){ad._redraw()});this.requested_redraw=true}},_redraw:function(){this.requested_redraw=false;var ad=this.low,ah=this.high;if(ad<this.max_low){ad=this.max_low}if(ah>this.max_high){ah=this.max_high}var ae=this.high-this.low;if(this.high!==0&&ae<this.min_separation){ah=ad+this.min_separation}this.low=Math.floor(ad);this.high=Math.ceil(ah);this.update_location(this.low,this.high);this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var ag=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ai=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var af=13;this.overview_box.css({left:ag,width:Math.max(af,ai)}).show();if(ai<af){this.overview_box.css("left",ag-(af-ai)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ag,width:ai})}ac.each(this.tracks_to_be_redrawn,function(al){var aj=al[0],ak=al[1];if(aj){aj._draw(ak)}});this.tracks_to_be_redrawn=[];ac.each(this.label_tracks,function(aj){aj._draw()})},zoom_in:function(ae,af){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ag=this.high-this.low,ah=ag/2+this.low,ad=(ag/this.zoom_factor)/2;if(ae){ah=ae/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ah-ad);this.high=Math.round(ah+ad);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ae=this.high-this.low,af=ae/2+this.low,ad=(ae*this.zoom_factor)/2;this.low=Math.round(af-ad);this.high=Math.round(af+ad);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(af){if(this.overview_drawable){if(this.overview_drawable.dataset.id===af.dataset.id){return}this.overview_viewport.find(".track").remove()}var ae=af.copy({content_div:this.overview_viewport}),ad=this;ae.header_div.hide();ae.is_overview=true;ad.overview_drawable=ae;this.overview_drawable.postdraw_actions=function(){ad.overview_highlight.show().height(ad.overview_drawable.content_div.height());ad.overview_viewport.height(ad.overview_drawable.content_div.height()+ad.overview_box.outerHeight());ad.overview_close.show();ad.resize_window()};ad.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 q=R.Tool.extend({defaults:{track:null},initialize:function(ad){if(ad.tool_state!==undefined){this.set("hidden",ad.tool_state.hidden)}this.remove_inputs(["data","hidden_data","conditional"])},state_dict:function(ad){return ac.extend(this.get_inputs_dict(),{hidden:!this.is_visible()})}});var t=Backbone.View.extend({events:{"change input":"update_value"},render:function(){var af=this.$el.addClass("param-row"),ag=this.model;var ad=$("<div>").addClass("param-label").text(ag.get("label")).appendTo(af);var ae=$("<div/>").addClass("param-input").html(ag.get("html")).appendTo(af);ae.find(":input").val(ag.get("value"));$("<div style='clear: both;'/>").appendTo(af)},update_value:function(ad){this.model.set_value($(ad.target).val())}});var ab=Backbone.View.extend({initialize:function(ad){this.model.on("change:hidden",this.set_visible,this)},render:function(){var ae=this;tool=this.model,parent_div=this.$el.addClass("dynamic-tool").hide();parent_div.bind("drag",function(ai){ai.stopPropagation()}).click(function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()}).keydown(function(ai){ai.stopPropagation()});var af=$("<div class='tool-name'>").appendTo(parent_div).text(tool.get("name"));tool.get("inputs").each(function(aj){var ai=new t({model:aj});ai.render();parent_div.append(ai.$el)});parent_div.find("input").click(function(){$(this).select()});var ag=$("<div>").addClass("param-row").appendTo(parent_div);var ah=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ag);var ad=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ag);ad.click(function(){ae.run_on_region()});ah.click(function(){ae.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 ad=0;ad<this.params.length;ad++){this.params[ad].update_value()}},run_on_dataset:function(){var ad=this.model;this.run({target_dataset_id:this.model.get("track").dataset.id,action:"rerun",tool_id:ad.id},null,function(ae){Galaxy.modal.show({title:ad.get("name")+" is Running",body:ad.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 ae=this.model.get("track"),ah=this.model,aj=new w.GenomeRegion({chrom:ae.view.chrom,start:ae.view.low,end:ae.view.high}),ak={target_dataset_id:ae.dataset.id,action:"rerun",tool_id:ah.id,regions:[aj.toJSON()]},ai=ae,am=ak.tool_id+ai.tool_region_and_parameters_str(aj),ad;if(ai.container===view){var al=new P(view,view,{name:this.name});var ag=ai.container.replace_drawable(ai,al,false);al.container_div.insertBefore(ai.view.content_div.children()[ag]);al.add_drawable(ai);ai.container_div.appendTo(al.content_div);ad=al}else{ad=ai.container}var af=new ai.constructor(view,ad,{name:am,hda_ldda:"hda"});af.init_for_tool_data();af.change_mode(ai.mode);af.set_filters_manager(ai.filters_manager.copy(af));af.update_icons();ad.add_drawable(af);af.tiles_div.text("Starting job.");this.run(ak,af,function(an){af.set_dataset(new X.Dataset(an));af.tiles_div.text("Running job.");af.init()})},run:function(ad,af,ag){ad.inputs=this.model.get_inputs_dict();var ae=new j.ServerStateDeferred({ajax_settings:{url:galaxy_config.root+"api/tools",data:JSON.stringify(ad),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ah){return ah!=="pending"}});$.when(ae.go()).then(function(ah){if(ah==="no converter"){af.container_div.addClass("error");af.content_div.text(J)}else{if(ah.error){af.container_div.addClass("error");af.content_div.text(x+ah.message)}else{ag(ah)}}})}});var C=function(ad,ae){L.Scaler.call(this,ae);this.filter=ad};C.prototype.gen_val=function(ad){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(ad[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ad){this.track=ad.track;this.params=ad.params;this.values={};this.restore_values((ad.saved_values?ad.saved_values:{}));this.onchange=ad.onchange};o(F.prototype,{set_param_default_value:function(ae,ad){var af=ac.find(this.params,function(ag){return ag.key===ae});if(af){af.default_value=ad}},set_param_value:function(ad,ae){var af=ac.find(this.params,function(ag){return ag.key===ad});if(af){if(typeof ae==="string"||ae instanceof String){if(ae.trim()===""){ae=af.default_value}else{if(af.type==="float"){ae=parseFloat(ae)}else{if(af.type==="int"){ae=parseInt(ae,10)}}}}}if(this.values[ad]!==ae){this.values[ad]=ae;return true}else{return false}},restore_values:function(ad){var ae=this;$.each(this.params,function(af,ag){if(ad[ag.key]!==undefined){ae.values[ag.key]=ad[ag.key]}else{ae.values[ag.key]=ag.default_value}})},build_form:function(){var ag=this;var ad=$("<div />");var af;function ae(al,ah){for(var ap=0;ap<al.length;ap++){af=al[ap];if(af.hidden){continue}var aj="param_"+ap;var au=ag.values[af.key];var aw=$("<div class='form-row' />").appendTo(ah);aw.append($("<label />").attr("for",aj).text(af.label+":"));if(af.type==="bool"){aw.append($('<input type="checkbox" />').attr("id",aj).attr("name",aj).attr("checked",au))}else{if(af.type==="text"){aw.append($('<input type="text"/>').attr("id",aj).val(au).click(function(){$(this).select()}))}else{if(af.type==="select"){var ar=$("<select />").attr("id",aj);for(var an=0;an<af.options.length;an++){$("<option/>").text(af.options[an].label).attr("value",af.options[an].value).appendTo(ar)}ar.val(au);aw.append(ar)}else{if(af.type==="color"){var av=$("<div/>").appendTo(aw),aq=$("<input />").attr("id",aj).attr("name",aj).val(au).css("float","left").appendTo(av).click(function(ay){$(".tooltip").removeClass("in");var ax=$(this).siblings(".tooltip").addClass("in");ax.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top+Galaxy.modal.scrollTop()-($(ax).height()/2)+($(this).height()/2)}).show();ax.click(function(az){az.stopPropagation()});$(document).bind("click.color-picker",function(){ax.hide();$(document).unbind("click.color-picker")});ay.stopPropagation()}),ao=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(av).attr("title","Set new random color").tooltip(),at=$("<div class='tooltip right' style='position: absolute;' />").appendTo(av).hide(),ak=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(at),ai=$("<div class='tooltip-arrow'></div>").appendTo(at),am=$.farbtastic(ak,{width:100,height:100,callback:aq,color:au});av.append($("<div/>").css("clear","both"));(function(ax){ao.click(function(){ax.setColor(j.get_random_color())})})(am)}else{aw.append($("<input />").attr("id",aj).attr("name",aj).val(au))}}}}if(af.help){aw.append($("<div class='help'/>").text(af.help))}}}ae(this.params,ad);return ad},update_from_form:function(ad){var af=this;var ae=false;$.each(this.params,function(ag,ai){if(!ai.hidden){var aj="param_"+ag;var ah=ad.find("#"+aj).val();if(ai.type==="bool"){ah=ad.find("#"+aj).is(":checked")}ae=af.set_param_value(ai.key,ah)||ae}});if(ae){this.onchange();this.track.changed()}}});var b=function(ad,ag,ah,ae,af){this.track=ad;this.region=ag;this.low=ag.get("start");this.high=ag.get("end");this.w_scale=ah;this.html_elt=$("<div class='track-tile'/>").append(ae).height($(ae).attr("height"));this.data=af;this.stale=false};b.prototype.predisplay_actions=function(){};var M=function(ad,ag,ah,ae,af){b.call(this,ad,ag,ah,ae,af)};M.prototype.predisplay_actions=function(){};var O=function(ag,an,ap,af,ai,aj,aq,ae,am){b.call(this,ag,an,ap,af,ai);this.mode=aj;this.all_slotted=ae;this.feature_mapper=am;this.has_icons=false;if(aq){this.has_icons=true;var ak=this;af=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:af.width}).prependTo(this.html_elt);var al=new w.GenomeRegion({chrom:ag.view.chrom,start:this.low,end:this.high}),ao=ai.length,ah=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ad=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ao+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ah.click(function(){ak.stale=true;ag.data_manager.get_more_data(al,ag.mode,1/ak.w_scale,{},ag.data_manager.DEEP_DATA_REQ);$(".tooltip").hide();ag.request_draw()}).dblclick(function(ar){ar.stopPropagation()});ad.click(function(){ak.stale=true;ag.data_manager.get_more_data(al,ag.mode,1/ak.w_scale,{},ag.data_manager.BROAD_DATA_REQ);$(".tooltip").hide();ag.request_draw()}).dblclick(function(ar){ar.stopPropagation()})}};o(O.prototype,b.prototype);O.prototype.predisplay_actions=function(){var ae=this,ad={};if(ae.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(ap){if(!this.hovered){return}var ak=$(this).offset(),ao=ap.pageX-ak.left,an=ap.pageY-ak.top,au=ae.feature_mapper.get_feature_data(ao,an),al=(au?au[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!al||$(this).attr("id")!==al.toString()){$(this).remove()}});if(au){var ag=ad[al];if(!ag){var al=au[0],aq={name:au[3],start:au[1],end:au[2],strand:au[4]},aj=ae.track.filters_manager.filters,ai;for(var am=0;am<aj.length;am++){ai=aj[am];aq[ai.name]=au[ai.index]}var ag=$("<div/>").attr("id",al).addClass("feature-popup"),av=$("<table/>"),at,ar,aw;for(at in aq){ar=aq[at];aw=$("<tr/>").appendTo(av);$("<th/>").appendTo(aw).text(at);$("<td/>").attr("align","left").appendTo(aw).text(typeof(ar)==="number"?V(ar,2):ar)}ag.append($("<div class='feature-popup-inner'>").append(av));ad[al]=ag}ag.appendTo($(this).parents(".track-content").children(".overlay"));var ah=ao+parseInt(ae.html_elt.css("left"))-ag.width()/2,af=an+parseInt(ae.html_elt.css("top"))+7;ag.css("left",ah+"px").css("top",af+"px")}else{if(!ap.isPropagationStopped()){ap.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ap)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var f=function(ae,ad,af){o(af,{drag_handle_class:"draghandle"});p.call(this,ae,ad,af);this.dataset=null;if(af.dataset){this.dataset=(af.dataset instanceof Backbone.Model?af.dataset:X.Dataset.findOrCreate(af.dataset))}this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in af?af.data_query_wait:K);this.data_manager=("data_manager" in af?af.data_manager:new w.GenomeDataManager({dataset:this.dataset,genome:new w.Genome({key:ae.dbkey,chroms_info:{chrom_info:ae.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 af)||af.resize){this.add_resize_handle()}}};o(f.prototype,p.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},p.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ad){ad.view.set_overview(ad)}},p.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ad){if(ad.filters_manager.visible()){ad.filters_manager.clear_filters()}else{ad.filters_manager.init_filters()}ad.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ad){ad.tool.toggle();if(ad.tool.is_visible()){ad.set_name(ad.name+ad.tool_region_and_parameters_str())}else{ad.revert_name()}$(".tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ad){var ag='<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>',af=ac.template(ag,{track:ad});var ai=function(){Galaxy.modal.hide();$(window).unbind("keypress.check_enter_esc")},ae=function(){var ak=$('select[name="regions"] option:selected').val(),am,aj=new w.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),al=ac.map($(".bookmark"),function(an){return new w.GenomeRegion({from_str:$(an).children(".position").text()})});if(ak==="cur"){am=[aj]}else{if(ak==="bookmarks"){am=al}else{am=[aj].concat(al)}}Galaxy.modal.hide();window.location.href=galaxy_config.root+"visualization/sweepster?"+$.param({dataset_id:ad.dataset.id,hda_ldda:ad.dataset.get("hda_ldda"),regions:JSON.stringify(new Backbone.Collection(am).toJSON())})},ah=function(aj){if((aj.keyCode||aj.which)===27){ai()}else{if((aj.keyCode||aj.which)===13){ae()}}};Galaxy.modal.show({title:"Visualize tool parameter space and output from different parameter settings?",body:af,buttons:{No:ai,Yes:ae}})}},p.prototype.action_icons_def[2]],can_draw:function(){return this.dataset&&p.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 ad=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ad)}this.name_div=$("<div/>").addClass("track-name").appendTo(ad).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ad},set_dataset:function(ad){this.dataset=ad;this.data_manager.set("dataset",ad)},on_resize:function(){this.request_draw({clear_tile_cache:true})},add_resize_handle:function(){var ad=this;var ag=false;var af=false;var ae=$("<div class='track-resize'>");$(ad.container_div).hover(function(){if(ad.content_visible){ag=true;ae.show()}},function(){ag=false;if(!af){ae.hide()}});ae.hide().bind("dragstart",function(ah,ai){af=true;ai.original_height=$(ad.content_div).height()}).bind("drag",function(ai,aj){var ah=Math.min(Math.max(aj.original_height+aj.deltaY,ad.min_height_px),ad.max_height_px);$(ad.tiles_div).css("height",ah);ad.visible_height_px=(ad.max_height_px===ah?0:ah);ad.on_resize()}).bind("dragend",function(ah,ai){ad.tile_cache.clear();af=false;if(!ag){ae.hide()}ad.config.values.height=ad.visible_height_px;ad.changed()}).appendTo(ad.container_div)},set_display_modes:function(ag,aj){this.display_modes=ag;this.mode=(aj?aj:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ae=this,ah={};for(var af=0,ad=ae.display_modes.length;af<ad;af++){var ai=ae.display_modes[af];ah[ai]=function(ak){return function(){ae.change_mode(ak);ae.icons_div.show();ae.container_div.mouseleave(function(){ae.icons_div.hide()})}}(ai)}make_popupmenu(this.action_icons.mode_icon,ah)},build_action_icons:function(){p.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 B){return"ReferenceTrack"}else{if(this instanceof g){return"LineTrack"}else{if(this instanceof T){return"ReadTrack"}else{if(this instanceof Z){return"VariantTrack"}else{if(this instanceof e){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(af){var ae=this;ae.enabled=false;ae.tile_cache.clear();ae.data_manager.clear();ae.tiles_div.css("height","auto");ae.tiles_div.text("").children().remove();ae.container_div.removeClass("nodata error pending");if(!ae.dataset.id){return}var ad=$.Deferred(),ag={hda_ldda:ae.dataset.get("hda_ldda"),data_type:this.dataset_check_type,chrom:ae.view.chrom,retry:af};$.getJSON(this.dataset.url(),ag,function(ah){if(!ah||ah==="error"||ah.kind==="error"){ae.container_div.addClass("error");ae.tiles_div.text(m);if(ah.message){ae.tiles_div.append($("<a href='javascript:void(0);'></a>").text("View error").click(function(){Galaxy.modal.show({title:"Trackster Error",body:"<pre>"+ah.message+"</pre>",buttons:{Close:function(){Galaxy.modal.hide()}}})}));ae.tiles_div.append($("<span/>").text(" "));ae.tiles_div.append($("<a href='javascript:void(0);'></a>").text("Try again").click(function(){ae.init(true)}))}}else{if(ah==="no converter"){ae.container_div.addClass("error");ae.tiles_div.text(J)}else{if(ah==="no data"||(ah.data!==undefined&&(ah.data===null||ah.data.length===0))){ae.container_div.addClass("nodata");ae.tiles_div.text(E)}else{if(ah==="pending"){ae.container_div.addClass("pending");ae.tiles_div.html(u);setTimeout(function(){ae.init()},ae.data_query_wait)}else{if(ah==="data"||ah.status==="data"){if(ah.valid_chroms){ae.valid_chroms=ah.valid_chroms;ae.update_icons()}ae.tiles_div.text(U);if(ae.view.chrom){ae.tiles_div.text("");ae.tiles_div.css("height",ae.visible_height_px+"px");ae.enabled=true;$.when.apply($,ae.predraw_init()).done(function(){ad.resolve();ae.container_div.removeClass("nodata error pending");ae.request_draw()})}else{ad.resolve()}}}}}}});this.update_icons();return ad},predraw_init:function(){var ad=this;return $.getJSON(ad.dataset.url(),{data_type:"data",stats:true,chrom:ad.view.chrom,low:0,high:ad.view.max_high,hda_ldda:ad.dataset.get("hda_ldda")},function(ae){ad.container_div.addClass("line-track");var ag=ae.data;if(ag&&ag.min&&ag.max){var af=ag.min,ah=ag.max;af=Math.floor(Math.min(0,Math.max(af,ag.mean-2*ag.sd)));ah=Math.ceil(Math.max(0,Math.min(ah,ag.mean+2*ag.sd)));ad.config.set_param_default_value("min_value",af);ad.config.set_param_default_value("max_value",ah);ad.prefs.min_value=af;ad.prefs.max_value=ah}})},get_drawables:function(){return this}});var N=function(af,ae,ah){f.call(this,af,ae,ah);var ad=this;k(ad.container_div,ad.drag_handle_class,".group",ad);this.filters_manager=new h.FiltersManager(this,("filters" in ah?ah.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=(ah.tool?new q(ac.extend(ah.tool,{track:this,tool_state:ah.tool_state})):null);this.tile_cache=new w.Cache(Q);this.left_offset=0;if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){var ag=new ab({model:this.tool});ag.render();this.dynamic_tool_div=ag.$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(ah.mode){this.change_mode(ah.mode)}};o(N.prototype,p.prototype,f.prototype,{action_icons_def:f.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(ad){$(".tooltip").remove();ad.slotters[ad.view.resolution_px_b].max_rows*=2;ad.request_draw({clear_tile_cache:true})},hide:true}]),copy:function(ad){var ae=this.to_dict();o(ae,{data_manager:this.data_manager});var af=new this.constructor(this.view,ad,ae);af.change_mode(this.mode);af.enabled=this.enabled;return af},set_filters_manager:function(ad){this.filters_manager=ad;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 ad=this;return $.getJSON(ad.dataset.url(),{data_type:"data",stats:true,chrom:ad.view.chrom,low:0,high:ad.view.max_high,hda_ldda:ad.dataset.get("hda_ldda")},function(ae){var ag=ae.data;if(isNaN(parseFloat(ad.prefs.min_value))||isNaN(parseFloat(ad.prefs.max_value))){var af=ag.min,ah=ag.max;af=Math.floor(Math.min(0,Math.max(af,ag.mean-2*ag.sd)));ah=Math.ceil(Math.max(0,Math.min(ah,ag.mean+2*ag.sd)));ad.prefs.min_value=af;ad.prefs.max_value=ah}})},change_mode:function(ae){var ad=this;ad.mode=ae;ad.config.values.mode=ae;if(ae==="Auto"){this.data_manager.clear()}ad.request_draw({clear_tile_cache:true});this.action_icons.mode_icon.attr("title","Set display mode (now: "+ad.mode+")");return ad},update_icons:function(){var ad=this;if(ad.filters_available){ad.action_icons.filters_icon.show()}else{ad.action_icons.filters_icon.hide()}if(ad.tool){ad.action_icons.tools_icon.show();ad.action_icons.param_space_viz_icon.show()}else{ad.action_icons.tools_icon.hide();ad.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ae,ad){return ae+"_"+ad},request_draw:function(ad){if(ad&&ad.clear_tile_cache){this.tile_cache.clear()}this.view.request_redraw(ad,this)},before_draw:function(){this.max_height_px=0},_draw:function(ar){if(!this.can_draw()){return}var ao=ar&&ar.clear_after,am=this.view.low,ah=this.view.high,ak=ah-am,ae=this.view.container.width(),aq=this.view.resolution_px_b,ag=1/aq;if(this.is_overview){am=this.view.max_low;ah=this.view.max_high;aq=ae/(view.max_high-view.max_low);ag=1/aq}this.before_draw();this.tiles_div.children().addClass("remove");var ad=Math.floor(am/(ag*S)),al,an,ai,aj=[],ap=[];while((ad*S*ag)<ah){al=Math.floor(ad*S*ag);an=new w.GenomeRegion({chrom:this.view.chrom,start:al,end:Math.min(al+Math.ceil(S*ag),this.view.max_high)});ai=this.draw_helper(an,aq,ar);aj.push(ai);$.when(ai).then(function(at){ap.push(at)});ad+=1}if(!ao){this.tiles_div.children(".remove").removeClass("remove").remove()}var af=this;$.when.apply($,aj).then(function(){af.tiles_div.children(".remove").remove();ap=ac.filter(ap,function(at){return at!==null});if(ap.length!==0){af.postdraw_actions(ap,ae,aq,ao)}})},_add_yaxis_label:function(ag,ai){var ae=this,ah=(ag==="max"?"top":"bottom"),aj=(ag==="max"?"max":"min"),ad=(ag==="max"?"max_value":"min_value"),ai=ai||function(){ae.request_draw({clear_tile_cache:true})},af=this.container_div.find(".yaxislabel."+ah);if(af.length!==0){af.text(ae.prefs[ad])}else{af=$("<div/>").text(ae.prefs[ad]).make_text_editable({num_cols:12,on_finish:function(ak){$(".tooltip").remove();ae.config.set_param_value(ad,ak);ai()},help_text:"Set "+aj+" value"}).addClass("yaxislabel "+ah).css("color",this.prefs.label_color);this.container_div.prepend(af)}},postdraw_actions:function(ag,ah,aj,ad){var af=ac.filter(ag,function(ak){return(ak instanceof M)});if(af.length>0){this.max_height_px=0;var ae=this;ac.each(ag,function(ak){if(!(ak instanceof M)){ak.html_elt.remove();ae.draw_helper(ak.region,aj,{force:true,mode:"Coverage"})}});ae._add_yaxis_label("max")}else{this.container_div.find(".yaxislabel").remove();var ai=ac.find(ag,function(ak){return ak.has_icons});if(ai){ac.each(ag,function(ak){if(!ak.has_icons){ak.html_elt.css("padding-top",D)}})}}},get_mode:function(ad){return this.mode},update_auto_mode:function(ad){},_get_drawables:function(){return[this]},draw_helper:function(am,ap,aq){if(!aq){aq={}}var ae=aq.force,ao=!(aq.data_fetch===false),aj=aq.mode||this.mode,ag=1/ap,af=this,ah=this._get_drawables(),an=this._gen_tile_cache_key(ap,am),ai=function(ar){return(ar&&"track" in ar)};var ak=(ae?undefined:af.tile_cache.get_elt(an));if(ak){if(ai(ak)){af.show_tile(ak,ap)}return ak}if(!ao){return null}var al=function(){var ar=(ac.find(A,function(au){return au===aj})?"Coverage":aj);var at=ac.map(ah,function(au){return au.data_manager.get_data(am,ar,ag,af.data_url_extra_params)});if(view.reference_track){at.push(view.reference_track.data_manager.get_data(am,aj,ag,view.reference_track.data_url_extra_params))}return at};var ad=$.Deferred();af.tile_cache.set_elt(an,ad);$.when.apply($,al()).then(function(){var ar=al(),ax=ar,aD;if(view.reference_track){aD=view.reference_track.data_manager.subset_entry(ar.pop(),am)}var ay=[],av=[];ac.each(ah,function(aI,aF){var aH=aI.mode,aG=ax[aF];if(aH==="Auto"){aH=aI.get_mode(aG);aI.update_auto_mode(aH)}ay.push(aH);av.push(aI.get_canvas_height(aG,aH,ap,at))});var aw=af.view.canvas_manager.new_canvas(),az=am.get("start"),aE=am.get("end"),au=0,at=Math.ceil((aE-az)*ap)+af.left_offset,aB=ac.max(av),aA;aw.width=at;aw.height=(aq.height||aB);var aC=aw.getContext("2d");aC.translate(af.left_offset,0);if(ah.length>1){aC.globalAlpha=0.5;aC.globalCompositeOperation="source-over"}ac.each(ah,function(aG,aF){aA=aG.draw_tile(ax[aF],aC,ay[aF],am,ap,aD)});if(aA!==undefined){af.tile_cache.set_elt(an,aA);af.show_tile(aA,ap)}ad.resolve(aA)});return ad},get_canvas_height:function(ad,af,ag,ae){return this.visible_height_px},_draw_line_track_tile:function(ad,af,ai,ah,aj){var ag=af.canvas,ae=new L.LinePainter(ad.data,ah.get("start"),ah.get("end"),this.prefs,ai);ae.draw(af,ag.width,ag.height,aj);return new M(this,ah,aj,ag,ad.data)},draw_tile:function(ad,ae,ah,ag,ai,af){},show_tile:function(af,ai){var ae=this,ad=af.html_elt;af.predisplay_actions();var ah=(af.low-(this.is_overview?this.view.max_low:this.view.low))*ai;if(this.left_offset){ah-=this.left_offset}ad.css({position:"absolute",top:0,left:ah});if(ad.hasClass("remove")){ad.removeClass("remove")}else{this.tiles_div.append(ad)}af.html_elt.height("auto");this.max_height_px=Math.max(this.max_height_px,af.html_elt.height());af.html_elt.parent().children().css("height",this.max_height_px+"px");var ag=this.max_height_px;if(this.visible_height_px!==0){ag=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",ag+"px")},tool_region_and_parameters_str:function(ag){var ad=this,af=(ag!==undefined?ag.toString():"all"),ae=ac.values(ad.tool.get_inputs_dict()).join(", ");return" - region=["+af+"], parameters=["+ae+"]"},data_and_mode_compatible:function(ad,ae){if(ae==="Auto"){return true}else{if(ae==="Coverage"){return ad.dataset_type==="bigwig"}else{if(ad.dataset_type==="bigwig"||ad.extra_info==="no_detail"){return false}else{return true}}}},can_subset:function(ad){if(ad.message||ad.extra_info==="no_detail"){return false}else{if(ad.dataset_type==="bigwig"){return(ad.data[1][0]-ad.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(ae,ad){var af={resize:false};f.call(this,ae,ad,af);this.container_div.addClass("label-track")};o(W.prototype,f.prototype,{build_header_div:function(){},init:function(){this.enabled=true},predraw_init:function(){},_draw:function(ah){var af=this.view,ag=af.high-af.low,ak=Math.floor(Math.pow(10,Math.floor(Math.log(ag)/Math.log(10)))),ad=Math.floor(af.low/ak)*ak,ai=this.view.container.width(),ae=$("<div style='position: relative; height: 1.3em;'></div>");while(ad<af.high){var aj=(ad-af.low)/ag*ai;ae.append($("<div class='label'>"+commatize(ad)+"</div>").css({position:"absolute",left:aj-1}));ad+=ak}this.content_div.children(":first").remove();this.content_div.append(ae)}});var e=function(ae,ad,ah){this.display_modes=A;N.call(this,ae,ad,ah);this.drawables=[];if("drawables" in ah){var ag;for(var af=0;af<ah.drawables.length;af++){ag=ah.drawables[af];this.drawables[af]=n(ag,ae,null);if(ag.left_offset>this.left_offset){this.left_offset=ag.left_offset}}this.enabled=true}ac.each(this.drawables,function(ai){if(ai instanceof c||ai instanceof T){ai.change_mode("Coverage")}});this.update_icons();this.obj_type="CompositeTrack"};o(e.prototype,N.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ad){$(".tooltip").remove();ad.show_group()}}].concat(N.prototype.action_icons_def),to_dict:y.prototype.to_dict,add_drawable:y.prototype.add_drawable,unpack_drawables:y.prototype.unpack_drawables,change_mode:function(ad){N.prototype.change_mode.call(this,ad);for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae].change_mode(ad)}},init:function(){var af=[];for(var ae=0;ae<this.drawables.length;ae++){af.push(this.drawables[ae].init())}var ad=this;$.when.apply($,af).then(function(){ad.enabled=true;ad.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:p.prototype.can_draw,_get_drawables:function(){return this.drawables},show_group:function(){var ag=new P(this.view,this.container,{name:this.name}),ad;for(var af=0;af<this.drawables.length;af++){ad=this.drawables[af];ad.update_icons();ag.add_drawable(ad);ad.container=ag;ag.content_div.append(ad.container_div)}var ae=this.container.replace_drawable(this,ag,true);ag.request_draw({clear_tile_cache:true})},before_draw:function(){N.prototype.before_draw.call(this);var ae=ac.min(ac.map(this.drawables,function(af){return af.prefs.min_value})),ad=ac.max(ac.map(this.drawables,function(af){return af.prefs.max_value}));this.prefs.min_value=ae;this.prefs.max_value=ad;ac.each(this.drawables,function(af){af.prefs.min_value=ae;af.prefs.max_value=ad})},update_all_min_max:function(){var ad=this;ac.each(this.drawables,function(ae){ae.prefs.min_value=ad.prefs.min_value;ae.prefs.max_value=ad.prefs.max_value});this.request_draw({clear_tile_cache:true})},postdraw_actions:function(aj,ad,am,ai){N.prototype.postdraw_actions.call(this,aj,ad,am,ai);var ah=-1;for(var af=0;af<aj.length;af++){var ak=aj[af].html_elt.find("canvas").height();if(ak>ah){ah=ak}}for(var af=0;af<aj.length;af++){var ag=aj[af];if(ag.html_elt.find("canvas").height()!==ah){this.draw_helper(ag.region,am,{force:true,height:ah});ag.html_elt.remove()}}var ae=this,al=function(){ae.update_all_min_max()};this._add_yaxis_label("min",al);this._add_yaxis_label("max",al)}});var B=function(ad){N.call(this,ad,{content_div:ad.top_labeltrack},{resize:false});ad.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=galaxy_config.root+"api/genomes//"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new w.GenomeReferenceDataManager({data_url:this.data_url,can_subset:this.can_subset});this.hide_contents()};o(B.prototype,p.prototype,N.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},predraw_init:function(){},can_draw:p.prototype.can_draw,draw_helper:function(ae,af,ad){if(af>this.view.canvas_manager.char_width_px){this.tiles_div.show();return N.prototype.draw_helper.call(this,ae,af,ad)}else{this.tiles_div.hide();return null}},can_subset:function(ad){return true},draw_tile:function(af,al,ag,ai,am){var ae=this.data_manager.subset_entry(af,ai),ak=ae.data;var ad=al.canvas;al.font=al.canvas.manager.default_font;al.textAlign="center";for(var ah=0,aj=ak.length;ah<aj;ah++){al.fillStyle=this.view.get_base_color(ak[ah]);al.fillText(ak[ah],Math.floor(ah*am),10)}return new b(this,ai,am,ad,ae)}});var g=function(af,ae,ag){var ad=this;this.display_modes=A;this.mode="Histogram";N.call(this,af,ae,ag);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:j.get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:ag.prefs,onchange:function(){ad.set_name(ad.prefs.name);ad.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};o(g.prototype,p.prototype,N.prototype,{before_draw:function(){},draw_tile:function(ad,ae,ag,af,ah){return this._draw_line_track_tile(ad,ae,ag,af,ah)},can_subset:function(ad){return(ad.data[1][0]-ad.data[0][0]===1)},postdraw_actions:function(ae,af,ag,ad){this._add_yaxis_label("max");this._add_yaxis_label("min")}});var r=function(af,ae,ag){var ad=this;this.display_modes=["Heatmap"];this.mode="Heatmap";N.call(this,af,ae,ag);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"#FF8C00"},{key:"neg_color",label:"Negative Color",type:"color",default_value:"#4169E1"},{key:"min_value",label:"Min Value",type:"float",default_value:-1},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:ag.prefs,onchange:function(){ad.set_name(ad.prefs.name);this.request_redraw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height};o(r.prototype,p.prototype,N.prototype,{draw_tile:function(ad,af,ai,ah,aj){var ag=af.canvas,ae=new L.DiagonalHeatmapPainter(ad.data,ah.get("start"),ah.get("end"),this.prefs,ai);ae.draw(af,ag.width,ag.height,aj);return new b(this,ah,aj,ag,ad.data)}});var c=function(ag,af,ai){var ae=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ag,af,ai);var ah=j.get_random_color(),ad=j.get_random_color([ah,"#FFFFFF"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ah},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ad},{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:ai.prefs,onchange:function(){ae.set_name(ae.prefs.name);ae.set_painter_from_config();ae.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.visible_height_px=this.config.values.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()};o(c.prototype,p.prototype,N.prototype,{set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},postdraw_actions:function(an,af,ao,am){N.prototype.postdraw_actions.call(this,an,af,ao,am);var ah=this,ai;if(ah.filters_manager){var ag=ah.filters_manager.filters;for(var ak=0;ak<ag.length;ak++){ag[ak].update_ui_elt()}var aj=false,al,ae;for(ai=0;ai<an.length;ai++){if(an[ai].data.length){al=an[ai].data[0];for(var ak=0;ak<ag.length;ak++){ae=ag[ak];if(ae.applies_to(al)&&ae.min!==ae.max){aj=true;break}}}}if(ah.filters_available!==aj){ah.filters_available=aj;if(!ah.filters_available){ah.filters_manager.hide()}ah.update_icons()}}if(an[0] instanceof O){var ad=true;for(ai=0;ai<an.length;ai++){if(!an[ai].all_slotted){ad=false;break}}if(!ad){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(ad){var ad;if(this.mode==="Auto"){if(ad==="no_detail"){ad="feature spans"}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ad+")")}},incremental_slots:function(ah,ad,ag){var ae=this.view.canvas_manager.dummy_context,af=this.slotters[ah];if(!af||(af.mode!==ag)){af=new (s.FeatureSlotter)(ah,ag,z,function(ai){return ae.measureText(ai)});this.slotters[ah]=af}return af.slot_features(ad)},get_mode:function(ad){if(ad.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(ad,ah,ai,ae){if(ah==="Coverage"||ad.dataset_type==="bigwig"){return this.summary_draw_height}else{var ag=this.incremental_slots(ai,ad.data,ah);var af=new (this.painter)(null,null,null,this.prefs,ah);return Math.max(aa,af.get_required_height(ag,ae))}},draw_tile:function(an,ar,ap,ag,ak,af){var aq=this,ae=ar.canvas,ay=ag.get("start"),ad=ag.get("end"),ah=this.left_offset;if(an.dataset_type==="bigwig"){return this._draw_line_track_tile(an,ar,ap,ag,ak)}var aj=[],ao=this.slotters[ak].slots;all_slotted=true;if(an.data){var al=this.filters_manager.filters;for(var at=0,av=an.data.length;at<av;at++){var ai=an.data[at];var au=false;var am;for(var ax=0,aC=al.length;ax<aC;ax++){am=al[ax];am.update_attrs(ai);if(!am.keep(ai)){au=true;break}}if(!au){aj.push(ai);if(!(ai[0] in ao)){all_slotted=false}}}}var aB=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null),az=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null),aA=new (this.painter)(aj,ay,ad,this.prefs,ap,aB,az,af,function(aD){return aq.view.get_base_color(aD)});var aw=null;ar.fillStyle=this.prefs.block_color;ar.font=ar.canvas.manager.default_font;ar.textAlign="right";if(an.data){aw=aA.draw(ar,ae.width,ae.height,ak,ao);aw.translation=-ah}return new O(aq,ag,ak,ae,an.data,ap,an.message,all_slotted,aw)}});var Z=function(ae,ad,af){this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ae,ad,af);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Histogram color",type:"color",default_value:j.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:af.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=L.VariantPainter;this.summary_draw_height=30;this.left_offset=30};o(Z.prototype,p.prototype,N.prototype,{draw_tile:function(ad,ag,ai,ah,aj){if(ad.dataset_type==="bigwig"){return this._draw_line_track_tile(ad,ag,"Histogram",ah,aj)}else{var af=this.view,ae=new (this.painter)(ad.data,ah.get("start"),ah.get("end"),this.prefs,ai,function(ak){return af.get_base_color(ak)});ae.draw(ag,ag.canvas.width,ag.canvas.height,aj);return new b(this,ah,aj,ag.canvas,ad.data)}},get_canvas_height:function(ad,ah,ai,af){if(ad.dataset_type==="bigwig"){return this.summary_draw_height}else{var ae=(this.dataset.get_metadata("sample_names")?this.dataset.get_metadata("sample_names").length:0);if(ae===0&&ad.data.length!==0){ae=ad.data[0][7].match(/,/g);if(ae===null){ae=1}else{ae=ae.length+1}}var ag=new (this.painter)(null,null,null,this.prefs,ah);return ag.get_required_height(ae)}},predraw_init:function(){var ad=[f.prototype.predraw_init.call(this)];if(!this.dataset.get_metadata("sample_names")){ad.push(this.dataset.fetch())}return ad},postdraw_actions:function(ah,ai,ak,ae){N.prototype.postdraw_actions.call(this,ah,ai,ak,ae);var ag=ac.filter(ah,function(al){return(al instanceof M)});var af=this.dataset.get_metadata("sample_names");if(ag.length===0&&this.prefs.show_labels&&af){var ad;if(this.container_div.find(".yaxislabel.variant").length===0){ad=this.prefs.summary_height/2;this.tiles_div.prepend($("<div/>").text("Summary").addClass("yaxislabel variant top").css({"font-size":ad+"px",top:(this.prefs.summary_height-ad)/2+"px"}));if(this.prefs.show_sample_data){var aj=af.join("<br/>");this.tiles_div.prepend($("<div/>").html(aj).addClass("yaxislabel variant top sample").css({top:this.prefs.summary_height+2,}))}}ad=(this.mode==="Squish"?5:10)+"px";$(this.tiles_div).find(".sample").css({"font-size":ad,"line-height":ad});$(this.tiles_div).find(".yaxislabel").css("color",this.prefs.label_color)}else{this.container_div.find(".yaxislabel.variant").remove()}}});var T=function(af,ae,ah){c.call(this,af,ae,ah);var ag=j.get_random_color(),ad=j.get_random_color([ag,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:ag},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ad},{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:ah.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.request_draw({clear_tile_cache:true})}});this.prefs=this.config.values;this.painter=(af.reference_track?L.RefBasedReadPainter:L.ReadPainter);this.update_icons()};o(T.prototype,p.prototype,N.prototype,c.prototype);var d={CompositeTrack:e,DrawableGroup:P,DiagonalHeatmapTrack:r,FeatureTrack:c,LineTrack:g,ReadTrack:T,VariantTrack:Z,VcfTrack:Z};var n=function(af,ae,ad){if("copy" in af){return af.copy(ad)}else{var ag=af.obj_type;if(!ag){ag=af.track_type}return new d[ag](ae,ad,af)}};return{TracksterView:Y,DrawableGroup:P,LineTrack:g,FeatureTrack:c,DiagonalHeatmapTrack:r,ReadTrack:T,VariantTrack:Z,CompositeTrack:e,object_from_template:n}});
\ 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(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"))-ah.width()/2,ag=ao+parseInt(af.html_elt.css("top"))+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){var 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
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 static/scripts/packed/viz/visualization.js
--- a/static/scripts/packed/viz/visualization.js
+++ b/static/scripts/packed/viz/visualization.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","mvc/data","viz/trackster/util","utils/config"],function(s,i,l,o){var a=function(u,x,w,v){$.ajax({url:u,data:w,error:function(){alert("Grid failed")},success:function(y){Galaxy.modal.show({title:"Select datasets for new tracks",body:y,buttons:{Cancel:function(){Galaxy.modal.hide()},Add:function(){var z=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var A={data_type:"track_config",hda_ldda:"hda"},B=$(this).val();if($(this).attr("name")!=="id"){A.hda_ldda="ldda"}z[z.length]=$.ajax({url:x+"/"+B,data:A,dataType:"json"})});$.when.apply($,z).then(function(){var A=(arguments[0] instanceof Array?$.map(arguments,function(B){return B[0]}):[arguments[0]]);v(A)});Galaxy.modal.hide()}}})}})};var j=function(u){return("promise" in u)};var f=function(u){this.default_font=u!==undefined?u:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};s.extend(f.prototype,{load_pattern:function(u,y){var v=this.patterns,w=this.dummy_context,x=new Image();x.src=galaxy_config.root+"static/images"+y;x.onload=function(){v[u]=w.createPattern(x,"repeat")}},get_pattern:function(u){return this.patterns[u]},new_canvas:function(){var u=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(u)}u.manager=this;return u}});var q=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(u){this.clear()},get_elt:function(w){var x=this.attributes.obj_cache,y=this.attributes.key_ary,v=w.toString(),u=s.indexOf(y,function(z){return z.toString()===v});if(u!==-1){if(x[v].stale){y.splice(u,1);delete x[v]}else{this.move_key_to_end(w,u)}}return x[v]},set_elt:function(w,y){var z=this.attributes.obj_cache,A=this.attributes.key_ary,v=w.toString(),x=this.attributes.num_elements;if(!z[v]){if(A.length>=x){var u=A.shift();delete z[u.toString()]}A.push(w)}z[v]=y;return y},move_key_to_end:function(v,u){this.attributes.key_ary.splice(u,1);this.attributes.key_ary.push(v)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length},most_recently_added:function(){return this.size()===0?null:this.attributes.key_ary[this.attributes.key_ary.length-1]}});var d=q.extend({defaults:s.extend({},q.prototype.defaults,{dataset:null,genome:null,init_data:null,min_region_size:200,filters_manager:null,data_type:"data",data_mode_compatible:function(u,v){return true},can_subset:function(u){return false}}),initialize:function(u){q.prototype.initialize.call(this);var v=this.get("init_data");if(v){this.add_data(v)}},add_data:function(u){if(this.get("num_elements")<u.length){this.set("num_elements",u.length)}var v=this;s.each(u,function(w){v.set_data(w.region,w)})},data_is_ready:function(){var x=this.get("dataset"),w=$.Deferred(),u=(this.get("data_type")==="raw_data"?"state":this.get("data_type")==="data"?"converted_datasets_state":"error"),v=new l.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:x.get("hda_ldda"),data_type:u},dataType:"json"},interval:5000,success_fn:function(y){return y!=="pending"}});$.when(v.go()).then(function(y){w.resolve(y==="ok"||y==="data")});return w},search_features:function(u){var v=this.get("dataset"),w={query:u,hda_ldda:v.get("hda_ldda"),data_type:"features"};return $.getJSON(v.url(),w)},load_data:function(C,B,v,A){var y=this.get("dataset"),x={data_type:this.get("data_type"),chrom:C.get("chrom"),low:C.get("start"),high:C.get("end"),mode:B,resolution:v,hda_ldda:y.get("hda_ldda")};$.extend(x,A);var E=this.get("filters_manager");if(E){var F=[];var u=E.filters;for(var z=0;z<u.length;z++){F.push(u[z].name)}x.filter_cols=JSON.stringify(F)}var w=this,D=$.getJSON(y.url(),x,function(G){G.region=C;w.set_data(C,G)});this.set_data(C,D);return D},get_data:function(B,A,w,y){var C=this.get_elt(B);if(C&&(j(C)||this.get("data_mode_compatible")(C,A))){return C}var D=this.get("key_ary"),u=this.get("obj_cache"),v,z;for(var x=0;x<D.length;x++){v=D[x];if(v.contains(B)){z=true;C=u[v.toString()];if(j(C)||(this.get("data_mode_compatible")(C,A)&&this.get("can_subset")(C))){this.move_key_to_end(v,x);if(!j(C)){var F=this.subset_entry(C,B);this.set(B,F);C=F}return C}}}if(!z&&B.length()<this.attributes.min_region_size){var E=this.most_recently_added();if(!E||(B.get("start")>E.get("start"))){B.set("end",B.get("start")+this.attributes.min_region_size)}else{B.set("start",B.get("end")-this.attributes.min_region_size)}B.set("genome",this.attributes.genome);B.trim()}return this.load_data(B,A,w,y)},set_data:function(v,u){this.set_elt(v,u)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(C,B,x,A,y){var E=this._mark_stale(C);if(!(E&&this.get("data_mode_compatible")(E,B))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var w=C.get("start");if(y===this.DEEP_DATA_REQ){$.extend(A,{start_val:E.data.length+1})}else{if(y===this.BROAD_DATA_REQ){w=(E.max_high?E.max_high:E.data[E.data.length-1][2])+1}}var D=C.copy().set("start",w);var v=this,z=this.load_data(D,B,x,A),u=$.Deferred();this.set_data(C,u);$.when(z).then(function(F){if(F.data){F.data=E.data.concat(F.data);if(F.max_low){F.max_low=E.max_low}if(F.message){F.message=F.message.replace(/[0-9]+/,F.data.length)}}v.set_data(C,F);u.resolve(F)});return u},can_get_more_detailed_data:function(v){var u=this.get_elt(v);return(u.dataset_type==="bigwig"&&u.data.length<8000)},get_more_detailed_data:function(x,z,v,y,w){var u=this._mark_stale(x);if(!u){console.log("ERROR getting more detailed data: no current data");return}if(!w){w={}}if(u.dataset_type==="bigwig"){w.num_samples=1000*y}return this.load_data(x,z,v,w)},_mark_stale:function(v){var u=this.get_elt(v);if(!u){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),v.toString())}u.stale=true;return u},get_genome_wide_data:function(u){var w=this,y=true,x=s.map(u.get("chroms_info").chrom_info,function(A){var z=w.get_elt(new g({chrom:A.chrom,start:0,end:A.len}));if(!z){y=false}return z});if(y){return x}var v=$.Deferred();$.getJSON(this.get("dataset").url(),{data_type:"genome_data"},function(z){w.add_data(z.data);v.resolve(z.data)});return v},subset_entry:function(w,x){var u={bigwig:function(y,z){return s.filter(y,function(A){return A[0]>=z.get("start")&&A[0]<=z.get("end")})},refseq:function(z,A){var B=A.get("start")-w.region.get("start"),y=w.data.length-(w.region.get("end")-A.get("end"));return w.data.slice(B,y)}};var v=w.data;if(!w.region.same(x)&&w.dataset_type in u){v=u[w.dataset_type](w.data,x)}return{region:x,data:v,dataset_type:w.dataset_type}}});var p=d.extend({initialize:function(u){var v=new Backbone.Model();v.urlRoot=u.data_url;this.set("dataset",v)},load_data:function(w,x,u,v){return(w.length()<=100000?d.prototype.load_data.call(this,w,x,u,v):{data:null,region:w})}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(u){this.id=u.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(u){var v=s.find(this.get_chroms_info(),function(w){return w.chrom===u});return new g({chrom:v.chrom,end:v.len})},get_chrom_len:function(u){return s.find(this.get_chroms_info(),function(v){return v.chrom===u}).len}});var g=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,str_val:null,genome:null},same:function(u){return this.attributes.chrom===u.get("chrom")&&this.attributes.start===u.get("start")&&this.attributes.end===u.get("end")},initialize:function(v){if(v.from_str){var x=v.from_str.split(":"),w=x[0],u=x[1].split("-");this.set({chrom:w,start:parseInt(u[0],10),end:parseInt(u[1],10)})}this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end");this.on("change",function(){this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},this)},copy:function(){return new g({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.attributes.str_val},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(B){var v=this.get("chrom"),A=B.get("chrom"),z=this.get("start"),x=B.get("start"),y=this.get("end"),w=B.get("end"),u;if(v&&A&&v!==A){return g.overlap_results.DIF_CHROMS}if(z<x){if(y<x){u=g.overlap_results.BEFORE}else{if(y<w){u=g.overlap_results.OVERLAP_START}else{u=g.overlap_results.CONTAINS}}}else{if(z>x){if(z>w){u=g.overlap_results.AFTER}else{if(y<=w){u=g.overlap_results.CONTAINED_BY}else{u=g.overlap_results.OVERLAP_END}}}else{u=(y>=w?g.overlap_results.CONTAINS:g.overlap_results.CONTAINED_BY)}}return u},trim:function(u){if(this.attributes.start<0){this.attributes.start=0}if(this.attributes.genome){var v=this.attributes.genome.get_chrom_len(this.attributes.chrom);if(this.attributes.end>v){this.attributes.end=v-1}}return this},contains:function(u){return this.compute_overlap(u)===g.overlap_results.CONTAINS},overlaps:function(u){return s.intersection([this.compute_overlap(u)],[g.overlap_results.DIF_CHROMS,g.overlap_results.BEFORE,g.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var m=Backbone.Collection.extend({model:g});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:g}]});var r=Backbone.Collection.extend({model:e});var t=Backbone.RelationalModel.extend({relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:i.Dataset}],initialize:function(u){this.set("config",o.ConfigSettingCollection.from_config_dict(u.prefs));this.get("config").add([{key:"name",value:this.get("name")},{key:"color"}]);var v=this.get("preloaded_data");if(v){v=v.data}else{v=[]}this.set("data_manager",new d({dataset:this.get("dataset"),init_data:v}))}});var n=Backbone.RelationalModel.extend({defaults:{title:"",type:""},url:galaxy_config.root+"visualization/save",save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=n.extend({defaults:s.extend({},n.prototype.defaults,{dbkey:"",tracks:null,bookmarks:null,viewport:null}),relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:t}],add_tracks:function(u){this.get("tracks").add(u)}});var b=Backbone.Model.extend({});var h=Backbone.Router.extend({initialize:function(v){this.view=v.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var u=this;u.view.on("navigate",function(w){u.navigate(w)})},change_location:function(u){this.view.go_to(u)}});return{BackboneTrack:t,BrowserBookmark:e,BrowserBookmarkCollection:r,Cache:q,CanvasManager:f,Genome:c,GenomeDataManager:d,GenomeRegion:g,GenomeRegionCollection:m,GenomeVisualization:k,GenomeReferenceDataManager:p,TrackBrowserRouter:h,TrackConfig:b,Visualization:n,select_datasets:a}});
\ No newline at end of file
+define(["libs/underscore","mvc/data","viz/trackster/util","utils/config"],function(s,i,l,o){var a=function(u,x,w,v){$.ajax({url:u,data:w,error:function(){alert("Grid failed")},success:function(y){Galaxy.modal.show({title:"Select datasets for new tracks",body:y,buttons:{Cancel:function(){Galaxy.modal.hide()},Add:function(){var z=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var A={data_type:"track_config",hda_ldda:"hda"},B=$(this).val();if($(this).attr("name")!=="id"){A.hda_ldda="ldda"}z[z.length]=$.ajax({url:x+"/"+B,data:A,dataType:"json"})});$.when.apply($,z).then(function(){var A=(arguments[0] instanceof Array?$.map(arguments,function(B){return B[0]}):[arguments[0]]);v(A)});Galaxy.modal.hide()}}})}})};var j=function(u){return("promise" in u)};var f=function(u){this.default_font=u!==undefined?u:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};s.extend(f.prototype,{load_pattern:function(u,y){var v=this.patterns,w=this.dummy_context,x=new Image();x.src=galaxy_config.root+"static/images"+y;x.onload=function(){v[u]=w.createPattern(x,"repeat")}},get_pattern:function(u){return this.patterns[u]},new_canvas:function(){var u=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(u)}u.manager=this;return u}});var q=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(u){this.clear()},get_elt:function(w){var x=this.attributes.obj_cache,y=this.attributes.key_ary,v=w.toString(),u=s.indexOf(y,function(z){return z.toString()===v});if(u!==-1){if(x[v].stale){y.splice(u,1);delete x[v]}else{this.move_key_to_end(w,u)}}return x[v]},set_elt:function(w,y){var z=this.attributes.obj_cache,A=this.attributes.key_ary,v=w.toString(),x=this.attributes.num_elements;if(!z[v]){if(A.length>=x){var u=A.shift();delete z[u.toString()]}A.push(w)}z[v]=y;return y},move_key_to_end:function(v,u){this.attributes.key_ary.splice(u,1);this.attributes.key_ary.push(v)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length},most_recently_added:function(){return this.size()===0?null:this.attributes.key_ary[this.attributes.key_ary.length-1]}});var d=q.extend({defaults:s.extend({},q.prototype.defaults,{dataset:null,genome:null,init_data:null,min_region_size:200,filters_manager:null,data_type:"data",data_mode_compatible:function(u,v){return true},can_subset:function(u){return false}}),initialize:function(u){q.prototype.initialize.call(this);var v=this.get("init_data");if(v){this.add_data(v)}},add_data:function(u){if(this.get("num_elements")<u.length){this.set("num_elements",u.length)}var v=this;s.each(u,function(w){v.set_data(w.region,w)})},data_is_ready:function(){var x=this.get("dataset"),w=$.Deferred(),u=(this.get("data_type")==="raw_data"?"state":this.get("data_type")==="data"?"converted_datasets_state":"error"),v=new l.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:x.get("hda_ldda"),data_type:u},dataType:"json"},interval:5000,success_fn:function(y){return y!=="pending"}});$.when(v.go()).then(function(y){w.resolve(y==="ok"||y==="data")});return w},search_features:function(u){var v=this.get("dataset"),w={query:u,hda_ldda:v.get("hda_ldda"),data_type:"features"};return $.getJSON(v.url(),w)},load_data:function(C,B,v,A){var y=this.get("dataset"),x={data_type:this.get("data_type"),chrom:C.get("chrom"),low:C.get("start"),high:C.get("end"),mode:B,resolution:v,hda_ldda:y.get("hda_ldda")};$.extend(x,A);var E=this.get("filters_manager");if(E){var F=[];var u=E.filters;for(var z=0;z<u.length;z++){F.push(u[z].name)}x.filter_cols=JSON.stringify(F)}var w=this,D=$.getJSON(y.url(),x,function(G){G.region=C;w.set_data(C,G)});this.set_data(C,D);return D},get_data:function(B,A,w,y){var C=this.get_elt(B);if(C&&(j(C)||this.get("data_mode_compatible")(C,A))){return C}var D=this.get("key_ary"),u=this.get("obj_cache"),v,z;for(var x=0;x<D.length;x++){v=D[x];if(v.contains(B)){z=true;C=u[v.toString()];if(j(C)||(this.get("data_mode_compatible")(C,A)&&this.get("can_subset")(C))){this.move_key_to_end(v,x);if(!j(C)){var F=this.subset_entry(C,B);this.set(B,F);C=F}return C}}}if(!z&&B.length()<this.attributes.min_region_size){var E=this.most_recently_added(),B=B.copy();if(!E||(B.get("start")>E.get("start"))){B.set("end",B.get("start")+this.attributes.min_region_size)}else{B.set("start",B.get("end")-this.attributes.min_region_size)}B.set("genome",this.attributes.genome);B.trim()}return this.load_data(B,A,w,y)},set_data:function(v,u){this.set_elt(v,u)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(C,B,x,A,y){var E=this._mark_stale(C);if(!(E&&this.get("data_mode_compatible")(E,B))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var w=C.get("start");if(y===this.DEEP_DATA_REQ){$.extend(A,{start_val:E.data.length+1})}else{if(y===this.BROAD_DATA_REQ){w=(E.max_high?E.max_high:E.data[E.data.length-1][2])+1}}var D=C.copy().set("start",w);var v=this,z=this.load_data(D,B,x,A),u=$.Deferred();this.set_data(C,u);$.when(z).then(function(F){if(F.data){F.data=E.data.concat(F.data);if(F.max_low){F.max_low=E.max_low}if(F.message){F.message=F.message.replace(/[0-9]+/,F.data.length)}}v.set_data(C,F);u.resolve(F)});return u},can_get_more_detailed_data:function(v){var u=this.get_elt(v);return(u.dataset_type==="bigwig"&&u.data.length<8000)},get_more_detailed_data:function(x,z,v,y,w){var u=this._mark_stale(x);if(!u){console.log("ERROR getting more detailed data: no current data");return}if(!w){w={}}if(u.dataset_type==="bigwig"){w.num_samples=1000*y}return this.load_data(x,z,v,w)},_mark_stale:function(v){var u=this.get_elt(v);if(!u){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),v.toString())}u.stale=true;return u},get_genome_wide_data:function(u){var w=this,y=true,x=s.map(u.get("chroms_info").chrom_info,function(A){var z=w.get_elt(new g({chrom:A.chrom,start:0,end:A.len}));if(!z){y=false}return z});if(y){return x}var v=$.Deferred();$.getJSON(this.get("dataset").url(),{data_type:"genome_data"},function(z){w.add_data(z.data);v.resolve(z.data)});return v},subset_entry:function(w,x){var u={bigwig:function(y,z){return s.filter(y,function(A){return A[0]>=z.get("start")&&A[0]<=z.get("end")})},refseq:function(z,A){var B=A.get("start")-w.region.get("start"),y=w.data.length-(w.region.get("end")-A.get("end"));return w.data.slice(B,y)}};var v=w.data;if(!w.region.same(x)&&w.dataset_type in u){v=u[w.dataset_type](w.data,x)}return{region:x,data:v,dataset_type:w.dataset_type}}});var p=d.extend({initialize:function(u){var v=new Backbone.Model();v.urlRoot=u.data_url;this.set("dataset",v)},load_data:function(w,x,u,v){return(w.length()<=100000?d.prototype.load_data.call(this,w,x,u,v):{data:null,region:w})}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(u){this.id=u.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(u){var v=s.find(this.get_chroms_info(),function(w){return w.chrom===u});return new g({chrom:v.chrom,end:v.len})},get_chrom_len:function(u){return s.find(this.get_chroms_info(),function(v){return v.chrom===u}).len}});var g=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,str_val:null,genome:null},same:function(u){return this.attributes.chrom===u.get("chrom")&&this.attributes.start===u.get("start")&&this.attributes.end===u.get("end")},initialize:function(v){if(v.from_str){var x=v.from_str.split(":"),w=x[0],u=x[1].split("-");this.set({chrom:w,start:parseInt(u[0],10),end:parseInt(u[1],10)})}this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end");this.on("change",function(){this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},this)},copy:function(){return new g({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.attributes.str_val},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(B){var v=this.get("chrom"),A=B.get("chrom"),z=this.get("start"),x=B.get("start"),y=this.get("end"),w=B.get("end"),u;if(v&&A&&v!==A){return g.overlap_results.DIF_CHROMS}if(z<x){if(y<x){u=g.overlap_results.BEFORE}else{if(y<w){u=g.overlap_results.OVERLAP_START}else{u=g.overlap_results.CONTAINS}}}else{if(z>x){if(z>w){u=g.overlap_results.AFTER}else{if(y<=w){u=g.overlap_results.CONTAINED_BY}else{u=g.overlap_results.OVERLAP_END}}}else{u=(y>=w?g.overlap_results.CONTAINS:g.overlap_results.CONTAINED_BY)}}return u},trim:function(u){if(this.attributes.start<0){this.attributes.start=0}if(this.attributes.genome){var v=this.attributes.genome.get_chrom_len(this.attributes.chrom);if(this.attributes.end>v){this.attributes.end=v-1}}return this},contains:function(u){return this.compute_overlap(u)===g.overlap_results.CONTAINS},overlaps:function(u){return s.intersection([this.compute_overlap(u)],[g.overlap_results.DIF_CHROMS,g.overlap_results.BEFORE,g.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var m=Backbone.Collection.extend({model:g});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:g}]});var r=Backbone.Collection.extend({model:e});var t=Backbone.RelationalModel.extend({relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:i.Dataset}],initialize:function(u){this.set("config",o.ConfigSettingCollection.from_config_dict(u.prefs));this.get("config").add([{key:"name",value:this.get("name")},{key:"color"}]);var v=this.get("preloaded_data");if(v){v=v.data}else{v=[]}this.set("data_manager",new d({dataset:this.get("dataset"),init_data:v}))}});var n=Backbone.RelationalModel.extend({defaults:{title:"",type:""},url:galaxy_config.root+"visualization/save",save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=n.extend({defaults:s.extend({},n.prototype.defaults,{dbkey:"",tracks:null,bookmarks:null,viewport:null}),relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:t}],add_tracks:function(u){this.get("tracks").add(u)}});var b=Backbone.Model.extend({});var h=Backbone.Router.extend({initialize:function(v){this.view=v.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var u=this;u.view.on("navigate",function(w){u.navigate(w)})},change_location:function(u){this.view.go_to(u)}});return{BackboneTrack:t,BrowserBookmark:e,BrowserBookmarkCollection:r,Cache:q,CanvasManager:f,Genome:c,GenomeDataManager:d,GenomeRegion:g,GenomeRegionCollection:m,GenomeVisualization:k,GenomeReferenceDataManager:p,TrackBrowserRouter:h,TrackConfig:b,Visualization:n,select_datasets:a}});
\ No newline at end of file
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -1215,7 +1215,9 @@
// Load chroms.
if (result.reference) {
- view.add_label_track( new ReferenceTrack(view) );
+ var ref_track = new ReferenceTrack(view);
+ view.add_label_track(ref_track);
+ view.reference_track = ref_track;
}
view.chrom_data = result.chrom_info;
var chrom_options = '<option value="">Select Chrom/Contig</option>';
@@ -3726,8 +3728,9 @@
var ReferenceTrack = function (view) {
TiledTrack.call(this, view, { content_div: view.top_labeltrack }, { resize: false });
- view.reference_track = this;
this.visible_height_px = 12;
+ // 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");
this.data_url = galaxy_config.root + "api/genomes/" + this.view.dbkey;
this.data_url_extra_params = {reference: true};
@@ -3776,7 +3779,6 @@
// Try to subset data.
var subset = this.data_manager.subset_entry(data, region),
seq_data = subset.data;
- console.log(region.toString());
// Draw sequence data.
var canvas = ctx.canvas;
@@ -4148,7 +4150,6 @@
* @param ref_seq reference sequence data
*/
draw_tile: function(result, ctx, mode, region, w_scale, ref_seq) {
- console.log("FeatureTrack", region.toString());
var track = this,
canvas = ctx.canvas,
tile_low = region.get('start'),
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6634ab26b76f8da657157e8373dc5424d0b89435 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -410,7 +410,9 @@
// below.
// Use heuristic to extend region: extend relative to last data request.
- var last_request = this.most_recently_added();
+ var last_request = this.most_recently_added(),
+ // Use copy of region to avoid changing actual region.
+ region = region.copy();
if (!last_request || (region.get('start') > last_request.get('start'))) {
// This request is after the last request, so extend right.
region.set('end', region.get('start') + this.attributes.min_region_size);
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Force odict usage (sorted by 'order' key in object_store_config) for HierarchicalObjectStore
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/829c047e0577/
Changeset: 829c047e0577
User: dannon
Date: 2013-10-11 16:56:57
Summary: Force odict usage (sorted by 'order' key in object_store_config) for HierarchicalObjectStore
Affected #: 1 file
diff -r 750e687b468a27978d51dfac9d542a0cc113e64b -r 829c047e05776fb2a6568f0d1076856fe6255fab lib/galaxy/objectstore/__init__.py
--- a/lib/galaxy/objectstore/__init__.py
+++ b/lib/galaxy/objectstore/__init__.py
@@ -14,6 +14,7 @@
from galaxy.jobs import Sleeper
from galaxy.model import directory_hash_id
from galaxy.exceptions import ObjectNotFound, ObjectInvalid
+from galaxy.util.odict import odict
from sqlalchemy.orm import object_session
@@ -568,10 +569,10 @@
def __init__(self, config, config_xml=None, fsmon=False):
super(HierarchicalObjectStore, self).__init__(config, config_xml=config_xml)
- for b in config_xml.find('backends'):
+ self.backends = odict()
+ for b in sorted(config_xml.find('backends'), key=lambda b: int(b.get('order'))):
self.backends[int(b.get('order'))] = build_object_store_from_config(config, fsmon=fsmon, config_xml=b)
-
def exists(self, obj, **kwargs):
"""
Exists must check all child object stores
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