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
July 2012
- 1 participants
- 99 discussions
commit/galaxy-central: jgoecks: Add icon to set mode in paramamonster. Move chevron-expand icon from tracks CSS to base CSS.
by Bitbucket 10 Jul '12
by Bitbucket 10 Jul '12
10 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/761a17ad3aad/
changeset: 761a17ad3aad
user: jgoecks
date: 2012-07-10 17:31:41
summary: Add icon to set mode in paramamonster. Move chevron-expand icon from tracks CSS to base CSS.
affected #: 8 files
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 static/june_2007_style/base_sprites.less.tmpl
--- a/static/june_2007_style/base_sprites.less.tmpl
+++ b/static/june_2007_style/base_sprites.less.tmpl
@@ -130,6 +130,14 @@
-sprite-group: fugue;
-sprite-image: fugue/arrow-split.png;
}
+.icon-button.chevron-expand:hover {
+ -sprite-group: fugue;
+ -sprite-image: fugue/chevron-expand.png;
+}
+.icon-button.chevron-expand {
+ -sprite-group: fugue;
+ -sprite-image: fugue/chevron-expand-bw.png;
+}
.text-and-autocomplete-select {
-sprite-group: fugue;
-sprite-image: fugue/control-270.png;
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 static/june_2007_style/blue/base.css
--- a/static/june_2007_style/blue/base.css
+++ b/static/june_2007_style/blue/base.css
@@ -761,7 +761,9 @@
.icon-button.cross-circle:hover{background:url(fugue.png) no-repeat 0px -546px;}
.icon-button.arrow-split{background:url(fugue.png) no-repeat 0px -572px;}
.icon-button.arrow-split:hover{background:url(fugue.png) no-repeat 0px -598px;}
-.text-and-autocomplete-select{background:url(fugue.png) no-repeat right -624px;}
+.icon-button.chevron-expand:hover{background:url(fugue.png) no-repeat 0px -624px;}
+.icon-button.chevron-expand{background:url(fugue.png) no-repeat 0px -650px;}
+.text-and-autocomplete-select{background:url(fugue.png) no-repeat right -676px;}
div.historyItem-error .state-icon{background:url(history-states.png) no-repeat 0px 0px;}
div.historyItem-empty .state-icon{background:url(history-states.png) no-repeat 0px -25px;}
div.historyItem-queued .state-icon{background:url(history-states.png) no-repeat 0px -50px;}
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 static/june_2007_style/blue/fugue.png
Binary file static/june_2007_style/blue/fugue.png has changed
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 static/june_2007_style/blue/trackster.css
--- a/static/june_2007_style/blue/trackster.css
+++ b/static/june_2007_style/blue/trackster.css
@@ -66,8 +66,6 @@
.arrow-resize-090.active{background:transparent url(../images/fugue/arrow-resize-090.png) no-repeat;}
.layers-stack{background:transparent url(../images/fugue/layers-stack-bw.png) no-repeat;}
.layers-stack:hover{background:transparent url(../images/fugue/layers-stack.png) no-repeat;}
-.chevron-expand{background:transparent url(../images/fugue/chevron-expand-bw.png) no-repeat;}
-.chevron-expand:hover{background:transparent url(../images/fugue/chevron-expand.png) no-repeat;}
.settings-icon{background:transparent url(../images/fugue/gear-bw.png) no-repeat;}
.settings-icon:hover{background:transparent url(../images/fugue/gear.png) no-repeat;}
.overview-icon{background:transparent url(../images/fugue/application-dock-270-bw.png) no-repeat;}
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 static/june_2007_style/trackster.css.tmpl
--- a/static/june_2007_style/trackster.css.tmpl
+++ b/static/june_2007_style/trackster.css.tmpl
@@ -356,12 +356,6 @@
.layers-stack:hover {
background:transparent url(../images/fugue/layers-stack.png) no-repeat;
}
-.chevron-expand {
- background: transparent url(../images/fugue/chevron-expand-bw.png) no-repeat;
-}
-.chevron-expand:hover {
- background:transparent url(../images/fugue/chevron-expand.png) no-repeat;
-}
.settings-icon {
background: transparent url(../images/fugue/gear-bw.png) no-repeat;
}
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 static/scripts/packed/viz/paramamonster.js
--- a/static/scripts/packed/viz/paramamonster.js
+++ b/static/scripts/packed/viz/paramamonster.js
@@ -1,1 +1,1 @@
-var ToolInputsSettings=Backbone.Model.extend({defaults:{inputs:null,values:null}});var ToolParameterTree=Backbone.RelationalModel.extend({defaults:{tool:null,tree_data:null},initialize:function(b){var a=this;this.get("tool").get("inputs").each(function(c){if(!c.get_samples()){return}c.on("change:min change:max change:num_samples",function(d){if(d.get("in_ptree")){a.set_tree_data()}},a);c.on("change:in_ptree",function(d){if(d.get("in_ptree")){a.add_param(d)}else{a.remove_param(d)}a.set_tree_data()},a)});if(b.config){_.each(b.config,function(d){var c=a.get("tool").get("inputs").find(function(e){return e.get("name")===d.name});a.add_param(c);c.set(d)})}},add_param:function(a){if(a.get("ptree_index")){return}a.set("in_ptree",true);a.set("ptree_index",this.get_tree_params().length)},remove_param:function(a){a.set("in_ptree",false);a.set("ptree_index",null);_(this.get_tree_params()).each(function(b,c){b.set("ptree_index",c+1)})},set_tree_data:function(){var b=_.map(this.get_tree_params(),function(d){return{param:d,samples:d.get_samples()}});var a=0,c=function(g,d){var i=g[d],h=i.param,f=h.get("label"),e=i.samples;if(g.length-1===d){return _.map(e,function(j){return{id:a++,name:j,param:h,value:j}})}return _.map(e,function(j){return{id:a++,name:j,param:h,value:j,children:c(g,d+1)}})};this.set("tree_data",{name:"Root",id:a++,children:(b.length!==0?c(b,0):null)})},get_tree_params:function(){return _(this.get("tool").get("inputs").where({in_ptree:true})).sortBy(function(a){return a.get("ptree_index")})},get_num_leaves:function(){return this.get_tree_params().reduce(function(a,b){return a*b.get_samples().length},1)},get_node_settings:function(e){var c=this.get("tool").get_inputs_dict();var f=e.parent;if(f){while(f.depth!==0){c[f.param.get("name")]=f.value;f=f.parent}}var a=this,b=function(h,g){if(h.param){g[h.param.get("name")]=h.value}if(!h.children){return new ToolInputsSettings({inputs:a.get("tool").get("inputs"),values:g})}else{return _.flatten(_.map(h.children,function(i){return b(i,_.clone(g))}))}},d=b(e,c);if(!_.isArray(d)){d=[d]}return d},get_connected_nodes:function(c){var d=function(e){if(!e.children){return e}else{return _.flatten([e,_.map(e.children,function(f){return d(f)})])}};var b=[],a=c.parent;while(a){b.push(a);a=a.parent}return _.flatten([b,d(c)])},get_leaf:function(b){var c=this.get("tree_data"),a=function(d){return _.find(d,function(e){return b[e.param.get("name")]===e.value})};while(c.children){c=a(c.children)}return c},toJSON:function(){return this.get_tree_params().map(function(a){return{name:a.get("name"),min:a.get("min"),max:a.get("max"),num_samples:a.get("num_samples")}})}});var ParamaMonsterTrack=Backbone.RelationalModel.extend({defaults:{track:null,settings:null,regions:null},relations:[{type:Backbone.HasMany,key:"regions",relatedModel:"GenomeRegion"}],initialize:function(a){if(a.track){var b=_.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},a.track);delete b.mode;this.set("track",object_from_template(b,{},null))}},same_settings:function(a){var b=this.get("settings"),c=a.get("settings");for(var d in b){if(!c[d]||b[d]!==c[d]){return false}}return true},toJSON:function(){return{track:this.get("track").to_dict(),settings:this.get("settings"),regions:this.get("regions")}}});var TrackCollection=Backbone.Collection.extend({model:ParamaMonsterTrack});var ParamaMonsterVisualization=Visualization.extend({defaults:_.extend({},Visualization.prototype.defaults,{dataset:null,tool:null,parameter_tree:null,regions:null,tracks:null}),relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:"Dataset"},{type:Backbone.HasOne,key:"tool",relatedModel:"Tool"},{type:Backbone.HasMany,key:"regions",relatedModel:"GenomeRegion"},{type:Backbone.HasMany,key:"tracks",relatedModel:"ParamaMonsterTrack"}],initialize:function(a){var b=this.get("tool").copy(true);this.set("tool_with_samplable_inputs",b);this.set("parameter_tree",new ToolParameterTree({tool:b,config:a.tree_config}))},add_placeholder:function(a){this.get("tracks").add(new PlaceholderTrack(a))},add_track:function(a){this.get("tracks").add(a)},toJSON:function(){return{id:this.get("id"),title:"Parameter exploration for dataset '"+this.get("dataset").get("name")+"'",type:"paramamonster",dataset_id:this.get("dataset").id,tool_id:this.get("tool").id,regions:this.get("regions").toJSON(),tree_config:this.get("parameter_tree").toJSON(),tracks:this.get("tracks").toJSON()}}});var ParamaMonsterTrackView=Backbone.View.extend({tagName:"tr",TILE_LEN:250,initialize:function(a){this.canvas_manager=a.canvas_manager;this.render();this.model.on("change:track",this.draw_tiles,this)},render:function(){var f=this.model.get("settings"),b=f.get("values"),d=$("<td/>").addClass("settings").appendTo(this.$el),c=$("<div/>").addClass("track-info").hide().appendTo(d);c.append($("<div/>").css("font-weight","bold").text("Track Settings"));f.get("inputs").each(function(h){c.append(h.get("label")+": "+b[h.get("name")]+"<br/>")});var a=this,g=$("<button/>").appendTo(c).text("Run on complete dataset").click(function(){c.toggle();a.trigger("run_on_dataset",f)});var e=create_icon_buttons_menu([{title:"Settings",icon_class:"gear track-settings",on_click:function(){c.toggle()},tipsy_config:{gravity:"s"}},{title:"Remove",icon_class:"cross-circle",on_click:function(){a.$el.remove();$(".tipsy").remove()}}]);d.prepend(e.$el);this.model.get("regions").each(function(){a.$el.append($("<td/>").addClass("tile").html($("<img/>").attr("src",galaxy_paths.get("image_path")+"/loading_large_white_bg.gif")))});if(this.model.get("track")){this.draw_tiles()}},draw_tiles:function(){var b=this,a=this.model.get("track"),d=this.model.get("regions"),c=this.$el.find("td.tile");$.when(a.data_manager.data_is_ready()).then(function(e){d.each(function(h,g){var f=h.length()/b.TILE_LEN,j=1/f,i="Pack";$.when(a.data_manager.get_data(h,i,f,{})).then(function(l){var k=b.canvas_manager.new_canvas();k.width=b.TILE_LEN;k.height=a.get_canvas_height(l,i,j,k.width);a.draw_tile(l,k.getContext("2d"),i,f,h,j);$(c[g]).empty().append(k)})})})}});var ToolInputValOrSweepView=Backbone.View.extend({number_input_template:'<div class="form-row-input sweep"><input class="min" type="text" size="6" value="<%= min %>"> - <input class="max" type="text" size="6" value="<%= max %>"> samples: <input class="num_samples" type="text" size="1" value="<%= num_samples %>"></div>',select_input_template:'<div class="form-row-input sweep"><%= options %></div>',initialize:function(a){this.$el=a.tool_row;this.render()},render:function(){var b=this.model,f=b.get("type"),h=this.$el.find(".form-row-input"),d=null;h.find(":input").change(function(){b.set("value",$(this).val())});if(f==="number"){d=$(_.template(this.number_input_template,this.model.toJSON()))}else{if(f==="select"){var c=_.map(this.$el.find("select option"),function(i){return $(i).val()}),e=c.join(", ");d=$(_.template(this.select_input_template,{options:e}))}}d.insertAfter(h);var a=this,g=create_icon_buttons_menu([{title:"Add parameter to tree",icon_class:"plus-button",on_click:function(){b.set("in_ptree",true);h.hide();d.show();$(this).hide();a.$el.find(".icon-button.toggle").show()}},{title:"Remove parameter from tree",icon_class:"toggle",on_click:function(){b.set("in_ptree",false);d.hide();h.show();$(this).hide();a.$el.find(".icon-button.plus-button").show()}}],{tipsy_config:{gravity:"s"}});this.$el.prepend(g.$el);if(b.get("in_ptree")){h.hide();a.$el.find(".icon-button.plus-button").hide()}else{a.$el.find(".icon-button.toggle").hide();d.hide()}_.each(["min","max","num_samples"],function(i){d.find("."+i).change(function(){b.set(i,parseFloat($(this).val()))})})}});var ToolParameterTreeDesignView=Backbone.View.extend({className:"tree-design",initialize:function(a){this.render()},render:function(){var c=new ToolFormView({model:this.model.get("tool")});c.render();this.$el.append(c.$el);var b=this,a=b.model.get("tool").get("inputs");this.$el.find(".form-row").not(".form-actions").each(function(d){var e=new ToolInputValOrSweepView({model:a.at(d),tool_row:$(this)})})}});var ToolParameterTreeView=Backbone.View.extend({className:"tool-parameter-tree",initialize:function(a){this.model.on("change:tree_data",this.render,this)},render:function(){this.$el.children().remove();var i=this.model.get_tree_params();if(!i.length){return}this.width=100*(2+i.length);this.height=15*this.model.get_num_leaves();var h=this;var g=d3.layout.cluster().size([this.height,this.width-160]);var c=d3.svg.diagonal().projection(function(j){return[j.y,j.x]});var a=g.nodes(this.model.get("tree_data"));var d=_.uniq(_.pluck(a,"y"));_.each(i,function(l,k){var j=d[k+1],m=$("#center").position().left;h.$el.append($("<div>").addClass("label").text(l.get("label")).css("left",j+m))});var b=d3.select(this.$el[0]).append("svg").attr("width",this.width).attr("height",this.height+20).append("g").attr("transform","translate(40, 10)");var f=b.selectAll("path.link").data(g.links(a)).enter().append("path").attr("class","link").attr("d",c);var e=b.selectAll("g.node").data(a).enter().append("g").attr("class","node").attr("transform",function(j){return"translate("+j.y+","+j.x+")"}).on("mouseover",function(k){var j=_.pluck(h.model.get_connected_nodes(k),"id");e.filter(function(l){return _.find(j,function(m){return m===l.id})!==undefined}).style("fill","#f00")}).on("mouseout",function(){e.style("fill","#000")});e.append("circle").attr("r",9);e.append("text").attr("dx",function(j){return j.children?-12:12}).attr("dy",3).attr("text-anchor",function(j){return j.children?"end":"start"}).text(function(j){return j.name})}});var ParamaMonsterVisualizationView=Backbone.View.extend({className:"paramamonster",helpText:"<div><h4>Getting Started</h4><ol><li>Create a parameter tree by using the icons next to the tool's parameter names to add or remove parameters.<li>Adjust the tree by using parameter inputs to select min, max, and number of samples<li>Run the tool with different settings by clicking on tree nodes</ol></div>",initialize:function(b){this.canvas_manager=new CanvasManager(this.$el.parents("body"));this.tool_param_tree_view=new ToolParameterTreeView({model:this.model.get("parameter_tree")});this.track_collection_container=$("<table/>").addClass("tracks");this.model.get("parameter_tree").on("change:tree_data",this.handle_node_clicks,this);var a=this;this.model.get("tracks").each(function(c){c.get("track").view=a})},render:function(){var f=new ToolParameterTreeDesignView({model:this.model.get("parameter_tree")});$("#left").append(f.$el);var b=this,g=b.model.get("regions"),c=$("<tr/>").appendTo(this.track_collection_container);g.each(function(h){c.append($("<th>").text(h.toString()))});c.children().first().attr("colspan",2);var e=$("<div>").addClass("tiles");$("#right").append(e.append(this.track_collection_container));b.model.get("tracks").each(function(h){b.add_track(h)});var d=$(this.helpText).addClass("help"),a=create_icon_buttons_menu([{title:"Close",icon_class:"cross-circle",on_click:function(){$(".tipsy").remove();d.remove()},tipsy_config:{gravity:"s"}}]);d.prepend(a.$el.css("float","right"));$("#center").append(d);this.tool_param_tree_view.render();$("#center").append(this.tool_param_tree_view.$el);this.handle_node_clicks()},run_tool_on_dataset:function(b){var a=this.model.get("tool"),d=a.get("name"),c=this.model.get("dataset");a.set_input_values(b.get("values"));$.when(a.rerun(c)).then(function(e){});show_modal("Running "+d+" on complete dataset",d+" is running on dataset '"+c.get("name")+"'. Outputs are in the dataset's history.",{Ok:function(){hide_modal()}})},add_track:function(d){var b=this,c=this.model.get("parameter_tree");b.model.add_track(d);var a=new ParamaMonsterTrackView({model:d,canvas_manager:b.canvas_manager});a.on("run_on_dataset",b.run_tool_on_dataset,b);b.track_collection_container.append(a.$el);a.$el.hover(function(){var f=c.get_leaf(d.get("settings").get("values"));var e=_.pluck(c.get_connected_nodes(f),"id");d3.select(b.tool_param_tree_view.$el[0]).selectAll("g.node").filter(function(g){return _.find(e,function(h){return h===g.id})!==undefined}).style("fill","#f00")},function(){d3.select(b.tool_param_tree_view.$el[0]).selectAll("g.node").style("fill","#000")});return d},handle_node_clicks:function(){var a=this,b=this.model.get("parameter_tree"),d=this.model.get("regions"),c=d3.select(this.tool_param_tree_view.$el[0]).selectAll("g.node");c.on("click",function(k,g){var f=a.model.get("tool"),j=a.model.get("dataset"),h=b.get_node_settings(k),e=$.Deferred();if(h.length>=10){show_modal("Whoa there cowboy!","You clicked on a node to try "+a.model.get("tool").get("name")+" with "+h.length+" different combinations of settings. You can only run 10 jobs at a time.",{Ok:function(){hide_modal();e.resolve(false)}})}else{e.resolve(true)}$.when(e).then(function(i){if(!i){return}var l=_.map(h,function(m){var n=new ParamaMonsterTrack({settings:m,regions:d});a.add_track(n);return n});_.each(l,function(n,m){setTimeout(function(){f.set_input_values(n.get("settings").get("values"));$.when(f.rerun(j,d)).then(function(p){var q=_.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},p.first().get("track_config")),o=object_from_template(q,a,null);n.set("track",o)})},m*10000)})})})}});
\ No newline at end of file
+var ToolInputsSettings=Backbone.Model.extend({defaults:{inputs:null,values:null}});var ToolParameterTree=Backbone.RelationalModel.extend({defaults:{tool:null,tree_data:null},initialize:function(b){var a=this;this.get("tool").get("inputs").each(function(c){if(!c.get_samples()){return}c.on("change:min change:max change:num_samples",function(d){if(d.get("in_ptree")){a.set_tree_data()}},a);c.on("change:in_ptree",function(d){if(d.get("in_ptree")){a.add_param(d)}else{a.remove_param(d)}a.set_tree_data()},a)});if(b.config){_.each(b.config,function(d){var c=a.get("tool").get("inputs").find(function(e){return e.get("name")===d.name});a.add_param(c);c.set(d)})}},add_param:function(a){if(a.get("ptree_index")){return}a.set("in_ptree",true);a.set("ptree_index",this.get_tree_params().length)},remove_param:function(a){a.set("in_ptree",false);a.set("ptree_index",null);_(this.get_tree_params()).each(function(b,c){b.set("ptree_index",c+1)})},set_tree_data:function(){var b=_.map(this.get_tree_params(),function(d){return{param:d,samples:d.get_samples()}});var a=0,c=function(g,d){var i=g[d],h=i.param,f=h.get("label"),e=i.samples;if(g.length-1===d){return _.map(e,function(j){return{id:a++,name:j,param:h,value:j}})}return _.map(e,function(j){return{id:a++,name:j,param:h,value:j,children:c(g,d+1)}})};this.set("tree_data",{name:"Root",id:a++,children:(b.length!==0?c(b,0):null)})},get_tree_params:function(){return _(this.get("tool").get("inputs").where({in_ptree:true})).sortBy(function(a){return a.get("ptree_index")})},get_num_leaves:function(){return this.get_tree_params().reduce(function(a,b){return a*b.get_samples().length},1)},get_node_settings:function(e){var c=this.get("tool").get_inputs_dict();var f=e.parent;if(f){while(f.depth!==0){c[f.param.get("name")]=f.value;f=f.parent}}var a=this,b=function(h,g){if(h.param){g[h.param.get("name")]=h.value}if(!h.children){return new ToolInputsSettings({inputs:a.get("tool").get("inputs"),values:g})}else{return _.flatten(_.map(h.children,function(i){return b(i,_.clone(g))}))}},d=b(e,c);if(!_.isArray(d)){d=[d]}return d},get_connected_nodes:function(c){var d=function(e){if(!e.children){return e}else{return _.flatten([e,_.map(e.children,function(f){return d(f)})])}};var b=[],a=c.parent;while(a){b.push(a);a=a.parent}return _.flatten([b,d(c)])},get_leaf:function(b){var c=this.get("tree_data"),a=function(d){return _.find(d,function(e){return b[e.param.get("name")]===e.value})};while(c.children){c=a(c.children)}return c},toJSON:function(){return this.get_tree_params().map(function(a){return{name:a.get("name"),min:a.get("min"),max:a.get("max"),num_samples:a.get("num_samples")}})}});var ParamaMonsterTrack=Backbone.RelationalModel.extend({defaults:{track:null,mode:"Pack",settings:null,regions:null},relations:[{type:Backbone.HasMany,key:"regions",relatedModel:"GenomeRegion"}],initialize:function(a){if(a.track){var b=_.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},a.track);this.set("track",object_from_template(b,{},null))}},same_settings:function(a){var b=this.get("settings"),c=a.get("settings");for(var d in b){if(!c[d]||b[d]!==c[d]){return false}}return true},toJSON:function(){return{track:this.get("track").to_dict(),settings:this.get("settings"),regions:this.get("regions")}}});var TrackCollection=Backbone.Collection.extend({model:ParamaMonsterTrack});var ParamaMonsterVisualization=Visualization.extend({defaults:_.extend({},Visualization.prototype.defaults,{dataset:null,tool:null,parameter_tree:null,regions:null,tracks:null,default_mode:"Pack"}),relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:"Dataset"},{type:Backbone.HasOne,key:"tool",relatedModel:"Tool"},{type:Backbone.HasMany,key:"regions",relatedModel:"GenomeRegion"},{type:Backbone.HasMany,key:"tracks",relatedModel:"ParamaMonsterTrack"}],initialize:function(a){var b=this.get("tool").copy(true);this.set("tool_with_samplable_inputs",b);this.set("parameter_tree",new ToolParameterTree({tool:b,config:a.tree_config}))},add_track:function(a){this.get("tracks").add(a)},toJSON:function(){return{id:this.get("id"),title:"Parameter exploration for dataset '"+this.get("dataset").get("name")+"'",type:"paramamonster",dataset_id:this.get("dataset").id,tool_id:this.get("tool").id,regions:this.get("regions").toJSON(),tree_config:this.get("parameter_tree").toJSON(),tracks:this.get("tracks").toJSON()}}});var ParamaMonsterTrackView=Backbone.View.extend({tagName:"tr",TILE_LEN:250,initialize:function(a){this.canvas_manager=a.canvas_manager;this.render();this.model.on("change:track change:mode",this.draw_tiles,this)},render:function(){var f=this.model.get("settings"),b=f.get("values"),d=$("<td/>").addClass("settings").appendTo(this.$el),c=$("<div/>").addClass("track-info").hide().appendTo(d);c.append($("<div/>").css("font-weight","bold").text("Track Settings"));f.get("inputs").each(function(h){c.append(h.get("label")+": "+b[h.get("name")]+"<br/>")});var a=this,g=$("<button/>").appendTo(c).text("Run on complete dataset").click(function(){c.toggle();a.trigger("run_on_dataset",f)});var e=create_icon_buttons_menu([{title:"Settings",icon_class:"gear track-settings",on_click:function(){c.toggle()},tipsy_config:{gravity:"s"}},{title:"Remove",icon_class:"cross-circle",on_click:function(){a.$el.remove();$(".tipsy").remove()}}]);d.prepend(e.$el);this.model.get("regions").each(function(){a.$el.append($("<td/>").addClass("tile").html($("<img/>").attr("src",galaxy_paths.get("image_path")+"/loading_large_white_bg.gif")))});if(this.model.get("track")){this.draw_tiles()}},draw_tiles:function(){var b=this,a=this.model.get("track"),d=this.model.get("regions"),c=this.$el.find("td.tile");if(!a){return}$.when(a.data_manager.data_is_ready()).then(function(e){d.each(function(h,g){var f=h.length()/b.TILE_LEN,j=1/f,i=b.model.get("mode");$.when(a.data_manager.get_data(h,i,f,{})).then(function(l){var k=b.canvas_manager.new_canvas();k.width=b.TILE_LEN;k.height=a.get_canvas_height(l,i,j,k.width);a.draw_tile(l,k.getContext("2d"),i,f,h,j);$(c[g]).empty().append(k)})})})}});var ToolInputValOrSweepView=Backbone.View.extend({number_input_template:'<div class="form-row-input sweep"><input class="min" type="text" size="6" value="<%= min %>"> - <input class="max" type="text" size="6" value="<%= max %>"> samples: <input class="num_samples" type="text" size="1" value="<%= num_samples %>"></div>',select_input_template:'<div class="form-row-input sweep"><%= options %></div>',initialize:function(a){this.$el=a.tool_row;this.render()},render:function(){var b=this.model,f=b.get("type"),h=this.$el.find(".form-row-input"),d=null;h.find(":input").change(function(){b.set("value",$(this).val())});if(f==="number"){d=$(_.template(this.number_input_template,this.model.toJSON()))}else{if(f==="select"){var c=_.map(this.$el.find("select option"),function(i){return $(i).val()}),e=c.join(", ");d=$(_.template(this.select_input_template,{options:e}))}}d.insertAfter(h);var a=this,g=create_icon_buttons_menu([{title:"Add parameter to tree",icon_class:"plus-button",on_click:function(){b.set("in_ptree",true);h.hide();d.show();$(this).hide();a.$el.find(".icon-button.toggle").show()}},{title:"Remove parameter from tree",icon_class:"toggle",on_click:function(){b.set("in_ptree",false);d.hide();h.show();$(this).hide();a.$el.find(".icon-button.plus-button").show()}}],{tipsy_config:{gravity:"s"}});this.$el.prepend(g.$el);if(b.get("in_ptree")){h.hide();a.$el.find(".icon-button.plus-button").hide()}else{a.$el.find(".icon-button.toggle").hide();d.hide()}_.each(["min","max","num_samples"],function(i){d.find("."+i).change(function(){b.set(i,parseFloat($(this).val()))})})}});var ToolParameterTreeDesignView=Backbone.View.extend({className:"tree-design",initialize:function(a){this.render()},render:function(){var c=new ToolFormView({model:this.model.get("tool")});c.render();this.$el.append(c.$el);var b=this,a=b.model.get("tool").get("inputs");this.$el.find(".form-row").not(".form-actions").each(function(d){var e=new ToolInputValOrSweepView({model:a.at(d),tool_row:$(this)})})}});var ToolParameterTreeView=Backbone.View.extend({className:"tool-parameter-tree",initialize:function(a){this.model.on("change:tree_data",this.render,this)},render:function(){this.$el.children().remove();var i=this.model.get_tree_params();if(!i.length){return}this.width=100*(2+i.length);this.height=15*this.model.get_num_leaves();var h=this;var g=d3.layout.cluster().size([this.height,this.width-160]);var c=d3.svg.diagonal().projection(function(j){return[j.y,j.x]});var a=g.nodes(this.model.get("tree_data"));var d=_.uniq(_.pluck(a,"y"));_.each(i,function(l,k){var j=d[k+1],m=$("#center").position().left;h.$el.append($("<div>").addClass("label").text(l.get("label")).css("left",j+m))});var b=d3.select(this.$el[0]).append("svg").attr("width",this.width).attr("height",this.height+20).append("g").attr("transform","translate(40, 10)");var f=b.selectAll("path.link").data(g.links(a)).enter().append("path").attr("class","link").attr("d",c);var e=b.selectAll("g.node").data(a).enter().append("g").attr("class","node").attr("transform",function(j){return"translate("+j.y+","+j.x+")"}).on("mouseover",function(k){var j=_.pluck(h.model.get_connected_nodes(k),"id");e.filter(function(l){return _.find(j,function(m){return m===l.id})!==undefined}).style("fill","#f00")}).on("mouseout",function(){e.style("fill","#000")});e.append("circle").attr("r",9);e.append("text").attr("dx",function(j){return j.children?-12:12}).attr("dy",3).attr("text-anchor",function(j){return j.children?"end":"start"}).text(function(j){return j.name})}});var ParamaMonsterVisualizationView=Backbone.View.extend({className:"paramamonster",helpText:"<div><h4>Getting Started</h4><ol><li>Create a parameter tree by using the icons next to the tool's parameter names to add or remove parameters.<li>Adjust the tree by using parameter inputs to select min, max, and number of samples<li>Run the tool with different settings by clicking on tree nodes</ol></div>",initialize:function(b){this.canvas_manager=new CanvasManager(this.$el.parents("body"));this.tool_param_tree_view=new ToolParameterTreeView({model:this.model.get("parameter_tree")});this.track_collection_container=$("<table/>").addClass("tracks");this.model.get("parameter_tree").on("change:tree_data",this.handle_node_clicks,this);var a=this;this.model.get("tracks").each(function(c){c.get("track").view=a})},render:function(){var g=new ToolParameterTreeDesignView({model:this.model.get("parameter_tree")});$("#left").append(g.$el);var j=this,d=j.model.get("regions"),h=$("<tr/>").appendTo(this.track_collection_container);d.each(function(k){h.append($("<th>").text(k.toString()))});h.children().first().attr("colspan",2);var e=$("<div>").addClass("tiles");$("#right").append(e.append(this.track_collection_container));j.model.get("tracks").each(function(k){j.add_track(k)});var i=$(this.helpText).addClass("help"),f=create_icon_buttons_menu([{title:"Close",icon_class:"cross-circle",on_click:function(){$(".tipsy").remove();i.remove()},tipsy_config:{gravity:"s"}}]);i.prepend(f.$el.css("float","right"));$("#center").append(i);this.tool_param_tree_view.render();$("#center").append(this.tool_param_tree_view.$el);this.handle_node_clicks();var c=create_icon_buttons_menu([{icon_class:"chevron-expand",title:"Set display mode"},{icon_class:"cross-circle",title:"Close",on_click:function(){window.location="${h.url_for( controller='visualization', action='list' )}"}}],{tipsy_config:{gravity:"n"}});var b=["Squish","Pack"],a={};_.each(b,function(k){a[k]=function(){j.model.set("default_mode",k);j.model.get("tracks").each(function(l){l.set("mode",k)})}});make_popupmenu(c.$el.find(".chevron-expand"),a);c.$el.attr("style","float: right");$("#right .unified-panel-header-inner").append(c.$el)},run_tool_on_dataset:function(b){var a=this.model.get("tool"),d=a.get("name"),c=this.model.get("dataset");a.set_input_values(b.get("values"));$.when(a.rerun(c)).then(function(e){});show_modal("Running "+d+" on complete dataset",d+" is running on dataset '"+c.get("name")+"'. Outputs are in the dataset's history.",{Ok:function(){hide_modal()}})},add_track:function(d){var b=this,c=this.model.get("parameter_tree");b.model.add_track(d);var a=new ParamaMonsterTrackView({model:d,canvas_manager:b.canvas_manager});a.on("run_on_dataset",b.run_tool_on_dataset,b);b.track_collection_container.append(a.$el);a.$el.hover(function(){var f=c.get_leaf(d.get("settings").get("values"));var e=_.pluck(c.get_connected_nodes(f),"id");d3.select(b.tool_param_tree_view.$el[0]).selectAll("g.node").filter(function(g){return _.find(e,function(h){return h===g.id})!==undefined}).style("fill","#f00")},function(){d3.select(b.tool_param_tree_view.$el[0]).selectAll("g.node").style("fill","#000")});return d},handle_node_clicks:function(){var a=this,b=this.model.get("parameter_tree"),d=this.model.get("regions"),c=d3.select(this.tool_param_tree_view.$el[0]).selectAll("g.node");c.on("click",function(k,g){var f=a.model.get("tool"),j=a.model.get("dataset"),h=b.get_node_settings(k),e=$.Deferred();if(h.length>=10){show_modal("Whoa there cowboy!","You clicked on a node to try "+a.model.get("tool").get("name")+" with "+h.length+" different combinations of settings. You can only run 10 jobs at a time.",{Ok:function(){hide_modal();e.resolve(false)}})}else{e.resolve(true)}$.when(e).then(function(i){if(!i){return}var l=_.map(h,function(m){var n=new ParamaMonsterTrack({settings:m,regions:d,mode:a.model.get("default_mode")});a.add_track(n);return n});_.each(l,function(n,m){setTimeout(function(){f.set_input_values(n.get("settings").get("values"));$.when(f.rerun(j,d)).then(function(p){var q=_.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},p.first().get("track_config")),o=object_from_template(q,a,null);n.set("track",o)})},m*10000)})})})}});
\ No newline at end of file
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 static/scripts/viz/paramamonster.js
--- a/static/scripts/viz/paramamonster.js
+++ b/static/scripts/viz/paramamonster.js
@@ -250,6 +250,7 @@
var ParamaMonsterTrack = Backbone.RelationalModel.extend({
defaults: {
track: null,
+ mode: 'Pack',
settings: null,
regions: null
},
@@ -269,8 +270,6 @@
data_url: galaxy_paths.get('raw_data_url'),
converted_datasets_state_url: galaxy_paths.get('dataset_state_url')
}, options.track);
- // HACK: remove prefs b/c they cause a redraw, which is not supported now.
- delete track_config.mode;
this.set('track', object_from_template(track_config, {}, null));
}
},
@@ -309,7 +308,8 @@
tool: null,
parameter_tree: null,
regions: null,
- tracks: null
+ tracks: null,
+ default_mode: 'Pack'
}),
relations: [
@@ -346,10 +346,6 @@
}));
},
- add_placeholder: function(settings) {
- this.get('tracks').add(new PlaceholderTrack(settings));
- },
-
add_track: function(track) {
this.get('tracks').add(track);
},
@@ -384,7 +380,7 @@
initialize: function(options) {
this.canvas_manager = options.canvas_manager;
this.render();
- this.model.on('change:track', this.draw_tiles, this);
+ this.model.on('change:track change:mode', this.draw_tiles, this);
},
render: function() {
@@ -436,20 +432,25 @@
}
},
+ /**
+ * Draw tiles for regions.
+ */
draw_tiles: function() {
- // Display tiles for regions of interest.
var self = this,
track = this.model.get('track'),
regions = this.model.get('regions'),
tile_containers = this.$el.find('td.tile');
+ // Do nothing if track is not defined.
+ if (!track) { return; }
+
// When data is ready, draw tiles.
$.when(track.data_manager.data_is_ready()).then(function(data_ok) {
// Draw tile for each region.
regions.each(function(region, index) {
var resolution = region.length() / self.TILE_LEN,
w_scale = 1/resolution,
- mode = 'Pack';
+ mode = self.model.get('mode');
$.when(track.data_manager.get_data(region, mode, resolution, {})).then(function(tile_data) {
var canvas = self.canvas_manager.new_canvas();
canvas.width = self.TILE_LEN;
@@ -752,7 +753,65 @@
this.tool_param_tree_view.render();
$('#center').append(this.tool_param_tree_view.$el);
+ // Set up handler for tree node clicks.
this.handle_node_clicks();
+
+ // Set up visualization menu.
+ var menu = create_icon_buttons_menu(
+ [
+ // Save.
+ /*
+ { icon_class: 'disk--arrow', title: 'Save', on_click: function() {
+ // Show saving dialog box
+ show_modal("Saving...", "progress");
+
+ viz.save().success(function(vis_info) {
+ hide_modal();
+ viz.set({
+ 'id': vis_info.vis_id,
+ 'has_changes': false
+ });
+ })
+ .error(function() {
+ show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
+ { "Close" : hide_modal } );
+ });
+ } },
+ */
+ // Change track modes.
+ {
+ icon_class: 'chevron-expand',
+ title: 'Set display mode'
+ },
+ // Close viz.
+ {
+ icon_class: 'cross-circle',
+ title: 'Close',
+ on_click: function() {
+ window.location = "${h.url_for( controller='visualization', action='list' )}";
+ }
+ }
+ ],
+ {
+ tipsy_config: {gravity: 'n'}
+ });
+
+ // Create mode selection popup. Mode selection changes default mode and mode for all tracks.
+ var modes = ['Squish', 'Pack'],
+ mode_mapping = {};
+ _.each(modes, function(mode) {
+ mode_mapping[mode] = function() {
+ self.model.set('default_mode', mode);
+ self.model.get('tracks').each(function(track) {
+ track.set('mode', mode);
+ });
+ };
+ });
+
+ make_popupmenu(menu.$el.find('.chevron-expand'), mode_mapping);
+
+ menu.$el.attr("style", "float: right");
+ $("#right .unified-panel-header-inner").append(menu.$el);
},
run_tool_on_dataset: function(settings) {
@@ -778,7 +837,10 @@
add_track: function(pm_track) {
var self = this,
param_tree = this.model.get('parameter_tree');
+
+ // Add track to model.
self.model.add_track(pm_track);
+
var track_view = new ParamaMonsterTrackView({
model: pm_track,
canvas_manager: self.canvas_manager
@@ -801,6 +863,10 @@
return pm_track;
},
+ /**
+ * Sets up handling when tree nodes are clicked. When a node is clicked, the tool is run for each of
+ * the settings defined by the node's subtree and tracks are added for each run.
+ */
handle_node_clicks: function() {
// When node clicked in tree, run tool and add tracks to model.
var self = this,
@@ -836,7 +902,8 @@
var tracks = _.map(all_settings, function(settings) {
var pm_track = new ParamaMonsterTrack({
settings: settings,
- regions: regions
+ regions: regions,
+ mode: self.model.get('default_mode')
});
self.add_track(pm_track);
return pm_track;
diff -r f6aad6dced57c050349db4bc3ff09fb05a1866ef -r 761a17ad3aad454283abca2bf33866ad954a2d97 templates/visualization/paramamonster.mako
--- a/templates/visualization/paramamonster.mako
+++ b/templates/visualization/paramamonster.mako
@@ -118,40 +118,7 @@
${ h.to_json_string( config ).replace('\\', '\\\\' )}
);
var viz_view = new ParamaMonsterVisualizationView({ model: viz });
-
viz_view.render();
- $('.unified-panel-body').append(viz_view.$el);
-
- // -- Menu set up. --
- /*
- var menu = create_icon_buttons_menu([
- { icon_class: 'disk--arrow', title: 'Save', on_click: function() {
- // Show saving dialog box
- show_modal("Saving...", "progress");
-
- viz.save().success(function(vis_info) {
- hide_modal();
- viz.set({
- 'id': vis_info.vis_id,
- 'has_changes': false
- });
- })
- .error(function() {
- show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
- { "Close" : hide_modal } );
- });
- } },
- { icon_class: 'cross-circle', title: 'Close', on_click: function() {
- window.location = "${h.url_for( controller='visualization', action='list' )}";
- } }
- ],
- {
- tipsy_config: {gravity: 'n'}
- });
-
- menu.$el.attr("style", "float: right");
- $("#right .unified-panel-header-inner").append(menu.$el);
- */
});
</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: dan: Fix for clearing converted datasets on dataset creation when set_metadata_externally = False.
by Bitbucket 10 Jul '12
by Bitbucket 10 Jul '12
10 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/f6aad6dced57/
changeset: f6aad6dced57
user: dan
date: 2012-07-10 17:09:38
summary: Fix for clearing converted datasets on dataset creation when set_metadata_externally = False.
affected #: 1 file
diff -r db93f1033bf861fadb7bdf838d1d5eb40cde5135 -r f6aad6dced57c050349db4bc3ff09fb05a1866ef lib/galaxy/jobs/__init__.py
--- a/lib/galaxy/jobs/__init__.py
+++ b/lib/galaxy/jobs/__init__.py
@@ -394,7 +394,7 @@
if not self.app.config.set_metadata_externally or \
( not self.external_output_metadata.external_metadata_set_successfully( dataset, self.sa_session ) \
and self.app.config.retry_metadata_internally ):
- dataset.set_meta( overwrite = False )
+ dataset.datatype.set_meta( dataset, overwrite = False ) #call datatype.set_meta directly for the initial set_meta call during dataset creation
# TODO: The context['stderr'] used to indicate that there
# was an error. Now we must rely on the job's state instead;
# that indicates whether the tool relied on stderr to indicate
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
10 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/db93f1033bf8/
changeset: db93f1033bf8
user: fbacall
date: 2012-07-10 10:01:19
summary: Fixed minor error in workflow image SVG
affected #: 1 file
diff -r dc20a7b5b6ce453a5fee7546a00604313bf1c54d -r db93f1033bf861fadb7bdf838d1d5eb40cde5135 lib/galaxy/web/controllers/workflow.py
--- a/lib/galaxy/web/controllers/workflow.py
+++ b/lib/galaxy/web/controllers/workflow.py
@@ -1930,8 +1930,8 @@
canvas.append(boxes)
canvas.append(text)
width, height = (max_x + max_width + 50), max_y + 300
- canvas['width'] = "%s px" % width
- canvas['height'] = "%s px" % height
+ canvas['width'] = "%spx" % width
+ canvas['height'] = "%spx" % height
canvas['viewBox'] = "0 0 %s %s" % (width, height)
return canvas
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: smcmanus: When the history panel is used to stop a job, the job's subtasks are
by Bitbucket 09 Jul '12
by Bitbucket 09 Jul '12
09 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/dc20a7b5b6ce/
changeset: dc20a7b5b6ce
user: smcmanus
date: 2012-07-09 23:43:25
summary: When the history panel is used to stop a job, the job's subtasks are
cancelled. The mapping change allows "Job.tasks" to refer to the job's
subtasks.
affected #: 2 files
diff -r fabe313817c42eedadbdb2f1399fed46b79bae20 -r dc20a7b5b6ce453a5fee7546a00604313bf1c54d lib/galaxy/jobs/runners/tasks.py
--- a/lib/galaxy/jobs/runners/tasks.py
+++ b/lib/galaxy/jobs/runners/tasks.py
@@ -171,31 +171,57 @@
return False
def stop_job( self, job ):
- # DBTODO Call stop on all of the tasks.
- #if our local job has JobExternalOutputMetadata associated, then our primary job has to have already finished
- if job.external_output_metadata:
- pid = job.external_output_metadata[0].job_runner_external_pid #every JobExternalOutputMetadata has a pid set, we just need to take from one of them
+ # We need to stop all subtasks. This is going to stay in the task
+ # runner because the task runner also starts all the tasks.
+ # First, get the list of tasks from job.tasks, which uses SQL
+ # alchemy to retrieve a job's list of tasks.
+ tasks = job.tasks
+ if ( len( job.tasks ) > 0 ):
+ for task in job.tasks:
+ self.stop_pid( task.task_runner_external_id, job.id )
+
+ # There were no subtasks, so just kill the job. We'll touch
+ # this if the tasks runner is used but the tool does not use
+ # parallelism.
else:
- pid = job.job_runner_external_id
- if pid in [ None, '' ]:
- log.warning( "stop_job(): %s: no PID in database for job, unable to stop" % job.id )
- return
+ #if our local job has JobExternalOutputMetadata associated, then our primary job has to have already finished
+ if job.external_output_metadata:
+ pid = job.external_output_metadata[0].job_runner_external_pid #every JobExternalOutputMetadata has a pid set, we just need to take from one of them
+ else:
+ pid = job.job_runner_external_id
+ if pid in [ None, '' ]:
+ log.warning( "stop_job(): %s: no PID in database for job, unable to stop" % job.id )
+ return
+ self.stop_pid( pid, job.id )
+
+ def stop_pid( self, pid, job_id ):
+ """
+ This method stops the given process id whether it's a task or job.
+ It is meant to be a private helper method, but it is mostly reusable.
+ The first argument is the process id to stop, and the second id is the
+ job's id (which is used for logging messages only right now).
+ """
pid = int( pid )
+ log.debug( "Stopping pid %s" % pid )
if not self.check_pid( pid ):
- log.warning( "stop_job(): %s: PID %d was already dead or can't be signaled" % ( job.id, pid ) )
+ log.warning( "stop_job(): %s: PID %d was already dead or can't be signaled" % ( job_id, pid ) )
return
for sig in [ 15, 9 ]:
try:
os.killpg( pid, sig )
except OSError, e:
- log.warning( "stop_job(): %s: Got errno %s when attempting to signal %d to PID %d: %s" % ( job.id, errno.errorcode[e.errno], sig, pid, e.strerror ) )
- return # give up
+ # This warning could be bogus; many tasks are stopped with
+ # SIGTERM (signal 15), but ymmv depending on the platform.
+ log.warning( "stop_job(): %s: Got errno %s when attempting to signal %d to PID %d: %s" % ( job_id, errno.errorcode[e.errno], sig, pid, e.strerror ) )
+ return
+ # TODO: If we're stopping lots of tasks, then we will want to put this
+ # avoid a two-second overhead using some other asynchronous method.
sleep( 2 )
if not self.check_pid( pid ):
- log.debug( "stop_job(): %s: PID %d successfully killed with signal %d" %( job.id, pid, sig ) )
+ log.debug( "stop_job(): %s: PID %d successfully killed with signal %d" %( job_id, pid, sig ) )
return
else:
- log.warning( "stop_job(): %s: PID %d refuses to die after signaling TERM/KILL" %( job.id, pid ) )
+ log.warning( "stop_job(): %s: PID %d refuses to die after signaling TERM/KILL" %( job_id, pid ) )
def recover( self, job, job_wrapper ):
# DBTODO Task Recovery, this should be possible.
diff -r fabe313817c42eedadbdb2f1399fed46b79bae20 -r dc20a7b5b6ce453a5fee7546a00604313bf1c54d lib/galaxy/model/mapping.py
--- a/lib/galaxy/model/mapping.py
+++ b/lib/galaxy/model/mapping.py
@@ -1563,10 +1563,11 @@
post_job_actions=relation( PostJobActionAssociation, lazy=False ),
input_library_datasets=relation( JobToInputLibraryDatasetAssociation ),
output_library_datasets=relation( JobToOutputLibraryDatasetAssociation ),
- external_output_metadata = relation( JobExternalOutputMetadata, lazy = False ) ) )
+ external_output_metadata = relation( JobExternalOutputMetadata, lazy = False ),
+ tasks = relation(Task) ) )
assign_mapper( context, Task, Task.table,
- properties=dict( job = relation( Job )))
+ properties=dict( job = relation( Job ) ) )
assign_mapper( context, DeferredJob, DeferredJob.table,
properties = {} )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Add the ability to view the current datatypes registry and fix some issues when installing tool shed repositories that do not include any valid tools.
by Bitbucket 09 Jul '12
by Bitbucket 09 Jul '12
09 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/fabe313817c4/
changeset: fabe313817c4
user: greg
date: 2012-07-09 23:15:56
summary: Add the ability to view the current datatypes registry and fix some issues when installing tool shed repositories that do not include any valid tools.
affected #: 5 files
diff -r e598a3e78079064fcde5b709fac17bf58153d82a -r fabe313817c42eedadbdb2f1399fed46b79bae20 lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -1491,7 +1491,7 @@
elif c in MAPPED_CHARS:
translated.append( MAPPED_CHARS[ c ] )
else:
- translated.append( 'X' )
+ translated.append( '' )
return ''.join( translated )
def to_html_str( text ):
"""Translates the characters in text to sn html string"""
@@ -1508,7 +1508,7 @@
elif c == '\n':
translated.append( '<br/>' )
elif c not in [ '\r' ]:
- translated.append( 'X' )
+ translated.append( '' )
return ''.join( translated )
def update_repository( repo, ctx_rev=None ):
"""
diff -r e598a3e78079064fcde5b709fac17bf58153d82a -r fabe313817c42eedadbdb2f1399fed46b79bae20 lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py
+++ b/lib/galaxy/web/controllers/admin.py
@@ -685,4 +685,9 @@
if emails is None:
emails = [ u.email for u in trans.sa_session.query( trans.app.model.User ).enable_eagerloads( False ).all() ]
return trans.fill_template( 'admin/impersonate.mako', emails=emails, message=message, status=status )
-
\ No newline at end of file
+ @web.expose
+ @web.require_admin
+ def view_datatypes_registry( self, trans, **kwd ):
+ message = util.restore_text( kwd.get( 'message', '' ) )
+ status = util.restore_text( kwd.get( 'status', 'done' ) )
+ return trans.fill_template( 'admin/view_datatypes_registry.mako', message=message, status=status )
diff -r e598a3e78079064fcde5b709fac17bf58153d82a -r fabe313817c42eedadbdb2f1399fed46b79bae20 lib/galaxy/web/controllers/admin_toolshed.py
--- a/lib/galaxy/web/controllers/admin_toolshed.py
+++ b/lib/galaxy/web/controllers/admin_toolshed.py
@@ -308,6 +308,14 @@
shed_tool_conf,
tool_panel_dict,
new_install=False )
+ if repository.includes_datatypes:
+ repository_install_dir = os.path.abspath ( relative_install_dir )
+ # Deactivate proprietary datatypes.
+ installed_repository_dict = load_installed_datatypes( trans.app, repository, repository_install_dir, deactivate=False )
+ if installed_repository_dict and 'converter_path' in installed_repository_dict:
+ load_installed_datatype_converters( trans.app, installed_repository_dict, deactivate=False )
+ if installed_repository_dict and 'display_path' in installed_repository_dict:
+ load_installed_display_applications( trans.app, installed_repository_dict, deactivate=False )
message = 'The <b>%s</b> repository has been activated.' % repository.name
status = 'done'
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
@@ -406,9 +414,9 @@
if tool_shed_repository.includes_datatypes:
# Deactivate proprietary datatypes.
installed_repository_dict = load_installed_datatypes( trans.app, tool_shed_repository, repository_install_dir, deactivate=True )
- if installed_repository_dict[ 'converter_path' ]:
+ if installed_repository_dict and 'converter_path' in installed_repository_dict:
load_installed_datatype_converters( trans.app, installed_repository_dict, deactivate=True )
- if installed_repository_dict[ 'display_path' ]:
+ if installed_repository_dict and 'display_path' in installed_repository_dict:
load_installed_display_applications( trans.app, installed_repository_dict, deactivate=True )
if remove_from_disk_checked:
try:
@@ -1243,10 +1251,21 @@
tool_shed_repository.installed_changeset_revision,
tool_shed_repository.owner,
tool_shed_repository.dist_to_shed )
+ ctx_rev = get_ctx_rev( tool_shed_url, tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.installed_changeset_revision )
+ repo_info_dict = kwd.get( 'repo_info_dict', None )
+ if not repo_info_dict:
+ # This should only happen if the tool_shed_repository does not include any valid tools.
+ repo_info_dict = {}
+ repo_info_dict[ tool_shed_repository.name ] = ( tool_shed_repository.description,
+ repository_clone_url,
+ tool_shed_repository.installed_changeset_revision,
+ ctx_rev,
+ tool_shed_repository.owner,
+ metadata.get( 'tool_dependencies', None ) )
new_kwd = dict( includes_tool_dependencies=tool_shed_repository.includes_tool_dependencies,
includes_tools=tool_shed_repository.includes_tools,
install_tool_dependencies=install_tool_dependencies,
- repo_info_dicts=kwd[ 'repo_info_dict' ],
+ repo_info_dicts=util.listify( repo_info_dict ),
message=message,
new_tool_panel_section=new_tool_panel_section,
shed_tool_conf=shed_tool_conf,
diff -r e598a3e78079064fcde5b709fac17bf58153d82a -r fabe313817c42eedadbdb2f1399fed46b79bae20 templates/admin/view_datatypes_registry.mako
--- /dev/null
+++ b/templates/admin/view_datatypes_registry.mako
@@ -0,0 +1,51 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Current datatypes registry contains ${len( trans.app.datatypes_registry.datatype_elems )} datatypes</div>
+ <div class="toolFormBody">
+ <table class="manage-table colored" border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr>
+ <th>Extension</th>
+ <th>Type</th>
+ <th>Mimetype</th>
+ <th>Display in upload</th>
+ <th>Datatype class</th>
+ </tr>
+ <% ctr = 0 %>
+ %for elem in trans.app.datatypes_registry.datatype_elems:
+ <%
+ import galaxy.util
+ extension = elem.get( 'extension', None )
+ dtype = elem.get( 'type', None )
+ type_extension = elem.get( 'type_extension', None )
+ mimetype = elem.get( 'mimetype', None )
+ display_in_upload = galaxy.util.string_as_bool( elem.get( 'display_in_upload', False ) )
+ %>
+ %if ctr % 2 == 1:
+ <tr class="odd_row">
+ %else:
+ <tr class="tr">
+ %endif
+ <td>${extension}</td>
+ <td>${dtype}</td>
+ <td>
+ %if mimetype:
+ ${mimetype}
+ %endif
+ </td>
+ <td>
+ %if display_in_upload:
+ ${display_in_upload}
+ %endif
+ </td>
+ </tr>
+ <% ctr += 1 %>
+ %endfor
+ </table>
+ </div>
+</div>
diff -r e598a3e78079064fcde5b709fac17bf58153d82a -r fabe313817c42eedadbdb2f1399fed46b79bae20 templates/webapps/galaxy/admin/index.mako
--- a/templates/webapps/galaxy/admin/index.mako
+++ b/templates/webapps/galaxy/admin/index.mako
@@ -66,6 +66,7 @@
<div class="toolSectionTitle">Server</div><div class="toolSectionBody"><div class="toolSectionBg">
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='view_datatypes_registry' )}" target="galaxy_main">View datatypes registry</a></div><div class="toolTitle"><a href="${h.url_for( controller='admin', action='tool_versions' )}" target="galaxy_main">Tool versions</a></div><div class="toolTitle"><a href="${h.url_for( controller='admin', action='reload_tool' )}" target="galaxy_main">Reload a tool's configuration</a></div><div class="toolTitle"><a href="${h.url_for( controller='admin', action='memdump' )}" target="galaxy_main">Profile memory usage</a></div>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Apply a category grid whose search feature searches valid repository names and descriptions when browsing a tool shed from Galaxy.
by Bitbucket 09 Jul '12
by Bitbucket 09 Jul '12
09 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/e598a3e78079/
changeset: e598a3e78079
user: greg
date: 2012-07-09 20:49:31
summary: Apply a category grid whose search feature searches valid repository names and descriptions when browsing a tool shed from Galaxy.
affected #: 12 files
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a lib/galaxy/web/controllers/admin_toolshed.py
--- a/lib/galaxy/web/controllers/admin_toolshed.py
+++ b/lib/galaxy/web/controllers/admin_toolshed.py
@@ -366,7 +366,7 @@
def browse_tool_shed( self, trans, **kwd ):
tool_shed_url = kwd[ 'tool_shed_url' ]
galaxy_url = url_for( '/', qualified=True )
- url = '%srepository/browse_valid_repositories?galaxy_url=%s&webapp=galaxy&no_reset=true' % ( tool_shed_url, galaxy_url )
+ url = '%srepository/browse_valid_categories?galaxy_url=%s&webapp=galaxy&no_reset=true' % ( tool_shed_url, galaxy_url )
return trans.response.send_redirect( url )
@web.expose
@web.require_admin
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py
+++ b/lib/galaxy/webapps/community/controllers/common.py
@@ -501,6 +501,9 @@
def get_category( trans, id ):
"""Get a category from the database"""
return trans.sa_session.query( trans.model.Category ).get( trans.security.decode_id( id ) )
+def get_category_by_name( trans, name ):
+ """Get a category from the database via name"""
+ return trans.sa_session.query( trans.model.Category ).filter_by( name=name ).one()
def get_categories( trans ):
"""Get all categories from the database"""
return trans.sa_session.query( trans.model.Category ) \
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -52,8 +52,46 @@
DescriptionColumn( "Description",
key="Category.description",
attach_popup=False ),
+ RepositoriesColumn( "Repositories",
+ model_class=model.Repository,
+ attach_popup=False )
+ ]
+ # Override these
+ default_filter = {}
+ global_actions = []
+ operations = []
+ standard_filters = []
+ num_rows_per_page = 50
+ preserve_state = False
+ use_paging = True
+
+class ValidCategoryListGrid( CategoryListGrid ):
+ class RepositoriesColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, category ):
+ if category.repositories:
+ viewable_repositories = 0
+ for rca in category.repositories:
+ repository = rca.repository
+ if repository.downloadable_revisions:
+ viewable_repositories += 1
+ return viewable_repositories
+ return 0
+
+ # Grid definition
+ title = "Categories of valid repositories"
+ model_class = model.Category
+ template='/webapps/community/category/valid_grid.mako'
+ default_sort_key = "name"
+ columns = [
+ CategoryListGrid.NameColumn( "Name",
+ key="Category.name",
+ link=( lambda item: dict( operation="valid_repositories_by_category", id=item.id, webapp="galaxy" ) ),
+ attach_popup=False ),
+ CategoryListGrid.DescriptionColumn( "Description",
+ key="Category.description",
+ attach_popup=False ),
# Columns that are valid for filtering but are not visible.
- RepositoriesColumn( "Repositories",
+ RepositoriesColumn( "Valid repositories",
model_class=model.Repository,
attach_popup=False )
]
@@ -208,14 +246,28 @@
]
class ValidRepositoryListGrid( RepositoryListGrid ):
+ class CategoryColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, repository ):
+ rval = '<ul>'
+ if repository.categories:
+ for rca in repository.categories:
+ rval += '<li><a href="browse_repositories?operation=valid_repositories_by_category&id=%s&webapp=galaxy">%s</a></li>' \
+ % ( trans.security.encode_id( rca.category.id ), rca.category.name )
+ else:
+ rval += '<li>not set</li>'
+ rval += '</ul>'
+ return rval
+ class RepositoryCategoryColumn( grids.GridColumn ):
+ def filter( self, trans, user, query, column_filter ):
+ """Modify query to filter by category."""
+ if column_filter == "All":
+ return query
+ return query.filter( model.Category.name == column_filter )
class RevisionColumn( grids.GridColumn ):
def __init__( self, col_name ):
grids.GridColumn.__init__( self, col_name )
def get_value( self, trans, grid, repository ):
- """
- Display a SelectField whose options are the changeset_revision
- strings of all download-able revisions of this repository.
- """
+ """Display a SelectField whose options are the changeset_revision strings of all download-able revisions of this repository."""
select_field = build_changeset_revision_select_field( trans, repository )
if len( select_field.options ) > 1:
return select_field.get_html()
@@ -231,19 +283,35 @@
RevisionColumn( "Revision" ),
RepositoryListGrid.UserColumn( "Owner",
model_class=model.User,
- attach_popup=False,
- key="User.username" )
+ attach_popup=False ),
+ # Columns that are valid for filtering but are not visible.
+ RepositoryCategoryColumn( "Category",
+ model_class=model.Category,
+ key="Category.name",
+ visible=False )
]
- columns.append( grids.MulticolFilterColumn( "Search repository name, description, owner",
+ columns.append( grids.MulticolFilterColumn( "Search repository name, description",
cols_to_filter=[ columns[0], columns[1] ],
key="free-text-search",
visible=False,
filterable="standard" ) )
operations = []
def build_initial_query( self, trans, **kwd ):
+ if 'id' in kwd:
+ # The user is browsing categories of valid repositories, so filter the request by the received id, which is a category id.
+ return trans.sa_session.query( self.model_class ) \
+ .join( model.RepositoryMetadata.table ) \
+ .join( model.User.table ) \
+ .join( model.RepositoryCategoryAssociation.table ) \
+ .join( model.Category.table ) \
+ .filter( and_( model.Category.table.c.id == trans.security.decode_id( kwd[ 'id' ] ),
+ model.RepositoryMetadata.table.c.downloadable == True ) )
+ # The user performed a free text search on the ValidCategoryListGrid.
return trans.sa_session.query( self.model_class ) \
.join( model.RepositoryMetadata.table ) \
.join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table ) \
.filter( model.RepositoryMetadata.table.c.downloadable == True )
class MatchedRepositoryListGrid( grids.Grid ):
@@ -323,6 +391,7 @@
repository_list_grid = RepositoryListGrid()
email_alerts_repository_list_grid = EmailAlertsRepositoryListGrid()
category_list_grid = CategoryListGrid()
+ valid_category_list_grid = ValidCategoryListGrid()
def __add_hgweb_config_entry( self, trans, repository, repository_path ):
# Add an entry in the hgweb.config file for a new repository. An entry looks something like:
@@ -346,14 +415,13 @@
shutil.move( tmp_fname, os.path.abspath( hgweb_config ) )
@web.expose
def browse_categories( self, trans, **kwd ):
+ # The request came from the tool shed.
if 'f-free-text-search' in kwd:
- # Trick to enable searching repository name, description from the CategoryListGrid.
- # What we've done is rendered the search box for the RepositoryListGrid on the grid.mako
- # template for the CategoryListGrid. See ~/templates/webapps/community/category/grid.mako.
- # Since we are searching repositories and not categories, redirect to browse_repositories().
+ # Trick to enable searching repository name, description from the CategoryListGrid. What we've done is rendered the search box for the
+ # RepositoryListGrid on the grid.mako template for the CategoryListGrid. See ~/templates/webapps/community/category/grid.mako. Since we
+ # are searching repositories and not categories, redirect to browse_repositories().
if 'id' in kwd and 'f-free-text-search' in kwd and kwd[ 'id' ] == kwd[ 'f-free-text-search' ]:
- # The value of 'id' has been set to the search string, which is a repository name.
- # We'll try to get the desired encoded repository id to pass on.
+ # The value of 'id' has been set to the search string, which is a repository name. We'll try to get the desired encoded repository id to pass on.
try:
repository = get_repository_by_name( trans, kwd[ 'id' ] )
kwd[ 'id' ] = trans.security.encode_id( repository.id )
@@ -408,11 +476,10 @@
status=status )
@web.expose
def browse_repositories( self, trans, **kwd ):
- # We add params to the keyword dict in this method in order to rename the param
- # with an "f-" prefix, simulating filtering by clicking a search link. We have
- # to take this approach because the "-" character is illegal in HTTP requests.
+ # We add params to the keyword dict in this method in order to rename the param with an "f-" prefix, simulating filtering by clicking a search
+ # link. We have to take this approach because the "-" character is illegal in HTTP requests.
if 'webapp' not in kwd:
- kwd[ 'webapp' ] = 'community'
+ kwd[ 'webapp' ] = get_webapp( trans, **kwd )
if 'operation' in kwd:
operation = kwd['operation'].lower()
if operation == "view_or_manage_repository":
@@ -441,8 +508,7 @@
kwd[ 'f-email' ] = user.email
del kwd[ 'user_id' ]
else:
- # The received id is the repository id, so we need to get the id of the user
- # that uploaded the repository.
+ # The received id is the repository id, so we need to get the id of the user that uploaded the repository.
repository_id = kwd.get( 'id', None )
repository = get_repository( trans, repository_id )
kwd[ 'f-email' ] = repository.user.email
@@ -509,27 +575,73 @@
message=message,
status=status )
@web.expose
+ def browse_valid_categories( self, trans, **kwd ):
+ # The request came from Galaxy, so restrict category links to display only valid repository changeset revisions.
+ galaxy_url = kwd.get( 'galaxy_url', None )
+ if galaxy_url:
+ trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
+ if 'f-free-text-search' in kwd:
+ if kwd[ 'f-free-text-search' ] == 'All':
+ # The user performed a search, then clicked the "x" to eliminate the search criteria.
+ new_kwd = dict( webapp='galaxy', no_reset='true' )
+ return self.valid_category_list_grid( trans, **new_kwd )
+ # Since we are searching valid repositories and not categories, redirect to browse_valid_repositories().
+ if 'id' in kwd and 'f-free-text-search' in kwd and kwd[ 'id' ] == kwd[ 'f-free-text-search' ]:
+ # The value of 'id' has been set to the search string, which is a repository name.
+ # We'll try to get the desired encoded repository id to pass on.
+ try:
+ repository = get_repository_by_name( trans, kwd[ 'id' ] )
+ kwd[ 'id' ] = trans.security.encode_id( repository.id )
+ except:
+ pass
+ return self.browse_valid_repositories( trans, **kwd )
+ if 'operation' in kwd:
+ operation = kwd['operation'].lower()
+ if operation in [ "valid_repositories_by_category", "valid_repositories_by_user" ]:
+ # Eliminate the current filters if any exist.
+ for k, v in kwd.items():
+ if k.startswith( 'f-' ):
+ del kwd[ k ]
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='browse_valid_repositories',
+ **kwd ) )
+ return self.valid_category_list_grid( trans, **kwd )
+ @web.expose
def browse_valid_repositories( self, trans, **kwd ):
webapp = get_webapp( trans, **kwd )
galaxy_url = kwd.get( 'galaxy_url', None )
+ if 'f-free-text-search' in kwd:
+ if 'f-Category.name' in kwd:
+ # The user browsed to a category and then entered a search string, so get the category associated with it's value.
+ category_name = kwd[ 'f-Category.name' ]
+ category = get_category_by_name( trans, category_name )
+ # Set the id value in kwd since it is required by the ValidRepositoryListGrid.build_initial_query method.
+ kwd[ 'id' ] = trans.security.encode_id( category.id )
if galaxy_url:
trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
- repository_id = kwd.get( 'id', None )
if 'operation' in kwd:
operation = kwd[ 'operation' ].lower()
if operation == "preview_tools_in_changeset":
+ repository_id = kwd.get( 'id', None )
repository = get_repository( trans, repository_id )
return trans.response.send_redirect( web.url_for( controller='repository',
action='preview_tools_in_changeset',
webapp=webapp,
repository_id=repository_id,
changeset_revision=repository.tip ) )
- # The changeset_revision_select_field in the RepositoryListGrid performs a refresh_on_change
- # which sends in request parameters like changeset_revison_1, changeset_revision_2, etc. One
- # of the many select fields on the grid performed the refresh_on_change, so we loop through
- # all of the received values to see which value is not the repository tip. If we find it, we
- # know the refresh_on_change occurred, and we have the necessary repository id and change set
- # revision to pass on.
+ elif operation == "valid_repositories_by_category":
+ # Eliminate the current filters if any exist.
+ for k, v in kwd.items():
+ if k.startswith( 'f-' ):
+ del kwd[ k ]
+ category_id = kwd.get( 'id', None )
+ category = get_category( trans, category_id )
+ kwd[ 'f-Category.name' ] = category.name
+ # The changeset_revision_select_field in the ValidRepositoryListGrid performs a refresh_on_change which sends in request parameters like
+ # changeset_revison_1, changeset_revision_2, etc. One of the many select fields on the grid performed the refresh_on_change, so we loop
+ # through all of the received values to see which value is not the repository tip. If we find it, we know the refresh_on_change occurred
+ # and we have the necessary repository id and change set revision to pass on.
+ repository_id = None
for k, v in kwd.items():
changset_revision_str = 'changeset_revision_'
if k.startswith( changset_revision_str ):
@@ -901,7 +1013,7 @@
if webapp == 'galaxy':
# Our initial request originated from a Galaxy instance.
global_actions = [ grids.GridAction( "Browse valid repositories",
- dict( controller='repository', action='browse_valid_repositories', webapp=webapp ) ),
+ dict( controller='repository', action='browse_valid_categories', webapp=webapp ) ),
grids.GridAction( "Search for valid tools",
dict( controller='repository', action='find_tools', webapp=webapp ) ),
grids.GridAction( "Search for workflows",
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/category/grid.mako
--- a/templates/webapps/community/category/grid.mako
+++ b/templates/webapps/community/category/grid.mako
@@ -4,6 +4,7 @@
<%inherit file="/grid_base.mako" />
## Render grid header.
+## TODO: This is very similar to this directory's valid_grid.mako, so see if we can re-use this code in a better way.
<%def name="render_grid_header( grid, repo_grid, render_title=True)"><div class="grid-header">
%if render_title:
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/category/valid_grid.mako
--- /dev/null
+++ b/templates/webapps/community/category/valid_grid.mako
@@ -0,0 +1,63 @@
+<%namespace file="/display_common.mako" import="render_message" />
+<%namespace file="/grid_base.mako" import="*" />
+<%namespace file="/grid_common.mako" import="*" />
+<%inherit file="/grid_base.mako" />
+
+## Render grid header.
+<%def name="render_grid_header( grid, repo_grid, render_title=True)">
+ <div class="grid-header">
+ %if render_title:
+ ${grid_title()}
+ %endif
+ %if grid.global_actions:
+ <ul class="manage-table-actions">
+ %if len( grid.global_actions ) < 4:
+ %for action in grid.global_actions:
+ <li><a class="action-button" href="${h.url_for( **action.url_args )}">${action.label}</a></li>
+ %endfor
+ %else:
+ <li><a class="action-button" id="action-8675309-popup" class="menubutton">Actions</a></li>
+ <div popupmenu="action-8675309-popup">
+ %for action in grid.global_actions:
+ <a class="action-button" href="${h.url_for( **action.url_args )}">${action.label}</a>
+ %endfor
+ </div>
+ %endif
+ </ul>
+ %endif
+ ${render_grid_filters( repo_grid, render_advanced_search=False )}
+ </div>
+</%def>
+
+<%def name="make_grid( grid, repo_grid )">
+ <div class="loading-elt-overlay"></div>
+ <table>
+ <tr>
+ <td width="75%">${self.render_grid_header( grid, repo_grid )}</td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="100%" id="grid-message" valign="top">${render_message( message, status )}</td>
+ <td></td>
+ <td></td>
+ </tr>
+ </table>
+ ${render_grid_table( grid, show_item_checkboxes )}
+</%def>
+
+<%def name="grid_body( grid )">
+ <%
+ from galaxy.webapps.community.controllers.repository import ValidRepositoryListGrid
+ repo_grid = ValidRepositoryListGrid()
+ %>
+ ${self.make_grid( grid, repo_grid )}
+</%def>
+
+<%def name="center_panel()">
+ <div style="overflow: auto; height: 100%">
+ <div class="page-container" style="padding: 10px;">
+ ${self.grid_body( grid )}
+ </div>
+ </div>
+</%def>
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/repository/find_tools.mako
--- a/templates/webapps/community/repository/find_tools.mako
+++ b/templates/webapps/community/repository/find_tools.mako
@@ -13,7 +13,7 @@
%if webapp == 'galaxy':
<br/><br/><ul class="manage-table-actions">
- <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', webapp=webapp )}">Browse valid repositories</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a></li><li><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a></li></ul>
%endif
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/repository/find_workflows.mako
--- a/templates/webapps/community/repository/find_workflows.mako
+++ b/templates/webapps/community/repository/find_workflows.mako
@@ -13,7 +13,7 @@
%if webapp == 'galaxy':
<br/><br/><ul class="manage-table-actions">
- <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', webapp=webapp )}">Browse valid repositories</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a></li><a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a></ul>
%endif
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/repository/preview_tools_in_changeset.mako
--- a/templates/webapps/community/repository/preview_tools_in_changeset.mako
+++ b/templates/webapps/community/repository/preview_tools_in_changeset.mako
@@ -67,7 +67,7 @@
<li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li><li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="repository-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', webapp=webapp )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a><a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a></div>
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/repository/tool_form.mako
--- a/templates/webapps/community/repository/tool_form.mako
+++ b/templates/webapps/community/repository/tool_form.mako
@@ -128,7 +128,7 @@
</div><li><a class="action-button" id="tool_shed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="tool_shed-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', webapp=webapp )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a><a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a></div>
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/repository/view_repository.mako
--- a/templates/webapps/community/repository/view_repository.mako
+++ b/templates/webapps/community/repository/view_repository.mako
@@ -97,7 +97,7 @@
<li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li><li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="repository-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', webapp=webapp )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a><a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a></div>
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/repository/view_tool_metadata.mako
--- a/templates/webapps/community/repository/view_tool_metadata.mako
+++ b/templates/webapps/community/repository/view_tool_metadata.mako
@@ -41,7 +41,7 @@
</div><li><a class="action-button" id="tool_shed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="tool_shed-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', webapp=webapp )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a><a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a></div>
diff -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 -r e598a3e78079064fcde5b709fac17bf58153d82a templates/webapps/community/repository/view_workflow.mako
--- a/templates/webapps/community/repository/view_workflow.mako
+++ b/templates/webapps/community/repository/view_workflow.mako
@@ -81,7 +81,7 @@
</div><li><a class="action-button" id="toolshed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="toolshed-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', webapp=webapp )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a><a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a></div>
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
09 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/f33269063dab/
changeset: f33269063dab
user: jgoecks
date: 2012-07-09 15:45:34
summary: Visualization framework enhancements: (a) support for unpacking complete genome/trackster visualizations and (b) Circster view now uses genome visualizations rather than individual datasets as model.
affected #: 6 files
diff -r e449670f80edec4bec2ac81cd9e3630ff9e6a3b0 -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 lib/galaxy/visualization/tracks/data_providers.py
--- a/lib/galaxy/visualization/tracks/data_providers.py
+++ b/lib/galaxy/visualization/tracks/data_providers.py
@@ -614,9 +614,23 @@
def valid_chroms( self ):
st = summary_tree_from_file( self.converted_dataset.file_name )
return st.chrom_blocks.keys()
-
+
+ def get_genome_data( self, chroms_info ):
+ """
+ Returns summary tree data for complete genome.
+ """
+ dataset_summary = []
+ for chrom_info in chroms_info[ 'chrom_info' ]:
+ summary = self.get_summary( chrom_info[ 'chrom' ], 0, chrom_info[ 'len' ], level=4 )
+ dataset_summary.append( summary )
+
+ return dataset_summary
+ # TODO: rename to get_data to match other providers.
def get_summary( self, chrom, start, end, level=None, resolution=None ):
+ """
+ Returns summary tree data for a given genomic region.
+ """
filename = self.converted_dataset.file_name
st = self.CACHE[filename]
if st is None:
diff -r e449670f80edec4bec2ac81cd9e3630ff9e6a3b0 -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -233,7 +233,7 @@
@web.expose
@web.require_login()
- def browser(self, trans, id, chrom="", **kwargs):
+ def browser(self, trans, id, **kwargs):
"""
Display browser for the visualization denoted by id and add the datasets listed in `dataset_ids`.
"""
@@ -471,6 +471,11 @@
@web.expose
def paramamonster( self, trans, id=None, hda_ldda=None, dataset_id=None, regions=None ):
+ """
+ Creates a paramamonster visualization using the incoming parameters. If id is available,
+ get the visualization with the given id; otherwise, create a new visualization using
+ a given dataset and regions.
+ """
# Need to create history if necessary in order to create tool form.
trans.get_history( create=True )
@@ -497,27 +502,30 @@
return trans.fill_template_mako( "visualization/paramamonster.mako", config=viz_config )
@web.expose
- def circster( self, trans, hda_ldda, dataset_id ):
- # Get dataset.
- dataset = self.get_hda_or_ldda( trans, hda_ldda, dataset_id )
+ def circster( self, trans, id, **kwargs ):
+ vis = self.get_visualization( trans, id, check_ownership=False, check_accessible=True )
+ viz_config = self.get_visualization_config( trans, vis )
# Get genome info.
- dbkey = dataset.dbkey
+ dbkey = viz_config[ 'dbkey' ]
chroms_info = self.app.genomes.chroms( trans, dbkey=dbkey )
genome = { 'dbkey': dbkey, 'chroms_info': chroms_info }
- # Get summary tree data for dataset.
- data_sources = self._get_datasources( trans, dataset )
- tracks_dataset_type = data_sources['index']['name']
- converted_dataset = dataset.get_converted_dataset( trans, tracks_dataset_type )
- indexer = get_data_provider( tracks_dataset_type )( converted_dataset, dataset )
- dataset_summary = []
- for chrom_info in chroms_info[ 'chrom_info' ]:
- summary = indexer.get_summary( chrom_info[ 'chrom' ], 0, chrom_info[ 'len' ], level=4 )
- dataset_summary.append( summary )
+ # Add genome-wide summary tree data to each track in viz.
+ tracks = viz_config[ 'tracks' ]
+ for track in tracks:
+ # Get dataset and indexed datatype.
+ dataset = self.get_hda_or_ldda( trans, track[ 'hda_ldda'], track[ 'dataset_id' ] )
+ data_sources = self._get_datasources( trans, dataset )
+ indexed_type = data_sources['index']['name']
- return trans.fill_template_mako( "visualization/circster.mako", dataset=dataset, dataset_summary=dataset_summary, genome=genome )
-
+ # Get converted dataset and append track's genome data.
+ converted_dataset = dataset.get_converted_dataset( trans, indexed_type )
+ data_provider = get_data_provider( indexed_type )( converted_dataset, dataset )
+ track[ 'genome_wide_data' ] = { 'data': data_provider.get_genome_data( chroms_info ) }
+
+ return trans.fill_template( 'visualization/circster.mako', viz_config=viz_config, genome=genome )
+
# -----------------
# Helper methods.
# -----------------
diff -r e449670f80edec4bec2ac81cd9e3630ff9e6a3b0 -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 static/scripts/packed/viz/visualization.js
--- a/static/scripts/packed/viz/visualization.js
+++ b/static/scripts/packed/viz/visualization.js
@@ -1,1 +1,1 @@
-var ServerStateDeferred=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(a){return true}},go:function(){var d=$.Deferred(),c=this,f=c.get("ajax_settings"),e=c.get("success_fn"),b=c.get("interval"),a=function(){$.ajax(f).success(function(g){if(e(g)){d.resolve(g)}else{setTimeout(a,b)}})};a();return d}});var CanvasManager=function(a){this.default_font=a!==undefined?a:"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")};_.extend(CanvasManager.prototype,{load_pattern:function(a,e){var b=this.patterns,c=this.dummy_context,d=new Image();d.src=galaxy_paths.attributes.image_path+e;d.onload=function(){b[a]=c.createPattern(d,"repeat")}},get_pattern:function(a){return this.patterns[a]},new_canvas:function(){var a=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(a)}a.manager=this;return a}});var Cache=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(a){this.clear()},get_elt:function(b){var c=this.attributes.obj_cache,d=this.attributes.key_ary,a=d.indexOf(b);if(a!==-1){if(c[b].stale){d.splice(a,1);delete c[b]}else{this.move_key_to_end(b,a)}}return c[b]},set_elt:function(b,d){var e=this.attributes.obj_cache,f=this.attributes.key_ary,c=this.attributes.num_elements;if(!e[b]){if(f.length>=c){var a=f.shift();delete e[a]}f.push(b)}e[b]=d;return d},move_key_to_end:function(b,a){this.attributes.key_ary.splice(a,1);this.attributes.key_ary.push(b)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var GenomeDataManager=Cache.extend({defaults:_.extend({},Cache.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,data_mode_compatible:function(a,b){return true},can_subset:function(a){return false}}),data_is_ready:function(){var c=this.get("dataset"),b=$.Deferred(),a=new ServerStateDeferred({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:c.id,hda_ldda:c.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(d){return d!=="pending"}});$.when(a.go()).then(function(d){b.resolve(d==="ok"||d==="data")});return b},load_data:function(h,g,b,f){var d={chrom:h.get("chrom"),low:h.get("start"),high:h.get("end"),mode:g,resolution:b};dataset=this.get("dataset");if(dataset){d.dataset_id=dataset.id;d.hda_ldda=dataset.get("hda_ldda")}$.extend(d,f);var j=this.get("filters_manager");if(j){var k=[];var a=j.filters;for(var e=0;e<a.length;e++){k.push(a[e].name)}d.filter_cols=JSON.stringify(k)}var c=this;return $.getJSON(this.get("data_url"),d,function(i){c.set_data(h,i)})},get_data:function(g,f,c,e){var h=this.get_elt(g);if(h&&(is_deferred(h)||this.get("data_mode_compatible")(h,f))){return h}var j=this.get("key_ary"),b=this.get("obj_cache"),k,a;for(var d=0;d<j.length;d++){k=j[d];a=new GenomeRegion({from_str:k});if(a.contains(g)){h=b[k];if(is_deferred(h)||(this.get("data_mode_compatible")(h,f)&&this.get("can_subset")(h))){this.move_key_to_end(k,d);return h}}}h=this.load_data(g,f,c,e);this.set_data(g,h);return h},set_data:function(b,a){this.set_elt(b,a)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(i,h,d,g,e){var k=this.get_elt(i);if(!(k&&this.get("data_mode_compatible")(k,h))){console.log("ERROR: no current data for: ",dataset,i.toString(),h,d,g);return}k.stale=true;var c=i.get("start");if(e===this.DEEP_DATA_REQ){$.extend(g,{start_val:k.data.length+1})}else{if(e===this.BROAD_DATA_REQ){c=(k.max_high?k.max_high:k.data[k.data.length-1][2])+1}}var j=i.copy().set("start",c);var b=this,f=this.load_data(j,h,d,g),a=$.Deferred();this.set_data(i,a);$.when(f).then(function(l){if(l.data){l.data=k.data.concat(l.data);if(l.max_low){l.max_low=k.max_low}if(l.message){l.message=l.message.replace(/[0-9]+/,l.data.length)}}b.set_data(i,l);a.resolve(l)});return a},get_elt:function(a){return Cache.prototype.get_elt.call(this,a.toString())},set_elt:function(b,a){return Cache.prototype.set_elt.call(this,b.toString(),a)}});var ReferenceTrackDataManager=GenomeDataManager.extend({load_data:function(a,d,e,b,c){if(b>1){return{data:null}}return GenomeDataManager.prototype.load_data.call(this,a,d,e,b,c)}});var Genome=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var GenomeRegion=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(b){if(b.from_str){var d=b.from_str.split(":"),c=d[0],a=d[1].split("-");this.set({chrom:c,start:parseInt(a[0],10),end:parseInt(a[1],10)})}},copy:function(){return new GenomeRegion({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.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(h){var b=this.get("chrom"),g=h.get("chrom"),f=this.get("start"),d=h.get("start"),e=this.get("end"),c=h.get("end"),a;if(b&&g&&b!==g){return this.get("DIF_CHROMS")}if(f<d){if(e<d){a=this.get("BEFORE")}else{if(e<=c){a=this.get("OVERLAP_START")}else{a=this.get("CONTAINS")}}}else{if(f>c){a=this.get("AFTER")}else{if(e<=c){a=this.get("CONTAINED_BY")}else{a=this.get("OVERLAP_END")}}}return a},contains:function(a){return this.compute_overlap(a)===this.get("CONTAINS")},overlaps:function(a){return _.intersection([this.compute_overlap(a)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var GenomeRegionCollection=Backbone.Collection.extend({model:GenomeRegion});var BrowserBookmark=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:"GenomeRegion"}]});var BrowserBookmarkCollection=Backbone.Collection.extend({model:BrowserBookmark});var Visualization=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",datasets:[]},url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var TracksterVisualization=Visualization.extend({defaults:{bookmarks:[],viewport:{}}});var CircsterVisualization=Visualization.extend({});var HistogramDataset=Backbone.Model.extend({initialize:function(a){this.attributes.data=a;this.attributes.max=_.max(a,function(b){if(!b||typeof b==="string"){return 0}return b[1]})[1]}});var TrackConfig=Backbone.Model.extend({});var CircsterHistogramDatasetLayout=Backbone.Model.extend({chroms_layout:function(){var b=this.attributes.genome.get_chroms_info(),d=d3.layout.pie().value(function(f){return f.len}).sort(null),e=d(b),a=this.attributes.total_gap/b.length,c=_.map(e,function(h,g){var f=h.endAngle-a;h.endAngle=(f>h.startAngle?f:h.startAngle);return h});return c},chrom_data_layout:function(j,b,g,f,h){if(!b||typeof b==="string"){return null}var d=b[0],i=b[3],c=d3.scale.linear().domain([0,h]).range([g,f]),e=d3.layout.pie().value(function(k){return i}).startAngle(j.startAngle).endAngle(j.endAngle),a=e(d);_.each(d,function(k,l){a[l].outerRadius=c(k[1])});return a}});var CircsterView=Backbone.View.extend({className:"circster",initialize:function(a){this.width=a.width;this.height=a.height;this.total_gap=a.total_gap;this.genome=a.genome;this.dataset=a.dataset;this.radius_start=a.radius_start;this.dataset_arc_height=a.dataset_arc_height},render:function(){var d=this.radius_start,e=this.dataset_arc_height,j=new CircsterHistogramDatasetLayout({genome:this.genome,total_gap:this.total_gap}),i=j.chroms_layout(),g=_.zip(i,this.dataset.attributes.data),h=this.dataset.attributes.max,b=_.map(g,function(m){var n=m[0],l=m[1];return j.chrom_data_layout(n,l,d,d+e,h)});var c=d3.select(this.$el[0]).append("svg").attr("width",this.width).attr("height",this.height).append("g").attr("transform","translate("+this.width/2+","+this.height/2+")");var k=c.append("g").attr("id","inner-arc"),f=d3.svg.arc().innerRadius(d).outerRadius(d+e),a=k.selectAll("#inner-arc>path").data(i).enter().append("path").attr("d",f).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(l){return l.data.chrom});_.each(b,function(l){if(!l){return}var o=c.append("g"),n=d3.svg.arc().innerRadius(d),m=o.selectAll("path").data(l).enter().append("path").attr("d",n).style("stroke","red").style("fill","red")})}});var TrackBrowserRouter=Backbone.Router.extend({initialize:function(b){this.view=b.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var a=this;a.view.on("navigate",function(c){a.navigate(c)})},change_location:function(a){this.view.go_to(a)}});var add_datasets=function(a,c,b){$.ajax({url:a,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(d){show_modal("Select datasets for new tracks",d,{Cancel:function(){hide_modal()},Add:function(){var e=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var f,g=$(this).val();if($(this).attr("name")==="id"){f={hda_id:g}}else{f={ldda_id:g}}e[e.length]=$.ajax({url:c,data:f,dataType:"json"})});$.when.apply($,e).then(function(){var f=(arguments[0] instanceof Array?$.map(arguments,function(g){return g[0]}):[arguments[0]]);b(f)});hide_modal()}})}})};
\ No newline at end of file
+var ServerStateDeferred=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(a){return true}},go:function(){var d=$.Deferred(),c=this,f=c.get("ajax_settings"),e=c.get("success_fn"),b=c.get("interval"),a=function(){$.ajax(f).success(function(g){if(e(g)){d.resolve(g)}else{setTimeout(a,b)}})};a();return d}});var CanvasManager=function(a){this.default_font=a!==undefined?a:"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")};_.extend(CanvasManager.prototype,{load_pattern:function(a,e){var b=this.patterns,c=this.dummy_context,d=new Image();d.src=galaxy_paths.attributes.image_path+e;d.onload=function(){b[a]=c.createPattern(d,"repeat")}},get_pattern:function(a){return this.patterns[a]},new_canvas:function(){var a=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(a)}a.manager=this;return a}});var Cache=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(a){this.clear()},get_elt:function(b){var c=this.attributes.obj_cache,d=this.attributes.key_ary,a=d.indexOf(b);if(a!==-1){if(c[b].stale){d.splice(a,1);delete c[b]}else{this.move_key_to_end(b,a)}}return c[b]},set_elt:function(b,d){var e=this.attributes.obj_cache,f=this.attributes.key_ary,c=this.attributes.num_elements;if(!e[b]){if(f.length>=c){var a=f.shift();delete e[a]}f.push(b)}e[b]=d;return d},move_key_to_end:function(b,a){this.attributes.key_ary.splice(a,1);this.attributes.key_ary.push(b)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var GenomeDataManager=Cache.extend({defaults:_.extend({},Cache.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,genome_wide_summary_data:null,data_mode_compatible:function(a,b){return true},can_subset:function(a){return false}}),data_is_ready:function(){var c=this.get("dataset"),b=$.Deferred(),a=new ServerStateDeferred({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:c.id,hda_ldda:c.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(d){return d!=="pending"}});$.when(a.go()).then(function(d){b.resolve(d==="ok"||d==="data")});return b},load_data:function(h,g,b,f){var d={chrom:h.get("chrom"),low:h.get("start"),high:h.get("end"),mode:g,resolution:b};dataset=this.get("dataset");if(dataset){d.dataset_id=dataset.id;d.hda_ldda=dataset.get("hda_ldda")}$.extend(d,f);var j=this.get("filters_manager");if(j){var k=[];var a=j.filters;for(var e=0;e<a.length;e++){k.push(a[e].name)}d.filter_cols=JSON.stringify(k)}var c=this;return $.getJSON(this.get("data_url"),d,function(i){c.set_data(h,i)})},get_data:function(g,f,c,e){var h=this.get_elt(g);if(h&&(is_deferred(h)||this.get("data_mode_compatible")(h,f))){return h}var j=this.get("key_ary"),b=this.get("obj_cache"),k,a;for(var d=0;d<j.length;d++){k=j[d];a=new GenomeRegion({from_str:k});if(a.contains(g)){h=b[k];if(is_deferred(h)||(this.get("data_mode_compatible")(h,f)&&this.get("can_subset")(h))){this.move_key_to_end(k,d);return h}}}h=this.load_data(g,f,c,e);this.set_data(g,h);return h},set_data:function(b,a){this.set_elt(b,a)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(i,h,d,g,e){var k=this.get_elt(i);if(!(k&&this.get("data_mode_compatible")(k,h))){console.log("ERROR: no current data for: ",dataset,i.toString(),h,d,g);return}k.stale=true;var c=i.get("start");if(e===this.DEEP_DATA_REQ){$.extend(g,{start_val:k.data.length+1})}else{if(e===this.BROAD_DATA_REQ){c=(k.max_high?k.max_high:k.data[k.data.length-1][2])+1}}var j=i.copy().set("start",c);var b=this,f=this.load_data(j,h,d,g),a=$.Deferred();this.set_data(i,a);$.when(f).then(function(l){if(l.data){l.data=k.data.concat(l.data);if(l.max_low){l.max_low=k.max_low}if(l.message){l.message=l.message.replace(/[0-9]+/,l.data.length)}}b.set_data(i,l);a.resolve(l)});return a},get_elt:function(a){return Cache.prototype.get_elt.call(this,a.toString())},set_elt:function(b,a){return Cache.prototype.set_elt.call(this,b.toString(),a)}});var ReferenceTrackDataManager=GenomeDataManager.extend({load_data:function(a,d,e,b,c){if(b>1){return{data:null}}return GenomeDataManager.prototype.load_data.call(this,a,d,e,b,c)}});var Genome=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var GenomeRegion=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(b){if(b.from_str){var d=b.from_str.split(":"),c=d[0],a=d[1].split("-");this.set({chrom:c,start:parseInt(a[0],10),end:parseInt(a[1],10)})}},copy:function(){return new GenomeRegion({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.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(h){var b=this.get("chrom"),g=h.get("chrom"),f=this.get("start"),d=h.get("start"),e=this.get("end"),c=h.get("end"),a;if(b&&g&&b!==g){return this.get("DIF_CHROMS")}if(f<d){if(e<d){a=this.get("BEFORE")}else{if(e<=c){a=this.get("OVERLAP_START")}else{a=this.get("CONTAINS")}}}else{if(f>c){a=this.get("AFTER")}else{if(e<=c){a=this.get("CONTAINED_BY")}else{a=this.get("OVERLAP_END")}}}return a},contains:function(a){return this.compute_overlap(a)===this.get("CONTAINS")},overlaps:function(a){return _.intersection([this.compute_overlap(a)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var GenomeRegionCollection=Backbone.Collection.extend({model:GenomeRegion});var BrowserBookmark=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:"GenomeRegion"}]});var BrowserBookmarkCollection=Backbone.Collection.extend({model:BrowserBookmark});var GenomeWideSummaryData=Backbone.RelationalModel.extend({defaults:{data:null,max:0},initialize:function(b){var a=_.max(this.get("data"),function(c){if(!c||typeof c==="string"){return 0}return c[1]});this.attributes.max=(a&&typeof a!=="string"?a[1]:0)}});var BackboneTrack=Dataset.extend({initialize:function(a){this.set("id",a.dataset_id)},relations:[{type:Backbone.HasOne,key:"genome_wide_data",relatedModel:"GenomeWideSummaryData"}]});var Visualization=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:"BackboneTrack"}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var GenomeVisualization=Visualization.extend({defaults:_.extend({},Visualization.prototype.defaults,{bookmarks:null,viewport:null})});var TrackConfig=Backbone.Model.extend({});var CircsterHistogramDatasetLayout=Backbone.Model.extend({chroms_layout:function(){var b=this.attributes.genome.get_chroms_info(),d=d3.layout.pie().value(function(f){return f.len}).sort(null),e=d(b),a=this.attributes.total_gap/b.length,c=_.map(e,function(h,g){var f=h.endAngle-a;h.endAngle=(f>h.startAngle?f:h.startAngle);return h});return c},chrom_data_layout:function(j,b,g,f,h){if(!b||typeof b==="string"){return null}var d=b[0],i=b[3],c=d3.scale.linear().domain([0,h]).range([g,f]),e=d3.layout.pie().value(function(k){return i}).startAngle(j.startAngle).endAngle(j.endAngle),a=e(d);_.each(d,function(k,l){a[l].outerRadius=c(k[1])});return a}});var CircsterView=Backbone.View.extend({className:"circster",initialize:function(a){this.width=a.width;this.height=a.height;this.total_gap=a.total_gap;this.genome=a.genome;this.radius_start=a.radius_start;this.dataset_arc_height=a.dataset_arc_height},render:function(){var c=this.model.get("tracks").at(0).get("genome_wide_data");var e=this.radius_start,f=this.dataset_arc_height,k=new CircsterHistogramDatasetLayout({genome:this.genome,total_gap:this.total_gap}),j=k.chroms_layout(),h=_.zip(j,c.get("data")),i=c.get("max"),b=_.map(h,function(n){var o=n[0],m=n[1];return k.chrom_data_layout(o,m,e,e+f,i)});var d=d3.select(this.$el[0]).append("svg").attr("width",this.width).attr("height",this.height).append("g").attr("transform","translate("+this.width/2+","+this.height/2+")");var l=d.append("g").attr("id","inner-arc"),g=d3.svg.arc().innerRadius(e).outerRadius(e+f),a=l.selectAll("#inner-arc>path").data(j).enter().append("path").attr("d",g).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(m){return m.data.chrom});_.each(b,function(m){if(!m){return}var p=d.append("g"),o=d3.svg.arc().innerRadius(e),n=p.selectAll("path").data(m).enter().append("path").attr("d",o).style("stroke","red").style("fill","red")})}});var TrackBrowserRouter=Backbone.Router.extend({initialize:function(b){this.view=b.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var a=this;a.view.on("navigate",function(c){a.navigate(c)})},change_location:function(a){this.view.go_to(a)}});var add_datasets=function(a,c,b){$.ajax({url:a,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(d){show_modal("Select datasets for new tracks",d,{Cancel:function(){hide_modal()},Add:function(){var e=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var f,g=$(this).val();if($(this).attr("name")==="id"){f={hda_id:g}}else{f={ldda_id:g}}e[e.length]=$.ajax({url:c,data:f,dataType:"json"})});$.when.apply($,e).then(function(){var f=(arguments[0] instanceof Array?$.map(arguments,function(g){return g[0]}):[arguments[0]]);b(f)});hide_modal()}})}})};
\ No newline at end of file
diff -r e449670f80edec4bec2ac81cd9e3630ff9e6a3b0 -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -169,6 +169,7 @@
filters_manager: null,
data_url: null,
dataset_state_url: null,
+ genome_wide_summary_data: null,
data_mode_compatible: function(entry, mode) { return true; },
can_subset: function(entry) { return false; }
}),
@@ -549,17 +550,64 @@
});
/**
+ * Genome-wide summary data.
+ */
+var GenomeWideSummaryData = Backbone.RelationalModel.extend({
+ defaults: {
+ data: null,
+ max: 0
+ },
+
+ initialize: function(options) {
+ // Set max across dataset.
+ var max_data = _.max(this.get('data'), function(d) {
+ if (!d || typeof d === 'string') { return 0; }
+ return d[1];
+ });
+ this.attributes.max = (max_data && typeof max_data !== 'string' ? max_data[1] : 0)
+ }
+});
+
+/**
+ * A track of data in a genome visualization.
+ */
+// TODO: rename to Track and merge with Trackster's Track object.
+var BackboneTrack = Dataset.extend({
+
+ initialize: function(options) {
+ // Dataset id is unique ID for now.
+ this.set('id', options.dataset_id);
+ },
+
+ relations: [
+ {
+ type: Backbone.HasOne,
+ key: 'genome_wide_data',
+ relatedModel: 'GenomeWideSummaryData'
+ }
+ ]
+});
+
+/**
* A visualization.
*/
var Visualization = Backbone.RelationalModel.extend({
defaults: {
- id: "",
- title: "",
- type: "",
- dbkey: "",
- datasets: []
+ id: '',
+ title: '',
+ type: '',
+ dbkey: '',
+ tracks: null
},
-
+
+ relations: [
+ {
+ type: Backbone.HasMany,
+ key: 'tracks',
+ relatedModel: 'BackboneTrack'
+ }
+ ],
+
// Use function because visualization_url changes depending on viz.
// FIXME: all visualizations should save to the same URL (and hence
// this function won't be needed).
@@ -585,42 +633,13 @@
});
/**
- * A Trackster visualization.
+ * A Genome space visualization.
*/
-var TracksterVisualization = Visualization.extend({
- defaults: {
- bookmarks: [],
- viewport: {}
- }
-});
-
-/**
- * A Circster visualization.
- */
-var CircsterVisualization = Visualization.extend({
-});
-
-/**
- * A histogram dataset.
- */
-var HistogramDataset = Backbone.Model.extend({
- /*
- defaults: {
- data: [],
- dataset: null,
- max: 0
- },
- */
-
- initialize: function(data) {
- // Set max across dataset.
- this.attributes.data = data;
- this.attributes.max = _.max(data, function(d) {
- if (!d || typeof d === "string") { return 0; }
- return d[1];
- })[1];
- }
-
+var GenomeVisualization = Visualization.extend({
+ defaults: _.extend({}, Visualization.prototype.defaults, {
+ bookmarks: null,
+ viewport: null
+ })
});
/**
@@ -701,13 +720,15 @@
this.height = options.height;
this.total_gap = options.total_gap;
this.genome = options.genome;
- this.dataset = options.dataset;
this.radius_start = options.radius_start;
this.dataset_arc_height = options.dataset_arc_height;
},
render: function() {
// -- Layout viz. --
+
+ // FOR TESTING:
+ var dataset = this.model.get('tracks').at(0).get('genome_wide_data');
var radius_start = this.radius_start,
dataset_arc_height = this.dataset_arc_height,
@@ -720,8 +741,8 @@
chrom_arcs = arcs_layout.chroms_layout(),
// Merge chroms layout with data.
- layout_and_data = _.zip(chrom_arcs, this.dataset.attributes.data),
- dataset_max = this.dataset.attributes.max,
+ layout_and_data = _.zip(chrom_arcs, dataset.get('data')),
+ dataset_max = dataset.get('max'),
// Do dataset layout for each chromosome's data using pie layout.
chroms_data_layout = _.map(layout_and_data, function(chrom_info) {
diff -r e449670f80edec4bec2ac81cd9e3630ff9e6a3b0 -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -127,30 +127,36 @@
});
// FIXME: give unique IDs to Drawables and save overview as ID.
- var overview_track_name = (view.overview_drawable ? view.overview_drawable.name : null);
- var visualization = new TracksterVisualization({
- 'id': view.vis_id,
- 'title': view.name,
- 'dbkey': view.dbkey,
- 'type': 'trackster',
- 'datasets': view.to_dict(),
- 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high, 'overview': overview_track_name },
- 'bookmarks': bookmarks
+ var overview_track_name = (view.overview_drawable ? view.overview_drawable.name : null),
+ viz_config = {
+ 'id': view.vis_id,
+ 'title': view.name,
+ 'dbkey': view.dbkey,
+ 'type': 'trackster',
+ 'datasets': view.to_dict(),
+ 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high, 'overview': overview_track_name },
+ 'bookmarks': bookmarks
+ };
+
+ $.ajax({
+ url: galaxy_paths.get("visualization_url"),
+ type: "POST",
+ dataType: "json",
+ data: {
+ vis_json: JSON.stringify(viz_config)
+ }
+ }).success(function(vis_info) {
+ hide_modal();
+ view.vis_id = vis_info.vis_id;
+ view.has_changes = false;
+
+ // Needed to set URL when first saving a visualization.
+ window.history.pushState({}, "", vis_info.url + window.location.hash);
+ })
+ .error(function() {
+ show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
+ { "Close" : hide_modal } );
});
-
- visualization.save()
- .success(function(vis_info) {
- hide_modal();
- view.vis_id = vis_info.vis_id;
- view.has_changes = false;
-
- // Needed to set URL when first saving a visualization.
- window.history.pushState({}, "", vis_info.url + window.location.hash);
- })
- .error(function() {
- show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
- { "Close" : hide_modal } );
- });
} },
{ icon_class: 'cross-circle', title: 'Close', on_click: function() {
window.location = "${h.url_for( controller='visualization', action='list' )}";
diff -r e449670f80edec4bec2ac81cd9e3630ff9e6a3b0 -r f33269063dab72e84f1ba7cb1ebc509ee73651e8 templates/visualization/circster.mako
--- a/templates/visualization/circster.mako
+++ b/templates/visualization/circster.mako
@@ -16,7 +16,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/d3", "viz/visualization" )}
+ ${h.js( "libs/d3", "mvc/data", "viz/visualization" )}
<script type="text/javascript">
$(function() {
@@ -65,23 +65,23 @@
// -- Viz set up. --
- var genome = new Genome(JSON.parse('${ h.to_json_string( genome ) }')),
- dataset = new HistogramDataset(JSON.parse('${ h.to_json_string( dataset_summary ) }')),
- circster = new CircsterView({
+ var genome = new Genome(JSON.parse('${ h.to_json_string( genome ) }'))
+ visualization = new GenomeVisualization(JSON.parse('${ h.to_json_string( viz_config ) }')),
+ viz_view = new CircsterView({
width: 600,
height: 600,
// Gap is difficult to set because it very dependent on chromosome size and organization.
total_gap: 2 * Math.PI * 0.5,
genome: genome,
- dataset: dataset,
+ model: visualization,
radius_start: 100,
dataset_arc_height: 50
});
// -- Render viz. --
- circster.render();
- $('#vis').append(circster.$el);
+ viz_view.render();
+ $('#vis').append(viz_view.$el);
});
</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: dannon: Fix for using HDAs as a source in API workflow execution -- Previously erroneously *moved* the hda to the new history when not using 'add_to_history=False', will now create a copy.
by Bitbucket 08 Jul '12
by Bitbucket 08 Jul '12
08 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/e449670f80ed/
changeset: e449670f80ed
user: dannon
date: 2012-07-09 02:02:47
summary: Fix for using HDAs as a source in API workflow execution -- Previously erroneously *moved* the hda to the new history when not using 'add_to_history=False', will now create a copy.
affected #: 1 file
diff -r ea7432fd68e0472dea262f56e8181301109a28ff -r e449670f80edec4bec2ac81cd9e3630ff9e6a3b0 lib/galaxy/web/api/workflows.py
--- a/lib/galaxy/web/api/workflows.py
+++ b/lib/galaxy/web/api/workflows.py
@@ -134,11 +134,12 @@
hda = trans.sa_session.query(self.app.model.HistoryDatasetAssociation).get(
trans.security.decode_id(ds_map[k]['id']))
assert trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset )
- if add_to_history and hda.history != history:
- history.add_dataset(hda)
else:
trans.response.status = 400
return "Unknown dataset source '%s' specified." % ds_map[k]['src']
+ if add_to_history and hda.history != history:
+ hda = hda.copy()
+ history.add_dataset(hda)
ds_map[k]['hda'] = hda
except AssertionError:
trans.response.status = 400
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/ea7432fd68e0/
changeset: ea7432fd68e0
user: jgoecks
date: 2012-07-06 22:05:15
summary: Trackster bug fixes.
affected #: 3 files
diff -r a419b8beaa69ce84374ef1b33a9201301929b3e7 -r ea7432fd68e0472dea262f56e8181301109a28ff lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -225,7 +225,7 @@
'viewport': vis_config[ 'viewport' ]
}
type = vis_config[ 'type' ]
- id = vis_config[ 'id' ]
+ id = vis_config.get( 'id', None )
title = vis_config[ 'title' ]
dbkey = vis_config[ 'dbkey' ]
annotation = vis_config.get( 'annotation', None )
diff -r a419b8beaa69ce84374ef1b33a9201301929b3e7 -r ea7432fd68e0472dea262f56e8181301109a28ff 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 class_module=function(b,a){var c=function(){var g=arguments[0];for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var e in d){g[e]=d[e]}}return g};a.extend=c};var requestAnimationFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b,a){window.setTimeout(b,1000/60)}})();var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=BEFORE}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=AFTER}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a};var is_overlap=function(c,b){var a=compute_overlap(c,b);return(a!==BEFORE&&a!==AFTER)};var is_deferred=function(a){return("isResolved" in a)};var get_random_color=function(a){if(!a){a="#ffffff"}if(typeof(a)==="string"){a=[a]}for(var j=0;j<a.length;j++){a[j]=parseInt(a[j].slice(1),16)}var n=function(t,s,i){return((t*299)+(s*587)+(i*114))/1000};var e=function(v,u,w,s,i,t){return(Math.max(v,s)-Math.min(v,s))+(Math.max(u,i)-Math.min(u,i))+(Math.max(w,t)-Math.min(w,t))};var g,o,f,k,q,h,r,c,d,b,p,m=false,l=0;do{g=Math.round(Math.random()*16777215);o=(g&16711680)>>16;f=(g&65280)>>8;k=g&255;d=n(o,f,k);m=true;for(j=0;j<a.length;j++){q=a[j];h=(q&16711680)>>16;r=(q&65280)>>8;c=q&255;b=n(h,r,c);p=e(o,f,k,h,r,c);if((Math.abs(d-b)<40)||(p<200)){m=false;break}}l++}while(!m&&l<=10);return"#"+(16777216+g).toString(16).substr(1,6)};var create_action_icon=function(c,b,a){return $("<a/>").attr("href","javascript:void(0);").attr("title",c).addClass("icon-button").addClass(b).tipsy({gravity:"s"}).click(a)};var trackster_module=function(d,R){var o=d("class").extend,r=d("slotting"),H=d("painters");var m={};var k=function(Y,Z){m[Y.attr("id")]=Z};var l=function(Y,aa,ac,ab){ac=".group";var Z={};m[Y.attr("id")]=ab;Y.bind("drag",{handle:"."+aa,relative:true},function(ak,al){var aj=$(this),ao=$(this).parent(),ag=ao.children(),ai=m[$(this).attr("id")],af,ae,am,ad,ah;ae=$(this).parents(ac);if(ae.length!==0){am=ae.position().top;ad=am+ae.outerHeight();if(al.offsetY<am){$(this).insertBefore(ae);var an=m[ae.attr("id")];an.remove_drawable(ai);an.container.add_drawable_before(ai,an);return}else{if(al.offsetY>ad){$(this).insertAfter(ae);var an=m[ae.attr("id")];an.remove_drawable(ai);an.container.add_drawable(ai);return}}}ae=null;for(ah=0;ah<ag.length;ah++){af=$(ag.get(ah));am=af.position().top;ad=am+af.outerHeight();if(af.is(ac)&&this!==af.get(0)&&al.offsetY>=am&&al.offsetY<=ad){if(al.offsetY-am<ad-al.offsetY){af.find(".content-div").prepend(this)}else{af.find(".content-div").append(this)}if(ai.container){ai.container.remove_drawable(ai)}m[af.attr("id")].add_drawable(ai);return}}for(ah=0;ah<ag.length;ah++){af=$(ag.get(ah));if(al.offsetY<af.position().top&&!(af.hasClass("reference-track")||af.hasClass("intro"))){break}}if(ah===ag.length){if(this!==ag.get(ah-1)){ao.append(this);m[ao.attr("id")].move_drawable(ai,ah)}}else{if(this!==ag.get(ah)){$(this).insertBefore(ag.get(ah));m[ao.attr("id")].move_drawable(ai,(al.deltaY>0?ah-1:ah))}}}).bind("dragstart",function(){Z["border-top"]=Y.css("border-top");Z["border-bottom"]=Y.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(Z)})};R.moveable=l;var X=16,C=9,z=20,w=100,E=12000,O=400,G=5000,t=100,n="There was an error in indexing this dataset. ",F="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",A="No data for this chrom/contig.",s="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",u="Tool cannot be rerun: ",a="Loading data...",S="Ready for display",M=10,D=20;function T(Z,Y){if(!Y){Y=0}var aa=Math.pow(10,Y);return Math.round(Z*aa)/aa}var p=function(Z,Y,ab){if(!p.id_counter){p.id_counter=0}this.id=p.id_counter++;this.name=ab.name;this.view=Z;this.container=Y;this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ab.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ab.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(ac){ac.stopPropagation()});var aa=this;this.container_div.hover(function(){aa.icons_div.show()},function(){aa.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(Y){if(Y.content_visible){Y.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");Y.hide_contents();Y.content_visible=false}else{Y.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");Y.content_visible=true;Y.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(Z){var ab=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},Y=function(){Z.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},aa=function(ac){if((ac.keyCode||ac.which)===27){ab()}else{if((ac.keyCode||ac.which)===13){Y()}}};$(window).bind("keypress.check_enter_esc",aa);show_modal("Configure",Z.config.build_form(),{Cancel:ab,OK:Y})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(Y){$(".tipsy").remove();Y.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(){},to_dict:function(){},set_name:function(Y){this.old_name=this.name;this.name=Y;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 Y=this.view;this.container_div.hide(0,function(){$(this).remove();Y.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(Z,ae,ad,ac,Y,ab){var aa=this;this.action_icons[Z]=$("<a/>").attr("href","javascript:void(0);").attr("title",ae).addClass("icon-button").addClass(ad).tipsy({gravity:"s"}).click(function(){ac(aa)}).appendTo(this.icons_div);if(ab){this.action_icons[Z].hide()}},build_action_icons:function(Y){var aa;for(var Z=0;Z<Y.length;Z++){aa=Y[Z];this.add_action_icon(aa.name,aa.title,aa.css_class,aa.on_click_fn,aa.prepend,aa.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){}});var v=function(Z,Y,aa){p.call(this,Z,Y,aa);this.obj_type=aa.obj_type;this.drawables=[]};o(v.prototype,p.prototype,{unpack_drawables:function(aa){this.drawables=[];var Z;for(var Y=0;Y<aa.length;Y++){Z=object_from_template(aa[Y],this);this.add_drawable(Z)}},init:function(){for(var Y=0;Y<this.drawables.length;Y++){this.drawables[Y].init()}},_draw:function(){for(var Y=0;Y<this.drawables.length;Y++){this.drawables[Y]._draw()}},to_dict:function(){var Z=[];for(var Y=0;Y<this.drawables.length;Y++){Z.push(this.drawables[Y].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:Z}},add_drawable:function(Y){this.drawables.push(Y);Y.container=this;this.changed()},add_drawable_before:function(aa,Y){this.changed();var Z=this.drawables.indexOf(Y);if(Z!==-1){this.drawables.splice(Z,0,aa);return true}return false},replace_drawable:function(aa,Y,Z){var ab=this.drawables.indexOf(aa);if(ab!==-1){this.drawables[ab]=Y;if(Z){aa.container_div.replaceWith(Y.container_div)}this.changed()}return ab},remove_drawable:function(Z){var Y=this.drawables.indexOf(Z);if(Y!==-1){this.drawables.splice(Y,1);Z.container=null;this.changed();return true}return false},move_drawable:function(Z,aa){var Y=this.drawables.indexOf(Z);if(Y!==-1){this.drawables.splice(Y,1);this.drawables.splice(aa,0,Z);this.changed();return true}return false}});var L=function(Z,Y,ab){o(ab,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});v.call(this,Z,Y,ab);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);l(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new U(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ab){this.unpack_drawables(ab.drawables)}if("filters" in ab){var aa=this.filters_manager;this.filters_manager=new U(this,ab.filters);aa.parent_div.replaceWith(this.filters_manager.parent_div);if(ab.filters.visible){this.setup_multitrack_filtering()}}};o(L.prototype,p.prototype,v.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(Y){$(".tipsy").remove();Y.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(Y){if(Y.filters_manager.visible()){Y.filters_manager.clear_filters();Y._restore_filter_managers()}else{Y.setup_multitrack_filtering();Y.request_draw(true)}Y.filters_manager.toggle()}},p.prototype.action_icons_def[2]],build_container_div:function(){var Y=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(Y)}return Y},build_header_div:function(){var Y=$("<div/>").addClass("track-header");Y.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(Y);return Y},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var aa=this.drawables.length;if(aa===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(aa===1){if(this.drawables[0] instanceof g){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var ah,ag,ae,ak=true,ac=this.drawables[0].get_type(),Y=0;for(ah=0;ah<aa;ah++){ae=this.drawables[ah];if(ae.get_type()!==ac){can_composite=false;break}if(ae instanceof c){Y++}}if(ak||Y===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tipsy").remove()}if(Y>1&&Y===this.drawables.length){var al={},Z;ae=this.drawables[0];for(ag=0;ag<ae.filters_manager.filters.length;ag++){Z=ae.filters_manager.filters[ag];al[Z.name]=[Z]}for(ah=1;ah<this.drawables.length;ah++){ae=this.drawables[ah];for(ag=0;ag<ae.filters_manager.filters.length;ag++){Z=ae.filters_manager.filters[ag];if(Z.name in al){al[Z.name].push(Z)}}}this.filters_manager.remove_all();var ab,ad,af,ai;for(var aj in al){ab=al[aj];if(ab.length===Y){ad=new P({name:ab[0].name,index:ab[0].index});this.filters_manager.add_filter(ad)}}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 Y=0;Y<this.drawables.length;Y++){this.drawables[Y].filters_manager=this.saved_filters_managers[Y]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var Y=0;Y<this.drawables.length;Y++){drawable=this.drawables[Y];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ac=[];for(var Z=0;Z<this.drawables.length;Z++){ac.push(this.drawables[Z].name)}var aa="Composite Track of "+this.drawables.length+" tracks ("+ac.join(", ")+")";var ab=new g(this.view,this.view,{name:aa,drawables:this.drawables});var Y=this.container.replace_drawable(this,ab,true);ab.request_draw()},add_drawable:function(Y){v.prototype.add_drawable.call(this,Y);this.update_icons()},remove_drawable:function(Y){v.prototype.remove_drawable.call(this,Y);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var Y=o(v.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return Y},request_draw:function(Y,aa){for(var Z=0;Z<this.drawables.length;Z++){this.drawables[Z].request_draw(Y,aa)}}});var W=function(Y){o(Y,{obj_type:"View"});v.call(this,"View",Y.container,Y);this.chrom=null;this.vis_id=Y.vis_id;this.dbkey=Y.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.init();this.canvas_manager=new CanvasManager(this.container.get(0).ownerDocument);this.reset()};_.extend(W.prototype,Backbone.Events);o(W.prototype,v.prototype,{init:function(){this.requested_redraw=false;var aa=this.container,Y=this;this.top_container=$("<div/>").addClass("top-container").appendTo(aa);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(aa);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(aa);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,Y);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ab=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){add_datasets(add_datasets_url,add_track_async_url,function(ac){_.each(ac,function(ad){Y.add_drawable(object_from_template(ad,Y))})})});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").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var Z=function(ac){if(ac.type==="focusout"||(ac.keyCode||ac.which)===13||(ac.keyCode||ac.which)===27){if((ac.keyCode||ac.which)!==27){Y.go_to($(this).val())}$(this).hide();$(this).val("");Y.location_span.show();Y.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",Z).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tipsy({gravity:"n"}).appendTo(this.nav_controls);this.location_span.click(function(){Y.location_span.hide();Y.chrom_select.hide();Y.nav_input.val(Y.chrom+":"+Y.low+"-"+Y.high);Y.nav_input.css("display","inline-block");Y.nav_input.select();Y.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tipsy({gravity:"n"}).click(function(){Y.zoom_out();Y.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tipsy({gravity:"n"}).click(function(){Y.zoom_in();Y.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){Y.change_chrom(Y.chrom_select.val())});this.browser_content_div.click(function(ac){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ac){Y.zoom_in(ac.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ac,ad){this.current_x=ad.offsetX}).bind("drag",function(ac,ae){var af=ae.offsetX-this.current_x;this.current_x=ae.offsetX;var ad=Math.round(af/Y.viewport_container.width()*(Y.max_high-Y.max_low));Y.move_delta(-ad)});this.overview_close.click(function(){Y.reset_overview()});this.viewport_container.bind("draginit",function(ac,ad){if(ac.clientX>Y.viewport_container.width()-16){return false}}).bind("dragstart",function(ac,ad){ad.original_low=Y.low;ad.current_height=ac.clientY;ad.current_x=ad.offsetX}).bind("drag",function(ae,ag){var ac=$(this);var ah=ag.offsetX-ag.current_x;var ad=ac.scrollTop()-(ae.clientY-ag.current_height);ac.scrollTop(ad);ag.current_height=ae.clientY;ag.current_x=ag.offsetX;var af=Math.round(ah/Y.viewport_container.width()*(Y.high-Y.low));Y.move_delta(af)}).bind("mousewheel",function(ae,ag,ad,ac){if(ad){ad*=50;var af=Math.round(-ad/Y.viewport_container.width()*(Y.high-Y.low));Y.move_delta(af)}});this.top_labeltrack.bind("dragstart",function(ac,ad){return $("<div />").css({height:Y.browser_content_div.height()+Y.top_labeltrack.height()+Y.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ag,ah){$(ah.proxy).css({left:Math.min(ag.pageX,ah.startX)-Y.container.offset().left,width:Math.abs(ag.pageX-ah.startX)});var ad=Math.min(ag.pageX,ah.startX)-Y.container.offset().left,ac=Math.max(ag.pageX,ah.startX)-Y.container.offset().left,af=(Y.high-Y.low),ae=Y.viewport_container.width();Y.update_location(Math.round(ad/ae*af)+Y.low,Math.round(ac/ae*af)+Y.low)}).bind("dragend",function(ah,ai){var ad=Math.min(ah.pageX,ai.startX),ac=Math.max(ah.pageX,ai.startX),af=(Y.high-Y.low),ae=Y.viewport_container.width(),ag=Y.low;Y.low=Math.round(ad/ae*af)+ag;Y.high=Math.round(ac/ae*af)+ag;$(ai.proxy).remove();Y.request_redraw()});this.add_label_track(new V(this,{content_div:this.top_labeltrack}));this.add_label_track(new V(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){Y.resize_window()},500)});$(document).bind("redraw",function(){Y.redraw()});this.reset();$(window).trigger("resize")},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(Z,ab,Y,ac){if(this.timer){clearTimeout(this.timer)}if(ac){var aa=this;this.timer=setTimeout(function(){aa.trigger("navigate",Z+":"+ab+"-"+Y)},500)}else{view.trigger("navigate",Z+":"+ab+"-"+Y)}},update_location:function(Y,aa){this.location_span.text(commatize(Y)+" - "+commatize(aa));this.nav_input.val(this.chrom+":"+commatize(Y)+"-"+commatize(aa));var Z=view.chrom_select.val();if(Z!==""){this.trigger_navigate(Z,view.low,view.high,true)}},load_chroms:function(aa){aa.num=t;aa.dbkey=this.dbkey;var Y=this,Z=$.Deferred();$.ajax({url:chrom_url,data:aa,dataType:"json",success:function(ac){if(ac.chrom_info.length===0){alert("Invalid chromosome: "+aa.chrom);return}if(ac.reference){Y.add_label_track(new x(Y))}Y.chrom_data=ac.chrom_info;var af='<option value="">Select Chrom/Contig</option>';for(var ae=0,ab=Y.chrom_data.length;ae<ab;ae++){var ad=Y.chrom_data[ae].chrom;af+='<option value="'+ad+'">'+ad+"</option>"}if(ac.prev_chroms){af+='<option value="previous">Previous '+t+"</option>"}if(ac.next_chroms){af+='<option value="next">Next '+t+"</option>"}Y.chrom_select.html(af);Y.chrom_start_index=ac.start_index;Z.resolve(ac)},error:function(){alert("Could not load chroms for this dbkey:",Y.dbkey)}});return Z},change_chrom:function(ad,Z,af){var aa=this;if(!aa.chrom_data){aa.load_chroms_deferred.then(function(){aa.change_chrom(ad,Z,af)});return}if(!ad||ad==="None"){return}if(ad==="previous"){aa.load_chroms({low:this.chrom_start_index-t});return}if(ad==="next"){aa.load_chroms({low:this.chrom_start_index+t});return}var ae=$.grep(aa.chrom_data,function(ag,ah){return ag.chrom===ad})[0];if(ae===undefined){aa.load_chroms({chrom:ad},function(){aa.change_chrom(ad,Z,af)});return}else{if(ad!==aa.chrom){aa.chrom=ad;aa.chrom_select.val(aa.chrom);aa.max_high=ae.len-1;aa.reset();aa.request_redraw(true);for(var ac=0,Y=aa.drawables.length;ac<Y;ac++){var ab=aa.drawables[ac];if(ab.init){ab.init()}}if(aa.reference_track){aa.reference_track.init()}}if(Z!==undefined&&af!==undefined){aa.low=Math.max(Z,0);aa.high=Math.min(af,aa.max_high)}else{aa.low=0;aa.high=aa.max_high}aa.reset_overview();aa.request_redraw()}},go_to:function(ac){ac=ac.replace(/ |,/g,"");var ag=this,Y,ab,Z=ac.split(":"),ae=Z[0],af=Z[1];if(af!==undefined){try{var ad=af.split("-");Y=parseInt(ad[0],10);ab=parseInt(ad[1],10)}catch(aa){return false}}ag.change_chrom(ae,Y,ab)},move_fraction:function(aa){var Y=this;var Z=Y.high-Y.low;this.move_delta(aa*Z)},move_delta:function(ab){var Y=this;var aa=Y.high-Y.low;if(Y.low-ab<Y.max_low){Y.low=Y.max_low;Y.high=Y.max_low+aa}else{if(Y.high-ab>Y.max_high){Y.high=Y.max_high;Y.low=Y.max_high-aa}else{Y.high-=ab;Y.low-=ab}}Y.request_redraw();var Z=Y.chrom_select.val();this.trigger_navigate(Z,Y.low,Y.high,true)},add_drawable:function(Y){v.prototype.add_drawable.call(this,Y);Y.init();this.changed();this.update_intro_div()},add_label_track:function(Y){Y.view=this;Y.init();this.label_tracks.push(Y)},remove_drawable:function(aa,Z){v.prototype.remove_drawable.call(this,aa);if(Z){var Y=this;aa.container_div.hide(0,function(){$(this).remove();Y.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ag,Y,af,ah){var ae=this,ad=(ah?[ah]:ae.drawables),aa;var Z;for(var ac=0;ac<ad.length;ac++){Z=ad[ac];aa=-1;for(var ab=0;ab<ae.tracks_to_be_redrawn.length;ab++){if(ae.tracks_to_be_redrawn[ab][0]===Z){aa=ab;break}}if(aa<0){ae.tracks_to_be_redrawn.push([Z,Y,af])}else{ae.tracks_to_be_redrawn[ac][1]=Y;ae.tracks_to_be_redrawn[ac][2]=af}}if(!this.requested_redraw){requestAnimationFrame(function(){ae._redraw(ag)});this.requested_redraw=true}},_redraw:function(ai){this.requested_redraw=false;var af=this.low,ab=this.high;if(af<this.max_low){af=this.max_low}if(ab>this.max_high){ab=this.max_high}var ah=this.high-this.low;if(this.high!==0&&ah<this.min_separation){ab=af+this.min_separation}this.low=Math.floor(af);this.high=Math.ceil(ab);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var Y=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var aj=13;this.overview_box.css({left:Y,width:Math.max(aj,ae)}).show();if(ae<aj){this.overview_box.css("left",Y-(aj-ae)/2)}if(this.overview_highlight){this.overview_highlight.css({left:Y,width:ae})}if(!ai){var aa,Z,ag;for(var ac=0,ad=this.tracks_to_be_redrawn.length;ac<ad;ac++){aa=this.tracks_to_be_redrawn[ac][0];Z=this.tracks_to_be_redrawn[ac][1];ag=this.tracks_to_be_redrawn[ac][2];if(aa){aa._draw(Z,ag)}}this.tracks_to_be_redrawn=[];for(ac=0,ad=this.label_tracks.length;ac<ad;ac++){this.label_tracks[ac]._draw()}}},zoom_in:function(Z,aa){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ab=this.high-this.low,ac=ab/2+this.low,Y=(ab/this.zoom_factor)/2;if(Z){ac=Z/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ac-Y);this.high=Math.round(ac+Y);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var Z=this.high-this.low,aa=Z/2+this.low,Y=(Z*this.zoom_factor)/2;this.low=Math.round(aa-Y);this.high=Math.round(aa+Y);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(aa){if(this.overview_drawable){if(this.overview_drawable.dataset_id===aa.dataset_id){return}this.overview_viewport.find(".track").remove()}var Z=aa.copy({content_div:this.overview_viewport}),Y=this;Z.header_div.hide();Z.is_overview=true;Y.overview_drawable=Z;this.overview_drawable.postdraw_actions=function(){Y.overview_highlight.show().height(Y.overview_drawable.content_div.height());Y.overview_viewport.height(Y.overview_drawable.content_div.height()+Y.overview_box.outerHeight());Y.overview_close.show();Y.resize_window()};Y.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tipsy").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var q=function(aa,af,ab){this.track=aa;this.name=af.name;this.params=[];var am=af.params;for(var ac=0;ac<am.length;ac++){var ah=am[ac],Z=ah.name,al=ah.label,ad=unescape(ah.html),an=ah.value,aj=ah.type;if(aj==="number"){this.params.push(new e(Z,al,ad,(Z in ab?ab[Z]:an),ah.min,ah.max))}else{if(aj==="select"){this.params.push(new J(Z,al,ad,(Z in ab?ab[Z]:an)))}else{console.log("WARNING: unrecognized tool parameter type:",Z,aj)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ap){ap.stopPropagation()}).click(function(ap){ap.stopPropagation()}).bind("dblclick",function(ap){ap.stopPropagation()});var ak=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ai=this.params;var ag=this;$.each(this.params,function(aq,au){var at=$("<div>").addClass("param-row").appendTo(ag.parent_div);var ap=$("<div>").addClass("param-label").text(au.label).appendTo(at);var ar=$("<div/>").addClass("param-input").html(au.html).appendTo(at);ar.find(":input").val(au.value);$("<div style='clear: both;'/>").appendTo(at)});this.parent_div.find("input").click(function(){$(this).select()});var ao=$("<div>").addClass("param-row").appendTo(this.parent_div);var ae=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ao);var Y=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ao);Y.click(function(){ag.run_on_region()});ae.click(function(){ag.run_on_dataset()});if("visible" in ab&&ab.visible){this.parent_div.show()}};o(q.prototype,{update_params:function(){for(var Y=0;Y<this.params.length;Y++){this.params[Y].update_value()}},state_dict:function(){var Z={};for(var Y=0;Y<this.params.length;Y++){Z[this.params[Y].name]=this.params[Y].value}Z.visible=this.parent_div.is(":visible");return Z},get_param_values_dict:function(){var Y={};this.parent_div.find(":input").each(function(){var Z=$(this).attr("name"),aa=$(this).val();Y[Z]=aa});return Y},get_param_values:function(){var Y=[];this.parent_div.find(":input").each(function(){var Z=$(this).attr("name"),aa=$(this).val();if(Z){Y[Y.length]=aa}});return Y},run_on_dataset:function(){var Y=this;Y.run({target_dataset_id:this.track.original_dataset_id,tool_id:Y.name},null,function(Z){show_modal(Y.name+" is Running",Y.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var Z={target_dataset_id:this.track.original_dataset_id,action:"rerun",tool_id:this.name,regions:[{chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}]},ad=this.track,aa=Z.tool_id+ad.tool_region_and_parameters_str(Z.chrom,Z.low,Z.high),Y;if(ad.container===view){var ac=new L(view,view,{name:this.name});var ab=ad.container.replace_drawable(ad,ac,false);ac.container_div.insertBefore(ad.view.content_div.children()[ab]);ac.add_drawable(ad);ad.container_div.appendTo(ac.content_div);Y=ac}else{Y=ad.container}var ae=new ad.constructor(view,Y,{name:aa,hda_ldda:"hda"});ae.init_for_tool_data();ae.change_mode(ad.mode);ae.set_filters_manager(ad.filters_manager.copy(ae));ae.update_icons();Y.add_drawable(ae);ae.tiles_div.text("Starting job.");this.update_params();this.run(Z,ae,function(af){ae.set_dataset(new Dataset(af));ae.tiles_div.text("Running job.");ae.init()})},run:function(Y,aa,ab){Y.inputs=this.get_param_values_dict();var Z=new ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(Y),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ac){return ac!=="pending"}});$.when(Z.go()).then(function(ac){if(ac==="no converter"){aa.container_div.addClass("error");aa.content_div.text(F)}else{if(ac.error){aa.container_div.addClass("error");aa.content_div.text(u+ac.message)}else{ab(ac)}}})}});var J=function(Z,Y,aa,ab){this.name=Z;this.label=Y;this.html=$(aa);this.value=ab};o(J.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(aa,Z,ac,ad,ab,Y){J.call(this,aa,Z,ac,ad);this.min=ab;this.max=Y};o(e.prototype,J.prototype,{update_value:function(){J.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var f=function(Y){this.manager=null;this.name=Y.name;this.index=Y.index;this.tool_id=Y.tool_id;this.tool_exp_name=Y.tool_exp_name};o(f.prototype,{to_dict:function(){return{name:this.name,index:this.index,tool_id:this.tool_id,tool_exp_name:this.tool_exp_name}}});var P=function(ah){f.call(this,ah);this.low=("low" in ah?ah.low:-Number.MAX_VALUE);this.high=("high" in ah?ah.high:Number.MAX_VALUE);this.min=("min" in ah?ah.min:Number.MAX_VALUE);this.max=("max" in ah?ah.max:-Number.MAX_VALUE);this.container=null;this.slider=null;this.slider_label=null;var ad=function(ai,aj,ak){ai.click(function(){var ap=aj.text(),an=parseFloat(ak.slider("option","max")),am=(an<=1?4:an<=1000000?an.toString().length:6),ao=false,al=$(this).parents(".slider-row");al.addClass("input");if(ak.slider("option","values")){am=2*am+1;ao=true}aj.text("");$("<input type='text'/>").attr("size",am).attr("maxlength",am).attr("value",ap).appendTo(aj).focus().select().click(function(aq){aq.stopPropagation()}).blur(function(){$(this).remove();aj.text(ap);al.removeClass("input")}).keyup(function(av){if(av.keyCode===27){$(this).trigger("blur")}else{if(av.keyCode===13){var at=ak.slider("option","min"),aq=ak.slider("option","max"),au=function(aw){return(isNaN(aw)||aw>aq||aw<at)},ar=$(this).val();if(!ao){ar=parseFloat(ar);if(au(ar)){alert("Parameter value must be in the range ["+at+"-"+aq+"]");return $(this)}}else{ar=ar.split("-");ar=[parseFloat(ar[0]),parseFloat(ar[1])];if(au(ar[0])||au(ar[1])){alert("Parameter value must be in the range ["+at+"-"+aq+"]");return $(this)}}ak.slider((ao?"values":"value"),ar);al.removeClass("input")}}})})};var Z=this;Z.parent_div=$("<div/>").addClass("filter-row slider-row");var Y=$("<div/>").addClass("elt-label").appendTo(Z.parent_div),af=$("<span/>").addClass("slider-name").text(Z.name+" ").appendTo(Y),aa=$("<span/>").text(this.low+"-"+this.high),ab=$("<span/>").addClass("slider-value").appendTo(Y).append("[").append(aa).append("]");Z.values_span=aa;var ae=$("<div/>").addClass("slider").appendTo(Z.parent_div);Z.control_element=$("<div/>").attr("id",Z.name+"-filter-control").appendTo(ae);var ac=[0,0];Z.control_element.slider({range:true,min:this.min,max:this.max,step:this.get_slider_step(this.min,this.max),values:[this.low,this.high],slide:function(ai,aj){Z.slide(ai,aj)},change:function(ai,aj){Z.control_element.slider("option","slide").call(Z.control_element,ai,aj)}});Z.slider=Z.control_element;Z.slider_label=aa;ad(ab,aa,Z.control_element);var ag=$("<div/>").addClass("display-controls").appendTo(Z.parent_div);this.transparency_icon=create_action_icon("Use filter for data transparency","layer-transparent",function(){if(Z.manager.alpha_filter!==Z){Z.manager.alpha_filter=Z;Z.manager.parent_div.find(".layer-transparent").removeClass("active").hide();Z.transparency_icon.addClass("active").show()}else{Z.manager.alpha_filter=null;Z.transparency_icon.removeClass("active")}Z.manager.track.request_draw(true,true)}).appendTo(ag).hide();this.height_icon=create_action_icon("Use filter for data height","arrow-resize-090",function(){if(Z.manager.height_filter!==Z){Z.manager.height_filter=Z;Z.manager.parent_div.find(".arrow-resize-090").removeClass("active").hide();Z.height_icon.addClass("active").show()}else{Z.manager.height_filter=null;Z.height_icon.removeClass("active")}Z.manager.track.request_draw(true,true)}).appendTo(ag).hide();Z.parent_div.hover(function(){Z.transparency_icon.show();Z.height_icon.show()},function(){if(Z.manager.alpha_filter!==Z){Z.transparency_icon.hide()}if(Z.manager.height_filter!==Z){Z.height_icon.hide()}});$("<div style='clear: both;'/>").appendTo(Z.parent_div)};o(P.prototype,{to_dict:function(){var Y=f.prototype.to_dict.call(this);return o(Y,{type:"number",min:this.min,max:this.max,low:this.low,high:this.high})},copy:function(){return new P({name:this.name,index:this.index,tool_id:this.tool_id,tool_exp_name:this.tool_exp_name})},get_slider_step:function(aa,Y){var Z=Y-aa;return(Z<=2?0.01:1)},slide:function(Z,aa){var Y=aa.values;this.values_span.text(Y[0]+"-"+Y[1]);this.low=Y[0];this.high=Y[1];this.manager.track.request_draw(true,true)},applies_to:function(Y){if(Y.length>this.index){return true}return false},_keep_val:function(Y){return(isNaN(Y)||(Y>=this.low&&Y<=this.high))},keep:function(Z){if(!this.applies_to(Z)){return true}var ab=this;var ac=Z[this.index];if(ac instanceof Array){var aa=true;for(var Y=0;Y<ac.length;Y++){if(!this._keep_val(ac[Y])){aa=false;break}}return aa}else{return this._keep_val(Z[this.index])}},update_attrs:function(ab){var Y=false;if(!this.applies_to(ab)){return Y}var Z=ab[this.index];if(!(Z instanceof Array)){Z=[Z]}for(var aa=0;aa<Z.length;aa++){var ac=Z[aa];if(ac<this.min){this.min=Math.floor(ac);Y=true}if(ac>this.max){this.max=Math.ceil(ac);Y=true}}return Y},update_ui_elt:function(){if(this.min<this.max){this.parent_div.show()}else{this.parent_div.hide()}var Z=this.slider.slider("option","min"),Y=this.slider.slider("option","max");if(this.min<Z||this.max>Y){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",this.get_slider_step(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var U=function(aa,ag){this.track=aa;this.alpha_filter=null;this.height_filter=null;this.filters=[];this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(ai){ai.stopPropagation()}).click(function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()}).bind("keydown",function(ai){ai.stopPropagation()});if(ag&&"filters" in ag){var Y=("alpha_filter" in ag?ag.alpha_filter:null),ab=("height_filter" in ag?ag.height_filter:null),ad=ag.filters,Z;for(var ae=0;ae<ad.length;ae++){if(ad[ae].type==="number"){Z=new P(ad[ae]);this.add_filter(Z);if(Z.name===Y){this.alpha_filter=Z;Z.transparency_icon.addClass("active").show()}if(Z.name===ab){this.height_filter=Z;Z.height_icon.addClass("active").show()}}else{console.log("ERROR: unsupported filter: ",name,type)}}if("visible" in ag&&ag.visible){this.parent_div.show()}}if(this.filters.length!==0){var ah=$("<div/>").addClass("param-row").appendTo(this.parent_div);var af=$("<input type='submit'/>").attr("value","Run on complete dataset").appendTo(ah);var ac=this;af.click(function(){ac.run_on_dataset()})}};o(U.prototype,{show:function(){this.parent_div.show()},hide:function(){this.parent_div.hide()},toggle:function(){this.parent_div.toggle()},visible:function(){return this.parent_div.is(":visible")},to_dict:function(){var ab={},aa=[],Z;for(var Y=0;Y<this.filters.length;Y++){Z=this.filters[Y];aa.push(Z.to_dict())}ab.filters=aa;ab.alpha_filter=(this.alpha_filter?this.alpha_filter.name:null);ab.height_filter=(this.height_filter?this.height_filter.name:null);ab.visible=this.parent_div.is(":visible");return ab},copy:function(Z){var aa=new U(Z);for(var Y=0;Y<this.filters.length;Y++){aa.add_filter(this.filters[Y].copy())}return aa},add_filter:function(Y){Y.manager=this;this.parent_div.append(Y.parent_div);this.filters.push(Y)},remove_all:function(){this.filters=[];this.parent_div.children().remove()},init_filters:function(){for(var Y=0;Y<this.filters.length;Y++){var Z=this.filters[Y];Z.update_ui_elt()}},clear_filters:function(){for(var Y=0;Y<this.filters.length;Y++){var Z=this.filters[Y];Z.slider.slider("option","values",[Z.min,Z.max])}this.alpha_filter=null;this.height_filter=null;this.parent_div.find(".icon-button").hide()},run_on_dataset:function(){var ae=function(ai,ag,ah){if(!(ag in ai)){ai[ag]=ah}return ai[ag]};var ad={},af,Y;for(var ac=0;ac<this.filters.length;ac++){af=this.filters[ac];if(af.tool_id){if(af.min!==af.low){Y=ae(ad,af.tool_id,[]);Y[Y.length]=af.tool_exp_name+" >= "+af.low}if(af.max!==af.high){Y=ae(ad,af.tool_id,[]);Y[Y.length]=af.tool_exp_name+" <= "+af.high}}}var Z=[];for(var ab in ad){Z[Z.length]=[ab,ad[ab]]}(function aa(am,aj){var ah=aj[0],ai=ah[0],al=ah[1],ak="("+al.join(") and (")+")",ag={cond:ak,input:am,target_dataset_id:am,tool_id:ai},aj=aj.slice(1);$.getJSON(run_tool_url,ag,function(an){if(an.error){show_modal("Filter Dataset","Error running tool "+ai,{Close:hide_modal})}else{if(aj.length===0){show_modal("Filtering Dataset","Filter(s) are running on the complete dataset. Outputs are in dataset's history.",{Close:hide_modal})}else{aa(an.dataset_id,aj)}}})})(this.track.dataset_id,Z)}});var y=function(Y,Z){H.Scaler.call(this,Z);this.filter=Y};y.prototype.gen_val=function(Y){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(Y[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var B=function(Y){this.track=Y.track;this.params=Y.params;this.values={};this.restore_values((Y.saved_values?Y.saved_values:{}));this.onchange=Y.onchange};o(B.prototype,{restore_values:function(Y){var Z=this;$.each(this.params,function(aa,ab){if(Y[ab.key]!==undefined){Z.values[ab.key]=Y[ab.key]}else{Z.values[ab.key]=ab.default_value}})},build_form:function(){var ab=this;var Y=$("<div />");var aa;function Z(af,ac){for(var aj=0;aj<af.length;aj++){aa=af[aj];if(aa.hidden){continue}var ad="param_"+aj;var an=ab.values[aa.key];var aq=$("<div class='form-row' />").appendTo(ac);aq.append($("<label />").attr("for",ad).text(aa.label+":"));if(aa.type==="bool"){aq.append($('<input type="checkbox" />').attr("id",ad).attr("name",ad).attr("checked",an))}else{if(aa.type==="text"){aq.append($('<input type="text"/>').attr("id",ad).val(an).click(function(){$(this).select()}))}else{if(aa.type==="select"){var al=$("<select />").attr("id",ad);for(var ah=0;ah<aa.options.length;ah++){$("<option/>").text(aa.options[ah].label).attr("value",aa.options[ah].value).appendTo(al)}al.val(an);aq.append(al)}else{if(aa.type==="color"){var ap=$("<div/>").appendTo(aq),ak=$("<input />").attr("id",ad).attr("name",ad).val(an).css("float","left").appendTo(ap).click(function(at){$(".tipsy").hide();var ar=$(this).siblings(".tipsy");ar.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(ar).height()/2)+($(this).height()/2)}).show();ar.click(function(au){au.stopPropagation()});$(document).bind("click.color-picker",function(){ar.hide();$(document).unbind("click.color-picker")});at.stopPropagation()}),ai=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(ap).attr("title","Set new random color").tipsy({gravity:"s"}),am=$("<div class='tipsy tipsy-west' style='position: absolute;' />").appendTo(ap).hide(),ae=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(am),ao=$("<div/>").appendTo(ae),ag=$.farbtastic(ao,{width:100,height:100,callback:ak,color:an});ap.append($("<div/>").css("clear","both"));(function(ar){ai.click(function(){ar.setColor(get_random_color())})})(ag)}else{aq.append($("<input />").attr("id",ad).attr("name",ad).val(an))}}}}if(aa.help){aq.append($("<div class='help'/>").text(aa.help))}}}Z(this.params,Y);return Y},update_from_form:function(Y){var aa=this;var Z=false;$.each(this.params,function(ab,ad){if(!ad.hidden){var ae="param_"+ab;var ac=Y.find("#"+ae).val();if(ad.type==="float"){ac=parseFloat(ac)}else{if(ad.type==="int"){ac=parseInt(ac)}else{if(ad.type==="bool"){ac=Y.find("#"+ae).is(":checked")}}}if(ac!==aa.values[ad.key]){aa.values[ad.key]=ac;Z=true}}});if(Z){this.onchange();this.track.changed()}}});var b=function(Y,ac,aa,Z,ab){this.track=Y;this.region=ac;this.low=ac.get("start");this.high=ac.get("end");this.resolution=aa;this.html_elt=$("<div class='track-tile'/>").append(Z).height($(Z).attr("height"));this.data=ab;this.stale=false};b.prototype.predisplay_actions=function(){};var j=function(Y,ad,aa,Z,ab,ac){b.call(this,Y,ad,aa,Z,ab);this.max_val=ac};o(j.prototype,b.prototype);var K=function(ab,aj,ac,aa,ae,al,af,am,Z,ai){b.call(this,ab,aj,ac,aa,ae);this.mode=af;this.all_slotted=Z;this.feature_mapper=ai;this.has_icons=false;if(am){this.has_icons=true;var ag=this;aa=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:z-1,width:aa.width}).prependTo(this.html_elt);var ah=new GenomeRegion({chrom:ab.view.chrom,start:this.low,end:this.high}),ak=ae.length,ad=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ak+" features in this region were obtained from server. Click to get more data including depth").tipsy({gravity:"s"}).appendTo(message_div),Y=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ak+" features in this region were obtained from server. Click to get more data excluding depth").tipsy({gravity:"s"}).appendTo(message_div);ad.click(function(){ag.stale=true;ab.data_manager.get_more_data(ah,ab.mode,ag.resolution,{},ab.data_manager.DEEP_DATA_REQ);$(".tipsy").hide();ab.request_draw(true)}).dblclick(function(an){an.stopPropagation()});Y.click(function(){ag.stale=true;ab.data_manager.get_more_data(ah,ab.mode,ag.resolution,{},ab.data_manager.BROAD_DATA_REQ);$(".tipsy").hide();ab.request_draw(true)}).dblclick(function(an){an.stopPropagation()})}};o(K.prototype,b.prototype);K.prototype.predisplay_actions=function(){var Z=this,Y={};if(Z.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(ak){if(!this.hovered){return}var af=$(this).offset(),aj=ak.pageX-af.left,ai=ak.pageY-af.top,ao=Z.feature_mapper.get_feature_data(aj,ai),ag=(ao?ao[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!ag||$(this).attr("id")!==ag.toString()){$(this).remove()}});if(ao){var ab=Y[ag];if(!ab){var ag=ao[0],al={name:ao[3],start:ao[1],end:ao[2],strand:ao[4]},ae=Z.track.filters_manager.filters,ad;for(var ah=0;ah<ae.length;ah++){ad=ae[ah];al[ad.name]=ao[ad.index]}var ab=$("<div/>").attr("id",ag).addClass("feature-popup"),ap=$("<table/>"),an,am,aq;for(an in al){am=al[an];aq=$("<tr/>").appendTo(ap);$("<th/>").appendTo(aq).text(an);$("<td/>").attr("align","left").appendTo(aq).text(typeof(am)==="number"?T(am,2):am)}ab.append($("<div class='feature-popup-inner'>").append(ap));Y[ag]=ab}ab.appendTo($(this).parents(".track-content").children(".overlay"));var ac=aj+parseInt(Z.html_elt.css("left"))-ab.width()/2,aa=ai+parseInt(Z.html_elt.css("top"))+7;ab.css("left",ac+"px").css("top",aa+"px")}else{if(!ak.isPropagationStopped()){ak.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ak)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var h=function(aa,Z,ac){o(ac,{drag_handle_class:"draghandle"});p.call(this,aa,Z,ac);this.data_url=("data_url" in ac?ac.data_url:default_data_url);this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ac?ac.data_query_wait:G);this.dataset_check_url=("converted_datasets_state_url" in ac?ac.converted_datasets_state_url:converted_datasets_state_url);var Y=this,ab=new Dataset({id:ac.dataset_id,hda_ldda:ac.hda_ldda});this.data_manager=("data_manager" in ac?ac.data_manager:new GenomeDataManager({dataset:ab,data_url:Y.data_url,dataset_state_url:Y.dataset_check_url,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 ac)||ac.resize){this.add_resize_handle()}}};o(h.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(Y){Y.view.set_overview(Y)}},p.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(Y){if(Y.filters_manager.visible()){Y.filters_manager.clear_filters()}else{Y.filters_manager.init_filters()}Y.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(Y){Y.dynamic_tool_div.toggle();if(Y.dynamic_tool_div.is(":visible")){Y.set_name(Y.name+Y.tool_region_and_parameters_str())}else{Y.revert_name()}$(".tipsy").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(Y){var ab='<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>',aa=_.template(ab,{track:Y});var ad=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},Z=function(){var af=$('select[name="regions"] option:selected').val(),ah,ae=new GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ag=_.map($(".bookmark"),function(ai){return new GenomeRegion({from_str:$(ai).children(".position").text()})});if(af==="cur"){ah=[ae]}else{if(af==="bookmarks"){ah=ag}else{ah=[ae].concat(ag)}}hide_modal();window.location.href=galaxy_paths.get("paramamonster_url")+"?"+$.param({dataset_id:Y.dataset_id,hda_ldda:Y.hda_ldda,regions:JSON.stringify(new Backbone.Collection(ah).toJSON())})},ac=function(ae){if((ae.keyCode||ae.which)===27){ad()}else{if((ae.keyCode||ae.which)===13){Z()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",aa,{No:ad,Yes:Z})}},p.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset_id&&p.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var Y=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(Y)}this.name_div=$("<div/>").addClass("track-name").appendTo(Y).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return Y},on_resize:function(){},add_resize_handle:function(){var Y=this;var ab=false;var aa=false;var Z=$("<div class='track-resize'>");$(Y.container_div).hover(function(){if(Y.content_visible){ab=true;Z.show()}},function(){ab=false;if(!aa){Z.hide()}});Z.hide().bind("dragstart",function(ac,ad){aa=true;ad.original_height=$(Y.content_div).height()}).bind("drag",function(ad,ae){var ac=Math.min(Math.max(ae.original_height+ae.deltaY,Y.min_height_px),Y.max_height_px);$(Y.tiles_div).css("height",ac);Y.visible_height_px=(Y.max_height_px===ac?0:ac);Y.on_resize()}).bind("dragend",function(ac,ad){Y.tile_cache.clear();aa=false;if(!ab){Z.hide()}Y.config.values.height=Y.visible_height_px;Y.changed()}).appendTo(Y.container_div)},set_display_modes:function(ab,ae){this.display_modes=ab;this.mode=(ae?ae:(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 Z=this,ac={};for(var aa=0,Y=Z.display_modes.length;aa<Y;aa++){var ad=Z.display_modes[aa];ac[ad]=function(af){return function(){Z.change_mode(af);Z.icons_div.show();Z.container_div.mouseleave(function(){Z.icons_div.hide()})}}(ad)}make_popupmenu(this.action_icons.mode_icon,ac)},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 V){return"LabelTrack"}else{if(this instanceof x){return"ReferenceTrack"}else{if(this instanceof i){return"LineTrack"}else{if(this instanceof Q){return"ReadTrack"}else{if(this instanceof N){return"VcfTrack"}else{if(this instanceof g){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(){var Z=this;Z.enabled=false;Z.tile_cache.clear();Z.data_manager.clear();Z.content_div.css("height","auto");Z.tiles_div.children().remove();Z.container_div.removeClass("nodata error pending");if(!Z.dataset_id){return}var Y=$.Deferred();$.getJSON(this.dataset_check_url,{hda_ldda:Z.hda_ldda,dataset_id:Z.dataset_id,chrom:Z.view.chrom},function(aa){if(!aa||aa==="error"||aa.kind==="error"){Z.container_div.addClass("error");Z.tiles_div.text(n);if(aa.message){var ab=$(" <a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+aa.message+"</pre>",{Close:hide_modal})});Z.tiles_div.append(ab)}}else{if(aa==="no converter"){Z.container_div.addClass("error");Z.tiles_div.text(F)}else{if(aa==="no data"||(aa.data!==undefined&&(aa.data===null||aa.data.length===0))){Z.container_div.addClass("nodata");Z.tiles_div.text(A)}else{if(aa==="pending"){Z.container_div.addClass("pending");Z.tiles_div.html(s);setTimeout(function(){Z.init()},Z.data_query_wait)}else{if(aa==="data"||aa.status==="data"){if(aa.valid_chroms){Z.valid_chroms=aa.valid_chroms;Z.update_icons()}Z.tiles_div.text(S);if(Z.view.chrom){Z.tiles_div.text("");Z.tiles_div.css("height",Z.visible_height_px+"px");Z.enabled=true;$.when(Z.predraw_init()).done(function(){Y.resolve();Z.container_div.removeClass("nodata error pending");Z.request_draw()})}else{Y.resolve()}}}}}}});this.update_icons();return Y},predraw_init:function(){}});var I=function(aa,Z,ab){h.call(this,aa,Z,ab);var Y=this,aa=Y.view;l(Y.container_div,Y.drag_handle_class,".group",Y);this.filters_manager=new U(this,("filters" in ab?ab.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in ab&&ab.tool?new q(this,ab.tool,ab.tool_state):null);this.tile_cache=new Cache(M);if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ab.mode){this.change_mode(ab.mode)}};o(I.prototype,p.prototype,h.prototype,{action_icons_def:h.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(Y){$(".tipsy").remove();Y.slotters[Y.view.resolution_px_b].max_rows*=2;Y.request_draw(true)},hide:true}]),copy:function(Y){var Z=this.to_dict();o(Z,{data_manager:this.data_manager});var aa=new this.constructor(this.view,Y,Z);aa.change_mode(this.mode);aa.enabled=this.enabled;return aa},set_filters_manager:function(Y){this.filters_manager=Y;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},change_mode:function(Z){var Y=this;Y.mode=Z;Y.config.values.mode=Z;Y.tile_cache.clear();Y.request_draw();this.action_icons.mode_icon.attr("title","Set display mode (now: "+Y.mode+")");return Y},update_icons:function(){var Y=this;if(Y.filters_available){Y.action_icons.filters_icon.show()}else{Y.action_icons.filters_icon.hide()}if(Y.tool){Y.action_icons.tools_icon.show();Y.action_icons.param_space_viz_icon.show()}else{Y.action_icons.tools_icon.hide();Y.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(Z,aa,Y){return Z+"_"+aa+"_"+Y},request_draw:function(Z,Y){this.view.request_redraw(false,Z,Y,this)},before_draw:function(){},_draw:function(Z,aj){if(!this.can_draw()){return}var ah=this.view.low,ad=this.view.high,af=ad-ah,aa=this.view.container.width(),al=this.view.resolution_px_b,ac=this.view.resolution_b_px;if(this.is_overview){ah=this.view.max_low;ad=this.view.max_high;ac=Math.pow(RESOLUTION,Math.ceil(Math.log((view.max_high-view.max_low)/O)/Math.log(RESOLUTION)));al=aa/(view.max_high-view.max_low)}this.before_draw();this.tiles_div.children().addClass("remove");var Y=Math.floor(ah/(ac*O)),ag=true,ak=[],ae=function(am){return(am&&"track" in am)};while((Y*O*ac)<ad){var ai=this.draw_helper(Z,aa,Y,ac,this.tiles_div,al);if(ae(ai)){ak.push(ai)}else{ag=false}Y+=1}if(!aj){this.tiles_div.children(".remove").removeClass("remove").remove()}var ab=this;if(ag){this.tiles_div.children(".remove").remove();ab.postdraw_actions(ak,aa,al,aj)}},postdraw_actions:function(ab,ac,ae,Y){var aa=this;var ad=false;for(var Z=0;Z<ab.length;Z++){if(ab[Z].has_icons){ad=true;break}}if(ad){for(var Z=0;Z<ab.length;Z++){tile=ab[Z];if(!tile.has_icons){tile.html_elt.css("padding-top",z)}}}},draw_helper:function(Y,ak,ap,an,ad,ae,al){var aj=this,at=this._gen_tile_cache_key(ak,ae,ap),ab=this._get_tile_bounds(ap,an);if(!al){al={}}var ar=(Y?undefined:aj.tile_cache.get_elt(at));if(ar){aj.show_tile(ar,ad,ae);return ar}var ah=true;var ao=aj.data_manager.get_data(ab,aj.mode,an,aj.data_url_extra_params);if(is_deferred(ao)){ah=false}var af;if(view.reference_track&&ae>view.canvas_manager.char_width_px){af=view.reference_track.data_manager.get_data(ab,aj.mode,an,view.reference_track.data_url_extra_params);if(is_deferred(af)){ah=false}}if(ah){o(ao,al.more_tile_data);var ag=aj.mode;if(ag==="Auto"){ag=aj.get_mode(ao);aj.update_auto_mode(ag)}var aa=aj.view.canvas_manager.new_canvas(),aq=ab.get("start"),Z=ab.get("end"),ak=Math.ceil((Z-aq)*ae)+aj.left_offset,ai=aj.get_canvas_height(ao,ag,ae,ak);aa.width=ak;aa.height=ai;var am=aa.getContext("2d");am.translate(this.left_offset,0);var ar=aj.draw_tile(ao,am,ag,an,ab,ae,af);if(ar!==undefined){aj.tile_cache.set_elt(at,ar);aj.show_tile(ar,ad,ae)}return ar}var ac=$.Deferred();$.when(ao,af).then(function(){view.request_redraw(false,false,false,aj);ac.resolve()});return ac},get_canvas_height:function(Y,aa,ab,Z){return this.visible_height_px},draw_tile:function(Y,Z,ad,ab,ac,ae,aa){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(aa,ac,ad){var Z=this,Y=aa.html_elt;aa.predisplay_actions();var ab=(aa.low-(this.is_overview?this.view.max_low:this.view.low))*ad;if(this.left_offset){ab-=this.left_offset}Y.css({position:"absolute",top:0,left:ab});if(Y.hasClass("remove")){Y.removeClass("remove")}else{ac.append(Y)}Z.after_show_tile(aa)},after_show_tile:function(Y){},_get_tile_bounds:function(Y,Z){var ab=Math.floor(Y*O*Z),ac=Math.ceil(O*Z),aa=(ab+ac<=this.view.max_high?ab+ac:this.view.max_high);return new GenomeRegion({chrom:this.view.chrom,start:ab,end:aa})},tool_region_and_parameters_str:function(aa,Y,ab){var Z=this,ac=(aa!==undefined&&Y!==undefined&&ab!==undefined?aa+":"+Y+"-"+ab:"all");return" - region=["+ac+"], parameters=["+Z.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(Y,Z){return true},can_subset:function(Y){return false},init_for_tool_data:function(){this.data_manager.set("data_url",raw_data_url);this.data_query_wait=1000;this.dataset_check_url=dataset_state_url;this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(aa,ab,ad,Y){var Z=this;Z.normal_postdraw_actions(aa,ab,ad,Y);Z.dataset_state_url=converted_datasets_state_url;Z.data_query_wait=G;var ac=new ServerStateDeferred({url:Z.dataset_state_url,url_params:{dataset_id:Z.dataset_id,hda_ldda:Z.hda_ldda},interval:Z.data_query_wait,success_fn:function(ae){return ae!=="pending"}});$.when(ac.go()).then(function(){Z.data_manager.set("data_url",default_data_url)});Z.postdraw_actions=Z.normal_postdraw_actions}}});var V=function(Z,Y){var aa={resize:false};h.call(this,Z,Y,aa);this.container_div.addClass("label-track")};o(V.prototype,h.prototype,{build_header_div:function(){},init:function(){this.enabled=true},_draw:function(){var aa=this.view,ab=aa.high-aa.low,ae=Math.floor(Math.pow(10,Math.floor(Math.log(ab)/Math.log(10)))),Y=Math.floor(aa.low/ae)*ae,ac=this.view.container.width(),Z=$("<div style='position: relative; height: 1.3em;'></div>");while(Y<aa.high){var ad=(Y-aa.low)/ab*ac;Z.append($("<div class='label'>"+commatize(Y)+"</div>").css({position:"absolute",left:ad-1}));Y+=ae}this.content_div.children(":first").remove();this.content_div.append(Z)}});var g=function(Z,Y,ac){I.call(this,Z,Y,ac);this.drawables=[];this.left_offset=0;if("drawables" in ac){var ab;for(var aa=0;aa<ac.drawables.length;aa++){ab=ac.drawables[aa];this.drawables[aa]=object_from_template(ab);if(ab.left_offset>this.left_offset){this.left_offset=ab.left_offset}}this.enabled=true}if(this.drawables.length!==0){this.set_display_modes(this.drawables[0].display_modes,this.drawables[0].mode)}this.update_icons();this.obj_type="CompositeTrack"};o(g.prototype,I.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(Y){$(".tipsy").remove();Y.show_group()}}].concat(I.prototype.action_icons_def),to_dict:v.prototype.to_dict,add_drawable:v.prototype.add_drawable,unpack_drawables:v.prototype.unpack_drawables,change_mode:function(Y){I.prototype.change_mode.call(this,Y);for(var Z=0;Z<this.drawables.length;Z++){this.drawables[Z].change_mode(Y)}},init:function(){var aa=[];for(var Z=0;Z<this.drawables.length;Z++){aa.push(this.drawables[Z].init())}var Y=this;$.when.apply($,aa).then(function(){Y.enabled=true;Y.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,draw_helper:function(Z,an,au,aq,af,ah,ao){var am=this,ay=this._gen_tile_cache_key(an,ah,au),ad=this._get_tile_bounds(au,aq),av=ad.get("start"),aa=ad.get("end");if(!ao){ao={}}var ax=(Z?undefined:am.tile_cache.get_elt(ay));if(ax){am.show_tile(ax,af,ah);return ax}var ag=[],am,ak=true,ar,ai;for(var at=0;at<this.drawables.length;at++){am=this.drawables[at];ar=am.data_manager.get_data(av,aa,am.mode,aq,am.data_url_extra_params);if(is_deferred(ar)){ak=false}ag.push(ar);ai=null;if(view.reference_track&&ah>view.canvas_manager.char_width_px){ai=view.reference_track.data_manager.get_data(av,aa,am.mode,aq,view.reference_track.data_url_extra_params);if(is_deferred(ai)){ak=false}}ag.push(ai)}if(ak){o(ar,ao.more_tile_data);this.tile_predraw_init();var ac=am.view.canvas_manager.new_canvas(),ad=am._get_tile_bounds(au,aq),av=ad.get("start"),aa=ad.get("end"),aw=0,an=Math.ceil((aa-av)*ah)+this.left_offset,al=0,ab=[];var Y=0;for(var at=0;at<this.drawables.length;at++,aw+=2){am=this.drawables[at];ar=ag[aw];var aj=am.mode;if(aj==="Auto"){aj=am.get_mode(ar);am.update_auto_mode(aj)}ab.push(aj);Y=am.get_canvas_height(ar,aj,ah,an);if(Y>al){al=Y}}ac.width=an;ac.height=(ao.height?ao.height:al);aw=0;var ap=ac.getContext("2d");ap.translate(this.left_offset,0);ap.globalAlpha=0.5;ap.globalCompositeOperation="source-over";for(var at=0;at<this.drawables.length;at++,aw+=2){am=this.drawables[at];ar=ag[aw];ai=ag[aw+1];ax=am.draw_tile(ar,ap,ab[at],aq,ad,ah,ai)}this.tile_cache.set_elt(ay,ax);this.show_tile(ax,af,ah);return ax}var ae=$.Deferred(),am=this;$.when.apply($,ag).then(function(){view.request_redraw(false,false,false,am);ae.resolve()});return ae},show_group:function(){var ab=new L(this.view,this.container,{name:this.name}),Y;for(var aa=0;aa<this.drawables.length;aa++){Y=this.drawables[aa];ab.add_drawable(Y);Y.container=ab;ab.content_div.append(Y.container_div)}var Z=this.container.replace_drawable(this,ab,true);ab.request_draw()},tile_predraw_init:function(){var ab=Number.MAX_VALUE,Y=-ab,Z;for(var aa=0;aa<this.drawables.length;aa++){Z=this.drawables[aa];if(Z instanceof i){if(Z.prefs.min_value<ab){ab=Z.prefs.min_value}if(Z.prefs.max_value>Y){Y=Z.prefs.max_value}}}for(var aa=0;aa<this.drawables.length;aa++){Z=this.drawables[aa];Z.prefs.min_value=ab;Z.prefs.max_value=Y}},postdraw_actions:function(aa,ad,af,Z){I.prototype.postdraw_actions.call(this,aa,ad,af,Z);var ac=-1;for(var ab=0;ab<aa.length;ab++){var Y=aa[ab].html_elt.find("canvas").height();if(Y>ac){ac=Y}}for(var ab=0;ab<aa.length;ab++){var ae=aa[ab];if(ae.html_elt.find("canvas").height()!==ac){this.draw_helper(true,ad,ae.index,ae.resolution,ae.html_elt.parent(),af,{height:ac});ae.html_elt.remove()}}}});var x=function(Y){I.call(this,Y,{content_div:Y.top_labeltrack},{resize:false});Y.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:Y.dbkey};this.data_manager=new ReferenceTrackDataManager({data_url:reference_url});this.hide_contents()};o(x.prototype,p.prototype,I.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},can_draw:p.prototype.can_draw,draw_tile:function(ag,ah,ac,ab,ae,ai){var aa=this;if(ai>this.view.canvas_manager.char_width_px){if(ag.data===null){this.hide_contents();return}var Z=ah.canvas;ah.font=ah.canvas.manager.default_font;ah.textAlign="center";ag=ag.data;for(var ad=0,af=ag.length;ad<af;ad++){var Y=Math.floor(ad*ai);ah.fillText(ag[ad],Y,10)}this.show_contents();return new b(aa,ae,ab,Z,ag)}this.hide_contents()}});var i=function(aa,Z,ab){var Y=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";I.call(this,aa,Z,ab);this.hda_ldda=ab.hda_ldda;this.dataset_id=ab.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:ab.prefs,onchange:function(){Y.set_name(Y.prefs.name);Y.vertical_range=Y.prefs.max_value-Y.prefs.min_value;Y.set_min_value(Y.prefs.min_value);Y.set_max_value(Y.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};o(i.prototype,p.prototype,I.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(Y){this.prefs.min_value=Y;$("#linetrack_"+this.dataset_id+"_minval").text(this.prefs.min_value);this.tile_cache.clear();this.request_draw()},set_max_value:function(Y){this.prefs.max_value=Y;$("#linetrack_"+this.dataset_id+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.request_draw()},predraw_init:function(){var Y=this;Y.vertical_range=undefined;return $.getJSON(Y.data_url,{stats:true,chrom:Y.view.chrom,low:null,high:null,hda_ldda:Y.hda_ldda,dataset_id:Y.dataset_id},function(Z){Y.container_div.addClass("line-track");var ac=Z.data;if(isNaN(parseFloat(Y.prefs.min_value))||isNaN(parseFloat(Y.prefs.max_value))){var aa=ac.min,ae=ac.max;aa=Math.floor(Math.min(0,Math.max(aa,ac.mean-2*ac.sd)));ae=Math.ceil(Math.max(0,Math.min(ae,ac.mean+2*ac.sd)));Y.prefs.min_value=aa;Y.prefs.max_value=ae;$("#track_"+Y.dataset_id+"_minval").val(Y.prefs.min_value);$("#track_"+Y.dataset_id+"_maxval").val(Y.prefs.max_value)}Y.vertical_range=Y.prefs.max_value-Y.prefs.min_value;Y.total_frequency=ac.total_frequency;Y.container_div.find(".yaxislabel").remove();var ad=$("<div/>").text(T(Y.prefs.min_value,3)).make_text_editable({num_cols:6,on_finish:function(af){$(".tipsy").remove();var af=parseFloat(af);if(!isNaN(af)){Y.set_min_value(af)}},help_text:"Set min value"}).addClass("yaxislabel bottom").attr("id","linetrack_"+Y.dataset_id+"_minval").prependTo(Y.container_div),ab=$("<div/>").text(T(Y.prefs.max_value,3)).make_text_editable({num_cols:6,on_finish:function(af){$(".tipsy").remove();var af=parseFloat(af);if(!isNaN(af)){Y.set_max_value(af)}},help_text:"Set max value"}).addClass("yaxislabel top").attr("id","linetrack_"+Y.dataset_id+"_maxval").prependTo(Y.container_div)})},draw_tile:function(ah,af,aa,Z,ac,ag){var Y=af.canvas,ab=ac.get("start"),ae=ac.get("end"),ad=new H.LinePainter(ah.data,ab,ae,this.prefs,aa);ad.draw(af,Y.width,Y.height,ag);return new b(this,ac,Z,Y,ah.data)},can_subset:function(Y){return false}});var c=function(ab,aa,ad){var Z=this;this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];I.call(this,ab,aa,ad);var ac=get_random_color(),Y=get_random_color([ac,"#ffffff"]);this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ac},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:Y},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ad.prefs,onchange:function(){Z.set_name(Z.prefs.name);Z.tile_cache.clear();Z.set_painter_from_config();Z.request_draw()}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.hda_ldda=ad.hda_ldda;this.dataset_id=ad.dataset_id;this.original_dataset_id=ad.dataset_id;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};o(c.prototype,p.prototype,I.prototype,{set_dataset:function(Y){this.dataset_id=Y.get("id");this.hda_ldda=Y.get("hda_ldda");this.data_manager.set("dataset",Y)},set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=H.ArcLinkedFeaturePainter}else{this.painter=H.LinkedFeaturePainter}},before_draw:function(){this.max_height_px=0},after_show_tile:function(Y){this.max_height_px=Math.max(this.max_height_px,Y.html_elt.height());Y.html_elt.parent().children().css("height",this.max_height_px+"px");var Z=this.max_height_px;if(this.visible_height_px!==0){Z=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",Z+"px")},postdraw_actions:function(an,ai,ad,ac){I.prototype.postdraw_actions.call(this,an,ac);var ah=this;if(ah.mode==="Histogram"){var ak,Z=-1;for(ak=0;ak<an.length;ak++){var aj=an[ak].max_val;if(aj>Z){Z=aj}}for(ak=0;ak<an.length;ak++){var ap=an[ak];if(ap.max_val!==Z){ap.html_elt.remove();ah.draw_helper(true,ai,ap.index,ap.resolution,ap.html_elt.parent(),ad,{more_tile_data:{max:Z}})}}}if(ah.filters_manager){var ae=ah.filters_manager.filters;for(var am=0;am<ae.length;am++){ae[am].update_ui_elt()}var ao=false,Y,af;for(var ak=0;ak<an.length;ak++){if(an[ak].data.length){Y=an[ak].data[0];for(var am=0;am<ae.length;am++){af=ae[am];if(af.applies_to(Y)&&af.min!==af.max){ao=true;break}}}}if(ah.filters_available!==ao){ah.filters_available=ao;if(!ah.filters_available){ah.filters_manager.hide()}ah.update_icons()}}this.container_div.find(".yaxislabel").remove();var ab=an[0];if(ab instanceof j){var ag=(this.prefs.histogram_max?this.prefs.histogram_max:ab.max_val),aa=$("<div/>").text(ag).make_text_editable({num_cols:12,on_finish:function(aq){$(".tipsy").remove();var aq=parseFloat(aq);ah.prefs.histogram_max=(!isNaN(aq)?aq:null);ah.tile_cache.clear();ah.request_draw()},help_text:"Set max value; leave blank to use default"}).addClass("yaxislabel top").css("color",this.prefs.label_color);this.container_div.prepend(aa)}if(ab instanceof K){var al=true;for(var ak=0;ak<an.length;ak++){if(!an[ak].all_slotted){al=false;break}}if(!al){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(Y){var Y;if(this.mode==="Auto"){if(Y==="no_detail"){Y="feature spans"}else{if(Y==="summary_tree"){Y="coverage histogram"}}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+Y+")")}},incremental_slots:function(ac,Y,ab){var Z=this.view.canvas_manager.dummy_context,aa=this.slotters[ac];if(!aa||(aa.mode!==ab)){aa=new (r.FeatureSlotter)(ac,ab,w,function(ad){return Z.measureText(ad)});this.slotters[ac]=aa}return aa.slot_features(Y)},get_summary_tree_data:function(ac,af,aa,an){if(an>aa-af){an=aa-af}var aj=Math.floor((aa-af)/an),am=[],ab=0;var ad=0,ae=0,ai,al=0,ag=[],ak,ah;var Z=function(aq,ap,ar,ao){aq[0]=ap+ar*ao;aq[1]=ap+(ar+1)*ao};while(al<an&&ad!==ac.length){var Y=false;for(;al<an&&!Y;al++){Z(ag,af,al,aj);for(ae=ad;ae<ac.length;ae++){ai=ac[ae].slice(1,3);if(is_overlap(ai,ag)){Y=true;break}}if(Y){break}}data_start_index=ae;am[am.length]=ak=[ag[0],0];for(;ae<ac.length;ae++){ai=ac[ae].slice(1,3);if(is_overlap(ai,ag)){ak[1]++}else{break}}if(ak[1]>ab){ab=ak[1]}al++}return{max:ab,delta:aj,data:am}},get_mode:function(Y){if(Y.dataset_type==="summary_tree"){mode="summary_tree"}else{if(Y.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>E){mode="Squish"}else{mode="Pack"}}}return mode},get_canvas_height:function(Y,ac,ad,Z){if(ac==="summary_tree"||ac==="Histogram"){return this.summary_draw_height}else{var ab=this.incremental_slots(ad,Y.data,ac);var aa=new (this.painter)(null,null,null,this.prefs,ac);return Math.max(X,aa.get_required_height(ab,Z))}},draw_tile:function(aj,an,al,ao,ab,af,aa){var am=this,Z=an.canvas,av=ab.get("start"),Y=ab.get("end"),aA=25,ac=this.left_offset;if(al==="summary_tree"||al==="Histogram"){if(aj.dataset_type!=="summary_tree"){var ag=this.get_summary_tree_data(aj.data,av,Y,200);if(aj.max){ag.max=aj.max}aj=ag}var ax=new H.SummaryTreePainter(aj,av,Y,this.prefs);ax.draw(an,Z.width,Z.height,af);return new j(am,ab,ao,Z,aj.data,aj.max)}var ae=[],ak=this.slotters[af].slots;all_slotted=true;if(aj.data){var ah=this.filters_manager.filters;for(var ap=0,ar=aj.data.length;ap<ar;ap++){var ad=aj.data[ap];var aq=false;var ai;for(var au=0,az=ah.length;au<az;au++){ai=ah[au];ai.update_attrs(ad);if(!ai.keep(ad)){aq=true;break}}if(!aq){ae.push(ad);if(!(ad[0] in ak)){all_slotted=false}}}}var ay=(this.filters_manager.alpha_filter?new y(this.filters_manager.alpha_filter):null);var aw=(this.filters_manager.height_filter?new y(this.filters_manager.height_filter):null);var ax=new (this.painter)(ae,av,Y,this.prefs,al,ay,aw,aa);var at=null;an.fillStyle=this.prefs.block_color;an.font=an.canvas.manager.default_font;an.textAlign="right";if(aj.data){at=ax.draw(an,Z.width,Z.height,af,ak);at.translation=-ac}return new K(am,ab,ao,Z,aj.data,af,al,aj.message,all_slotted,at)},data_and_mode_compatible:function(Y,Z){if(Z==="Auto"){return true}else{if(Y.extra_info==="no_detail"||Y.dataset_type==="summary_tree"){return false}else{return true}}},can_subset:function(Y){if(Y.dataset_type==="summary_tree"||Y.message||Y.extra_info==="no_detail"){return false}return true}});var N=function(Z,Y,aa){c.call(this,Z,Y,aa);this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:get_random_color()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:aa.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=H.ReadPainter};o(N.prototype,p.prototype,I.prototype,c.prototype);var Q=function(aa,Z,ac){c.call(this,aa,Z,ac);var ab=get_random_color(),Y=get_random_color([ab,"#ffffff"]);this.config=new B({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:ab},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:Y},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"Clear value to set automatically"},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ac.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=H.ReadPainter;this.update_icons()};o(Q.prototype,p.prototype,I.prototype,c.prototype);R.View=W;R.DrawableGroup=L;R.LineTrack=i;R.FeatureTrack=c;R.ReadTrack=Q;R.VcfTrack=N;R.CompositeTrack=g};var slotting_module=function(c,b){var e=c("class").extend;var d=2,a=5;b.FeatureSlotter=function(i,h,f,g){this.slots={};this.start_end_dct={};this.w_scale=i;this.mode=h;this.include_label=(h==="Pack");this.max_rows=f;this.measureText=g};e(b.FeatureSlotter.prototype,{slot_features:function(m){var p=this.w_scale,h=this.start_end_dct,x=[],z=[],n=0,y=this.max_rows;for(var v=0,w=m.length;v<w;v++){var k=m[v],o=k[0];if(this.slots[o]!==undefined){n=Math.max(n,this.slots[o]);z.push(this.slots[o])}else{x.push(v)}}var q=function(E,F){for(var D=0;D<=y;D++){var B=false,G=h[D];if(G!==undefined){for(var A=0,C=G.length;A<C;A++){var i=G[A];if(F>i[0]&&E<i[1]){B=true;break}}}if(!B){return D}}return -1};for(var v=0,w=x.length;v<w;v++){var k=m[x[v]],o=k[0],t=k[1],f=k[2],r=k[3],g=Math.floor(t*p),l=Math.ceil(f*p),u=this.measureText(r).width,j;if(r!==undefined&&this.include_label){u+=(d+a);if(g-u>=0){g-=u;j="left"}else{l+=u;j="right"}}var s=q(g,l);if(s>=0){if(h[s]===undefined){h[s]=[]}h[s].push([g,l]);this.slots[o]=s;n=Math.max(n,s)}}return n+1}})};var painters_module=function(i,x){var u=i("class").extend;var p=function(I,A,G,z,F,D){if(D===undefined){D=4}var C=z-A;var B=F-G;var E=Math.floor(Math.sqrt(C*C+B*B)/D);var J=C/E;var H=B/E;var y;for(y=0;y<E;y++,A+=J,G+=H){if(y%2!==0){continue}I.fillRect(A,G,D,1)}};var q=function(B,A,z,E){var D=A-E/2,C=A+E/2,F=z-Math.sqrt(E*3/2);B.beginPath();B.moveTo(D,F);B.lineTo(C,F);B.lineTo(A,z);B.lineTo(D,F);B.strokeStyle=this.fillStyle;B.fill();B.stroke();B.closePath()};var d=function(y){this.default_val=(y?y:1)};d.prototype.gen_val=function(y){return this.default_val};var l=function(A,C,y,z,B){this.data=A;this.view_start=C;this.view_end=y;this.prefs=u({},this.default_prefs,z);this.mode=B};l.prototype.default_prefs={};l.prototype.draw=function(z,A,y,B){};var v=function(A,C,y,z,B){l.call(this,A,C,y,z,B)};v.prototype.default_prefs={show_counts:false};v.prototype.draw=function(L,z,K,M){var E=this.view_start,N=this.view_end-this.view_start,I=this.data.data,G=(this.prefs.histogram_max?this.prefs.histogram_max:this.data.max),B=K;delta_x_px=Math.ceil(this.data.delta*M);L.save();for(var C=0,D=I.length;C<D;C++){var H=Math.floor((I[C][0]-E)*M);var F=I[C][1];if(!F){continue}var J=F/G*K;if(F!==0&&J<1){J=1}L.fillStyle=this.prefs.block_color;L.fillRect(H,B-J,delta_x_px,J);var A=4;if(this.prefs.show_counts&&(L.measureText(F).width+A)<delta_x_px){L.fillStyle=this.prefs.label_color;L.textAlign="center";L.fillText(F,H+(delta_x_px/2),10)}}L.restore()};var b=function(y,C,E,F,A){l.call(this,y,C,E,F,A);if(this.prefs.min_value===undefined){var G=Infinity;for(var z=0,B=this.data.length;z<B;z++){G=Math.min(G,this.data[z][1])}this.prefs.min_value=G}if(this.prefs.max_value===undefined){var D=-Infinity;for(var z=0,B=this.data.length;z<B;z++){D=Math.max(D,this.data[z][1])}this.prefs.max_value=D}};b.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};b.prototype.draw=function(S,Q,N,D){var I=false,K=this.prefs.min_value,F=this.prefs.max_value,M=F-K,B=N,C=this.view_start,P=this.view_end-this.view_start,L=this.mode,aa=this.data;S.save();var ac=Math.round(N+K/M*N);if(L!=="Intensity"){S.fillStyle="#aaa";S.fillRect(0,ac,Q,1)}S.beginPath();var Y,G,E;if(aa.length>1){E=Math.ceil((aa[1][0]-aa[0][0])*D)}else{E=10}var A=parseInt(this.prefs.color.slice(1),16),H=(A&16711680)>>16,R=(A&65280)>>8,V=A&255;for(var T=0,U=aa.length;T<U;T++){S.fillStyle=S.strokeStyle=this.prefs.color;Y=Math.round((aa[T][0]-C)*D);G=aa[T][1];var W=false,J=false;if(G===null){if(I&&L==="Filled"){S.lineTo(Y,B)}I=false;continue}if(G<K){J=true;G=K}else{if(G>F){W=true;G=F}}if(L==="Histogram"){G=Math.round(G/M*B);S.fillRect(Y,ac,E,-G)}else{if(L==="Intensity"){var z=(G-K)/M,O=Math.round(H+(255-H)*(1-z)),X=Math.round(R+(255-R)*(1-z)),ab=Math.round(V+(255-V)*(1-z));S.fillStyle="rgb("+O+","+X+","+ab+")";S.fillRect(Y,0,E,B)}else{G=Math.round(B-(G-K)/M*B);if(I){S.lineTo(Y,G)}else{I=true;if(L==="Filled"){S.moveTo(Y,B);S.lineTo(Y,G)}else{S.moveTo(Y,G)}}}}S.fillStyle=this.prefs.overflow_color;if(W||J){var Z;if(L==="Histogram"||L==="Intensity"){Z=E}else{Y-=2;Z=4}if(W){S.fillRect(Y,0,Z,3)}if(J){S.fillRect(Y,B-3,Z,3)}}S.fillStyle=this.prefs.color}if(L==="Filled"){if(I){S.lineTo(Y,ac);S.lineTo(0,ac)}S.fill()}else{S.stroke()}S.restore()};var m=function(y){this.feature_positions={};this.slot_height=y;this.translation=0;this.y_translation=0};m.prototype.map_feature_data=function(z,B,y,A){if(!this.feature_positions[B]){this.feature_positions[B]=[]}this.feature_positions[B].push({data:z,x_start:y,x_end:A})};m.prototype.get_feature_data=function(z,D){var C=Math.floor((D-this.y_translation)/this.slot_height),B;if(!this.feature_positions[C]){return null}z+=this.translation;for(var A=0;A<this.feature_positions[C].length;A++){B=this.feature_positions[C][A];if(z>=B.x_start&&z<=B.x_end){return B.data}}};var o=function(A,D,y,z,C,E,B){l.call(this,A,D,y,z,C);this.alpha_scaler=(E?E:new d());this.height_scaler=(B?B:new d())};o.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};u(o.prototype,{get_required_height:function(A,z){var y=y_scale=this.get_row_height(),B=this.mode;if(B==="no_detail"||B==="Squish"||B==="Pack"){y=A*y_scale}return y+this.get_top_padding(z)+this.get_bottom_padding(z)},get_top_padding:function(y){return 0},get_bottom_padding:function(y){return Math.max(Math.round(this.get_row_height()/2),5)},draw:function(K,I,G,E,F){var Q=this.data,D=this.view_start,M=this.view_end;K.save();K.fillStyle=this.prefs.block_color;K.textAlign="right";var H=this.view_end-this.view_start,L=this.get_row_height(),P=new m(L),B;for(var N=0,O=Q.length;N<O;N++){var A=Q[N],C=A[0],J=A[1],y=A[2],z=(F&&F[C]!==undefined?F[C]:null);if((J<M&&y>D)&&(this.mode==="Dense"||z!==null)){B=this.draw_element(K,this.mode,A,z,D,M,E,L,I);P.map_feature_data(A,z,B[0],B[1])}}K.restore();P.y_translation=this.get_top_padding(I);return P},draw_element:function(E,A,G,C,B,D,F,z,y){console.log("WARNING: Unimplemented function.");return[0,0]}});var c=10,h=3,k=5,w=10,f=1,s=9,e=3,a=9,j=2,g="#ccc";var r=function(A,D,y,z,C,E,B){o.call(this,A,D,y,z,C,E,B);this.draw_background_connector=true;this.draw_individual_connectors=false};u(r.prototype,o.prototype,{get_row_height:function(){var z=this.mode,y;if(z==="Dense"){y=c}else{if(z==="no_detail"){y=h}else{if(z==="Squish"){y=k}else{y=w}}}return y},draw_element:function(M,D,X,H,O,ai,am,ao,y){var T=X[0],ak=X[1],ad=X[2]-1,Q=X[3],K=X[4],ae=Math.floor(Math.max(0,(ak-O)*am)),N=Math.ceil(Math.min(y,Math.max(0,(ad-O)*am))),ac=ae,an=N,aa=(D==="Dense"?0:(0+H))*ao+this.get_top_padding(y),L,ag,R=null,aq=null,B=B=(!K||K==="+"||K==="."?this.prefs.block_color:this.prefs.reverse_strand_color);label_color=this.prefs.label_color;M.globalAlpha=this.alpha_scaler.gen_val(X);if(D==="Dense"){H=1}if(D==="no_detail"){M.fillStyle=B;M.fillRect(ae,aa+5,N-ae,f)}else{var Z=X[5],af=X[6],C=X[7],V=true;if(Z&&af){R=Math.floor(Math.max(0,(Z-O)*am));aq=Math.ceil(Math.min(y,Math.max(0,(af-O)*am)))}var al,U;if(D==="Squish"){al=1;U=e;V=false}else{if(D==="Dense"){al=5;U=s}else{al=5;U=a}}if(!C){M.fillStyle=B;M.fillRect(ae,aa+1,N-ae,U);if(K&&V){if(K==="+"){M.fillStyle=M.canvas.manager.get_pattern("right_strand_inv")}else{if(K==="-"){M.fillStyle=M.canvas.manager.get_pattern("left_strand_inv")}}M.fillRect(ae,aa+1,N-ae,U)}}else{var J,W;if(D==="Squish"||D==="Dense"){J=aa+Math.floor(e/2)+1;W=1}else{if(K){J=aa;W=U}else{J+=(e/2)+1;W=1}}if(this.draw_background_connector){if(D==="Squish"||D==="Dense"){M.fillStyle=g}else{if(K){if(K==="+"){M.fillStyle=M.canvas.manager.get_pattern("right_strand")}else{if(K==="-"){M.fillStyle=M.canvas.manager.get_pattern("left_strand")}}}else{M.fillStyle=g}}M.fillRect(ae,J,N-ae,W)}var E;for(var aj=0,A=C.length;aj<A;aj++){var F=C[aj],z=Math.floor(Math.max(0,(F[0]-O)*am)),Y=Math.ceil(Math.min(y,Math.max((F[1]-1-O)*am))),S,ab;if(z>Y){continue}M.fillStyle=B;M.fillRect(z,aa+(U-al)/2+1,Y-z,al);if(R!==undefined&&af>Z&&!(z>aq||Y<R)){var ah=Math.max(z,R),I=Math.min(Y,aq);M.fillRect(ah,aa+1,I-ah,U)}if(this.draw_individual_connectors&&S){this.draw_connector(M,S,ab,z,Y,aa)}S=z;ab=Y}if(D==="Pack"){M.globalAlpha=1;M.fillStyle="white";var G=this.height_scaler.gen_val(X),P=Math.ceil(U*G),ap=Math.round((U-P)/2);if(G!==1){M.fillRect(ae,J+1,N-ae,ap);M.fillRect(ae,J+U-ap+1,N-ae,ap)}}}M.globalAlpha=1;if(D==="Pack"&&ak>O){M.fillStyle=label_color;if(O===0&&ae-M.measureText(Q).width<0){M.textAlign="left";M.fillText(Q,N+j,aa+8);an+=M.measureText(Q).width+j}else{M.textAlign="right";M.fillText(Q,ae-j,aa+8);ac-=M.measureText(Q).width+j}}}M.globalAlpha=1;return[ac,an]}});var t=function(B,E,y,A,D,F,C,z){o.call(this,B,E,y,A,D,F,C);this.ref_seq=(z?z.data:null)};u(t.prototype,o.prototype,{get_row_height:function(){var y,z=this.mode;if(z==="Dense"){y=c}else{if(z==="Squish"){y=k}else{y=w;if(this.prefs.show_insertions){y*=2}}}return y},draw_read:function(K,A,ag,V,L,aa,ad,C,B,M){K.textAlign="center";var J=this,R=[L,aa],Z=0,W=0,D=0,F=K.canvas.manager.char_width_px,y=(B==="+"?this.prefs.block_color:this.prefs.reverse_strand_color);var O=[];if((A==="Pack"||this.mode==="Auto")&&M!==undefined&&ag>F){D=Math.round(ag/2)}if(!C){C=[[0,M.length]]}for(var G=0,I=C.length;G<I;G++){var z=C[G],E="MIDNSHP=X"[z[0]],S=z[1];if(E==="H"||E==="S"){Z-=S}var U=ad+Z,Y=Math.floor(Math.max(0,(U-L)*ag)),ab=Math.floor(Math.max(0,(U+S-L)*ag));if(Y===ab){ab+=1}switch(E){case"H":break;case"S":case"M":case"=":if(is_overlap([U,U+S],R)){var N=M.slice(W,W+S);if(D>0){K.fillStyle=y;K.fillRect(Y-D,V+1,ab-Y,9);K.fillStyle=g;for(var af=0,H=N.length;af<H;af++){if(this.prefs.show_differences){if(this.ref_seq){var P=this.ref_seq[U-L+af];if(!P||P.toLowerCase()===N[af].toLowerCase()){continue}}else{continue}}if(U+af>=L&&U+af<=aa){var X=Math.floor(Math.max(0,(U+af-L)*ag));K.fillText(N[af],X,V+9)}}}else{K.fillStyle=y;K.fillRect(Y,V+4,ab-Y,e)}}W+=S;Z+=S;break;case"N":K.fillStyle=g;K.fillRect(Y-D,V+5,ab-Y,1);Z+=S;break;case"D":K.fillStyle="red";K.fillRect(Y-D,V+4,ab-Y,3);Z+=S;break;case"P":break;case"I":var ah=Y-D;if(is_overlap([U,U+S],R)){var N=M.slice(W,W+S);if(this.prefs.show_insertions){var T=Y-(ab-Y)/2;if((A==="Pack"||this.mode==="Auto")&&M!==undefined&&ag>F){K.fillStyle="yellow";K.fillRect(T-D,V-9,ab-Y,9);O[O.length]={type:"triangle",data:[ah,V+4,5]};K.fillStyle=g;switch(compute_overlap([U,U+S],R)){case (OVERLAP_START):N=N.slice(L-U);break;case (OVERLAP_END):N=N.slice(0,U-aa);break;case (CONTAINED_BY):break;case (CONTAINS):N=N.slice(L-U,U-aa);break}for(var af=0,H=N.length;af<H;af++){var X=Math.floor(Math.max(0,(U+af-L)*ag));K.fillText(N[af],X-(ab-Y)/2,V)}}else{K.fillStyle="yellow";K.fillRect(T,V+(this.mode!=="Dense"?2:5),ab-Y,(A!=="Dense"?e:s))}}else{if((A==="Pack"||this.mode==="Auto")&&M!==undefined&&ag>F){O.push({type:"text",data:[N.length,ah,V+9]})}else{}}}W+=S;break;case"X":W+=S;break}}K.fillStyle="yellow";var Q,ai,ae;for(var ac=0;ac<O.length;ac++){Q=O[ac];ai=Q.type;ae=Q.data;if(ai==="text"){K.save();K.font="bold "+K.font;K.fillText(ae[0],ae[1],ae[2]);K.restore()}else{if(ai==="triangle"){q(K,ae[0],ae[1],ae[2])}}}},draw_element:function(R,M,E,B,U,z,I,S,P){var H=E[0],Q=E[1],A=E[2],J=E[3],D=Math.floor(Math.max(0,(Q-U)*I)),F=Math.ceil(Math.min(P,Math.max(0,(A-U)*I))),C=(M==="Dense"?0:(0+B))*S,G=this.prefs.label_color,O=0;if((M==="Pack"||this.mode==="Auto")&&I>R.canvas.manager.char_width_px){var O=Math.round(I/2)}if(E[5] instanceof Array){var N=Math.floor(Math.max(0,(E[4][0]-U)*I)),L=Math.ceil(Math.min(P,Math.max(0,(E[4][1]-U)*I))),K=Math.floor(Math.max(0,(E[5][0]-U)*I)),y=Math.ceil(Math.min(P,Math.max(0,(E[5][1]-U)*I)));if(E[4][1]>=U&&E[4][0]<=z&&E[4][2]){this.draw_read(R,M,I,C,U,z,E[4][0],E[4][2],E[4][3],E[4][4])}if(E[5][1]>=U&&E[5][0]<=z&&E[5][2]){this.draw_read(R,M,I,C,U,z,E[5][0],E[5][2],E[5][3],E[5][4])}if(K>L){R.fillStyle=g;p(R,L-O,C+5,K-O,C+5)}}else{this.draw_read(R,M,I,C,U,z,Q,E[4],E[5],E[6])}if(M==="Pack"&&Q>U&&J!=="."){R.fillStyle=this.prefs.label_color;var T=1;if(T===0&&D-R.measureText(J).width<0){R.textAlign="left";R.fillText(J,F+j-O,C+8)}else{R.textAlign="right";R.fillText(J,D-j-O,C+8)}}return[0,0]}});var n=function(A,D,y,z,C,E,B){r.call(this,A,D,y,z,C,E,B);this.longest_feature_length=this.calculate_longest_feature_length();this.draw_background_connector=false;this.draw_individual_connectors=true};u(n.prototype,o.prototype,r.prototype,{calculate_longest_feature_length:function(){var z=0;for(var C=0,y=this.data.length;C<y;C++){var B=this.data[C],A=B[1],D=B[2];z=Math.max(z,D-A)}return z},get_top_padding:function(z){var y=this.view_end-this.view_start,A=z/y;return Math.min(128,Math.ceil((this.longest_feature_length/2)*A))},draw_connector:function(G,B,F,H,E,D){var y=(F+H)/2,C=H-y;var A=Math.PI,z=0;if(C>0){G.beginPath();G.arc(y,D,H-y,Math.PI,0);G.stroke()}}});x.Scaler=d;x.SummaryTreePainter=v;x.LinePainter=b;x.LinkedFeaturePainter=r;x.ReadPainter=t;x.ArcLinkedFeaturePainter=n};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("class",class_module);a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window);
\ No newline at end of file
+var class_module=function(b,a){var c=function(){var g=arguments[0];for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var e in d){g[e]=d[e]}}return g};a.extend=c};var requestAnimationFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b,a){window.setTimeout(b,1000/60)}})();var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=BEFORE}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=AFTER}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a};var is_overlap=function(c,b){var a=compute_overlap(c,b);return(a!==BEFORE&&a!==AFTER)};var is_deferred=function(a){return("isResolved" in a)};var get_random_color=function(a){if(!a){a="#ffffff"}if(typeof(a)==="string"){a=[a]}for(var j=0;j<a.length;j++){a[j]=parseInt(a[j].slice(1),16)}var n=function(t,s,i){return((t*299)+(s*587)+(i*114))/1000};var e=function(v,u,w,s,i,t){return(Math.max(v,s)-Math.min(v,s))+(Math.max(u,i)-Math.min(u,i))+(Math.max(w,t)-Math.min(w,t))};var g,o,f,k,q,h,r,c,d,b,p,m=false,l=0;do{g=Math.round(Math.random()*16777215);o=(g&16711680)>>16;f=(g&65280)>>8;k=g&255;d=n(o,f,k);m=true;for(j=0;j<a.length;j++){q=a[j];h=(q&16711680)>>16;r=(q&65280)>>8;c=q&255;b=n(h,r,c);p=e(o,f,k,h,r,c);if((Math.abs(d-b)<40)||(p<200)){m=false;break}}l++}while(!m&&l<=10);return"#"+(16777216+g).toString(16).substr(1,6)};var create_action_icon=function(c,b,a){return $("<a/>").attr("href","javascript:void(0);").attr("title",c).addClass("icon-button").addClass(b).tipsy({gravity:"s"}).click(a)};var trackster_module=function(d,R){var o=d("class").extend,r=d("slotting"),H=d("painters");var m={};var k=function(Y,Z){m[Y.attr("id")]=Z};var l=function(Y,aa,ac,ab){ac=".group";var Z={};m[Y.attr("id")]=ab;Y.bind("drag",{handle:"."+aa,relative:true},function(ak,al){var aj=$(this),ao=$(this).parent(),ag=ao.children(),ai=m[$(this).attr("id")],af,ae,am,ad,ah;ae=$(this).parents(ac);if(ae.length!==0){am=ae.position().top;ad=am+ae.outerHeight();if(al.offsetY<am){$(this).insertBefore(ae);var an=m[ae.attr("id")];an.remove_drawable(ai);an.container.add_drawable_before(ai,an);return}else{if(al.offsetY>ad){$(this).insertAfter(ae);var an=m[ae.attr("id")];an.remove_drawable(ai);an.container.add_drawable(ai);return}}}ae=null;for(ah=0;ah<ag.length;ah++){af=$(ag.get(ah));am=af.position().top;ad=am+af.outerHeight();if(af.is(ac)&&this!==af.get(0)&&al.offsetY>=am&&al.offsetY<=ad){if(al.offsetY-am<ad-al.offsetY){af.find(".content-div").prepend(this)}else{af.find(".content-div").append(this)}if(ai.container){ai.container.remove_drawable(ai)}m[af.attr("id")].add_drawable(ai);return}}for(ah=0;ah<ag.length;ah++){af=$(ag.get(ah));if(al.offsetY<af.position().top&&!(af.hasClass("reference-track")||af.hasClass("intro"))){break}}if(ah===ag.length){if(this!==ag.get(ah-1)){ao.append(this);m[ao.attr("id")].move_drawable(ai,ah)}}else{if(this!==ag.get(ah)){$(this).insertBefore(ag.get(ah));m[ao.attr("id")].move_drawable(ai,(al.deltaY>0?ah-1:ah))}}}).bind("dragstart",function(){Z["border-top"]=Y.css("border-top");Z["border-bottom"]=Y.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(Z)})};R.moveable=l;var X=16,C=9,z=20,w=100,E=12000,O=400,G=5000,t=100,n="There was an error in indexing this dataset. ",F="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",A="No data for this chrom/contig.",s="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",u="Tool cannot be rerun: ",a="Loading data...",S="Ready for display",M=10,D=20;function T(Z,Y){if(!Y){Y=0}var aa=Math.pow(10,Y);return Math.round(Z*aa)/aa}var p=function(Z,Y,ab){if(!p.id_counter){p.id_counter=0}this.id=p.id_counter++;this.name=ab.name;this.view=Z;this.container=Y;this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ab.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ab.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(ac){ac.stopPropagation()});var aa=this;this.container_div.hover(function(){aa.icons_div.show()},function(){aa.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(Y){if(Y.content_visible){Y.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");Y.hide_contents();Y.content_visible=false}else{Y.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");Y.content_visible=true;Y.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(Z){var ab=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},Y=function(){Z.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},aa=function(ac){if((ac.keyCode||ac.which)===27){ab()}else{if((ac.keyCode||ac.which)===13){Y()}}};$(window).bind("keypress.check_enter_esc",aa);show_modal("Configure",Z.config.build_form(),{Cancel:ab,OK:Y})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(Y){$(".tipsy").remove();Y.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(){},to_dict:function(){},set_name:function(Y){this.old_name=this.name;this.name=Y;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 Y=this.view;this.container_div.hide(0,function(){$(this).remove();Y.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(Z,ae,ad,ac,Y,ab){var aa=this;this.action_icons[Z]=$("<a/>").attr("href","javascript:void(0);").attr("title",ae).addClass("icon-button").addClass(ad).tipsy({gravity:"s"}).click(function(){ac(aa)}).appendTo(this.icons_div);if(ab){this.action_icons[Z].hide()}},build_action_icons:function(Y){var aa;for(var Z=0;Z<Y.length;Z++){aa=Y[Z];this.add_action_icon(aa.name,aa.title,aa.css_class,aa.on_click_fn,aa.prepend,aa.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){}});var v=function(Z,Y,aa){p.call(this,Z,Y,aa);this.obj_type=aa.obj_type;this.drawables=[]};o(v.prototype,p.prototype,{unpack_drawables:function(aa){this.drawables=[];var Z;for(var Y=0;Y<aa.length;Y++){Z=object_from_template(aa[Y],this);this.add_drawable(Z)}},init:function(){for(var Y=0;Y<this.drawables.length;Y++){this.drawables[Y].init()}},_draw:function(){for(var Y=0;Y<this.drawables.length;Y++){this.drawables[Y]._draw()}},to_dict:function(){var Z=[];for(var Y=0;Y<this.drawables.length;Y++){Z.push(this.drawables[Y].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:Z}},add_drawable:function(Y){this.drawables.push(Y);Y.container=this;this.changed()},add_drawable_before:function(aa,Y){this.changed();var Z=this.drawables.indexOf(Y);if(Z!==-1){this.drawables.splice(Z,0,aa);return true}return false},replace_drawable:function(aa,Y,Z){var ab=this.drawables.indexOf(aa);if(ab!==-1){this.drawables[ab]=Y;if(Z){aa.container_div.replaceWith(Y.container_div)}this.changed()}return ab},remove_drawable:function(Z){var Y=this.drawables.indexOf(Z);if(Y!==-1){this.drawables.splice(Y,1);Z.container=null;this.changed();return true}return false},move_drawable:function(Z,aa){var Y=this.drawables.indexOf(Z);if(Y!==-1){this.drawables.splice(Y,1);this.drawables.splice(aa,0,Z);this.changed();return true}return false}});var L=function(Z,Y,ab){o(ab,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});v.call(this,Z,Y,ab);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);l(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new U(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ab){this.unpack_drawables(ab.drawables)}if("filters" in ab){var aa=this.filters_manager;this.filters_manager=new U(this,ab.filters);aa.parent_div.replaceWith(this.filters_manager.parent_div);if(ab.filters.visible){this.setup_multitrack_filtering()}}};o(L.prototype,p.prototype,v.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(Y){$(".tipsy").remove();Y.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(Y){if(Y.filters_manager.visible()){Y.filters_manager.clear_filters();Y._restore_filter_managers()}else{Y.setup_multitrack_filtering();Y.request_draw(true)}Y.filters_manager.toggle()}},p.prototype.action_icons_def[2]],build_container_div:function(){var Y=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(Y)}return Y},build_header_div:function(){var Y=$("<div/>").addClass("track-header");Y.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(Y);return Y},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var aa=this.drawables.length;if(aa===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(aa===1){if(this.drawables[0] instanceof g){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var ah,ag,ae,ak=true,ac=this.drawables[0].get_type(),Y=0;for(ah=0;ah<aa;ah++){ae=this.drawables[ah];if(ae.get_type()!==ac){can_composite=false;break}if(ae instanceof c){Y++}}if(ak||Y===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".tipsy").remove()}if(Y>1&&Y===this.drawables.length){var al={},Z;ae=this.drawables[0];for(ag=0;ag<ae.filters_manager.filters.length;ag++){Z=ae.filters_manager.filters[ag];al[Z.name]=[Z]}for(ah=1;ah<this.drawables.length;ah++){ae=this.drawables[ah];for(ag=0;ag<ae.filters_manager.filters.length;ag++){Z=ae.filters_manager.filters[ag];if(Z.name in al){al[Z.name].push(Z)}}}this.filters_manager.remove_all();var ab,ad,af,ai;for(var aj in al){ab=al[aj];if(ab.length===Y){ad=new P({name:ab[0].name,index:ab[0].index});this.filters_manager.add_filter(ad)}}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 Y=0;Y<this.drawables.length;Y++){this.drawables[Y].filters_manager=this.saved_filters_managers[Y]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var Y=0;Y<this.drawables.length;Y++){drawable=this.drawables[Y];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ac=[];for(var Z=0;Z<this.drawables.length;Z++){ac.push(this.drawables[Z].name)}var aa="Composite Track of "+this.drawables.length+" tracks ("+ac.join(", ")+")";var ab=new g(this.view,this.view,{name:aa,drawables:this.drawables});var Y=this.container.replace_drawable(this,ab,true);ab.request_draw()},add_drawable:function(Y){v.prototype.add_drawable.call(this,Y);this.update_icons()},remove_drawable:function(Y){v.prototype.remove_drawable.call(this,Y);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var Y=o(v.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return Y},request_draw:function(Y,aa){for(var Z=0;Z<this.drawables.length;Z++){this.drawables[Z].request_draw(Y,aa)}}});var W=function(Y){o(Y,{obj_type:"View"});v.call(this,"View",Y.container,Y);this.chrom=null;this.vis_id=Y.vis_id;this.dbkey=Y.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.init();this.canvas_manager=new CanvasManager(this.container.get(0).ownerDocument);this.reset()};_.extend(W.prototype,Backbone.Events);o(W.prototype,v.prototype,{init:function(){this.requested_redraw=false;var aa=this.container,Y=this;this.top_container=$("<div/>").addClass("top-container").appendTo(aa);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(aa);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(aa);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,Y);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ab=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){add_datasets(add_datasets_url,add_track_async_url,function(ac){_.each(ac,function(ad){Y.add_drawable(object_from_template(ad,Y,Y))})})});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").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var Z=function(ac){if(ac.type==="focusout"||(ac.keyCode||ac.which)===13||(ac.keyCode||ac.which)===27){if((ac.keyCode||ac.which)!==27){Y.go_to($(this).val())}$(this).hide();$(this).val("");Y.location_span.show();Y.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",Z).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tipsy({gravity:"n"}).appendTo(this.nav_controls);this.location_span.click(function(){Y.location_span.hide();Y.chrom_select.hide();Y.nav_input.val(Y.chrom+":"+Y.low+"-"+Y.high);Y.nav_input.css("display","inline-block");Y.nav_input.select();Y.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tipsy({gravity:"n"}).click(function(){Y.zoom_out();Y.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tipsy({gravity:"n"}).click(function(){Y.zoom_in();Y.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){Y.change_chrom(Y.chrom_select.val())});this.browser_content_div.click(function(ac){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ac){Y.zoom_in(ac.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ac,ad){this.current_x=ad.offsetX}).bind("drag",function(ac,ae){var af=ae.offsetX-this.current_x;this.current_x=ae.offsetX;var ad=Math.round(af/Y.viewport_container.width()*(Y.max_high-Y.max_low));Y.move_delta(-ad)});this.overview_close.click(function(){Y.reset_overview()});this.viewport_container.bind("draginit",function(ac,ad){if(ac.clientX>Y.viewport_container.width()-16){return false}}).bind("dragstart",function(ac,ad){ad.original_low=Y.low;ad.current_height=ac.clientY;ad.current_x=ad.offsetX}).bind("drag",function(ae,ag){var ac=$(this);var ah=ag.offsetX-ag.current_x;var ad=ac.scrollTop()-(ae.clientY-ag.current_height);ac.scrollTop(ad);ag.current_height=ae.clientY;ag.current_x=ag.offsetX;var af=Math.round(ah/Y.viewport_container.width()*(Y.high-Y.low));Y.move_delta(af)}).bind("mousewheel",function(ae,ag,ad,ac){if(ad){ad*=50;var af=Math.round(-ad/Y.viewport_container.width()*(Y.high-Y.low));Y.move_delta(af)}});this.top_labeltrack.bind("dragstart",function(ac,ad){return $("<div />").css({height:Y.browser_content_div.height()+Y.top_labeltrack.height()+Y.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ag,ah){$(ah.proxy).css({left:Math.min(ag.pageX,ah.startX)-Y.container.offset().left,width:Math.abs(ag.pageX-ah.startX)});var ad=Math.min(ag.pageX,ah.startX)-Y.container.offset().left,ac=Math.max(ag.pageX,ah.startX)-Y.container.offset().left,af=(Y.high-Y.low),ae=Y.viewport_container.width();Y.update_location(Math.round(ad/ae*af)+Y.low,Math.round(ac/ae*af)+Y.low)}).bind("dragend",function(ah,ai){var ad=Math.min(ah.pageX,ai.startX),ac=Math.max(ah.pageX,ai.startX),af=(Y.high-Y.low),ae=Y.viewport_container.width(),ag=Y.low;Y.low=Math.round(ad/ae*af)+ag;Y.high=Math.round(ac/ae*af)+ag;$(ai.proxy).remove();Y.request_redraw()});this.add_label_track(new V(this,{content_div:this.top_labeltrack}));this.add_label_track(new V(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){Y.resize_window()},500)});$(document).bind("redraw",function(){Y.redraw()});this.reset();$(window).trigger("resize")},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(Z,ab,Y,ac){if(this.timer){clearTimeout(this.timer)}if(ac){var aa=this;this.timer=setTimeout(function(){aa.trigger("navigate",Z+":"+ab+"-"+Y)},500)}else{view.trigger("navigate",Z+":"+ab+"-"+Y)}},update_location:function(Y,aa){this.location_span.text(commatize(Y)+" - "+commatize(aa));this.nav_input.val(this.chrom+":"+commatize(Y)+"-"+commatize(aa));var Z=view.chrom_select.val();if(Z!==""){this.trigger_navigate(Z,view.low,view.high,true)}},load_chroms:function(aa){aa.num=t;aa.dbkey=this.dbkey;var Y=this,Z=$.Deferred();$.ajax({url:chrom_url,data:aa,dataType:"json",success:function(ac){if(ac.chrom_info.length===0){alert("Invalid chromosome: "+aa.chrom);return}if(ac.reference){Y.add_label_track(new x(Y))}Y.chrom_data=ac.chrom_info;var af='<option value="">Select Chrom/Contig</option>';for(var ae=0,ab=Y.chrom_data.length;ae<ab;ae++){var ad=Y.chrom_data[ae].chrom;af+='<option value="'+ad+'">'+ad+"</option>"}if(ac.prev_chroms){af+='<option value="previous">Previous '+t+"</option>"}if(ac.next_chroms){af+='<option value="next">Next '+t+"</option>"}Y.chrom_select.html(af);Y.chrom_start_index=ac.start_index;Z.resolve(ac)},error:function(){alert("Could not load chroms for this dbkey:",Y.dbkey)}});return Z},change_chrom:function(ad,Z,af){var aa=this;if(!aa.chrom_data){aa.load_chroms_deferred.then(function(){aa.change_chrom(ad,Z,af)});return}if(!ad||ad==="None"){return}if(ad==="previous"){aa.load_chroms({low:this.chrom_start_index-t});return}if(ad==="next"){aa.load_chroms({low:this.chrom_start_index+t});return}var ae=$.grep(aa.chrom_data,function(ag,ah){return ag.chrom===ad})[0];if(ae===undefined){aa.load_chroms({chrom:ad},function(){aa.change_chrom(ad,Z,af)});return}else{if(ad!==aa.chrom){aa.chrom=ad;aa.chrom_select.val(aa.chrom);aa.max_high=ae.len-1;aa.reset();aa.request_redraw(true);for(var ac=0,Y=aa.drawables.length;ac<Y;ac++){var ab=aa.drawables[ac];if(ab.init){ab.init()}}if(aa.reference_track){aa.reference_track.init()}}if(Z!==undefined&&af!==undefined){aa.low=Math.max(Z,0);aa.high=Math.min(af,aa.max_high)}else{aa.low=0;aa.high=aa.max_high}aa.reset_overview();aa.request_redraw()}},go_to:function(ac){ac=ac.replace(/ |,/g,"");var ag=this,Y,ab,Z=ac.split(":"),ae=Z[0],af=Z[1];if(af!==undefined){try{var ad=af.split("-");Y=parseInt(ad[0],10);ab=parseInt(ad[1],10)}catch(aa){return false}}ag.change_chrom(ae,Y,ab)},move_fraction:function(aa){var Y=this;var Z=Y.high-Y.low;this.move_delta(aa*Z)},move_delta:function(ab){var Y=this;var aa=Y.high-Y.low;if(Y.low-ab<Y.max_low){Y.low=Y.max_low;Y.high=Y.max_low+aa}else{if(Y.high-ab>Y.max_high){Y.high=Y.max_high;Y.low=Y.max_high-aa}else{Y.high-=ab;Y.low-=ab}}Y.request_redraw();var Z=Y.chrom_select.val();this.trigger_navigate(Z,Y.low,Y.high,true)},add_drawable:function(Y){v.prototype.add_drawable.call(this,Y);Y.init();this.changed();this.update_intro_div()},add_label_track:function(Y){Y.view=this;Y.init();this.label_tracks.push(Y)},remove_drawable:function(aa,Z){v.prototype.remove_drawable.call(this,aa);if(Z){var Y=this;aa.container_div.hide(0,function(){$(this).remove();Y.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(ag,Y,af,ah){var ae=this,ad=(ah?[ah]:ae.drawables),aa;var Z;for(var ac=0;ac<ad.length;ac++){Z=ad[ac];aa=-1;for(var ab=0;ab<ae.tracks_to_be_redrawn.length;ab++){if(ae.tracks_to_be_redrawn[ab][0]===Z){aa=ab;break}}if(aa<0){ae.tracks_to_be_redrawn.push([Z,Y,af])}else{ae.tracks_to_be_redrawn[ac][1]=Y;ae.tracks_to_be_redrawn[ac][2]=af}}if(!this.requested_redraw){requestAnimationFrame(function(){ae._redraw(ag)});this.requested_redraw=true}},_redraw:function(ai){this.requested_redraw=false;var af=this.low,ab=this.high;if(af<this.max_low){af=this.max_low}if(ab>this.max_high){ab=this.max_high}var ah=this.high-this.low;if(this.high!==0&&ah<this.min_separation){ab=af+this.min_separation}this.low=Math.floor(af);this.high=Math.ceil(ab);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var Y=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var aj=13;this.overview_box.css({left:Y,width:Math.max(aj,ae)}).show();if(ae<aj){this.overview_box.css("left",Y-(aj-ae)/2)}if(this.overview_highlight){this.overview_highlight.css({left:Y,width:ae})}if(!ai){var aa,Z,ag;for(var ac=0,ad=this.tracks_to_be_redrawn.length;ac<ad;ac++){aa=this.tracks_to_be_redrawn[ac][0];Z=this.tracks_to_be_redrawn[ac][1];ag=this.tracks_to_be_redrawn[ac][2];if(aa){aa._draw(Z,ag)}}this.tracks_to_be_redrawn=[];for(ac=0,ad=this.label_tracks.length;ac<ad;ac++){this.label_tracks[ac]._draw()}}},zoom_in:function(Z,aa){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ab=this.high-this.low,ac=ab/2+this.low,Y=(ab/this.zoom_factor)/2;if(Z){ac=Z/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ac-Y);this.high=Math.round(ac+Y);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var Z=this.high-this.low,aa=Z/2+this.low,Y=(Z*this.zoom_factor)/2;this.low=Math.round(aa-Y);this.high=Math.round(aa+Y);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(aa){if(this.overview_drawable){if(this.overview_drawable.dataset_id===aa.dataset_id){return}this.overview_viewport.find(".track").remove()}var Z=aa.copy({content_div:this.overview_viewport}),Y=this;Z.header_div.hide();Z.is_overview=true;Y.overview_drawable=Z;this.overview_drawable.postdraw_actions=function(){Y.overview_highlight.show().height(Y.overview_drawable.content_div.height());Y.overview_viewport.height(Y.overview_drawable.content_div.height()+Y.overview_box.outerHeight());Y.overview_close.show();Y.resize_window()};Y.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".tipsy").remove();this.overview_viewport.find(".track-tile").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide();view.resize_window();view.overview_drawable=null}});var q=function(aa,af,ab){this.track=aa;this.name=af.name;this.params=[];var am=af.params;for(var ac=0;ac<am.length;ac++){var ah=am[ac],Z=ah.name,al=ah.label,ad=unescape(ah.html),an=ah.value,aj=ah.type;if(aj==="number"){this.params.push(new e(Z,al,ad,(Z in ab?ab[Z]:an),ah.min,ah.max))}else{if(aj==="select"){this.params.push(new J(Z,al,ad,(Z in ab?ab[Z]:an)))}else{console.log("WARNING: unrecognized tool parameter type:",Z,aj)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ap){ap.stopPropagation()}).click(function(ap){ap.stopPropagation()}).bind("dblclick",function(ap){ap.stopPropagation()});var ak=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ai=this.params;var ag=this;$.each(this.params,function(aq,au){var at=$("<div>").addClass("param-row").appendTo(ag.parent_div);var ap=$("<div>").addClass("param-label").text(au.label).appendTo(at);var ar=$("<div/>").addClass("param-input").html(au.html).appendTo(at);ar.find(":input").val(au.value);$("<div style='clear: both;'/>").appendTo(at)});this.parent_div.find("input").click(function(){$(this).select()});var ao=$("<div>").addClass("param-row").appendTo(this.parent_div);var ae=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ao);var Y=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ao);Y.click(function(){ag.run_on_region()});ae.click(function(){ag.run_on_dataset()});if("visible" in ab&&ab.visible){this.parent_div.show()}};o(q.prototype,{update_params:function(){for(var Y=0;Y<this.params.length;Y++){this.params[Y].update_value()}},state_dict:function(){var Z={};for(var Y=0;Y<this.params.length;Y++){Z[this.params[Y].name]=this.params[Y].value}Z.visible=this.parent_div.is(":visible");return Z},get_param_values_dict:function(){var Y={};this.parent_div.find(":input").each(function(){var Z=$(this).attr("name"),aa=$(this).val();Y[Z]=aa});return Y},get_param_values:function(){var Y=[];this.parent_div.find(":input").each(function(){var Z=$(this).attr("name"),aa=$(this).val();if(Z){Y[Y.length]=aa}});return Y},run_on_dataset:function(){var Y=this;Y.run({target_dataset_id:this.track.original_dataset_id,tool_id:Y.name},null,function(Z){show_modal(Y.name+" is Running",Y.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var Z={target_dataset_id:this.track.original_dataset_id,action:"rerun",tool_id:this.name,regions:[{chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}]},ad=this.track,aa=Z.tool_id+ad.tool_region_and_parameters_str(Z.chrom,Z.low,Z.high),Y;if(ad.container===view){var ac=new L(view,view,{name:this.name});var ab=ad.container.replace_drawable(ad,ac,false);ac.container_div.insertBefore(ad.view.content_div.children()[ab]);ac.add_drawable(ad);ad.container_div.appendTo(ac.content_div);Y=ac}else{Y=ad.container}var ae=new ad.constructor(view,Y,{name:aa,hda_ldda:"hda"});ae.init_for_tool_data();ae.change_mode(ad.mode);ae.set_filters_manager(ad.filters_manager.copy(ae));ae.update_icons();Y.add_drawable(ae);ae.tiles_div.text("Starting job.");this.update_params();this.run(Z,ae,function(af){ae.set_dataset(new Dataset(af));ae.tiles_div.text("Running job.");ae.init()})},run:function(Y,aa,ab){Y.inputs=this.get_param_values_dict();var Z=new ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(Y),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ac){return ac!=="pending"}});$.when(Z.go()).then(function(ac){if(ac==="no converter"){aa.container_div.addClass("error");aa.content_div.text(F)}else{if(ac.error){aa.container_div.addClass("error");aa.content_div.text(u+ac.message)}else{ab(ac)}}})}});var J=function(Z,Y,aa,ab){this.name=Z;this.label=Y;this.html=$(aa);this.value=ab};o(J.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(aa,Z,ac,ad,ab,Y){J.call(this,aa,Z,ac,ad);this.min=ab;this.max=Y};o(e.prototype,J.prototype,{update_value:function(){J.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var f=function(Y){this.manager=null;this.name=Y.name;this.index=Y.index;this.tool_id=Y.tool_id;this.tool_exp_name=Y.tool_exp_name};o(f.prototype,{to_dict:function(){return{name:this.name,index:this.index,tool_id:this.tool_id,tool_exp_name:this.tool_exp_name}}});var P=function(ah){f.call(this,ah);this.low=("low" in ah?ah.low:-Number.MAX_VALUE);this.high=("high" in ah?ah.high:Number.MAX_VALUE);this.min=("min" in ah?ah.min:Number.MAX_VALUE);this.max=("max" in ah?ah.max:-Number.MAX_VALUE);this.container=null;this.slider=null;this.slider_label=null;var ad=function(ai,aj,ak){ai.click(function(){var ap=aj.text(),an=parseFloat(ak.slider("option","max")),am=(an<=1?4:an<=1000000?an.toString().length:6),ao=false,al=$(this).parents(".slider-row");al.addClass("input");if(ak.slider("option","values")){am=2*am+1;ao=true}aj.text("");$("<input type='text'/>").attr("size",am).attr("maxlength",am).attr("value",ap).appendTo(aj).focus().select().click(function(aq){aq.stopPropagation()}).blur(function(){$(this).remove();aj.text(ap);al.removeClass("input")}).keyup(function(av){if(av.keyCode===27){$(this).trigger("blur")}else{if(av.keyCode===13){var at=ak.slider("option","min"),aq=ak.slider("option","max"),au=function(aw){return(isNaN(aw)||aw>aq||aw<at)},ar=$(this).val();if(!ao){ar=parseFloat(ar);if(au(ar)){alert("Parameter value must be in the range ["+at+"-"+aq+"]");return $(this)}}else{ar=ar.split("-");ar=[parseFloat(ar[0]),parseFloat(ar[1])];if(au(ar[0])||au(ar[1])){alert("Parameter value must be in the range ["+at+"-"+aq+"]");return $(this)}}ak.slider((ao?"values":"value"),ar);al.removeClass("input")}}})})};var Z=this;Z.parent_div=$("<div/>").addClass("filter-row slider-row");var Y=$("<div/>").addClass("elt-label").appendTo(Z.parent_div),af=$("<span/>").addClass("slider-name").text(Z.name+" ").appendTo(Y),aa=$("<span/>").text(this.low+"-"+this.high),ab=$("<span/>").addClass("slider-value").appendTo(Y).append("[").append(aa).append("]");Z.values_span=aa;var ae=$("<div/>").addClass("slider").appendTo(Z.parent_div);Z.control_element=$("<div/>").attr("id",Z.name+"-filter-control").appendTo(ae);var ac=[0,0];Z.control_element.slider({range:true,min:this.min,max:this.max,step:this.get_slider_step(this.min,this.max),values:[this.low,this.high],slide:function(ai,aj){Z.slide(ai,aj)},change:function(ai,aj){Z.control_element.slider("option","slide").call(Z.control_element,ai,aj)}});Z.slider=Z.control_element;Z.slider_label=aa;ad(ab,aa,Z.control_element);var ag=$("<div/>").addClass("display-controls").appendTo(Z.parent_div);this.transparency_icon=create_action_icon("Use filter for data transparency","layer-transparent",function(){if(Z.manager.alpha_filter!==Z){Z.manager.alpha_filter=Z;Z.manager.parent_div.find(".layer-transparent").removeClass("active").hide();Z.transparency_icon.addClass("active").show()}else{Z.manager.alpha_filter=null;Z.transparency_icon.removeClass("active")}Z.manager.track.request_draw(true,true)}).appendTo(ag).hide();this.height_icon=create_action_icon("Use filter for data height","arrow-resize-090",function(){if(Z.manager.height_filter!==Z){Z.manager.height_filter=Z;Z.manager.parent_div.find(".arrow-resize-090").removeClass("active").hide();Z.height_icon.addClass("active").show()}else{Z.manager.height_filter=null;Z.height_icon.removeClass("active")}Z.manager.track.request_draw(true,true)}).appendTo(ag).hide();Z.parent_div.hover(function(){Z.transparency_icon.show();Z.height_icon.show()},function(){if(Z.manager.alpha_filter!==Z){Z.transparency_icon.hide()}if(Z.manager.height_filter!==Z){Z.height_icon.hide()}});$("<div style='clear: both;'/>").appendTo(Z.parent_div)};o(P.prototype,{to_dict:function(){var Y=f.prototype.to_dict.call(this);return o(Y,{type:"number",min:this.min,max:this.max,low:this.low,high:this.high})},copy:function(){return new P({name:this.name,index:this.index,tool_id:this.tool_id,tool_exp_name:this.tool_exp_name})},get_slider_step:function(aa,Y){var Z=Y-aa;return(Z<=2?0.01:1)},slide:function(Z,aa){var Y=aa.values;this.values_span.text(Y[0]+"-"+Y[1]);this.low=Y[0];this.high=Y[1];this.manager.track.request_draw(true,true)},applies_to:function(Y){if(Y.length>this.index){return true}return false},_keep_val:function(Y){return(isNaN(Y)||(Y>=this.low&&Y<=this.high))},keep:function(Z){if(!this.applies_to(Z)){return true}var ab=this;var ac=Z[this.index];if(ac instanceof Array){var aa=true;for(var Y=0;Y<ac.length;Y++){if(!this._keep_val(ac[Y])){aa=false;break}}return aa}else{return this._keep_val(Z[this.index])}},update_attrs:function(ab){var Y=false;if(!this.applies_to(ab)){return Y}var Z=ab[this.index];if(!(Z instanceof Array)){Z=[Z]}for(var aa=0;aa<Z.length;aa++){var ac=Z[aa];if(ac<this.min){this.min=Math.floor(ac);Y=true}if(ac>this.max){this.max=Math.ceil(ac);Y=true}}return Y},update_ui_elt:function(){if(this.min<this.max){this.parent_div.show()}else{this.parent_div.hide()}var Z=this.slider.slider("option","min"),Y=this.slider.slider("option","max");if(this.min<Z||this.max>Y){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",this.get_slider_step(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var U=function(aa,ag){this.track=aa;this.alpha_filter=null;this.height_filter=null;this.filters=[];this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(ai){ai.stopPropagation()}).click(function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()}).bind("keydown",function(ai){ai.stopPropagation()});if(ag&&"filters" in ag){var Y=("alpha_filter" in ag?ag.alpha_filter:null),ab=("height_filter" in ag?ag.height_filter:null),ad=ag.filters,Z;for(var ae=0;ae<ad.length;ae++){if(ad[ae].type==="number"){Z=new P(ad[ae]);this.add_filter(Z);if(Z.name===Y){this.alpha_filter=Z;Z.transparency_icon.addClass("active").show()}if(Z.name===ab){this.height_filter=Z;Z.height_icon.addClass("active").show()}}else{console.log("ERROR: unsupported filter: ",name,type)}}if("visible" in ag&&ag.visible){this.parent_div.show()}}if(this.filters.length!==0){var ah=$("<div/>").addClass("param-row").appendTo(this.parent_div);var af=$("<input type='submit'/>").attr("value","Run on complete dataset").appendTo(ah);var ac=this;af.click(function(){ac.run_on_dataset()})}};o(U.prototype,{show:function(){this.parent_div.show()},hide:function(){this.parent_div.hide()},toggle:function(){this.parent_div.toggle()},visible:function(){return this.parent_div.is(":visible")},to_dict:function(){var ab={},aa=[],Z;for(var Y=0;Y<this.filters.length;Y++){Z=this.filters[Y];aa.push(Z.to_dict())}ab.filters=aa;ab.alpha_filter=(this.alpha_filter?this.alpha_filter.name:null);ab.height_filter=(this.height_filter?this.height_filter.name:null);ab.visible=this.parent_div.is(":visible");return ab},copy:function(Z){var aa=new U(Z);for(var Y=0;Y<this.filters.length;Y++){aa.add_filter(this.filters[Y].copy())}return aa},add_filter:function(Y){Y.manager=this;this.parent_div.append(Y.parent_div);this.filters.push(Y)},remove_all:function(){this.filters=[];this.parent_div.children().remove()},init_filters:function(){for(var Y=0;Y<this.filters.length;Y++){var Z=this.filters[Y];Z.update_ui_elt()}},clear_filters:function(){for(var Y=0;Y<this.filters.length;Y++){var Z=this.filters[Y];Z.slider.slider("option","values",[Z.min,Z.max])}this.alpha_filter=null;this.height_filter=null;this.parent_div.find(".icon-button").hide()},run_on_dataset:function(){var ae=function(ai,ag,ah){if(!(ag in ai)){ai[ag]=ah}return ai[ag]};var ad={},af,Y;for(var ac=0;ac<this.filters.length;ac++){af=this.filters[ac];if(af.tool_id){if(af.min!==af.low){Y=ae(ad,af.tool_id,[]);Y[Y.length]=af.tool_exp_name+" >= "+af.low}if(af.max!==af.high){Y=ae(ad,af.tool_id,[]);Y[Y.length]=af.tool_exp_name+" <= "+af.high}}}var Z=[];for(var ab in ad){Z[Z.length]=[ab,ad[ab]]}(function aa(am,aj){var ah=aj[0],ai=ah[0],al=ah[1],ak="("+al.join(") and (")+")",ag={cond:ak,input:am,target_dataset_id:am,tool_id:ai},aj=aj.slice(1);$.getJSON(run_tool_url,ag,function(an){if(an.error){show_modal("Filter Dataset","Error running tool "+ai,{Close:hide_modal})}else{if(aj.length===0){show_modal("Filtering Dataset","Filter(s) are running on the complete dataset. Outputs are in dataset's history.",{Close:hide_modal})}else{aa(an.dataset_id,aj)}}})})(this.track.dataset_id,Z)}});var y=function(Y,Z){H.Scaler.call(this,Z);this.filter=Y};y.prototype.gen_val=function(Y){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(Y[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var B=function(Y){this.track=Y.track;this.params=Y.params;this.values={};this.restore_values((Y.saved_values?Y.saved_values:{}));this.onchange=Y.onchange};o(B.prototype,{restore_values:function(Y){var Z=this;$.each(this.params,function(aa,ab){if(Y[ab.key]!==undefined){Z.values[ab.key]=Y[ab.key]}else{Z.values[ab.key]=ab.default_value}})},build_form:function(){var ab=this;var Y=$("<div />");var aa;function Z(af,ac){for(var aj=0;aj<af.length;aj++){aa=af[aj];if(aa.hidden){continue}var ad="param_"+aj;var an=ab.values[aa.key];var aq=$("<div class='form-row' />").appendTo(ac);aq.append($("<label />").attr("for",ad).text(aa.label+":"));if(aa.type==="bool"){aq.append($('<input type="checkbox" />').attr("id",ad).attr("name",ad).attr("checked",an))}else{if(aa.type==="text"){aq.append($('<input type="text"/>').attr("id",ad).val(an).click(function(){$(this).select()}))}else{if(aa.type==="select"){var al=$("<select />").attr("id",ad);for(var ah=0;ah<aa.options.length;ah++){$("<option/>").text(aa.options[ah].label).attr("value",aa.options[ah].value).appendTo(al)}al.val(an);aq.append(al)}else{if(aa.type==="color"){var ap=$("<div/>").appendTo(aq),ak=$("<input />").attr("id",ad).attr("name",ad).val(an).css("float","left").appendTo(ap).click(function(at){$(".tipsy").hide();var ar=$(this).siblings(".tipsy");ar.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(ar).height()/2)+($(this).height()/2)}).show();ar.click(function(au){au.stopPropagation()});$(document).bind("click.color-picker",function(){ar.hide();$(document).unbind("click.color-picker")});at.stopPropagation()}),ai=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(ap).attr("title","Set new random color").tipsy({gravity:"s"}),am=$("<div class='tipsy tipsy-west' style='position: absolute;' />").appendTo(ap).hide(),ae=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(am),ao=$("<div/>").appendTo(ae),ag=$.farbtastic(ao,{width:100,height:100,callback:ak,color:an});ap.append($("<div/>").css("clear","both"));(function(ar){ai.click(function(){ar.setColor(get_random_color())})})(ag)}else{aq.append($("<input />").attr("id",ad).attr("name",ad).val(an))}}}}if(aa.help){aq.append($("<div class='help'/>").text(aa.help))}}}Z(this.params,Y);return Y},update_from_form:function(Y){var aa=this;var Z=false;$.each(this.params,function(ab,ad){if(!ad.hidden){var ae="param_"+ab;var ac=Y.find("#"+ae).val();if(ad.type==="float"){ac=parseFloat(ac)}else{if(ad.type==="int"){ac=parseInt(ac)}else{if(ad.type==="bool"){ac=Y.find("#"+ae).is(":checked")}}}if(ac!==aa.values[ad.key]){aa.values[ad.key]=ac;Z=true}}});if(Z){this.onchange();this.track.changed()}}});var b=function(Y,ac,aa,Z,ab){this.track=Y;this.region=ac;this.low=ac.get("start");this.high=ac.get("end");this.resolution=aa;this.html_elt=$("<div class='track-tile'/>").append(Z).height($(Z).attr("height"));this.data=ab;this.stale=false};b.prototype.predisplay_actions=function(){};var j=function(Y,ad,aa,Z,ab,ac){b.call(this,Y,ad,aa,Z,ab);this.max_val=ac};o(j.prototype,b.prototype);var K=function(ab,aj,ac,aa,ae,al,af,am,Z,ai){b.call(this,ab,aj,ac,aa,ae);this.mode=af;this.all_slotted=Z;this.feature_mapper=ai;this.has_icons=false;if(am){this.has_icons=true;var ag=this;aa=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:z-1,width:aa.width}).prependTo(this.html_elt);var ah=new GenomeRegion({chrom:ab.view.chrom,start:this.low,end:this.high}),ak=ae.length,ad=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ak+" features in this region were obtained from server. Click to get more data including depth").tipsy({gravity:"s"}).appendTo(message_div),Y=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ak+" features in this region were obtained from server. Click to get more data excluding depth").tipsy({gravity:"s"}).appendTo(message_div);ad.click(function(){ag.stale=true;ab.data_manager.get_more_data(ah,ab.mode,ag.resolution,{},ab.data_manager.DEEP_DATA_REQ);$(".tipsy").hide();ab.request_draw(true)}).dblclick(function(an){an.stopPropagation()});Y.click(function(){ag.stale=true;ab.data_manager.get_more_data(ah,ab.mode,ag.resolution,{},ab.data_manager.BROAD_DATA_REQ);$(".tipsy").hide();ab.request_draw(true)}).dblclick(function(an){an.stopPropagation()})}};o(K.prototype,b.prototype);K.prototype.predisplay_actions=function(){var Z=this,Y={};if(Z.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(ak){if(!this.hovered){return}var af=$(this).offset(),aj=ak.pageX-af.left,ai=ak.pageY-af.top,ao=Z.feature_mapper.get_feature_data(aj,ai),ag=(ao?ao[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!ag||$(this).attr("id")!==ag.toString()){$(this).remove()}});if(ao){var ab=Y[ag];if(!ab){var ag=ao[0],al={name:ao[3],start:ao[1],end:ao[2],strand:ao[4]},ae=Z.track.filters_manager.filters,ad;for(var ah=0;ah<ae.length;ah++){ad=ae[ah];al[ad.name]=ao[ad.index]}var ab=$("<div/>").attr("id",ag).addClass("feature-popup"),ap=$("<table/>"),an,am,aq;for(an in al){am=al[an];aq=$("<tr/>").appendTo(ap);$("<th/>").appendTo(aq).text(an);$("<td/>").attr("align","left").appendTo(aq).text(typeof(am)==="number"?T(am,2):am)}ab.append($("<div class='feature-popup-inner'>").append(ap));Y[ag]=ab}ab.appendTo($(this).parents(".track-content").children(".overlay"));var ac=aj+parseInt(Z.html_elt.css("left"))-ab.width()/2,aa=ai+parseInt(Z.html_elt.css("top"))+7;ab.css("left",ac+"px").css("top",aa+"px")}else{if(!ak.isPropagationStopped()){ak.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ak)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var h=function(aa,Z,ac){o(ac,{drag_handle_class:"draghandle"});p.call(this,aa,Z,ac);this.data_url=("data_url" in ac?ac.data_url:default_data_url);this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ac?ac.data_query_wait:G);this.dataset_check_url=("converted_datasets_state_url" in ac?ac.converted_datasets_state_url:converted_datasets_state_url);var Y=this,ab=new Dataset({id:ac.dataset_id,hda_ldda:ac.hda_ldda});this.data_manager=("data_manager" in ac?ac.data_manager:new GenomeDataManager({dataset:ab,data_url:Y.data_url,dataset_state_url:Y.dataset_check_url,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 ac)||ac.resize){this.add_resize_handle()}}};o(h.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(Y){Y.view.set_overview(Y)}},p.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(Y){if(Y.filters_manager.visible()){Y.filters_manager.clear_filters()}else{Y.filters_manager.init_filters()}Y.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(Y){Y.dynamic_tool_div.toggle();if(Y.dynamic_tool_div.is(":visible")){Y.set_name(Y.name+Y.tool_region_and_parameters_str())}else{Y.revert_name()}$(".tipsy").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(Y){var ab='<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>',aa=_.template(ab,{track:Y});var ad=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},Z=function(){var af=$('select[name="regions"] option:selected').val(),ah,ae=new GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),ag=_.map($(".bookmark"),function(ai){return new GenomeRegion({from_str:$(ai).children(".position").text()})});if(af==="cur"){ah=[ae]}else{if(af==="bookmarks"){ah=ag}else{ah=[ae].concat(ag)}}hide_modal();window.location.href=galaxy_paths.get("paramamonster_url")+"?"+$.param({dataset_id:Y.dataset_id,hda_ldda:Y.hda_ldda,regions:JSON.stringify(new Backbone.Collection(ah).toJSON())})},ac=function(ae){if((ae.keyCode||ae.which)===27){ad()}else{if((ae.keyCode||ae.which)===13){Z()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",aa,{No:ad,Yes:Z})}},p.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset_id&&p.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var Y=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(Y)}this.name_div=$("<div/>").addClass("track-name").appendTo(Y).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return Y},on_resize:function(){},add_resize_handle:function(){var Y=this;var ab=false;var aa=false;var Z=$("<div class='track-resize'>");$(Y.container_div).hover(function(){if(Y.content_visible){ab=true;Z.show()}},function(){ab=false;if(!aa){Z.hide()}});Z.hide().bind("dragstart",function(ac,ad){aa=true;ad.original_height=$(Y.content_div).height()}).bind("drag",function(ad,ae){var ac=Math.min(Math.max(ae.original_height+ae.deltaY,Y.min_height_px),Y.max_height_px);$(Y.tiles_div).css("height",ac);Y.visible_height_px=(Y.max_height_px===ac?0:ac);Y.on_resize()}).bind("dragend",function(ac,ad){Y.tile_cache.clear();aa=false;if(!ab){Z.hide()}Y.config.values.height=Y.visible_height_px;Y.changed()}).appendTo(Y.container_div)},set_display_modes:function(ab,ae){this.display_modes=ab;this.mode=(ae?ae:(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 Z=this,ac={};for(var aa=0,Y=Z.display_modes.length;aa<Y;aa++){var ad=Z.display_modes[aa];ac[ad]=function(af){return function(){Z.change_mode(af);Z.icons_div.show();Z.container_div.mouseleave(function(){Z.icons_div.hide()})}}(ad)}make_popupmenu(this.action_icons.mode_icon,ac)},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 V){return"LabelTrack"}else{if(this instanceof x){return"ReferenceTrack"}else{if(this instanceof i){return"LineTrack"}else{if(this instanceof Q){return"ReadTrack"}else{if(this instanceof N){return"VcfTrack"}else{if(this instanceof g){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(){var Z=this;Z.enabled=false;Z.tile_cache.clear();Z.data_manager.clear();Z.content_div.css("height","auto");Z.tiles_div.children().remove();Z.container_div.removeClass("nodata error pending");if(!Z.dataset_id){return}var Y=$.Deferred();$.getJSON(this.dataset_check_url,{hda_ldda:Z.hda_ldda,dataset_id:Z.dataset_id,chrom:Z.view.chrom},function(aa){if(!aa||aa==="error"||aa.kind==="error"){Z.container_div.addClass("error");Z.tiles_div.text(n);if(aa.message){var ab=$(" <a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+aa.message+"</pre>",{Close:hide_modal})});Z.tiles_div.append(ab)}}else{if(aa==="no converter"){Z.container_div.addClass("error");Z.tiles_div.text(F)}else{if(aa==="no data"||(aa.data!==undefined&&(aa.data===null||aa.data.length===0))){Z.container_div.addClass("nodata");Z.tiles_div.text(A)}else{if(aa==="pending"){Z.container_div.addClass("pending");Z.tiles_div.html(s);setTimeout(function(){Z.init()},Z.data_query_wait)}else{if(aa==="data"||aa.status==="data"){if(aa.valid_chroms){Z.valid_chroms=aa.valid_chroms;Z.update_icons()}Z.tiles_div.text(S);if(Z.view.chrom){Z.tiles_div.text("");Z.tiles_div.css("height",Z.visible_height_px+"px");Z.enabled=true;$.when(Z.predraw_init()).done(function(){Y.resolve();Z.container_div.removeClass("nodata error pending");Z.request_draw()})}else{Y.resolve()}}}}}}});this.update_icons();return Y},predraw_init:function(){}});var I=function(aa,Z,ab){h.call(this,aa,Z,ab);var Y=this,aa=Y.view;l(Y.container_div,Y.drag_handle_class,".group",Y);this.filters_manager=new U(this,("filters" in ab?ab.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in ab&&ab.tool?new q(this,ab.tool,ab.tool_state):null);this.tile_cache=new Cache(M);if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ab.mode){this.change_mode(ab.mode)}};o(I.prototype,p.prototype,h.prototype,{action_icons_def:h.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(Y){$(".tipsy").remove();Y.slotters[Y.view.resolution_px_b].max_rows*=2;Y.request_draw(true)},hide:true}]),copy:function(Y){var Z=this.to_dict();o(Z,{data_manager:this.data_manager});var aa=new this.constructor(this.view,Y,Z);aa.change_mode(this.mode);aa.enabled=this.enabled;return aa},set_filters_manager:function(Y){this.filters_manager=Y;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},change_mode:function(Z){var Y=this;Y.mode=Z;Y.config.values.mode=Z;Y.tile_cache.clear();Y.request_draw();this.action_icons.mode_icon.attr("title","Set display mode (now: "+Y.mode+")");return Y},update_icons:function(){var Y=this;if(Y.filters_available){Y.action_icons.filters_icon.show()}else{Y.action_icons.filters_icon.hide()}if(Y.tool){Y.action_icons.tools_icon.show();Y.action_icons.param_space_viz_icon.show()}else{Y.action_icons.tools_icon.hide();Y.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(Z,aa,Y){return Z+"_"+aa+"_"+Y},request_draw:function(Z,Y){this.view.request_redraw(false,Z,Y,this)},before_draw:function(){},_draw:function(Z,aj){if(!this.can_draw()){return}var ah=this.view.low,ad=this.view.high,af=ad-ah,aa=this.view.container.width(),al=this.view.resolution_px_b,ac=this.view.resolution_b_px;if(this.is_overview){ah=this.view.max_low;ad=this.view.max_high;ac=Math.pow(RESOLUTION,Math.ceil(Math.log((view.max_high-view.max_low)/O)/Math.log(RESOLUTION)));al=aa/(view.max_high-view.max_low)}this.before_draw();this.tiles_div.children().addClass("remove");var Y=Math.floor(ah/(ac*O)),ag=true,ak=[],ae=function(am){return(am&&"track" in am)};while((Y*O*ac)<ad){var ai=this.draw_helper(Z,aa,Y,ac,this.tiles_div,al);if(ae(ai)){ak.push(ai)}else{ag=false}Y+=1}if(!aj){this.tiles_div.children(".remove").removeClass("remove").remove()}var ab=this;if(ag){this.tiles_div.children(".remove").remove();ab.postdraw_actions(ak,aa,al,aj)}},postdraw_actions:function(ab,ac,ae,Y){var aa=this;var ad=false;for(var Z=0;Z<ab.length;Z++){if(ab[Z].has_icons){ad=true;break}}if(ad){for(var Z=0;Z<ab.length;Z++){tile=ab[Z];if(!tile.has_icons){tile.html_elt.css("padding-top",z)}}}},draw_helper:function(Y,ak,ap,an,ad,ae,al){var aj=this,at=this._gen_tile_cache_key(ak,ae,ap),ab=this._get_tile_bounds(ap,an);if(!al){al={}}var ar=(Y?undefined:aj.tile_cache.get_elt(at));if(ar){aj.show_tile(ar,ad,ae);return ar}var ah=true;var ao=aj.data_manager.get_data(ab,aj.mode,an,aj.data_url_extra_params);if(is_deferred(ao)){ah=false}var af;if(view.reference_track&&ae>view.canvas_manager.char_width_px){af=view.reference_track.data_manager.get_data(ab,aj.mode,an,view.reference_track.data_url_extra_params);if(is_deferred(af)){ah=false}}if(ah){o(ao,al.more_tile_data);var ag=aj.mode;if(ag==="Auto"){ag=aj.get_mode(ao);aj.update_auto_mode(ag)}var aa=aj.view.canvas_manager.new_canvas(),aq=ab.get("start"),Z=ab.get("end"),ak=Math.ceil((Z-aq)*ae)+aj.left_offset,ai=aj.get_canvas_height(ao,ag,ae,ak);aa.width=ak;aa.height=ai;var am=aa.getContext("2d");am.translate(this.left_offset,0);var ar=aj.draw_tile(ao,am,ag,an,ab,ae,af);if(ar!==undefined){aj.tile_cache.set_elt(at,ar);aj.show_tile(ar,ad,ae)}return ar}var ac=$.Deferred();$.when(ao,af).then(function(){view.request_redraw(false,false,false,aj);ac.resolve()});return ac},get_canvas_height:function(Y,aa,ab,Z){return this.visible_height_px},draw_tile:function(Y,Z,ad,ab,ac,ae,aa){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(aa,ac,ad){var Z=this,Y=aa.html_elt;aa.predisplay_actions();var ab=(aa.low-(this.is_overview?this.view.max_low:this.view.low))*ad;if(this.left_offset){ab-=this.left_offset}Y.css({position:"absolute",top:0,left:ab});if(Y.hasClass("remove")){Y.removeClass("remove")}else{ac.append(Y)}Z.after_show_tile(aa)},after_show_tile:function(Y){},_get_tile_bounds:function(Y,Z){var ab=Math.floor(Y*O*Z),ac=Math.ceil(O*Z),aa=(ab+ac<=this.view.max_high?ab+ac:this.view.max_high);return new GenomeRegion({chrom:this.view.chrom,start:ab,end:aa})},tool_region_and_parameters_str:function(aa,Y,ab){var Z=this,ac=(aa!==undefined&&Y!==undefined&&ab!==undefined?aa+":"+Y+"-"+ab:"all");return" - region=["+ac+"], parameters=["+Z.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(Y,Z){return true},can_subset:function(Y){return false},init_for_tool_data:function(){this.data_manager.set("data_url",raw_data_url);this.data_query_wait=1000;this.dataset_check_url=dataset_state_url;this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(aa,ab,ad,Y){var Z=this;Z.normal_postdraw_actions(aa,ab,ad,Y);Z.dataset_state_url=converted_datasets_state_url;Z.data_query_wait=G;var ac=new ServerStateDeferred({url:Z.dataset_state_url,url_params:{dataset_id:Z.dataset_id,hda_ldda:Z.hda_ldda},interval:Z.data_query_wait,success_fn:function(ae){return ae!=="pending"}});$.when(ac.go()).then(function(){Z.data_manager.set("data_url",default_data_url)});Z.postdraw_actions=Z.normal_postdraw_actions}}});var V=function(Z,Y){var aa={resize:false};h.call(this,Z,Y,aa);this.container_div.addClass("label-track")};o(V.prototype,h.prototype,{build_header_div:function(){},init:function(){this.enabled=true},_draw:function(){var aa=this.view,ab=aa.high-aa.low,ae=Math.floor(Math.pow(10,Math.floor(Math.log(ab)/Math.log(10)))),Y=Math.floor(aa.low/ae)*ae,ac=this.view.container.width(),Z=$("<div style='position: relative; height: 1.3em;'></div>");while(Y<aa.high){var ad=(Y-aa.low)/ab*ac;Z.append($("<div class='label'>"+commatize(Y)+"</div>").css({position:"absolute",left:ad-1}));Y+=ae}this.content_div.children(":first").remove();this.content_div.append(Z)}});var g=function(Z,Y,ac){I.call(this,Z,Y,ac);this.drawables=[];this.left_offset=0;if("drawables" in ac){var ab;for(var aa=0;aa<ac.drawables.length;aa++){ab=ac.drawables[aa];this.drawables[aa]=object_from_template(ab);if(ab.left_offset>this.left_offset){this.left_offset=ab.left_offset}}this.enabled=true}if(this.drawables.length!==0){this.set_display_modes(this.drawables[0].display_modes,this.drawables[0].mode)}this.update_icons();this.obj_type="CompositeTrack"};o(g.prototype,I.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(Y){$(".tipsy").remove();Y.show_group()}}].concat(I.prototype.action_icons_def),to_dict:v.prototype.to_dict,add_drawable:v.prototype.add_drawable,unpack_drawables:v.prototype.unpack_drawables,change_mode:function(Y){I.prototype.change_mode.call(this,Y);for(var Z=0;Z<this.drawables.length;Z++){this.drawables[Z].change_mode(Y)}},init:function(){var aa=[];for(var Z=0;Z<this.drawables.length;Z++){aa.push(this.drawables[Z].init())}var Y=this;$.when.apply($,aa).then(function(){Y.enabled=true;Y.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,draw_helper:function(Z,an,au,aq,af,ah,ao){var am=this,ay=this._gen_tile_cache_key(an,ah,au),ad=this._get_tile_bounds(au,aq),av=ad.get("start"),aa=ad.get("end");if(!ao){ao={}}var ax=(Z?undefined:am.tile_cache.get_elt(ay));if(ax){am.show_tile(ax,af,ah);return ax}var ag=[],am,ak=true,ar,ai;for(var at=0;at<this.drawables.length;at++){am=this.drawables[at];ar=am.data_manager.get_data(av,aa,am.mode,aq,am.data_url_extra_params);if(is_deferred(ar)){ak=false}ag.push(ar);ai=null;if(view.reference_track&&ah>view.canvas_manager.char_width_px){ai=view.reference_track.data_manager.get_data(av,aa,am.mode,aq,view.reference_track.data_url_extra_params);if(is_deferred(ai)){ak=false}}ag.push(ai)}if(ak){o(ar,ao.more_tile_data);this.tile_predraw_init();var ac=am.view.canvas_manager.new_canvas(),ad=am._get_tile_bounds(au,aq),av=ad.get("start"),aa=ad.get("end"),aw=0,an=Math.ceil((aa-av)*ah)+this.left_offset,al=0,ab=[];var Y=0;for(var at=0;at<this.drawables.length;at++,aw+=2){am=this.drawables[at];ar=ag[aw];var aj=am.mode;if(aj==="Auto"){aj=am.get_mode(ar);am.update_auto_mode(aj)}ab.push(aj);Y=am.get_canvas_height(ar,aj,ah,an);if(Y>al){al=Y}}ac.width=an;ac.height=(ao.height?ao.height:al);aw=0;var ap=ac.getContext("2d");ap.translate(this.left_offset,0);ap.globalAlpha=0.5;ap.globalCompositeOperation="source-over";for(var at=0;at<this.drawables.length;at++,aw+=2){am=this.drawables[at];ar=ag[aw];ai=ag[aw+1];ax=am.draw_tile(ar,ap,ab[at],aq,ad,ah,ai)}this.tile_cache.set_elt(ay,ax);this.show_tile(ax,af,ah);return ax}var ae=$.Deferred(),am=this;$.when.apply($,ag).then(function(){view.request_redraw(false,false,false,am);ae.resolve()});return ae},show_group:function(){var ab=new L(this.view,this.container,{name:this.name}),Y;for(var aa=0;aa<this.drawables.length;aa++){Y=this.drawables[aa];ab.add_drawable(Y);Y.container=ab;ab.content_div.append(Y.container_div)}var Z=this.container.replace_drawable(this,ab,true);ab.request_draw()},tile_predraw_init:function(){var ab=Number.MAX_VALUE,Y=-ab,Z;for(var aa=0;aa<this.drawables.length;aa++){Z=this.drawables[aa];if(Z instanceof i){if(Z.prefs.min_value<ab){ab=Z.prefs.min_value}if(Z.prefs.max_value>Y){Y=Z.prefs.max_value}}}for(var aa=0;aa<this.drawables.length;aa++){Z=this.drawables[aa];Z.prefs.min_value=ab;Z.prefs.max_value=Y}},postdraw_actions:function(aa,ad,af,Z){I.prototype.postdraw_actions.call(this,aa,ad,af,Z);var ac=-1;for(var ab=0;ab<aa.length;ab++){var Y=aa[ab].html_elt.find("canvas").height();if(Y>ac){ac=Y}}for(var ab=0;ab<aa.length;ab++){var ae=aa[ab];if(ae.html_elt.find("canvas").height()!==ac){this.draw_helper(true,ad,ae.index,ae.resolution,ae.html_elt.parent(),af,{height:ac});ae.html_elt.remove()}}}});var x=function(Y){I.call(this,Y,{content_div:Y.top_labeltrack},{resize:false});Y.reference_track=this;this.left_offset=200;this.visible_height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:Y.dbkey};this.data_manager=new ReferenceTrackDataManager({data_url:reference_url});this.hide_contents()};o(x.prototype,p.prototype,I.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},can_draw:p.prototype.can_draw,draw_tile:function(ag,ah,ac,ab,ae,ai){var aa=this;if(ai>this.view.canvas_manager.char_width_px){if(ag.data===null){this.hide_contents();return}var Z=ah.canvas;ah.font=ah.canvas.manager.default_font;ah.textAlign="center";ag=ag.data;for(var ad=0,af=ag.length;ad<af;ad++){var Y=Math.floor(ad*ai);ah.fillText(ag[ad],Y,10)}this.show_contents();return new b(aa,ae,ab,Z,ag)}this.hide_contents()}});var i=function(aa,Z,ab){var Y=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";I.call(this,aa,Z,ab);this.hda_ldda=ab.hda_ldda;this.dataset_id=ab.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:get_random_color()},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:32,hidden:true}],saved_values:ab.prefs,onchange:function(){Y.set_name(Y.prefs.name);Y.vertical_range=Y.prefs.max_value-Y.prefs.min_value;Y.set_min_value(Y.prefs.min_value);Y.set_max_value(Y.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};o(i.prototype,p.prototype,I.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(Y){this.prefs.min_value=Y;$("#linetrack_"+this.dataset_id+"_minval").text(this.prefs.min_value);this.tile_cache.clear();this.request_draw()},set_max_value:function(Y){this.prefs.max_value=Y;$("#linetrack_"+this.dataset_id+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.request_draw()},predraw_init:function(){var Y=this;Y.vertical_range=undefined;return $.getJSON(Y.data_url,{stats:true,chrom:Y.view.chrom,low:null,high:null,hda_ldda:Y.hda_ldda,dataset_id:Y.dataset_id},function(Z){Y.container_div.addClass("line-track");var ac=Z.data;if(isNaN(parseFloat(Y.prefs.min_value))||isNaN(parseFloat(Y.prefs.max_value))){var aa=ac.min,ae=ac.max;aa=Math.floor(Math.min(0,Math.max(aa,ac.mean-2*ac.sd)));ae=Math.ceil(Math.max(0,Math.min(ae,ac.mean+2*ac.sd)));Y.prefs.min_value=aa;Y.prefs.max_value=ae;$("#track_"+Y.dataset_id+"_minval").val(Y.prefs.min_value);$("#track_"+Y.dataset_id+"_maxval").val(Y.prefs.max_value)}Y.vertical_range=Y.prefs.max_value-Y.prefs.min_value;Y.total_frequency=ac.total_frequency;Y.container_div.find(".yaxislabel").remove();var ad=$("<div/>").text(T(Y.prefs.min_value,3)).make_text_editable({num_cols:6,on_finish:function(af){$(".tipsy").remove();var af=parseFloat(af);if(!isNaN(af)){Y.set_min_value(af)}},help_text:"Set min value"}).addClass("yaxislabel bottom").attr("id","linetrack_"+Y.dataset_id+"_minval").prependTo(Y.container_div),ab=$("<div/>").text(T(Y.prefs.max_value,3)).make_text_editable({num_cols:6,on_finish:function(af){$(".tipsy").remove();var af=parseFloat(af);if(!isNaN(af)){Y.set_max_value(af)}},help_text:"Set max value"}).addClass("yaxislabel top").attr("id","linetrack_"+Y.dataset_id+"_maxval").prependTo(Y.container_div)})},draw_tile:function(ah,af,aa,Z,ac,ag){var Y=af.canvas,ab=ac.get("start"),ae=ac.get("end"),ad=new H.LinePainter(ah.data,ab,ae,this.prefs,aa);ad.draw(af,Y.width,Y.height,ag);return new b(this,ac,Z,Y,ah.data)},can_subset:function(Y){return false}});var c=function(ab,aa,ad){var Z=this;this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];I.call(this,ab,aa,ad);var ac=get_random_color(),Y=get_random_color([ac,"#ffffff"]);this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ac},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:Y},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ad.prefs,onchange:function(){Z.set_name(Z.prefs.name);Z.tile_cache.clear();Z.set_painter_from_config();Z.request_draw()}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.hda_ldda=ad.hda_ldda;this.dataset_id=ad.dataset_id;this.original_dataset_id=ad.dataset_id;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};o(c.prototype,p.prototype,I.prototype,{set_dataset:function(Y){this.dataset_id=Y.get("id");this.hda_ldda=Y.get("hda_ldda");this.data_manager.set("dataset",Y)},set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=H.ArcLinkedFeaturePainter}else{this.painter=H.LinkedFeaturePainter}},before_draw:function(){this.max_height_px=0},after_show_tile:function(Y){this.max_height_px=Math.max(this.max_height_px,Y.html_elt.height());Y.html_elt.parent().children().css("height",this.max_height_px+"px");var Z=this.max_height_px;if(this.visible_height_px!==0){Z=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",Z+"px")},postdraw_actions:function(an,ai,ad,ac){I.prototype.postdraw_actions.call(this,an,ac);var ah=this;if(ah.mode==="Histogram"){var ak,Z=-1;for(ak=0;ak<an.length;ak++){var aj=an[ak].max_val;if(aj>Z){Z=aj}}for(ak=0;ak<an.length;ak++){var ap=an[ak];if(ap.max_val!==Z){ap.html_elt.remove();ah.draw_helper(true,ai,ap.index,ap.resolution,ap.html_elt.parent(),ad,{more_tile_data:{max:Z}})}}}if(ah.filters_manager){var ae=ah.filters_manager.filters;for(var am=0;am<ae.length;am++){ae[am].update_ui_elt()}var ao=false,Y,af;for(var ak=0;ak<an.length;ak++){if(an[ak].data.length){Y=an[ak].data[0];for(var am=0;am<ae.length;am++){af=ae[am];if(af.applies_to(Y)&&af.min!==af.max){ao=true;break}}}}if(ah.filters_available!==ao){ah.filters_available=ao;if(!ah.filters_available){ah.filters_manager.hide()}ah.update_icons()}}this.container_div.find(".yaxislabel").remove();var ab=an[0];if(ab instanceof j){var ag=(this.prefs.histogram_max?this.prefs.histogram_max:ab.max_val),aa=$("<div/>").text(ag).make_text_editable({num_cols:12,on_finish:function(aq){$(".tipsy").remove();var aq=parseFloat(aq);ah.prefs.histogram_max=(!isNaN(aq)?aq:null);ah.tile_cache.clear();ah.request_draw()},help_text:"Set max value; leave blank to use default"}).addClass("yaxislabel top").css("color",this.prefs.label_color);this.container_div.prepend(aa)}if(ab instanceof K){var al=true;for(var ak=0;ak<an.length;ak++){if(!an[ak].all_slotted){al=false;break}}if(!al){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(Y){var Y;if(this.mode==="Auto"){if(Y==="no_detail"){Y="feature spans"}else{if(Y==="summary_tree"){Y="coverage histogram"}}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+Y+")")}},incremental_slots:function(ac,Y,ab){var Z=this.view.canvas_manager.dummy_context,aa=this.slotters[ac];if(!aa||(aa.mode!==ab)){aa=new (r.FeatureSlotter)(ac,ab,w,function(ad){return Z.measureText(ad)});this.slotters[ac]=aa}return aa.slot_features(Y)},get_summary_tree_data:function(ac,af,aa,an){if(an>aa-af){an=aa-af}var aj=Math.floor((aa-af)/an),am=[],ab=0;var ad=0,ae=0,ai,al=0,ag=[],ak,ah;var Z=function(aq,ap,ar,ao){aq[0]=ap+ar*ao;aq[1]=ap+(ar+1)*ao};while(al<an&&ad!==ac.length){var Y=false;for(;al<an&&!Y;al++){Z(ag,af,al,aj);for(ae=ad;ae<ac.length;ae++){ai=ac[ae].slice(1,3);if(is_overlap(ai,ag)){Y=true;break}}if(Y){break}}data_start_index=ae;am[am.length]=ak=[ag[0],0];for(;ae<ac.length;ae++){ai=ac[ae].slice(1,3);if(is_overlap(ai,ag)){ak[1]++}else{break}}if(ak[1]>ab){ab=ak[1]}al++}return{max:ab,delta:aj,data:am}},get_mode:function(Y){if(Y.dataset_type==="summary_tree"){mode="summary_tree"}else{if(Y.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>E){mode="Squish"}else{mode="Pack"}}}return mode},get_canvas_height:function(Y,ac,ad,Z){if(ac==="summary_tree"||ac==="Histogram"){return this.summary_draw_height}else{var ab=this.incremental_slots(ad,Y.data,ac);var aa=new (this.painter)(null,null,null,this.prefs,ac);return Math.max(X,aa.get_required_height(ab,Z))}},draw_tile:function(aj,an,al,ao,ab,af,aa){var am=this,Z=an.canvas,av=ab.get("start"),Y=ab.get("end"),aA=25,ac=this.left_offset;if(al==="summary_tree"||al==="Histogram"){if(aj.dataset_type!=="summary_tree"){var ag=this.get_summary_tree_data(aj.data,av,Y,200);if(aj.max){ag.max=aj.max}aj=ag}var ax=new H.SummaryTreePainter(aj,av,Y,this.prefs);ax.draw(an,Z.width,Z.height,af);return new j(am,ab,ao,Z,aj.data,aj.max)}var ae=[],ak=this.slotters[af].slots;all_slotted=true;if(aj.data){var ah=this.filters_manager.filters;for(var ap=0,ar=aj.data.length;ap<ar;ap++){var ad=aj.data[ap];var aq=false;var ai;for(var au=0,az=ah.length;au<az;au++){ai=ah[au];ai.update_attrs(ad);if(!ai.keep(ad)){aq=true;break}}if(!aq){ae.push(ad);if(!(ad[0] in ak)){all_slotted=false}}}}var ay=(this.filters_manager.alpha_filter?new y(this.filters_manager.alpha_filter):null);var aw=(this.filters_manager.height_filter?new y(this.filters_manager.height_filter):null);var ax=new (this.painter)(ae,av,Y,this.prefs,al,ay,aw,aa);var at=null;an.fillStyle=this.prefs.block_color;an.font=an.canvas.manager.default_font;an.textAlign="right";if(aj.data){at=ax.draw(an,Z.width,Z.height,af,ak);at.translation=-ac}return new K(am,ab,ao,Z,aj.data,af,al,aj.message,all_slotted,at)},data_and_mode_compatible:function(Y,Z){if(Z==="Auto"){return true}else{if(Y.extra_info==="no_detail"||Y.dataset_type==="summary_tree"){return false}else{return true}}},can_subset:function(Y){if(Y.dataset_type==="summary_tree"||Y.message||Y.extra_info==="no_detail"){return false}return true}});var N=function(Z,Y,aa){c.call(this,Z,Y,aa);this.config=new B({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:get_random_color()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:aa.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=H.ReadPainter};o(N.prototype,p.prototype,I.prototype,c.prototype);var Q=function(aa,Z,ac){c.call(this,aa,Z,ac);var ab=get_random_color(),Y=get_random_color([ab,"#ffffff"]);this.config=new B({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:ab},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:Y},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"Clear value to set automatically"},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ac.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=H.ReadPainter;this.update_icons()};o(Q.prototype,p.prototype,I.prototype,c.prototype);R.View=W;R.DrawableGroup=L;R.LineTrack=i;R.FeatureTrack=c;R.ReadTrack=Q;R.VcfTrack=N;R.CompositeTrack=g};var slotting_module=function(c,b){var e=c("class").extend;var d=2,a=5;b.FeatureSlotter=function(i,h,f,g){this.slots={};this.start_end_dct={};this.w_scale=i;this.mode=h;this.include_label=(h==="Pack");this.max_rows=f;this.measureText=g};e(b.FeatureSlotter.prototype,{slot_features:function(m){var p=this.w_scale,h=this.start_end_dct,x=[],z=[],n=0,y=this.max_rows;for(var v=0,w=m.length;v<w;v++){var k=m[v],o=k[0];if(this.slots[o]!==undefined){n=Math.max(n,this.slots[o]);z.push(this.slots[o])}else{x.push(v)}}var q=function(E,F){for(var D=0;D<=y;D++){var B=false,G=h[D];if(G!==undefined){for(var A=0,C=G.length;A<C;A++){var i=G[A];if(F>i[0]&&E<i[1]){B=true;break}}}if(!B){return D}}return -1};for(var v=0,w=x.length;v<w;v++){var k=m[x[v]],o=k[0],t=k[1],f=k[2],r=k[3],g=Math.floor(t*p),l=Math.ceil(f*p),u=this.measureText(r).width,j;if(r!==undefined&&this.include_label){u+=(d+a);if(g-u>=0){g-=u;j="left"}else{l+=u;j="right"}}var s=q(g,l);if(s>=0){if(h[s]===undefined){h[s]=[]}h[s].push([g,l]);this.slots[o]=s;n=Math.max(n,s)}}return n+1}})};var painters_module=function(i,x){var u=i("class").extend;var p=function(I,A,G,z,F,D){if(D===undefined){D=4}var C=z-A;var B=F-G;var E=Math.floor(Math.sqrt(C*C+B*B)/D);var J=C/E;var H=B/E;var y;for(y=0;y<E;y++,A+=J,G+=H){if(y%2!==0){continue}I.fillRect(A,G,D,1)}};var q=function(B,A,z,E){var D=A-E/2,C=A+E/2,F=z-Math.sqrt(E*3/2);B.beginPath();B.moveTo(D,F);B.lineTo(C,F);B.lineTo(A,z);B.lineTo(D,F);B.strokeStyle=this.fillStyle;B.fill();B.stroke();B.closePath()};var d=function(y){this.default_val=(y?y:1)};d.prototype.gen_val=function(y){return this.default_val};var l=function(A,C,y,z,B){this.data=A;this.view_start=C;this.view_end=y;this.prefs=u({},this.default_prefs,z);this.mode=B};l.prototype.default_prefs={};l.prototype.draw=function(z,A,y,B){};var v=function(A,C,y,z,B){l.call(this,A,C,y,z,B)};v.prototype.default_prefs={show_counts:false};v.prototype.draw=function(L,z,K,M){var E=this.view_start,N=this.view_end-this.view_start,I=this.data.data,G=(this.prefs.histogram_max?this.prefs.histogram_max:this.data.max),B=K;delta_x_px=Math.ceil(this.data.delta*M);L.save();for(var C=0,D=I.length;C<D;C++){var H=Math.floor((I[C][0]-E)*M);var F=I[C][1];if(!F){continue}var J=F/G*K;if(F!==0&&J<1){J=1}L.fillStyle=this.prefs.block_color;L.fillRect(H,B-J,delta_x_px,J);var A=4;if(this.prefs.show_counts&&(L.measureText(F).width+A)<delta_x_px){L.fillStyle=this.prefs.label_color;L.textAlign="center";L.fillText(F,H+(delta_x_px/2),10)}}L.restore()};var b=function(y,C,E,F,A){l.call(this,y,C,E,F,A);if(this.prefs.min_value===undefined){var G=Infinity;for(var z=0,B=this.data.length;z<B;z++){G=Math.min(G,this.data[z][1])}this.prefs.min_value=G}if(this.prefs.max_value===undefined){var D=-Infinity;for(var z=0,B=this.data.length;z<B;z++){D=Math.max(D,this.data[z][1])}this.prefs.max_value=D}};b.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};b.prototype.draw=function(S,Q,N,D){var I=false,K=this.prefs.min_value,F=this.prefs.max_value,M=F-K,B=N,C=this.view_start,P=this.view_end-this.view_start,L=this.mode,aa=this.data;S.save();var ac=Math.round(N+K/M*N);if(L!=="Intensity"){S.fillStyle="#aaa";S.fillRect(0,ac,Q,1)}S.beginPath();var Y,G,E;if(aa.length>1){E=Math.ceil((aa[1][0]-aa[0][0])*D)}else{E=10}var A=parseInt(this.prefs.color.slice(1),16),H=(A&16711680)>>16,R=(A&65280)>>8,V=A&255;for(var T=0,U=aa.length;T<U;T++){S.fillStyle=S.strokeStyle=this.prefs.color;Y=Math.round((aa[T][0]-C)*D);G=aa[T][1];var W=false,J=false;if(G===null){if(I&&L==="Filled"){S.lineTo(Y,B)}I=false;continue}if(G<K){J=true;G=K}else{if(G>F){W=true;G=F}}if(L==="Histogram"){G=Math.round(G/M*B);S.fillRect(Y,ac,E,-G)}else{if(L==="Intensity"){var z=(G-K)/M,O=Math.round(H+(255-H)*(1-z)),X=Math.round(R+(255-R)*(1-z)),ab=Math.round(V+(255-V)*(1-z));S.fillStyle="rgb("+O+","+X+","+ab+")";S.fillRect(Y,0,E,B)}else{G=Math.round(B-(G-K)/M*B);if(I){S.lineTo(Y,G)}else{I=true;if(L==="Filled"){S.moveTo(Y,B);S.lineTo(Y,G)}else{S.moveTo(Y,G)}}}}S.fillStyle=this.prefs.overflow_color;if(W||J){var Z;if(L==="Histogram"||L==="Intensity"){Z=E}else{Y-=2;Z=4}if(W){S.fillRect(Y,0,Z,3)}if(J){S.fillRect(Y,B-3,Z,3)}}S.fillStyle=this.prefs.color}if(L==="Filled"){if(I){S.lineTo(Y,ac);S.lineTo(0,ac)}S.fill()}else{S.stroke()}S.restore()};var m=function(y){this.feature_positions={};this.slot_height=y;this.translation=0;this.y_translation=0};m.prototype.map_feature_data=function(z,B,y,A){if(!this.feature_positions[B]){this.feature_positions[B]=[]}this.feature_positions[B].push({data:z,x_start:y,x_end:A})};m.prototype.get_feature_data=function(z,D){var C=Math.floor((D-this.y_translation)/this.slot_height),B;if(!this.feature_positions[C]){return null}z+=this.translation;for(var A=0;A<this.feature_positions[C].length;A++){B=this.feature_positions[C][A];if(z>=B.x_start&&z<=B.x_end){return B.data}}};var o=function(A,D,y,z,C,E,B){l.call(this,A,D,y,z,C);this.alpha_scaler=(E?E:new d());this.height_scaler=(B?B:new d())};o.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};u(o.prototype,{get_required_height:function(A,z){var y=y_scale=this.get_row_height(),B=this.mode;if(B==="no_detail"||B==="Squish"||B==="Pack"){y=A*y_scale}return y+this.get_top_padding(z)+this.get_bottom_padding(z)},get_top_padding:function(y){return 0},get_bottom_padding:function(y){return Math.max(Math.round(this.get_row_height()/2),5)},draw:function(K,I,G,E,F){var Q=this.data,D=this.view_start,M=this.view_end;K.save();K.fillStyle=this.prefs.block_color;K.textAlign="right";var H=this.view_end-this.view_start,L=this.get_row_height(),P=new m(L),B;for(var N=0,O=Q.length;N<O;N++){var A=Q[N],C=A[0],J=A[1],y=A[2],z=(F&&F[C]!==undefined?F[C]:null);if((J<M&&y>D)&&(this.mode==="Dense"||z!==null)){B=this.draw_element(K,this.mode,A,z,D,M,E,L,I);P.map_feature_data(A,z,B[0],B[1])}}K.restore();P.y_translation=this.get_top_padding(I);return P},draw_element:function(E,A,G,C,B,D,F,z,y){console.log("WARNING: Unimplemented function.");return[0,0]}});var c=10,h=3,k=5,w=10,f=1,s=9,e=3,a=9,j=2,g="#ccc";var r=function(A,D,y,z,C,E,B){o.call(this,A,D,y,z,C,E,B);this.draw_background_connector=true;this.draw_individual_connectors=false};u(r.prototype,o.prototype,{get_row_height:function(){var z=this.mode,y;if(z==="Dense"){y=c}else{if(z==="no_detail"){y=h}else{if(z==="Squish"){y=k}else{y=w}}}return y},draw_element:function(M,D,X,H,O,ai,am,ao,y){var T=X[0],ak=X[1],ad=X[2]-1,Q=X[3],K=X[4],ae=Math.floor(Math.max(0,(ak-O)*am)),N=Math.ceil(Math.min(y,Math.max(0,(ad-O)*am))),ac=ae,an=N,aa=(D==="Dense"?0:(0+H))*ao+this.get_top_padding(y),L,ag,R=null,aq=null,B=B=(!K||K==="+"||K==="."?this.prefs.block_color:this.prefs.reverse_strand_color);label_color=this.prefs.label_color;M.globalAlpha=this.alpha_scaler.gen_val(X);if(D==="Dense"){H=1}if(D==="no_detail"){M.fillStyle=B;M.fillRect(ae,aa+5,N-ae,f)}else{var Z=X[5],af=X[6],C=X[7],V=true;if(Z&&af){R=Math.floor(Math.max(0,(Z-O)*am));aq=Math.ceil(Math.min(y,Math.max(0,(af-O)*am)))}var al,U;if(D==="Squish"){al=1;U=e;V=false}else{if(D==="Dense"){al=5;U=s}else{al=5;U=a}}if(!C){M.fillStyle=B;M.fillRect(ae,aa+1,N-ae,U);if(K&&V){if(K==="+"){M.fillStyle=M.canvas.manager.get_pattern("right_strand_inv")}else{if(K==="-"){M.fillStyle=M.canvas.manager.get_pattern("left_strand_inv")}}M.fillRect(ae,aa+1,N-ae,U)}}else{var J,W;if(D==="Squish"||D==="Dense"){J=aa+Math.floor(e/2)+1;W=1}else{if(K){J=aa;W=U}else{J+=(e/2)+1;W=1}}if(this.draw_background_connector){if(D==="Squish"||D==="Dense"){M.fillStyle=g}else{if(K){if(K==="+"){M.fillStyle=M.canvas.manager.get_pattern("right_strand")}else{if(K==="-"){M.fillStyle=M.canvas.manager.get_pattern("left_strand")}}}else{M.fillStyle=g}}M.fillRect(ae,J,N-ae,W)}var E;for(var aj=0,A=C.length;aj<A;aj++){var F=C[aj],z=Math.floor(Math.max(0,(F[0]-O)*am)),Y=Math.ceil(Math.min(y,Math.max((F[1]-1-O)*am))),S,ab;if(z>Y){continue}M.fillStyle=B;M.fillRect(z,aa+(U-al)/2+1,Y-z,al);if(R!==undefined&&af>Z&&!(z>aq||Y<R)){var ah=Math.max(z,R),I=Math.min(Y,aq);M.fillRect(ah,aa+1,I-ah,U)}if(this.draw_individual_connectors&&S){this.draw_connector(M,S,ab,z,Y,aa)}S=z;ab=Y}if(D==="Pack"){M.globalAlpha=1;M.fillStyle="white";var G=this.height_scaler.gen_val(X),P=Math.ceil(U*G),ap=Math.round((U-P)/2);if(G!==1){M.fillRect(ae,J+1,N-ae,ap);M.fillRect(ae,J+U-ap+1,N-ae,ap)}}}M.globalAlpha=1;if(D==="Pack"&&ak>O){M.fillStyle=label_color;if(O===0&&ae-M.measureText(Q).width<0){M.textAlign="left";M.fillText(Q,N+j,aa+8);an+=M.measureText(Q).width+j}else{M.textAlign="right";M.fillText(Q,ae-j,aa+8);ac-=M.measureText(Q).width+j}}}M.globalAlpha=1;return[ac,an]}});var t=function(B,E,y,A,D,F,C,z){o.call(this,B,E,y,A,D,F,C);this.ref_seq=(z?z.data:null)};u(t.prototype,o.prototype,{get_row_height:function(){var y,z=this.mode;if(z==="Dense"){y=c}else{if(z==="Squish"){y=k}else{y=w;if(this.prefs.show_insertions){y*=2}}}return y},draw_read:function(K,A,ag,V,L,aa,ad,C,B,M){K.textAlign="center";var J=this,R=[L,aa],Z=0,W=0,D=0,F=K.canvas.manager.char_width_px,y=(B==="+"?this.prefs.block_color:this.prefs.reverse_strand_color);var O=[];if((A==="Pack"||this.mode==="Auto")&&M!==undefined&&ag>F){D=Math.round(ag/2)}if(!C){C=[[0,M.length]]}for(var G=0,I=C.length;G<I;G++){var z=C[G],E="MIDNSHP=X"[z[0]],S=z[1];if(E==="H"||E==="S"){Z-=S}var U=ad+Z,Y=Math.floor(Math.max(0,(U-L)*ag)),ab=Math.floor(Math.max(0,(U+S-L)*ag));if(Y===ab){ab+=1}switch(E){case"H":break;case"S":case"M":case"=":if(is_overlap([U,U+S],R)){var N=M.slice(W,W+S);if(D>0){K.fillStyle=y;K.fillRect(Y-D,V+1,ab-Y,9);K.fillStyle=g;for(var af=0,H=N.length;af<H;af++){if(this.prefs.show_differences){if(this.ref_seq){var P=this.ref_seq[U-L+af];if(!P||P.toLowerCase()===N[af].toLowerCase()){continue}}else{continue}}if(U+af>=L&&U+af<=aa){var X=Math.floor(Math.max(0,(U+af-L)*ag));K.fillText(N[af],X,V+9)}}}else{K.fillStyle=y;K.fillRect(Y,V+4,ab-Y,e)}}W+=S;Z+=S;break;case"N":K.fillStyle=g;K.fillRect(Y-D,V+5,ab-Y,1);Z+=S;break;case"D":K.fillStyle="red";K.fillRect(Y-D,V+4,ab-Y,3);Z+=S;break;case"P":break;case"I":var ah=Y-D;if(is_overlap([U,U+S],R)){var N=M.slice(W,W+S);if(this.prefs.show_insertions){var T=Y-(ab-Y)/2;if((A==="Pack"||this.mode==="Auto")&&M!==undefined&&ag>F){K.fillStyle="yellow";K.fillRect(T-D,V-9,ab-Y,9);O[O.length]={type:"triangle",data:[ah,V+4,5]};K.fillStyle=g;switch(compute_overlap([U,U+S],R)){case (OVERLAP_START):N=N.slice(L-U);break;case (OVERLAP_END):N=N.slice(0,U-aa);break;case (CONTAINED_BY):break;case (CONTAINS):N=N.slice(L-U,U-aa);break}for(var af=0,H=N.length;af<H;af++){var X=Math.floor(Math.max(0,(U+af-L)*ag));K.fillText(N[af],X-(ab-Y)/2,V)}}else{K.fillStyle="yellow";K.fillRect(T,V+(this.mode!=="Dense"?2:5),ab-Y,(A!=="Dense"?e:s))}}else{if((A==="Pack"||this.mode==="Auto")&&M!==undefined&&ag>F){O.push({type:"text",data:[N.length,ah,V+9]})}else{}}}W+=S;break;case"X":W+=S;break}}K.fillStyle="yellow";var Q,ai,ae;for(var ac=0;ac<O.length;ac++){Q=O[ac];ai=Q.type;ae=Q.data;if(ai==="text"){K.save();K.font="bold "+K.font;K.fillText(ae[0],ae[1],ae[2]);K.restore()}else{if(ai==="triangle"){q(K,ae[0],ae[1],ae[2])}}}},draw_element:function(R,M,E,B,U,z,I,S,P){var H=E[0],Q=E[1],A=E[2],J=E[3],D=Math.floor(Math.max(0,(Q-U)*I)),F=Math.ceil(Math.min(P,Math.max(0,(A-U)*I))),C=(M==="Dense"?0:(0+B))*S,G=this.prefs.label_color,O=0;if((M==="Pack"||this.mode==="Auto")&&I>R.canvas.manager.char_width_px){var O=Math.round(I/2)}if(E[5] instanceof Array){var N=Math.floor(Math.max(0,(E[4][0]-U)*I)),L=Math.ceil(Math.min(P,Math.max(0,(E[4][1]-U)*I))),K=Math.floor(Math.max(0,(E[5][0]-U)*I)),y=Math.ceil(Math.min(P,Math.max(0,(E[5][1]-U)*I)));if(E[4][1]>=U&&E[4][0]<=z&&E[4][2]){this.draw_read(R,M,I,C,U,z,E[4][0],E[4][2],E[4][3],E[4][4])}if(E[5][1]>=U&&E[5][0]<=z&&E[5][2]){this.draw_read(R,M,I,C,U,z,E[5][0],E[5][2],E[5][3],E[5][4])}if(K>L){R.fillStyle=g;p(R,L-O,C+5,K-O,C+5)}}else{this.draw_read(R,M,I,C,U,z,Q,E[4],E[5],E[6])}if(M==="Pack"&&Q>U&&J!=="."){R.fillStyle=this.prefs.label_color;var T=1;if(T===0&&D-R.measureText(J).width<0){R.textAlign="left";R.fillText(J,F+j-O,C+8)}else{R.textAlign="right";R.fillText(J,D-j-O,C+8)}}return[0,0]}});var n=function(A,D,y,z,C,E,B){r.call(this,A,D,y,z,C,E,B);this.longest_feature_length=this.calculate_longest_feature_length();this.draw_background_connector=false;this.draw_individual_connectors=true};u(n.prototype,o.prototype,r.prototype,{calculate_longest_feature_length:function(){var z=0;for(var C=0,y=this.data.length;C<y;C++){var B=this.data[C],A=B[1],D=B[2];z=Math.max(z,D-A)}return z},get_top_padding:function(z){var y=this.view_end-this.view_start,A=z/y;return Math.min(128,Math.ceil((this.longest_feature_length/2)*A))},draw_connector:function(G,B,F,H,E,D){var y=(F+H)/2,C=H-y;var A=Math.PI,z=0;if(C>0){G.beginPath();G.arc(y,D,H-y,Math.PI,0);G.stroke()}}});x.Scaler=d;x.SummaryTreePainter=v;x.LinePainter=b;x.LinkedFeaturePainter=r;x.ReadPainter=t;x.ArcLinkedFeaturePainter=n};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("class",class_module);a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window);
\ No newline at end of file
diff -r a419b8beaa69ce84374ef1b33a9201301929b3e7 -r ea7432fd68e0472dea262f56e8181301109a28ff static/scripts/viz/trackster.js
--- a/static/scripts/viz/trackster.js
+++ b/static/scripts/viz/trackster.js
@@ -1051,7 +1051,7 @@
var add_tracks_button = $("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function () {
add_datasets(add_datasets_url, add_track_async_url, function(tracks) {
_.each(tracks, function(track) {
- view.add_drawable( object_from_template(track, view) );
+ view.add_drawable( object_from_template(track, view, view) );
});
});
});
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Fix for handling lists when preparing to install tool shed repositories.
by Bitbucket 06 Jul '12
by Bitbucket 06 Jul '12
06 Jul '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/a419b8beaa69/
changeset: a419b8beaa69
user: greg
date: 2012-07-06 20:24:51
summary: Fix for handling lists when preparing to install tool shed repositories.
affected #: 1 file
diff -r ee9cd81ccce258a973c53f62489e54630d5d3fad -r a419b8beaa69ce84374ef1b33a9201301929b3e7 lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -1254,8 +1254,8 @@
# Redirect back to local Galaxy to perform install.
url = '%sadmin_toolshed/prepare_for_install' % galaxy_url
url += '?tool_shed_url=%s' % url_for( '/', qualified=True )
- url += '&repository_ids=%s' % ','.join( repository_ids )
- url += '&changeset_revisions=%s' % ','.join( changeset_revisions )
+ url += '&repository_ids=%s' % ','.join( util.listify( repository_ids ) )
+ url += '&changeset_revisions=%s' % ','.join( util.listify( changeset_revisions ) )
return trans.response.send_redirect( url )
@web.expose
def load_invalid_tool( self, trans, repository_id, tool_config, changeset_revision, **kwd ):
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