1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/92ac18adbdc5/ changeset: r5399:92ac18adbdc5 user: kanwei date: 2011-04-15 02:25:54 summary: trackster: - UI support for adding datasets from Data Libraries - Cleaner, more consistent "Add Tracks" dialog that implements above Sync .css changes with their corresponding .css.tmpl template affected #: 12 files (3.1 KB) --- a/lib/galaxy/web/controllers/tracks.py Thu Apr 14 16:51:40 2011 -0400 +++ b/lib/galaxy/web/controllers/tracks.py Thu Apr 14 20:25:54 2011 -0400 @@ -60,7 +60,6 @@ datasets_param = "f-history" columns = [ NameColumn( "History Name", key="name", filterable="standard" ), - grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), DbKeyPlaceholderColumn( "Dbkey", key="dbkey", model_class=model.HistoryDatasetAssociation, visible=False ) ] num_rows_per_page = 10 @@ -80,8 +79,7 @@ datasets_action = 'list_library_datasets' datasets_param = "f-library" columns = [ - NameColumn( "Library Name", key="name", filterable="standard" ), - grids.GridColumn( "Description", key="description" ) + NameColumn( "Library Name", key="name", filterable="standard" ) ] num_rows_per_page = 10 use_async = True @@ -601,7 +599,7 @@ """List a library's datasets that can be added to a visualization.""" library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( kwargs.get('f-library') ) ) - return trans.fill_template( '/library/common/browse_library.mako', + return trans.fill_template( '/tracks/library_datasets_select_grid.mako', cntrller="library", use_panels=False, library=library, --- a/static/june_2007_style/base.css.tmpl Thu Apr 14 16:51:40 2011 -0400 +++ b/static/june_2007_style/base.css.tmpl Thu Apr 14 20:25:54 2011 -0400 @@ -947,4 +947,21 @@ -sprite-image: fugue/control-270.png; -sprite-horiz-position: right; } +.icon-button.multiinput{ + background:url(../images/documents-stack.png) no-repeat; + cursor:pointer; + float:none; + display:inline-block; + margin-left:10px; +} +.icon-button.multiinput.disabled{ + background:url(../images/documents-stack-faded.png) no-repeat; + cursor:auto; +} +.workflow-invocation-complete{ + border:solid 1px #6A6; + border-left-width:5px; + margin:10px 0; + padding-left:5px; +} --- a/static/june_2007_style/blue/panel_layout.css Thu Apr 14 16:51:40 2011 -0400 +++ b/static/june_2007_style/blue/panel_layout.css Thu Apr 14 20:25:54 2011 -0400 @@ -27,7 +27,7 @@ .dialog-box-container{position:relative;margin-top:80px;margin-right:auto;margin-left:auto;} .dialog-box-wrapper{position:relative;padding:1em;background-color:rgba(0,0,0,0.5);-moz-border-radius:1em;-webkit-border-radius:1em;} .dialog-box{border:solid #999 1px;background:white;z-index:80000;} -.dialog-box .body{padding:5px;overflow:auto;max-height:500px;} +.dialog-box .body{padding:5px;overflow:auto;max-height:500px;min-width:300px;} .dialog-box .buttons{padding:5px;} .panel-error-message,.panel-warning-message,.panel-done-message,.panel-info-message{height:24px;line-height:24px;color:#303030;padding:0px;padding-left:26px;background-color:#FFCCCC;background-image:url(error_small.png);background-repeat:no-repeat;background-position:6px 50%;} .panel-warning-message{background-image:url(warn_small.png);background-color:#FFFFCC;} --- a/static/june_2007_style/panel_layout.css.tmpl Thu Apr 14 16:51:40 2011 -0400 +++ b/static/june_2007_style/panel_layout.css.tmpl Thu Apr 14 20:25:54 2011 -0400 @@ -194,6 +194,7 @@ padding: 5px; overflow: auto; max-height: 500px; + min-width: 300px; } .dialog-box .buttons { --- a/static/june_2007_style/trackster.css.tmpl Thu Apr 14 16:51:40 2011 -0400 +++ b/static/june_2007_style/trackster.css.tmpl Thu Apr 14 20:25:54 2011 -0400 @@ -170,17 +170,14 @@ .track.error .track-content { background-color: #ECB4AF; background-image: none; - padding: 2px 0; } .track.nodata .track-content { background-color: #eee; background-image: none; - padding: 2px 0; } .track.pending .track-content { background-color: white; background-image: none; - padding: 2px 0; } .loading { @@ -237,7 +234,7 @@ margin-top: 0.4em; margin-left: 1em; } -.param-label, .slider-label { +.slider-label { float: left; font-weight: bold; } --- a/static/scripts/packed/trackster.js Thu Apr 14 16:51:40 2011 -0400 +++ b/static/scripts/packed/trackster.js Thu Apr 14 20:25:54 2011 -0400 @@ -1,1 +1,1 @@ -var extend=function(){var c=arguments[0];for(var b=1;b<arguments.length;b++){var a=arguments[b];for(key in a){c[key]=a[key]}}return c};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 trackster_module=function(f,R){var p=f("slotting"),G=f("painters");var X=function(Y,Z){this.document=Y;this.default_font=Z!==undefined?Z:"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(X.prototype,{load_pattern:function(Y,ac){var Z=this.patterns,aa=this.dummy_context,ab=new Image();ab.src=image_path+ac;ab.onload=function(){Z[Y]=aa.createPattern(ab,"repeat")}},get_pattern:function(Y){return this.patterns[Y]},new_canvas:function(){var Y=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(Y)}Y.manager=this;return Y}});var B=function(Y,Z){Y.bind("drag",{handle:Z,relative:true},function(ad,ae){var ac=$(this).parent();var ab=ac.children();var aa;for(aa=0;aa<ab.length;aa++){if(ae.offsetY<$(ab.get(aa)).position().top){break}}if(aa===ab.length){if(this!==ab.get(aa-1)){ac.append(this)}}else{if(this!==ab.get(aa)){$(this).insertBefore(ab.get(aa))}}})};var h=function(aa,Y){var Z=Y-aa;return(Z<=2?0.01:(Z<=100?1:(Z<=1000?5:10)))};var C=9,z=10,M=C+2,w=100,D=12000,K=200,s=10,F=5000,t=100,n="There was an error in indexing this dataset. ",E="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",A="No data for this chrom/contig.",q="Currently indexing... please wait",v="Tool cannot be rerun: ",a="Loading data...",S="Ready for display",d=10,r=5,y=5;function u(Y){return Math.round(Y*1000)/1000}var c=function(Y){this.num_elements=Y;this.clear()};extend(c.prototype,{get:function(Z){var Y=this.key_ary.indexOf(Z);if(Y!==-1){this.move_key_to_end(Z,Y)}return this.obj_cache[Z]},set:function(Z,aa){if(!this.obj_cache[Z]){if(this.key_ary.length>=this.num_elements){var Y=this.key_ary.shift();delete this.obj_cache[Y]}this.key_ary.push(Z)}this.obj_cache[Z]=aa;return aa},move_key_to_end:function(Z,Y){this.key_ary.splice(Y,1);this.key_ary.push(Z)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var L=function(Z,Y,aa){c.call(this,Z);this.track=Y;this.subset=(aa!==undefined?aa:true)};extend(L.prototype,c.prototype,{load_data:function(ag,ah,ac,af,Z,ae){if(this.track.track_type=="ReferenceTrack"&&Z>1){return}var ab={chrom:ag,low:ah,high:ac,mode:af,resolution:Z,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(ab,ae);if(this.track.filters_manager){var ai=[];var Y=this.track.filters_manager.filters;for(var ad=0;ad<Y.length;ad++){ai[ai.length]=Y[ad].name}ab.filter_cols=JSON.stringify(ai)}var aa=this;return $.getJSON(this.track.data_url,ab,function(aj){aa.set_data(ah,ac,af,aj)})},get_data:function(aa,Y,ad,ae,Z,ac){var ab=this.get(this.gen_key(Y,ad,ae));if(ab){return ab}ab=this.load_data(aa,Y,ad,ae,Z,ac);this.set_data(Y,ad,ae,ab);return ab},set_data:function(Z,aa,ab,Y){return this.set(this.gen_key(Z,aa,ab),Y)},gen_key:function(Y,aa,ab){var Z=Y+"_"+aa+"_"+ab;return Z},split_key:function(Y){return Y.split("_")}});var W=function(Y,ab,aa,Z,ac){this.container=Y;this.chrom=null;this.vis_id=aa;this.dbkey=Z;this.title=ab;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(ac);this.canvas_manager=new X(Y.get(0).ownerDocument);this.reset()};extend(W.prototype,{init:function(ab){var aa=this.container,Y=this;this.top_container=$("<div/>").addClass("top-container").appendTo(aa);this.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").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").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").appendTo(this.nav_controls);this.location_span.bind("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 id='zoom-out' />").click(function(){Y.zoom_out();Y.redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){Y.zoom_in();Y.redraw()}).appendTo(this.nav_controls);this.load_chroms({low:0},ab);this.chrom_select.bind("change",function(){Y.change_chrom(Y.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(ac){$(this).find("input").trigger("blur")});this.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.bind("click",function(){for(var ad=0,ac=Y.tracks.length;ad<ac;ad++){Y.tracks[ad].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",Y.overview_box.height());Y.overview_highlight.hide();$(this).hide()});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){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.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),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.redraw()});this.add_label_track(new V(this,this.top_labeltrack));this.add_label_track(new V(this,this.nav_labeltrack));$(window).bind("resize",function(){Y.resize_window()});$(document).bind("redraw",function(){Y.redraw()});this.reset();$(window).trigger("resize")},update_location:function(Y,Z){this.location_span.text(commatize(Y)+" - "+commatize(Z));this.nav_input.val(this.chrom+":"+commatize(Y)+"-"+commatize(Z))},load_chroms:function(Z,aa){Z.num=t;$.extend(Z,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var Y=this;$.ajax({url:chrom_url,data:Z,dataType:"json",success:function(ac){if(ac.chrom_info.length===0){alert("Invalid chromosome: "+Z.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);if(aa){aa()}Y.chrom_start_index=ac.start_index},error:function(){alert("Could not load chroms for this dbkey:",Y.dbkey)}})},change_chrom:function(ac,Z,ae){if(!ac||ac==="None"){return}var ab=this;if(ac==="previous"){ab.load_chroms({low:this.chrom_start_index-t});return}if(ac==="next"){ab.load_chroms({low:this.chrom_start_index+t});return}var ad=$.grep(ab.chrom_data,function(ag,ah){return ag.chrom===ac})[0];if(ad===undefined){ab.load_chroms({chrom:ac},function(){ab.change_chrom(ac,Z,ae)});return}else{if(ac!==ab.chrom){ab.chrom=ac;if(!ab.chrom){ab.intro_div.show()}else{ab.intro_div.hide()}ab.chrom_select.val(ab.chrom);ab.max_high=ad.len-1;ab.reset();ab.redraw(true);for(var af=0,Y=ab.tracks.length;af<Y;af++){var aa=ab.tracks[af];if(aa.init){aa.init()}}}if(Z!==undefined&&ae!==undefined){ab.low=Math.max(Z,0);ab.high=Math.min(ae,ab.max_high)}ab.reset_overview();ab.redraw()}},go_to:function(ac){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].replace(/,/g,""),10);ab=parseInt(ad[1].replace(/,/g,""),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(aa){var Y=this;var Z=Y.high-Y.low;if(Y.low-aa<Y.max_low){Y.low=Y.max_low;Y.high=Y.max_low+Z}else{if(Y.high-aa>Y.max_high){Y.high=Y.max_high;Y.low=Y.max_high-Z}else{Y.high-=aa;Y.low-=aa}}Y.redraw()},add_track:function(Y){Y.view=this;Y.track_id=this.track_id_counter;this.tracks.push(Y);if(Y.init){Y.init()}Y.container_div.attr("id","track_"+Y.track_id);B(Y.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(Y){Y.view=this;this.label_tracks.push(Y)},remove_track:function(Y){this.has_changes=true;Y.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(Y)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(af){var ae=this.high-this.low,ad=this.low,Z=this.high;if(ad<this.max_low){ad=this.max_low}if(Z>this.max_high){Z=this.max_high}if(this.high!==0&&ae<this.min_separation){Z=ad+this.min_separation}this.low=Math.floor(ad);this.high=Math.ceil(Z);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/K)/Math.LN10));this.zoom_res=Math.pow(s,Math.max(0,Math.ceil(Math.log(this.resolution,s)/Math.log(s))));var Y=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ac=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ag=13;this.overview_box.css({left:Y,width:Math.max(ag,ac)}).show();if(ac<ag){this.overview_box.css("left",Y-(ag-ac)/2)}if(this.overview_highlight){this.overview_highlight.css({left:Y,width:ac})}this.update_location(this.low,this.high);if(!af){for(var aa=0,ab=this.tracks.length;aa<ab;aa++){if(this.tracks[aa]&&this.tracks[aa].enabled){this.tracks[aa].draw()}}for(aa=0,ab=this.label_tracks.length;aa<ab;aa++){this.label_tracks[aa].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.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.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").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()}});var o=function(Z,ac){this.track=Z;this.name=ac.name;this.params=[];var ak=ac.params;for(var aa=0;aa<ak.length;aa++){var af=ak[aa],Y=af.name,aj=af.label,ab=unescape(af.html),ah=af.type;if(ah==="number"){this.params[this.params.length]=new g(Y,aj,ab,af.min,af.max)}else{if(ah=="select"){this.params[this.params.length]=new I(Y,aj,ab)}else{console.log("WARNING: unrecognized tool parameter type:",Y,ah)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(am){am.stopPropagation()}).bind("click",function(am){am.stopPropagation()}).bind("dblclick",function(am){am.stopPropagation()});var ai=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ag=this.params;var ad=this;$.each(this.params,function(an,aq){var ap=$("<div>").addClass("param-row").appendTo(ad.parent_div);var am=$("<div>").addClass("param-label").text(aq.label).appendTo(ap);var ao=$("<div/>").addClass("slider").html(aq.html).appendTo(ap);$("<div style='clear: both;'/>").appendTo(ap)});this.parent_div.find("input").click(function(){$(this).select()});var al=$("<div>").addClass("slider-row").appendTo(this.parent_div);var ae=$("<input type='submit'>").attr("value","Run").appendTo(al);var ad=this;ae.click(function(){ad.run()})};extend(o.prototype,{get_param_values_dict:function(){var Y={};this.parent_div.find(":input").each(function(){var Z=$(this).attr("name"),aa=$(this).val();Y[Z]=JSON.stringify(aa)});return Y},get_param_values:function(){var Z=[];var Y={};this.parent_div.find(":input").each(function(){var aa=$(this).attr("name"),ab=$(this).val();if(aa){Z[Z.length]=ab}});return Z},run:function(){var Z={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name};$.extend(Z,this.get_param_values_dict());var ab=this.track,aa=Z.tool_id+ab.tool_region_and_parameters_str(Z.chrom,Z.low,Z.high),ac;if(ab.track_type==="FeatureTrack"){ac=new O(aa,view,ab.hda_ldda,undefined,{},{},ab)}this.track.add_track(ac);ac.content_div.text("Starting job.");var Y=function(){$.getJSON(run_tool_url,Z,function(ad){if(ad==="no converter"){ac.container_div.addClass("error");ac.content_div.text(E)}else{if(ad.error){ac.container_div.addClass("error");ac.content_div.text(v+ad.message)}else{if(ad==="pending"){ac.container_div.addClass("pending");ac.content_div.text("Converting input data so that it can be easily reused.");setTimeout(Y,2000)}else{ac.dataset_id=ad.dataset_id;ac.content_div.text("Running job.");ac.init()}}}})};Y()}});var I=function(Z,Y,aa){this.name=Z;this.label=Y;this.html=aa};var g=function(aa,Z,ac,ab,Y){I.call(this,aa,Z,ac);this.min=ab;this.max=Y};var j=function(Z,Y,aa){this.name=Z;this.index=Y;this.value=aa};var P=function(Z,Y){this.name=Z;this.index=Y;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};extend(P.prototype,{applies_to:function(Y){if(Y.length>this.index){return true}return false},keep:function(Y){if(!this.applies_to(Y)){return true}var Z=parseInt(Y[this.index]);return(isNaN(Z)||(Z>=this.low&&Z<=this.high))},update_attrs:function(Z){var Y=false;if(!this.applies_to(Z)){return Y}if(Z[this.index]<this.min){this.min=Math.floor(Z[this.index]);Y=true}if(Z[this.index]>this.max){this.max=Math.ceil(Z[this.index]);Y=true}return Y},update_ui_elt:function(){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",h(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var U=function(aa,ag){this.track=aa;this.filters=[];for(var ac=0;ac<ag.length;ac++){var Y=ag[ac];var Z=Y.name,af=Y.type,ad=Y.index;if(af==="int"||af==="float"){this.filters[ac]=new P(Z,ad)}else{this.filters[ac]=new j(Z,ad,af)}}var ae=function(ah,ai,aj){ah.click(function(){var ak=ai.text();max=parseFloat(aj.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(aj.slider("option","values")){input_size=2*input_size+1;multi_value=true}ai.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",ak).appendTo(ai).focus().select().click(function(al){al.stopPropagation()}).blur(function(){$(this).remove();ai.text(ak)}).keyup(function(ap){if(ap.keyCode===27){$(this).trigger("blur")}else{if(ap.keyCode===13){var an=aj.slider("option","min"),al=aj.slider("option","max"),ao=function(aq){return(isNaN(aq)||aq>al||aq<an)},am=$(this).val();if(!multi_value){am=parseFloat(am);if(ao(am)){alert("Parameter value must be in the range ["+an+"-"+al+"]");return $(this)}}else{am=am.split("-");am=[parseFloat(am[0]),parseFloat(am[1])];if(ao(am[0])||ao(am[1])){alert("Parameter value must be in the range ["+an+"-"+al+"]");return $(this)}}aj.slider((multi_value?"values":"value"),am)}}})})};this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(ah){ah.stopPropagation()}).bind("click",function(ah){ah.stopPropagation()}).bind("dblclick",function(ah){ah.stopPropagation()});var ab=this;$.each(this.filters,function(an,ai){var ak=$("<div/>").addClass("slider-row").appendTo(ab.parent_div);var ah=$("<div/>").addClass("slider-label").appendTo(ak);var ap=$("<span/>").addClass("slider-name").text(ai.name+" ").appendTo(ah);var aj=$("<span/>");var al=$("<span/>").addClass("slider-value").appendTo(ah).append("[").append(aj).append("]");var ao=$("<div/>").addClass("slider").appendTo(ak);ai.control_element=$("<div/>").attr("id",ai.name+"-filter-control").appendTo(ao);var am=[0,0];ai.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(aq,ar){am=ar.values;aj.text(ar.values[0]+"-"+ar.values[1]);setTimeout(function(){if(ar.values[0]==am[0]&&ar.values[1]==am[1]){var at=ar.values;aj.text(at[0]+"-"+at[1]);ai.low=at[0];ai.high=at[1];ab.track.draw(true,true)}},50)},change:function(aq,ar){ai.control_element.slider("option","slide").call(ai.control_element,aq,ar)}});ai.slider=ai.control_element;ai.slider_label=aj;ae(al,aj,ai.control_element);$("<div style='clear: both;'/>").appendTo(ak)})};var T=function(Y){this.track=Y.track;this.params=Y.params;this.values={};if(Y.saved_values){this.restore_values(Y.saved_values)}this.onchange=Y.onchange};extend(T.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 Z=this;var Y=$("<div />");$.each(this.params,function(ad,ab){if(!ab.hidden){var aa="param_"+ad;var ai=$("<div class='form-row' />").appendTo(Y);ai.append($("<label />").attr("for",aa).text(ab.label+":"));if(ab.type==="bool"){ai.append($('<input type="checkbox" />').attr("id",aa).attr("name",aa).attr("checked",Z.values[ab.key]))}else{if(ab.type==="color"){var af=Z.values[ab.key];var ae=$("<input />").attr("id",aa).attr("name",aa).val(af);var ag=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var ac=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(ag);var ah=$("<div/>").appendTo(ac).farbtastic({width:100,height:100,callback:ae,color:af});$("<div />").append(ae).append(ag).appendTo(ai).bind("click",function(aj){ag.css({left:$(this).position().left+($(ae).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){ag.hide();$(document).unbind("click.color-picker")});aj.stopPropagation()})}else{ai.append($("<input />").attr("id",aa).attr("name",aa).val(Z.values[ab.key]))}}}});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()}}});var b=function(aa,Z,Y){this.index=aa;this.resolution=Z;this.canvas=$("<div class='track-tile'/>").append(Y)};var m=function(aa,Z,Y,ab){b.call(this,aa,Z,Y);this.max_val=ab};var J=function(aa,Z,Y){b.call(this,aa,Z,Y)};var k=function(Z,Y,ac,aa,ab){this.name=Z;this.view=Y;this.parent_element=ac;this.data_url=(aa?aa:default_data_url);this.data_url_extra_params={};this.data_query_wait=(ab?ab:F);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};extend(k.prototype,{init:function(){var Y=this;Y.enabled=false;Y.tile_cache.clear();Y.data_cache.clear();Y.initial_canvas=undefined;Y.content_div.css("height","auto");Y.container_div.removeClass("nodata error pending");if(!Y.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:Y.hda_ldda,dataset_id:Y.dataset_id,chrom:Y.view.chrom},function(Z){if(!Z||Z==="error"||Z.kind==="error"){Y.container_div.addClass("error");Y.content_div.text(n);if(Z.message){var ab=Y.view.tracks.indexOf(Y);var aa=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+Z.message+"</pre>",{Close:hide_modal})});Y.content_div.append(aa)}}else{if(Z==="no converter"){Y.container_div.addClass("error");Y.content_div.text(E)}else{if(Z==="no data"||(Z.data!==undefined&&(Z.data===null||Z.data.length===0))){Y.container_div.addClass("nodata");Y.content_div.text(A)}else{if(Z==="pending"){Y.container_div.addClass("pending");Y.content_div.text(q);setTimeout(function(){Y.init()},Y.data_query_wait)}else{if(Z.status==="data"){if(Z.valid_chroms){Y.valid_chroms=Z.valid_chroms;Y.make_name_popup_menu()}Y.content_div.text(S);if(Y.view.chrom){Y.content_div.text("");Y.content_div.css("height",Y.height_px+"px");Y.enabled=true;$.when(Y.predraw_init()).done(function(){Y.container_div.removeClass("nodata error pending");Y.draw()})}}}}}}})},predraw_init:function(){},update_name:function(Y){this.old_name=this.name;this.name=Y;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var H=function(ag,ae,ah){var Z=this,ai=Z.view;this.filters_manager=(ag!==undefined?new U(this,ag):undefined);this.filters_available=false;this.filters_visible=false;this.tool=(ae!==undefined&&obj_length(ae)>0?new o(this,ae):undefined);this.parent_track=ah;this.child_tracks=[];if(Z.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}Z.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();Z.container_div.append(Z.child_tracks_container);if(this.filters_manager){this.filters_div=this.filters_manager.parent_div;this.header_div.after(this.filters_div)}if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}if(Z.display_modes!==undefined){if(Z.mode_div===undefined){Z.mode_div=$("<div class='right-float menubutton popup' />").appendTo(Z.header_div);var ab=(Z.track_config&&Z.track_config.values.mode?Z.track_config.values.mode:Z.display_modes[0]);Z.mode=ab;Z.mode_div.text(ab);var aa=function(aj){Z.mode_div.text(aj);Z.mode=aj;Z.track_config.values.mode=aj;Z.tile_cache.clear();Z.draw()};var Y={};for(var ac=0,af=Z.display_modes.length;ac<af;ac++){var ad=Z.display_modes[ac];Y[ad]=function(aj){return function(){aa(aj)}}(ad)}make_popupmenu(Z.mode_div,Y)}else{Z.mode_div.hide()}}this.make_name_popup_menu()};extend(H.prototype,k.prototype,{make_name_popup_menu:function(){var Z=this;var Y={};Y["Edit configuration"]=function(){var af=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ad=function(){Z.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(ag){if((ag.keyCode||ag.which)===27){af()}else{if((ag.keyCode||ag.which)===13){ad()}}};$(window).bind("keypress.check_enter_esc",ae);show_modal("Configure Track",Z.track_config.build_form(),{Cancel:af,OK:ad})};if(Z.filters_available>0){var ac=(Z.filters_div.is(":visible")?"Hide filters":"Show filters");Y[ac]=function(){Z.filters_visible=(Z.filters_div.is(":visible"));Z.filters_div.toggle();Z.make_name_popup_menu()}}if(Z.tool){var ac=(Z.dynamic_tool_div.is(":visible")?"Hide tool":"Show tool");Y[ac]=function(){if(!Z.dynamic_tool_div.is(":visible")){Z.update_name(Z.name+Z.tool_region_and_parameters_str())}else{menu_option_text="Show dynamic tool";Z.revert_name()}Z.dynamic_tool_div.toggle();Z.make_name_popup_menu()}}if(Z.valid_chroms){Y["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+Z.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}var aa=view;var ab=function(){$("#no-tracks").show()};if(this.parent_track){aa=this.parent_track;ab=function(){}}Y.Remove=function(){aa.remove_track(Z);if(aa.num_tracks===0){ab()}};make_popupmenu(Z.name_div,Y)},draw:function(Y,aa){var ar=this.view.low,ae=this.view.high,ag=ae-ar,ai=this.view.container.width(),ac=ai/ag,aj=this.view.resolution,ab=$("<div style='position: relative;'></div>"),ak=function(au,av,at){return au+"_"+av+"_"+at};if(!aa){this.content_div.children().remove()}this.content_div.append(ab);this.max_height=0;var am=Math.floor(ar/aj/K);var ad=[];var an=0;while((am*K*aj)<ae){var aq=ak(ai,ac,am);var af=this.tile_cache.get(aq);var ao=am*K*this.view.resolution;var Z=ao+K*this.view.resolution;if(!Y&&af){ad[ad.length]=af;this.show_tile(af,ab,ao,ac)}else{this.delayed_draw(Y,aq,am,aj,ab,ac,ad)}am+=1;an++}var ah=this;var ap=setInterval(function(){if(ad.length===an){clearInterval(ap);if(aa){var aw=ah.content_div.children();var ax=false;for(var av=aw.length-1,aB=0;av>=aB;av--){var au=$(aw[av]);if(ax){au.remove()}else{if(au.children().length!==0){ax=true}}}}if(ah.track_type=="FeatureTrack"&&ah.mode=="Histogram"){var aA=-1;for(var av=0;av<ad.length;av++){var aD=ad[av].max_val;if(aD>aA){aA=aD}}for(var av=0;av<ad.length;av++){if(ad[av].max_val!==aA){var aC=ad[av];aC.canvas.remove();ah.delayed_draw(true,ak(ai,ac,aC.index),aC.index,aC.resolution,ab,ac,[],{max:aA})}}}if(ah.filters_manager){var at=ah.filters_manager.filters;for(var az=0;az<at.length;az++){at[az].update_ui_elt()}var ay=false;if(ah.example_feature){for(var az=0;az<at.length;az++){if(at[az].applies_to(ah.example_feature)){ay=true;break}}}if(ah.filters_available!==ay){ah.filters_available=ay;if(!ah.filters_available){ah.filters_div.hide()}ah.make_name_popup_menu()}}}},50);for(var al=0;al<this.child_tracks.length;al++){this.child_tracks[al].draw(Y,aa)}},delayed_draw:function(Z,ag,aa,ac,ah,ak,ai,ad){var ab=this,ae=aa*K*ac,aj=ae+K*ac;var af=function(at,al,an,am,aq,ar,ao){var ap=ab.draw_tile(al,an,am,ar,ao);ab.tile_cache.set(ag,ap);ab.show_tile(ap,aq,ae,ar);ai[ai.length]=ap};var Y=setTimeout(function(){if(ae<=ab.view.high&&aj>=ab.view.low){var al=(Z?undefined:ab.tile_cache.get(ag));if(al){ab.show_tile(al,ah,ae,ak);ai[ai.length]=al}else{$.when(ab.data_cache.get_data(view.chrom,ae,aj,ab.mode,ac,ab.data_url_extra_params)).then(function(am){extend(am,ad);if(view.reference_track&&ak>view.canvas_manager.char_width_px){$.when(view.reference_track.data_cache.get_data(view.chrom,ae,aj,ab.mode,ac,view.reference_track.data_url_extra_params)).then(function(an){af(Y,am,ac,aa,ah,ak,an)})}else{af(Y,am,ac,aa,ah,ak)}})}}},50)},show_tile:function(ab,ae,ac,af){var Z=this;var aa=this.view.high-this.view.low,ad=(ac-this.view.low)*af;if(this.left_offset){ad-=this.left_offset}var Y=ab.canvas;Y.css({position:"absolute",top:0,left:ad,height:""});ae.append(Y);Z.max_height=Math.max(Z.max_height,Y.height());Z.content_div.css("height",Z.max_height+"px");ae.children().css("height",Z.max_height+"px")},set_overview:function(){var Y=this.view;if(this.initial_canvas&&this.is_overview){Y.overview_close.show();Y.overview_viewport.append(this.initial_canvas);Y.overview_highlight.show().height(this.initial_canvas.height());Y.overview_viewport.height(this.initial_canvas.height()+Y.overview_box.height())}$(window).trigger("resize")},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(", ")+"]"},add_track:function(Y){Y.track_id=this.track_id+"_"+this.child_tracks.length;Y.container_div.attr("id","track_"+Y.track_id);this.child_tracks_container.append(Y.container_div);B(Y.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(Y);this.view.has_changes=true},remove_track:function(Y){Y.container_div.fadeOut("slow",function(){$(this).remove()})}});var V=function(Y,Z){this.track_type="LabelTrack";this.hidden=true;k.call(this,null,Y,Z);this.container_div.addClass("label-track")};extend(V.prototype,k.prototype,{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 x=function(Y){this.track_type="ReferenceTrack";this.hidden=true;k.call(this,null,Y,Y.top_labeltrack);H.call(this);Y.reference_track=this;this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:Y.dbkey};this.data_cache=new L(y,this,false);this.tile_cache=new c(r)};extend(x.prototype,H.prototype,{draw_tile:function(ag,ad,Z,ai){var ac=this,aa=K*ad;if(ai>this.view.canvas_manager.char_width_px){if(ag===null){ac.content_div.css("height","0px");return}var ab=this.view.canvas_manager.new_canvas();var ah=ab.getContext("2d");ab.width=Math.ceil(aa*ai+ac.left_offset);ab.height=ac.height_px;ah.font=ah.canvas.manager.default_font;ah.textAlign="center";for(var ae=0,af=ag.length;ae<af;ae++){var Y=Math.round(ae*ai);ah.fillText(ag[ae],Y+ac.left_offset,10)}return new b(Z,ad,ab)}this.content_div.css("height","0px")}});var l=function(ac,aa,ad,Y,ab){var Z=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";k.call(this,ac,aa,aa.viewport_container);H.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=ad;this.dataset_id=Y;this.original_dataset_id=Y;this.data_cache=new L(y,this);this.tile_cache=new c(r);this.track_config=new T({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:ab,onchange:function(){Z.vertical_range=Z.prefs.max_value-Z.prefs.min_value;$("#linetrack_"+Z.track_id+"_minval").text(Z.prefs.min_value);$("#linetrack_"+Z.track_id+"_maxval").text(Z.prefs.max_value);Z.tile_cache.clear();Z.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;this.add_resize_handle()};extend(l.prototype,H.prototype,{add_resize_handle:function(){var Y=this;var ab=false;var aa=false;var Z=$("<div class='track-resize'>");$(Y.container_div).hover(function(){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.content_div).css("height",ac);Y.height_px=ac;Y.draw(true)}).bind("dragend",function(ac,ad){Y.tile_cache.clear();aa=false;if(!ab){Z.hide()}Y.track_config.values.height=Y.height_px}).appendTo(Y.container_div)},predraw_init:function(){var Y=this,Z=Y.view.tracks.indexOf(Y);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(aa){Y.container_div.addClass("line-track");var ac=aa.data;if(isNaN(parseFloat(Y.prefs.min_value))||isNaN(parseFloat(Y.prefs.max_value))){Y.prefs.min_value=ac.min;Y.prefs.max_value=ac.max;$("#track_"+Z+"_minval").val(Y.prefs.min_value);$("#track_"+Z+"_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 />").addClass("yaxislabel").attr("id","linetrack_"+Z+"_minval").text(u(Y.prefs.min_value));var ab=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+Z+"_maxval").text(u(Y.prefs.max_value));ab.css({position:"absolute",top:"24px",left:"10px"});ab.prependTo(Y.container_div);ad.css({position:"absolute",bottom:"2px",left:"10px"});ad.prependTo(Y.container_div)})},draw_tile:function(ai,ac,Z,ah){if(this.vertical_range===undefined){return}var ad=Z*K*ac,ab=K*ac,Y=Math.ceil(ab*ah),af=this.height_px;var aa=this.view.canvas_manager.new_canvas();aa.width=Y,aa.height=af;var ag=aa.getContext("2d");var ae=new G.LinePainter(ai.data,ad,ad+ab,this.prefs,this.mode);ae.draw(ag,Y,af);return new b(ab,ac,aa)}});var e=function(Y,ad,ac,ag,af,aa,ab,ae){var Z=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];this.track_config=new T({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:af,onchange:function(){Z.tile_cache.clear();Z.draw()}});this.prefs=this.track_config.values;k.call(this,Y,ad,ad.viewport_container);H.call(this,aa,ab,ae);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=ac;this.dataset_id=ag;this.original_dataset_id=ag;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_cache=new L(20,this);this.left_offset=200;this.painter=G.LinkedFeaturePainter};extend(e.prototype,H.prototype,{update_auto_mode:function(Y){if(this.mode=="Auto"){if(Y=="no_detail"){Y="feature spans"}else{if(Y=="summary_tree"){Y="coverage histogram"}}this.mode_div.text("Auto ("+Y+")")}},incremental_slots:function(ac,Z,ab){var aa=this.view.canvas_manager.dummy_context,Y=this.inc_slots[ac];if(!Y||(Y.mode!==ab)){Y=new (p.FeatureSlotter)(ac,ab==="Pack",w,function(ad){return aa.measureText(ad)});Y.mode=ab;this.inc_slots[ac]=Y}return Y.slot_features(Z)},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}},draw_tile:function(al,au,ay,ah,ab){var aq=this,aA=ay*K*au,Z=(ay+1)*K*au,an=Z-aA,ar=Math.ceil(an*ah),ap=this.mode,aE=25,ac=this.left_offset,am,ad;if(ap==="Auto"){if(al.dataset_type==="summary_tree"){ap=al.dataset_type}else{if(al.extra_info==="no_detail"){ap="no_detail"}else{var aD=al.data;if(this.view.high-this.view.low>D){ap="Squish"}else{ap="Pack"}}}this.update_auto_mode(ap)}if(ap==="summary_tree"||ap==="Histogram"){ad=this.summary_draw_height;this.container_div.find(".yaxislabel").remove();var Y=$("<div />").addClass("yaxislabel");Y.text(al.max);Y.css({position:"absolute",top:"22px",left:"10px"});Y.prependTo(this.container_div);var aa=this.view.canvas_manager.new_canvas();aa.width=ar+ac;aa.height=ad+M;if(al.dataset_type!="summary_tree"){var ai=this.get_summary_tree_data(al.data,aA,Z,200);if(al.max){ai.max=al.max}al=ai}var aB=new G.SummaryTreePainter(al,aA,Z,this.prefs);var at=aa.getContext("2d");at.translate(ac,M);aB.draw(at,ar,ad);return new m(ay,au,aa,al.max)}var am,af=1;if(ap==="no_detail"||ap==="Squish"||ap==="Pack"){af=this.incremental_slots(ah,al.data,ap);am=this.inc_slots[ah].slots}var ag=[];if(al.data){var aj=this.filters_manager.filters;for(var av=0,ax=al.data.length;av<ax;av++){var ae=al.data[av];var aw=false;var ak;for(var az=0,aC=aj.length;az<aC;az++){ak=aj[az];ak.update_attrs(ae);if(!ak.keep(ae)){aw=true;break}}if(!aw){ag.push(ae)}}}var aB=new (this.painter)(ag,aA,Z,this.prefs,ap,ab);var ad=aB.get_required_height(af)+z;var aa=this.view.canvas_manager.new_canvas();aa.width=ar+ac;aa.height=ad;var at=aa.getContext("2d");at.fillStyle=this.prefs.block_color;at.font=at.canvas.manager.default_font;at.textAlign="right";this.container_div.find(".yaxislabel").remove();if(al.message){$(aa).css({"border-top":"1px solid red"});at.fillStyle="red";at.textAlign="left";var ao=at.textBaseline;at.textBaseline="top";at.fillText(al.message,ac,0);at.textBaseline=ao;if(!al.data){return new b(ay,au,aa,ad)}}this.example_feature=(al.data.length?al.data[0]:undefined);at.translate(ac,z);aB.draw(at,ar,ad,am);return new J(ay,au,aa)}});var N=function(ab,Z,ad,Y,aa,ac){e.call(this,ab,Z,ad,Y,aa,ac);this.track_type="VcfTrack";this.painter=G.VariantPainter};extend(N.prototype,H.prototype,e.prototype);var Q=function(ab,Z,ad,Y,aa,ac){e.call(this,ab,Z,ad,Y,aa,ac);this.track_config=new T({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:aa,onchange:function(){this.track.tile_cache.clear();this.track.draw()}});this.prefs=this.track_config.values;this.track_type="ReadTrack";this.painter=G.ReadPainter;this.make_name_popup_menu()};extend(Q.prototype,H.prototype,e.prototype);var O=function(ac,aa,ae,Y,ab,ad,Z){e.call(this,ac,aa,ae,Y,ab,ad,{},Z);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};extend(O.prototype,H.prototype,e.prototype,{predraw_init:function(){var Z=this;var Y=function(){if(Z.data_cache.size()===0){setTimeout(Y,300)}else{Z.data_url=default_data_url;Z.data_query_wait=F;Z.dataset_state_url=converted_datasets_state_url;$.getJSON(Z.dataset_state_url,{dataset_id:Z.dataset_id,hda_ldda:Z.hda_ldda},function(aa){})}};Y()}});R.View=W;R.LineTrack=l;R.FeatureTrack=e;R.ReadTrack=Q};var slotting_module=function(c,b){var d=2,a=5;b.FeatureSlotter=function(h,g,e,f){this.slots={};this.start_end_dct={};this.w_scale=h;this.include_label=g;this.max_rows=e;this.measureText=f};extend(b.FeatureSlotter.prototype,{slot_features:function(l){var o=this.w_scale,r=this.slots,g=this.start_end_dct,x=[],z=[],m=0,y=this.max_rows;for(var v=0,w=l.length;v<w;v++){var k=l[v],n=k[0];if(r[n]!==undefined){m=Math.max(m,r[n]);z.push(r[n])}else{x.push(v)}}var p=function(F,G){for(var E=0;E<=y;E++){var C=false,H=g[E];if(H!==undefined){for(var B=0,D=H.length;B<D;B++){var A=H[B];if(G>A[0]&&F<A[1]){C=true;break}}}if(!C){return E}}return -1};for(var v=0,w=x.length;v<w;v++){var k=l[x[v]],n=k[0],t=k[1],e=k[2],q=k[3],f=Math.floor(t*o),j=Math.ceil(e*o),u=this.measureText(q).width,h;if(q!==undefined&&this.include_label){u+=(d+a);if(f-u>=0){f-=u;h="left"}else{j+=u;h="right"}}var s=p(f,j);if(s>=0){if(g[s]===undefined){g[s]=[]}g[s].push([f,j]);r[n]=s;m=Math.max(m,s)}else{}}return m+1}})};var painters_module=function(j,v){var o=function(G,y,E,x,D,B){if(B===undefined){B=4}var A=x-y;var z=D-E;var C=Math.floor(Math.sqrt(A*A+z*z)/B);var H=A/C;var F=z/C;var w;for(w=0;w<C;w++,y+=H,E+=F){if(w%2!==0){continue}G.fillRect(y,E,B,1)}};var p=function(z,x,w,C){var B=x-C/2,A=x+C/2,D=w-Math.sqrt(C*3/2);z.beginPath();z.moveTo(B,D);z.lineTo(A,D);z.lineTo(x,w);z.lineTo(B,D);z.strokeStyle=this.fillStyle;z.fill();z.stroke();z.closePath()};var l=function(y,A,w,x,z){this.data=y;this.view_start=A;this.view_end=w;this.prefs=extend({},this.default_prefs,x);this.mode=z};l.prototype.default_prefs={};var t=function(y,A,w,x,z){l.call(this,y,A,w,x,z)};t.prototype.default_prefs={show_counts:false};t.prototype.draw=function(L,w,K){var D=this.view_start,N=this.view_end-this.view_start,M=w/N;var I=this.data.data,H=this.data.delta,F=this.data.max,A=K;delta_x_px=Math.ceil(H*M);L.save();for(var B=0,C=I.length;B<C;B++){var G=Math.floor((I[B][0]-D)*M);var E=I[B][1];if(!E){continue}var J=E/F*K;if(E!==0&&J<1){J=1}L.fillStyle="black";L.fillRect(G,A-J,delta_x_px,J);var z=4;if(this.prefs.show_counts&&(L.measureText(E).width+z)<delta_x_px){L.fillStyle="#666";L.textAlign="center";L.fillText(E,G+(delta_x_px/2),10)}}L.restore()};var c=function(y,A,w,x,z){l.call(this,y,A,w,x,z)};c.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};c.prototype.draw=function(M,L,J){var E=false,F=this.prefs.min_value,C=this.prefs.max_value,I=C-F,x=J,z=this.view_start,K=this.view_end-this.view_start,A=L/K,G=this.mode,Q=this.data;M.save();var R=Math.round(J+F/I*J);if(G!=="Intensity"){M.fillStyle="#aaa";M.fillRect(0,R,L,1)}M.beginPath();M.fillStyle=this.prefs.color;var P,D,B;if(Q.length>1){B=Math.ceil((Q[1][0]-Q[0][0])*A)}else{B=10}for(var N=0,O=Q.length;N<O;N++){P=Math.round((Q[N][0]-z)*A);D=Q[N][1];if(D===null){if(E&&G==="Filled"){M.lineTo(P,x)}E=false;continue}if(D<F){D=F}else{if(D>C){D=C}}if(G==="Histogram"){D=Math.round(D/I*x);M.fillRect(P,R,B,-D)}else{if(G==="Intensity"){D=255-Math.floor((D-F)/I*255);M.fillStyle="rgb("+D+","+D+","+D+")";M.fillRect(P,0,B,x)}else{D=Math.round(x-(D-F)/I*x);if(E){M.lineTo(P,D)}else{E=true;if(G==="Filled"){M.moveTo(P,x);M.lineTo(P,D)}else{M.moveTo(P,D)}}}}}if(G==="Filled"){if(E){M.lineTo(P,R);M.lineTo(0,R)}M.fill()}else{M.stroke()}var w=-1,H=-1;M.fillStyle=this.prefs.overflow_color;for(var N=0,O=Q.length;N<O;N++){D=Q[N][1];P=Math.round((Q[N][0]-z)*A);x_minus_scaled=Math.round((Q[N][0]-1-z)*A);if(H>=0&&(D===null||D<C)){M.fillRect(H,0,x_minus_scaled-H+1,2);H=-1}else{if(w>=0&&(D===null||D>F)){M.fillRect(w,J-2,x_minus_scaled-w+1,2);w=-1}}if(D!==null&&D>C&&H<0){H=P}else{if(D!==null&&D<F&&w<0){w=P}}}M.restore()};var n=function(y,A,w,x,z){l.call(this,y,A,w,x,z)};n.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};extend(n.prototype,{get_required_height:function(x){var w=y_scale=this.get_row_height(),y=this.mode;if(y==="no_detail"||y==="Squish"||y==="Pack"){w=x*y_scale}return w+Math.max(Math.round(y_scale/2),5)},draw:function(I,z,H,E){var C=this.data,F=this.view_start,J=this.view_end;I.save();I.fillStyle=this.prefs.block_color;I.textAlign="right";var M=this.view_end-this.view_start,L=z/M,y=this.get_row_height();for(var B=0,D=C.length;B<D;B++){var K=C[B],A=K[0],w=K[1],x=K[2],G=(E&&E[A]!==undefined?E[A]:null);if((w<J&&x>F)&&(this.mode=="Dense"||G!==null)){this.draw_element(I,this.mode,K,G,F,J,L,y,z)}}I.restore()}});var d=10,h=3,k=5,u=10,f=1,r=3,e=3,a=9,m=2,g="#ccc";var q=function(y,A,w,x,z){n.call(this,y,A,w,x,z)};extend(q.prototype,n.prototype,{get_row_height:function(){var x=this.mode,w;if(x==="Dense"){w=d}else{if(x==="no_detail"){w=h}else{if(x==="Squish"){w=k}else{w=u}}}return w},draw_element:function(I,B,Q,D,K,aa,ae,af,w){var N=Q[0],ac=Q[1],U=Q[2],L=Q[3],V=Math.floor(Math.max(0,(ac-K)*ae)),J=Math.ceil(Math.min(w,Math.max(0,(U-K)*ae))),T=(B==="Dense"?0:(0+D))*af,H,Y,M=null,ag=null,z=this.prefs.block_color,X=this.prefs.label_color;if(B=="Dense"){D=1}if(B==="no_detail"){I.fillStyle=z;I.fillRect(V,T+5,J-V,f)}else{var G=Q[4],S=Q[5],W=Q[6],A=Q[7];if(S&&W){M=Math.floor(Math.max(0,(S-K)*ae));ag=Math.ceil(Math.min(w,Math.max(0,(W-K)*ae)))}var ad,O;if(B==="Squish"||B==="Dense"){ad=1;O=e}else{ad=5;O=a}if(!A){if(Q.strand){if(Q.strand==="+"){I.fillStyle=I.canvas.manager.get_pattern("right_strand_inv")}else{if(Q.strand==="-"){I.fillStyle=I.canvas.manager.get_pattern("left_strand_inv")}}}else{I.fillStyle=z}I.fillRect(V,T,J-V,O)}else{var F,P;if(B==="Squish"||B==="Dense"){I.fillStyle=g;F=T+Math.floor(e/2)+1;P=1}else{if(G){var F=T;var P=O;if(G==="+"){I.fillStyle=I.canvas.manager.get_pattern("right_strand")}else{if(G==="-"){I.fillStyle=I.canvas.manager.get_pattern("left_strand")}}}else{I.fillStyle=g;F+=(e/2)+1;P=1}}I.fillRect(V,F,J-V,P);for(var ab=0,y=A.length;ab<y;ab++){var C=A[ab],x=Math.floor(Math.max(0,(C[0]-K)*ae)),R=Math.ceil(Math.min(w,Math.max((C[1]-K)*ae)));if(x>R){continue}I.fillStyle=z;I.fillRect(x,T+(O-ad)/2+1,R-x,ad);if(M!==undefined&&W>S&&!(x>ag||R<M)){var Z=Math.max(x,M),E=Math.min(R,ag);I.fillRect(Z,T+1,E-Z,O);if(A.length==1&&B=="Pack"){if(G==="+"){I.fillStyle=I.canvas.manager.get_pattern("right_strand_inv")}else{if(G==="-"){I.fillStyle=I.canvas.manager.get_pattern("left_strand_inv")}}if(Z+14<E){Z+=2;E-=2}I.fillRect(Z,T+1,E-Z,O)}}}}if(B==="Pack"&&ac>K){I.fillStyle=X;if(K===0&&V-I.measureText(L).width<0){I.textAlign="left";I.fillText(L,J+m,T+8)}else{I.textAlign="right";I.fillText(L,V-m,T+8)}I.fillStyle=z}}}});var b=function(y,A,w,x,z){n.call(this,y,A,w,x,z)};extend(b.prototype,n.prototype,{draw_element:function(P,K,E,A,S,y,H,Q,N){var E=data[i],G=E[0],O=E[1],z=E[2],J=E[3],C=Math.floor(Math.max(0,(O-S)*H)),F=Math.ceil(Math.min(N,Math.max(0,(z-S)*H))),B=(K==="Dense"?0:(0+A))*Q,w,T,x=null,I=null;if(no_label){P.fillStyle=block_color;P.fillRect(C+left_offset,B+5,F-C,1)}else{var R=E[4],M=E[5],D=E[6];w=9;T=1;P.fillRect(C+left_offset,B,F-C,w);if(K!=="Dense"&&J!==undefined&&O>S){P.fillStyle=label_color;if(S===0&&C-P.measureText(J).width<0){P.textAlign="left";P.fillText(J,F+2+left_offset,B+8)}else{P.textAlign="right";P.fillText(J,C-2+left_offset,B+8)}P.fillStyle=block_color}var L=R+" / "+M;if(O>S&&P.measureText(L).width<(F-C)){P.fillStyle="white";P.textAlign="center";P.fillText(L,left_offset+C+(F-C)/2,B+8);P.fillStyle=block_color}}}});var s=function(z,B,w,y,A,x){n.call(this,z,B,w,y,A);this.ref_seq=x};s.prototype.default_prefs=extend({},n.prototype.default_prefs,{show_insertions:false});extend(s.prototype,n.prototype,{get_row_height:function(){var w,x=this.mode;if(x==="Dense"){w=d}else{if(x==="Squish"){w=k}else{w=u;if(this.prefs.show_insertions){w*=2}}}return w},draw_read:function(S,N,J,X,y,R,G,D,C){S.textAlign="center";var Q=this,x=[X,y],M=0,T=0,P=0;ref_seq=this.ref_seq,char_width_px=S.canvas.manager.char_width_px;var ac=[];if((N==="Pack"||this.mode==="Auto")&&D!==undefined&&J>char_width_px){P=Math.round(J/2)}if(!G){G=[[0,D.length]]}for(var K=0,V=G.length;K<V;K++){var H=G[K],z="MIDNSHP=X"[H[0]],L=H[1];if(z==="H"||z==="S"){M-=L}var E=R+M,ab=Math.floor(Math.max(0,(E-X)*J)),F=Math.floor(Math.max(0,(E+L-X)*J));if(ab===F){F+=1}switch(z){case"H":break;case"S":case"M":case"=":if(is_overlap([E,E+L],x)){var O=D.slice(T,T+L);if(P>0){S.fillStyle=this.prefs.block_color;S.fillRect(ab-P,C+1,F-ab,9);S.fillStyle=g;for(var Z=0,w=O.length;Z<w;Z++){if(this.prefs.show_differences&&ref_seq){var I=ref_seq[E-X+Z];if(!I||I.toLowerCase()===O[Z].toLowerCase()){continue}}if(E+Z>=X&&E+Z<=y){var aa=Math.floor(Math.max(0,(E+Z-X)*J));S.fillText(O[Z],aa,C+9)}}}else{S.fillStyle=this.prefs.block_color;S.fillRect(ab,C+4,F-ab,e)}}T+=L;M+=L;break;case"N":S.fillStyle=g;S.fillRect(ab-P,C+5,F-ab,1);M+=L;break;case"D":S.fillStyle="red";S.fillRect(ab-P,C+4,F-ab,3);M+=L;break;case"P":break;case"I":var W=ab-P;if(is_overlap([E,E+L],x)){var O=D.slice(T,T+L);if(this.prefs.show_insertions){var B=ab-(F-ab)/2;if((N==="Pack"||this.mode==="Auto")&&D!==undefined&&J>char_width_px){S.fillStyle="yellow";S.fillRect(B-P,C-9,F-ab,9);ac[ac.length]={type:"triangle",data:[W,C+4,5]};S.fillStyle=g;switch(seq_tile_overlap){case (OVERLAP_START):O=O.slice(X-E);break;case (OVERLAP_END):O=O.slice(0,E-y);break;case (CONTAINED_BY):break;case (CONTAINS):O=O.slice(X-E,E-y);break}for(var Z=0,w=O.length;Z<w;Z++){var aa=Math.floor(Math.max(0,(E+Z-X)*J));S.fillText(O[Z],aa-(F-ab)/2,C)}}else{S.fillStyle="yellow";S.fillRect(B,C+(this.mode!=="Dense"?2:5),F-ab,(N!=="Dense"?e:r))}}else{if((N==="Pack"||this.mode==="Auto")&&D!==undefined&&J>char_width_px){ac[ac.length]={type:"text",data:[O.length,W,C+9]}}else{}}}T+=L;break;case"X":T+=L;break}}S.fillStyle="yellow";var Y,A,ad;for(var U=0;U<ac.length;U++){Y=ac[U];A=Y.type;ad=Y.data;if(A==="text"){S.save();S.font="bold "+S.font;S.fillText(ad[0],ad[1],ad[2]);S.restore()}else{if(A=="triangle"){p(S,ad[0],ad[1],ad[2])}}}},draw_element:function(P,K,C,z,S,x,G,Q,N){var F=C[0],O=C[1],y=C[2],H=C[3],B=Math.floor(Math.max(0,(O-S)*G)),D=Math.ceil(Math.min(N,Math.max(0,(y-S)*G))),A=(K==="Dense"?0:(0+z))*Q,T=this.prefs.block_color,E=this.prefs.label_color,M=0;if((K==="Pack"||this.mode==="Auto")&&G>P.canvas.manager.char_width_px){var M=Math.round(G/2)}P.fillStyle=T;if(C[5] instanceof Array){var L=Math.floor(Math.max(0,(C[4][0]-S)*G)),J=Math.ceil(Math.min(N,Math.max(0,(C[4][1]-S)*G))),I=Math.floor(Math.max(0,(C[5][0]-S)*G)),w=Math.ceil(Math.min(N,Math.max(0,(C[5][1]-S)*G)));if(C[4][1]>=S&&C[4][0]<=x&&C[4][2]){this.draw_read(P,K,G,S,x,C[4][0],C[4][2],C[4][3],A)}if(C[5][1]>=S&&C[5][0]<=x&&C[5][2]){this.draw_read(P,K,G,S,x,C[5][0],C[5][2],C[5][3],A)}if(I>J){P.fillStyle=g;o(P,J-M,A+5,I-M,A+5)}}else{P.fillStyle=T;this.draw_read(P,K,G,S,x,O,C[4],C[5],A)}if(K==="Pack"&&O>S){P.fillStyle=this.prefs.label_color;var R=1;if(R===0&&B-P.measureText(H).width<0){P.textAlign="left";P.fillText(H,D+m-M,A+8)}else{P.textAlign="right";P.fillText(H,B-m-M,A+8)}P.fillStyle=T}}});v.SummaryTreePainter=t;v.LinePainter=c;v.LinkedFeaturePainter=q;v.ReadPainter=s;v.VariantPainter=b};(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("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window); \ No newline at end of file +var class_module=function(b,a){var c=function(){var f=arguments[0];for(var e=1;e<arguments.length;e++){var d=arguments[e];for(key in d){f[key]=d[key]}}return f};a.extend=c};var 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 trackster_module=function(f,T){var o=f("class").extend,q=f("slotting"),I=f("painters");var Z=function(aa,ab){this.document=aa;this.default_font=ab!==undefined?ab:"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")};o(Z.prototype,{load_pattern:function(aa,ae){var ab=this.patterns,ac=this.dummy_context,ad=new Image();ad.src=image_path+ae;ad.onload=function(){ab[aa]=ac.createPattern(ad,"repeat")}},get_pattern:function(aa){return this.patterns[aa]},new_canvas:function(){var aa=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(aa)}aa.manager=this;return aa}});var C=function(aa,ab){aa.bind("drag",{handle:ab,relative:true},function(af,ag){var ae=$(this).parent();var ad=ae.children();var ac;for(ac=0;ac<ad.length;ac++){if(ag.offsetY<$(ad.get(ac)).position().top){break}}if(ac===ad.length){if(this!==ad.get(ac-1)){ae.append(this)}}else{if(this!==ad.get(ac)){$(this).insertBefore(ad.get(ac))}}})};T.sortable=C;var h=function(ac,aa){var ab=aa-ac;return(ab<=2?0.01:(ab<=100?1:(ab<=1000?5:10)))};var D=9,A=10,O=D+2,x=100,F=12000,M=200,t=10,H=5000,u=100,n="There was an error in indexing this dataset. ",G="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",B="No data for this chrom/contig.",r="Currently indexing... please wait",w="Tool cannot be rerun: ",a="Loading data...",U="Ready for display",d=10,s=5,z=5;function v(aa){return Math.round(aa*1000)/1000}var c=function(aa){this.num_elements=aa;this.clear()};o(c.prototype,{get:function(ab){var aa=this.key_ary.indexOf(ab);if(aa!==-1){this.move_key_to_end(ab,aa)}return this.obj_cache[ab]},set:function(ab,ac){if(!this.obj_cache[ab]){if(this.key_ary.length>=this.num_elements){var aa=this.key_ary.shift();delete this.obj_cache[aa]}this.key_ary.push(ab)}this.obj_cache[ab]=ac;return ac},move_key_to_end:function(ab,aa){this.key_ary.splice(aa,1);this.key_ary.push(ab)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var N=function(ab,aa,ac){c.call(this,ab);this.track=aa;this.subset=(ac!==undefined?ac:true)};o(N.prototype,c.prototype,{load_data:function(ai,aj,ae,ah,ab,ag){var ad={chrom:ai,low:aj,high:ae,mode:ah,resolution:ab,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(ad,ag);if(this.track.filters_manager){var ak=[];var aa=this.track.filters_manager.filters;for(var af=0;af<aa.length;af++){ak[ak.length]=aa[af].name}ad.filter_cols=JSON.stringify(ak)}var ac=this;return $.getJSON(this.track.data_url,ad,function(al){ac.set_data(aj,ae,ah,al)})},get_data:function(ac,aa,af,ag,ab,ae){var ad=this.get(this.gen_key(aa,af,ag));if(ad){return ad}ad=this.load_data(ac,aa,af,ag,ab,ae);this.set_data(aa,af,ag,ad);return ad},set_data:function(ab,ac,ad,aa){return this.set(this.gen_key(ab,ac,ad),aa)},gen_key:function(aa,ac,ad){var ab=aa+"_"+ac+"_"+ad;return ab},split_key:function(aa){return aa.split("_")}});var E=function(ab,aa,ac){N.call(this,ab,aa,ac)};o(E.prototype,N.prototype,c.prototype,{load_data:function(ac,aa,ae,af,ab,ad){if(ab>1){return}return N.prototype.load_data.call(this,ac,aa,ae,af,ab,ad)}});var Y=function(aa,ad,ac,ab,ae){this.container=aa;this.chrom=null;this.vis_id=ac;this.dbkey=ab;this.title=ad;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(ae);this.canvas_manager=new Z(aa.get(0).ownerDocument);this.reset()};o(Y.prototype,{init:function(ad){var ac=this.container,aa=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ac);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ac);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ac);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").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 ab=function(ae){if(ae.type==="focusout"||(ae.keyCode||ae.which)===13||(ae.keyCode||ae.which)===27){if((ae.keyCode||ae.which)!==27){aa.go_to($(this).val())}$(this).hide();$(this).val("");aa.location_span.show();aa.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ab).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").appendTo(this.nav_controls);this.location_span.bind("click",function(){aa.location_span.hide();aa.chrom_select.hide();aa.nav_input.val(aa.chrom+":"+aa.low+"-"+aa.high);aa.nav_input.css("display","inline-block");aa.nav_input.select();aa.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a id='zoom-out' />").click(function(){aa.zoom_out();aa.redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){aa.zoom_in();aa.redraw()}).appendTo(this.nav_controls);this.load_chroms({low:0},ad);this.chrom_select.bind("change",function(){aa.change_chrom(aa.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(ae){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(ae){aa.zoom_in(ae.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ae,af){this.current_x=af.offsetX}).bind("drag",function(ae,ag){var ah=ag.offsetX-this.current_x;this.current_x=ag.offsetX;var af=Math.round(ah/aa.viewport_container.width()*(aa.max_high-aa.max_low));aa.move_delta(-af)});this.overview_close.bind("click",function(){for(var af=0,ae=aa.tracks.length;af<ae;af++){aa.tracks[af].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",aa.overview_box.height());aa.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(ae,af){if(ae.clientX>aa.viewport_container.width()-16){return false}}).bind("dragstart",function(ae,af){af.original_low=aa.low;af.current_height=ae.clientY;af.current_x=af.offsetX}).bind("drag",function(ag,ai){var ae=$(this);var aj=ai.offsetX-ai.current_x;var af=ae.scrollTop()-(ag.clientY-ai.current_height);ae.scrollTop(af);ai.current_height=ag.clientY;ai.current_x=ai.offsetX;var ah=Math.round(aj/aa.viewport_container.width()*(aa.high-aa.low));aa.move_delta(ah)}).bind("mousewheel",function(ag,ai,af,ae){if(af){var ah=Math.round(-af/aa.viewport_container.width()*(aa.high-aa.low));aa.move_delta(ah)}});this.top_labeltrack.bind("dragstart",function(ae,af){return $("<div />").css({height:aa.content_div.height()+aa.top_labeltrack.height()+aa.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ai,aj){$(aj.proxy).css({left:Math.min(ai.pageX,aj.startX),width:Math.abs(ai.pageX-aj.startX)});var af=Math.min(ai.pageX,aj.startX)-aa.container.offset().left,ae=Math.max(ai.pageX,aj.startX)-aa.container.offset().left,ah=(aa.high-aa.low),ag=aa.viewport_container.width();aa.update_location(Math.round(af/ag*ah)+aa.low,Math.round(ae/ag*ah)+aa.low)}).bind("dragend",function(aj,ak){var af=Math.min(aj.pageX,ak.startX),ae=Math.max(aj.pageX,ak.startX),ah=(aa.high-aa.low),ag=aa.viewport_container.width(),ai=aa.low;aa.low=Math.round(af/ag*ah)+ai;aa.high=Math.round(ae/ag*ah)+ai;$(ak.proxy).remove();aa.redraw()});this.add_label_track(new X(this,this.top_labeltrack));this.add_label_track(new X(this,this.nav_labeltrack));$(window).bind("resize",function(){aa.resize_window()});$(document).bind("redraw",function(){aa.redraw()});this.reset();$(window).trigger("resize")},update_location:function(aa,ab){this.location_span.text(commatize(aa)+" - "+commatize(ab));this.nav_input.val(this.chrom+":"+commatize(aa)+"-"+commatize(ab))},load_chroms:function(ab,ac){ab.num=u;$.extend(ab,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var aa=this;$.ajax({url:chrom_url,data:ab,dataType:"json",success:function(ae){if(ae.chrom_info.length===0){alert("Invalid chromosome: "+ab.chrom);return}if(ae.reference){aa.add_label_track(new y(aa))}aa.chrom_data=ae.chrom_info;var ah='<option value="">Select Chrom/Contig</option>';for(var ag=0,ad=aa.chrom_data.length;ag<ad;ag++){var af=aa.chrom_data[ag].chrom;ah+='<option value="'+af+'">'+af+"</option>"}if(ae.prev_chroms){ah+='<option value="previous">Previous '+u+"</option>"}if(ae.next_chroms){ah+='<option value="next">Next '+u+"</option>"}aa.chrom_select.html(ah);if(ac){ac()}aa.chrom_start_index=ae.start_index},error:function(){alert("Could not load chroms for this dbkey:",aa.dbkey)}})},change_chrom:function(ae,ab,ag){if(!ae||ae==="None"){return}var ad=this;if(ae==="previous"){ad.load_chroms({low:this.chrom_start_index-u});return}if(ae==="next"){ad.load_chroms({low:this.chrom_start_index+u});return}var af=$.grep(ad.chrom_data,function(ai,aj){return ai.chrom===ae})[0];if(af===undefined){ad.load_chroms({chrom:ae},function(){ad.change_chrom(ae,ab,ag)});return}else{if(ae!==ad.chrom){ad.chrom=ae;if(!ad.chrom){ad.intro_div.show()}else{ad.intro_div.hide()}ad.chrom_select.val(ad.chrom);ad.max_high=af.len-1;ad.reset();ad.redraw(true);for(var ah=0,aa=ad.tracks.length;ah<aa;ah++){var ac=ad.tracks[ah];if(ac.init){ac.init()}}}if(ab!==undefined&&ag!==undefined){ad.low=Math.max(ab,0);ad.high=Math.min(ag,ad.max_high)}ad.reset_overview();ad.redraw()}},go_to:function(ae){var ai=this,aa,ad,ab=ae.split(":"),ag=ab[0],ah=ab[1];if(ah!==undefined){try{var af=ah.split("-");aa=parseInt(af[0].replace(/,/g,""),10);ad=parseInt(af[1].replace(/,/g,""),10)}catch(ac){return false}}ai.change_chrom(ag,aa,ad)},move_fraction:function(ac){var aa=this;var ab=aa.high-aa.low;this.move_delta(ac*ab)},move_delta:function(ac){var aa=this;var ab=aa.high-aa.low;if(aa.low-ac<aa.max_low){aa.low=aa.max_low;aa.high=aa.max_low+ab}else{if(aa.high-ac>aa.max_high){aa.high=aa.max_high;aa.low=aa.max_high-ab}else{aa.high-=ac;aa.low-=ac}}aa.redraw()},add_track:function(aa){aa.view=this;aa.track_id=this.track_id_counter;this.tracks.push(aa);if(aa.init){aa.init()}aa.container_div.attr("id","track_"+aa.track_id);C(aa.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(aa){aa.view=this;this.label_tracks.push(aa)},remove_track:function(aa){this.has_changes=true;aa.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(aa)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(ah){var ag=this.high-this.low,af=this.low,ab=this.high;if(af<this.max_low){af=this.max_low}if(ab>this.max_high){ab=this.max_high}if(this.high!==0&&ag<this.min_separation){ab=af+this.min_separation}this.low=Math.floor(af);this.high=Math.ceil(ab);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/M)/Math.LN10));this.zoom_res=Math.pow(t,Math.max(0,Math.ceil(Math.log(this.resolution,t)/Math.log(t))));var aa=(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 ai=13;this.overview_box.css({left:aa,width:Math.max(ai,ae)}).show();if(ae<ai){this.overview_box.css("left",aa-(ai-ae)/2)}if(this.overview_highlight){this.overview_highlight.css({left:aa,width:ae})}this.update_location(this.low,this.high);if(!ah){for(var ac=0,ad=this.tracks.length;ac<ad;ac++){if(this.tracks[ac]&&this.tracks[ac].enabled){this.tracks[ac].draw()}}for(ac=0,ad=this.label_tracks.length;ac<ad;ac++){this.label_tracks[ac].draw()}}},zoom_in:function(ab,ac){if(this.max_high===0||this.high-this.low<this.min_separation){return}var ad=this.high-this.low,ae=ad/2+this.low,aa=(ad/this.zoom_factor)/2;if(ab){ae=ab/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ae-aa);this.high=Math.round(ae+aa);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var ab=this.high-this.low,ac=ab/2+this.low,aa=(ab*this.zoom_factor)/2;this.low=Math.round(ac-aa);this.high=Math.round(ac+aa);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").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()}});var p=function(ab,ae){this.track=ab;this.name=ae.name;this.params=[];var am=ae.params;for(var ac=0;ac<am.length;ac++){var ah=am[ac],aa=ah.name,al=ah.label,ad=unescape(ah.html),aj=ah.type;if(aj==="number"){this.params[this.params.length]=new g(aa,al,ad,ah.min,ah.max)}else{if(aj=="select"){this.params[this.params.length]=new K(aa,al,ad)}else{console.log("WARNING: unrecognized tool parameter type:",aa,aj)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ao){ao.stopPropagation()}).bind("click",function(ao){ao.stopPropagation()}).bind("dblclick",function(ao){ao.stopPropagation()});var ak=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ai=this.params;var af=this;$.each(this.params,function(ap,at){var ar=$("<div>").addClass("param-row").appendTo(af.parent_div);var ao=$("<div>").addClass("param-label").text(at.label).appendTo(ar);var aq=$("<div/>").addClass("slider").html(at.html).appendTo(ar);$("<div style='clear: both;'/>").appendTo(ar)});this.parent_div.find("input").click(function(){$(this).select()});var an=$("<div>").addClass("slider-row").appendTo(this.parent_div);var ag=$("<input type='submit'>").attr("value","Run").appendTo(an);var af=this;ag.click(function(){af.run()})};o(p.prototype,{get_param_values_dict:function(){var aa={};this.parent_div.find(":input").each(function(){var ab=$(this).attr("name"),ac=$(this).val();aa[ab]=JSON.stringify(ac)});return aa},get_param_values:function(){var ab=[];var aa={};this.parent_div.find(":input").each(function(){var ac=$(this).attr("name"),ad=$(this).val();if(ac){ab[ab.length]=ad}});return ab},run:function(){var ab={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name};$.extend(ab,this.get_param_values_dict());var ad=this.track,ac=ab.tool_id+ad.tool_region_and_parameters_str(ab.chrom,ab.low,ab.high),ae;if(ad.track_type==="FeatureTrack"){ae=new Q(ac,view,ad.hda_ldda,undefined,{},{},ad)}this.track.add_track(ae);ae.content_div.text("Starting job.");var aa=function(){$.getJSON(run_tool_url,ab,function(af){if(af==="no converter"){ae.container_div.addClass("error");ae.content_div.text(G)}else{if(af.error){ae.container_div.addClass("error");ae.content_div.text(w+af.message)}else{if(af==="pending"){ae.container_div.addClass("pending");ae.content_div.text("Converting input data so that it can be easily reused.");setTimeout(aa,2000)}else{ae.dataset_id=af.dataset_id;ae.content_div.text("Running job.");ae.init()}}}})};aa()}});var K=function(ab,aa,ac){this.name=ab;this.label=aa;this.html=ac};var g=function(ac,ab,ae,ad,aa){K.call(this,ac,ab,ae);this.min=ad;this.max=aa};var j=function(ab,aa,ac){this.name=ab;this.index=aa;this.value=ac};var R=function(ab,aa){this.name=ab;this.index=aa;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};o(R.prototype,{applies_to:function(aa){if(aa.length>this.index){return true}return false},keep:function(aa){if(!this.applies_to(aa)){return true}var ab=parseInt(aa[this.index]);return(isNaN(ab)||(ab>=this.low&&ab<=this.high))},update_attrs:function(ab){var aa=false;if(!this.applies_to(ab)){return aa}if(ab[this.index]<this.min){this.min=Math.floor(ab[this.index]);aa=true}if(ab[this.index]>this.max){this.max=Math.ceil(ab[this.index]);aa=true}return aa},update_ui_elt:function(){var ab=this.slider.slider("option","min"),aa=this.slider.slider("option","max");if(this.min<ab||this.max>aa){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",h(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var W=function(ac,ai){this.track=ac;this.filters=[];for(var ae=0;ae<ai.length;ae++){var aa=ai[ae];var ab=aa.name,ah=aa.type,af=aa.index;if(ah==="int"||ah==="float"){this.filters[ae]=new R(ab,af)}else{this.filters[ae]=new j(ab,af,ah)}}var ag=function(aj,ak,al){aj.click(function(){var am=ak.text();max=parseFloat(al.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(al.slider("option","values")){input_size=2*input_size+1;multi_value=true}ak.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",am).appendTo(ak).focus().select().click(function(an){an.stopPropagation()}).blur(function(){$(this).remove();ak.text(am)}).keyup(function(ar){if(ar.keyCode===27){$(this).trigger("blur")}else{if(ar.keyCode===13){var ap=al.slider("option","min"),an=al.slider("option","max"),aq=function(at){return(isNaN(at)||at>an||at<ap)},ao=$(this).val();if(!multi_value){ao=parseFloat(ao);if(aq(ao)){alert("Parameter value must be in the range ["+ap+"-"+an+"]");return $(this)}}else{ao=ao.split("-");ao=[parseFloat(ao[0]),parseFloat(ao[1])];if(aq(ao[0])||aq(ao[1])){alert("Parameter value must be in the range ["+ap+"-"+an+"]");return $(this)}}al.slider((multi_value?"values":"value"),ao)}}})})};this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(aj){aj.stopPropagation()}).bind("click",function(aj){aj.stopPropagation()}).bind("dblclick",function(aj){aj.stopPropagation()});var ad=this;$.each(this.filters,function(ap,ak){var am=$("<div/>").addClass("slider-row").appendTo(ad.parent_div);var aj=$("<div/>").addClass("slider-label").appendTo(am);var ar=$("<span/>").addClass("slider-name").text(ak.name+" ").appendTo(aj);var al=$("<span/>");var an=$("<span/>").addClass("slider-value").appendTo(aj).append("[").append(al).append("]");var aq=$("<div/>").addClass("slider").appendTo(am);ak.control_element=$("<div/>").attr("id",ak.name+"-filter-control").appendTo(aq);var ao=[0,0];ak.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(at,au){ao=au.values;al.text(au.values[0]+"-"+au.values[1]);setTimeout(function(){if(au.values[0]==ao[0]&&au.values[1]==ao[1]){var av=au.values;al.text(av[0]+"-"+av[1]);ak.low=av[0];ak.high=av[1];ad.track.draw(true,true)}},50)},change:function(at,au){ak.control_element.slider("option","slide").call(ak.control_element,at,au)}});ak.slider=ak.control_element;ak.slider_label=al;ag(an,al,ak.control_element);$("<div style='clear: both;'/>").appendTo(am)})};var V=function(aa){this.track=aa.track;this.params=aa.params;this.values={};if(aa.saved_values){this.restore_values(aa.saved_values)}this.onchange=aa.onchange};o(V.prototype,{restore_values:function(aa){var ab=this;$.each(this.params,function(ac,ad){if(aa[ad.key]!==undefined){ab.values[ad.key]=aa[ad.key]}else{ab.values[ad.key]=ad.default_value}})},build_form:function(){var ab=this;var aa=$("<div />");$.each(this.params,function(af,ad){if(!ad.hidden){var ac="param_"+af;var ak=$("<div class='form-row' />").appendTo(aa);ak.append($("<label />").attr("for",ac).text(ad.label+":"));if(ad.type==="bool"){ak.append($('<input type="checkbox" />').attr("id",ac).attr("name",ac).attr("checked",ab.values[ad.key]))}else{if(ad.type==="color"){var ah=ab.values[ad.key];var ag=$("<input />").attr("id",ac).attr("name",ac).val(ah);var ai=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var ae=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(ai);var aj=$("<div/>").appendTo(ae).farbtastic({width:100,height:100,callback:ag,color:ah});$("<div />").append(ag).append(ai).appendTo(ak).bind("click",function(al){ai.css({left:$(this).position().left+($(ag).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){ai.hide();$(document).unbind("click.color-picker")});al.stopPropagation()})}else{ak.append($("<input />").attr("id",ac).attr("name",ac).val(ab.values[ad.key]))}}}});return aa},update_from_form:function(aa){var ac=this;var ab=false;$.each(this.params,function(ad,af){if(!af.hidden){var ag="param_"+ad;var ae=aa.find("#"+ag).val();if(af.type==="float"){ae=parseFloat(ae)}else{if(af.type==="int"){ae=parseInt(ae)}else{if(af.type==="bool"){ae=aa.find("#"+ag).is(":checked")}}}if(ae!==ac.values[af.key]){ac.values[af.key]=ae;ab=true}}});if(ab){this.onchange()}}});var b=function(ac,ab,aa){this.index=ac;this.resolution=ab;this.canvas=$("<div class='track-tile'/>").append(aa)};var m=function(ac,ab,aa,ad){b.call(this,ac,ab,aa);this.max_val=ad};var L=function(ac,ab,aa){b.call(this,ac,ab,aa)};var k=function(ab,aa,ae,ac,ad){this.name=ab;this.view=aa;this.parent_element=ae;this.data_url=(ac?ac:default_data_url);this.data_url_extra_params={};this.data_query_wait=(ad?ad:H);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};o(k.prototype,{init:function(){var aa=this;aa.enabled=false;aa.tile_cache.clear();aa.data_cache.clear();aa.initial_canvas=undefined;aa.content_div.css("height","auto");aa.container_div.removeClass("nodata error pending");if(!aa.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:aa.hda_ldda,dataset_id:aa.dataset_id,chrom:aa.view.chrom},function(ab){if(!ab||ab==="error"||ab.kind==="error"){aa.container_div.addClass("error");aa.content_div.text(n);if(ab.message){var ad=aa.view.tracks.indexOf(aa);var ac=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+ab.message+"</pre>",{Close:hide_modal})});aa.content_div.append(ac)}}else{if(ab==="no converter"){aa.container_div.addClass("error");aa.content_div.text(G)}else{if(ab==="no data"||(ab.data!==undefined&&(ab.data===null||ab.data.length===0))){aa.container_div.addClass("nodata");aa.content_div.text(B)}else{if(ab==="pending"){aa.container_div.addClass("pending");aa.content_div.text(r);setTimeout(function(){aa.init()},aa.data_query_wait)}else{if(ab.status==="data"){if(ab.valid_chroms){aa.valid_chroms=ab.valid_chroms;aa.make_name_popup_menu()}aa.content_div.text(U);if(aa.view.chrom){aa.content_div.text("");aa.content_div.css("height",aa.height_px+"px");aa.enabled=true;$.when(aa.predraw_init()).done(function(){aa.container_div.removeClass("nodata error pending");aa.draw()})}}}}}}})},predraw_init:function(){},update_name:function(aa){this.old_name=this.name;this.name=aa;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var J=function(ai,ag,aj){var ab=this,ak=ab.view;this.filters_manager=(ai!==undefined?new W(this,ai):undefined);this.filters_available=false;this.filters_visible=false;this.tool=(ag!==undefined&&obj_length(ag)>0?new p(this,ag):undefined);this.parent_track=aj;this.child_tracks=[];if(ab.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}ab.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();ab.container_div.append(ab.child_tracks_container);if(this.filters_manager){this.filters_div=this.filters_manager.parent_div;this.header_div.after(this.filters_div)}if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}if(ab.display_modes!==undefined){if(ab.mode_div===undefined){ab.mode_div=$("<div class='right-float menubutton popup' />").appendTo(ab.header_div);var ad=(ab.track_config&&ab.track_config.values.mode?ab.track_config.values.mode:ab.display_modes[0]);ab.mode=ad;ab.mode_div.text(ad);var ac=function(al){ab.mode_div.text(al);ab.mode=al;ab.track_config.values.mode=al;ab.tile_cache.clear();ab.draw()};var aa={};for(var ae=0,ah=ab.display_modes.length;ae<ah;ae++){var af=ab.display_modes[ae];aa[af]=function(al){return function(){ac(al)}}(af)}make_popupmenu(ab.mode_div,aa)}else{ab.mode_div.hide()}}this.make_name_popup_menu()};o(J.prototype,k.prototype,{make_name_popup_menu:function(){var ab=this;var aa={};aa["Edit configuration"]=function(){var ah=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},af=function(){ab.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){af()}}};$(window).bind("keypress.check_enter_esc",ag);show_modal("Configure Track",ab.track_config.build_form(),{Cancel:ah,OK:af})};if(ab.filters_available>0){var ae=(ab.filters_div.is(":visible")?"Hide filters":"Show filters");aa[ae]=function(){ab.filters_visible=(ab.filters_div.is(":visible"));ab.filters_div.toggle();ab.make_name_popup_menu()}}if(ab.tool){var ae=(ab.dynamic_tool_div.is(":visible")?"Hide tool":"Show tool");aa[ae]=function(){if(!ab.dynamic_tool_div.is(":visible")){ab.update_name(ab.name+ab.tool_region_and_parameters_str())}else{menu_option_text="Show dynamic tool";ab.revert_name()}ab.dynamic_tool_div.toggle();ab.make_name_popup_menu()}}if(ab.valid_chroms){aa["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+ab.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}var ac=view;var ad=function(){$("#no-tracks").show()};if(this.parent_track){ac=this.parent_track;ad=function(){}}aa.Remove=function(){ac.remove_track(ab);if(ac.num_tracks===0){ad()}};make_popupmenu(ab.name_div,aa)},draw:function(aa,ac){var au=this.view.low,ag=this.view.high,ai=ag-au,ak=this.view.container.width(),ae=ak/ai,al=this.view.resolution,ad=$("<div style='position: relative;'></div>"),am=function(aw,ax,av){return aw+"_"+ax+"_"+av};if(!ac){this.content_div.children().remove()}this.content_div.append(ad);this.max_height=0;var ao=Math.floor(au/al/M);var af=[];var ap=0;while((ao*M*al)<ag){var at=am(ak,ae,ao);var ah=this.tile_cache.get(at);var aq=ao*M*this.view.resolution;var ab=aq+M*this.view.resolution;if(!aa&&ah){af[af.length]=ah;this.show_tile(ah,ad,aq,ae)}else{this.delayed_draw(aa,at,ao,al,ad,ae,af)}ao+=1;ap++}var aj=this;var ar=setInterval(function(){if(af.length===ap){clearInterval(ar);if(ac){var ay=aj.content_div.children();var az=false;for(var ax=ay.length-1,aD=0;ax>=aD;ax--){var aw=$(ay[ax]);if(az){aw.remove()}else{if(aw.children().length!==0){az=true}}}}if(aj.track_type=="FeatureTrack"&&aj.mode=="Histogram"){var aC=-1;for(var ax=0;ax<af.length;ax++){var aF=af[ax].max_val;if(aF>aC){aC=aF}}for(var ax=0;ax<af.length;ax++){if(af[ax].max_val!==aC){var aE=af[ax];aE.canvas.remove();aj.delayed_draw(true,am(ak,ae,aE.index),aE.index,aE.resolution,ad,ae,[],{max:aC})}}}if(aj.filters_manager){var av=aj.filters_manager.filters;for(var aB=0;aB<av.length;aB++){av[aB].update_ui_elt()}var aA=false;if(aj.example_feature){for(var aB=0;aB<av.length;aB++){if(av[aB].applies_to(aj.example_feature)){aA=true;break}}}if(aj.filters_available!==aA){aj.filters_available=aA;if(!aj.filters_available){aj.filters_div.hide()}aj.make_name_popup_menu()}}}},50);for(var an=0;an<this.child_tracks.length;an++){this.child_tracks[an].draw(aa,ac)}},delayed_draw:function(ab,ai,ac,ae,aj,am,ak,af){var ad=this,ag=ac*M*ae,al=ag+M*ae;var ah=function(av,an,ap,ao,at,au,aq){var ar=ad.draw_tile(an,ap,ao,au,aq);ad.tile_cache.set(ai,ar);ad.show_tile(ar,at,ag,au);ak[ak.length]=ar};var aa=setTimeout(function(){if(ag<=ad.view.high&&al>=ad.view.low){var an=(ab?undefined:ad.tile_cache.get(ai));if(an){ad.show_tile(an,aj,ag,am);ak[ak.length]=an}else{$.when(ad.data_cache.get_data(view.chrom,ag,al,ad.mode,ae,ad.data_url_extra_params)).then(function(ao){o(ao,af);if(view.reference_track&&am>view.canvas_manager.char_width_px){$.when(view.reference_track.data_cache.get_data(view.chrom,ag,al,ad.mode,ae,view.reference_track.data_url_extra_params)).then(function(ap){ah(aa,ao,ae,ac,aj,am,ap)})}else{ah(aa,ao,ae,ac,aj,am)}})}}},50)},show_tile:function(ad,ag,ae,ah){var ab=this;var ac=this.view.high-this.view.low,af=(ae-this.view.low)*ah;if(this.left_offset){af-=this.left_offset}var aa=ad.canvas;aa.css({position:"absolute",top:0,left:af,height:""});ag.append(aa);ab.max_height=Math.max(ab.max_height,aa.height());ab.content_div.css("height",ab.max_height+"px");ag.children().css("height",ab.max_height+"px")},set_overview:function(){var aa=this.view;if(this.initial_canvas&&this.is_overview){aa.overview_close.show();aa.overview_viewport.append(this.initial_canvas);aa.overview_highlight.show().height(this.initial_canvas.height());aa.overview_viewport.height(this.initial_canvas.height()+aa.overview_box.height())}$(window).trigger("resize")},tool_region_and_parameters_str:function(ac,aa,ad){var ab=this,ae=(ac!==undefined&&aa!==undefined&&ad!==undefined?ac+":"+aa+"-"+ad:"all");return" - region=["+ae+"], parameters=["+ab.tool.get_param_values().join(", ")+"]"},add_track:function(aa){aa.track_id=this.track_id+"_"+this.child_tracks.length;aa.container_div.attr("id","track_"+aa.track_id);this.child_tracks_container.append(aa.container_div);C(aa.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(aa);this.view.has_changes=true},remove_track:function(aa){aa.container_div.fadeOut("slow",function(){$(this).remove()})}});var X=function(aa,ab){this.track_type="LabelTrack";this.hidden=true;k.call(this,null,aa,ab);this.container_div.addClass("label-track")};o(X.prototype,k.prototype,{draw:function(){var ac=this.view,ad=ac.high-ac.low,ag=Math.floor(Math.pow(10,Math.floor(Math.log(ad)/Math.log(10)))),aa=Math.floor(ac.low/ag)*ag,ae=this.view.container.width(),ab=$("<div style='position: relative; height: 1.3em;'></div>");while(aa<ac.high){var af=(aa-ac.low)/ad*ae;ab.append($("<div class='label'>"+commatize(aa)+"</div>").css({position:"absolute",left:af-1}));aa+=ag}this.content_div.children(":first").remove();this.content_div.append(ab)}});var y=function(aa){this.track_type="ReferenceTrack";this.hidden=true;k.call(this,null,aa,aa.top_labeltrack);J.call(this);aa.reference_track=this;this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:aa.dbkey};this.data_cache=new E(z,this,false);this.tile_cache=new c(s)};o(y.prototype,J.prototype,{draw_tile:function(ai,af,ab,ak){var ae=this,ac=M*af;if(ak>this.view.canvas_manager.char_width_px){if(ai===null){ae.content_div.css("height","0px");return}var ad=this.view.canvas_manager.new_canvas();var aj=ad.getContext("2d");ad.width=Math.ceil(ac*ak+ae.left_offset);ad.height=ae.height_px;aj.font=aj.canvas.manager.default_font;aj.textAlign="center";for(var ag=0,ah=ai.length;ag<ah;ag++){var aa=Math.round(ag*ak);aj.fillText(ai[ag],aa+ae.left_offset,10)}return new b(ab,af,ad)}this.content_div.css("height","0px")}});var l=function(ae,ac,af,aa,ad){var ab=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";k.call(this,ae,ac,ac.viewport_container);J.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=af;this.dataset_id=aa;this.original_dataset_id=aa;this.data_cache=new N(z,this);this.tile_cache=new c(s);this.track_config=new V({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:ad,onchange:function(){ab.vertical_range=ab.prefs.max_value-ab.prefs.min_value;$("#linetrack_"+ab.track_id+"_minval").text(ab.prefs.min_value);$("#linetrack_"+ab.track_id+"_maxval").text(ab.prefs.max_value);ab.tile_cache.clear();ab.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;this.add_resize_handle()};o(l.prototype,J.prototype,{add_resize_handle:function(){var aa=this;var ad=false;var ac=false;var ab=$("<div class='track-resize'>");$(aa.container_div).hover(function(){ad=true;ab.show()},function(){ad=false;if(!ac){ab.hide()}});ab.hide().bind("dragstart",function(ae,af){ac=true;af.original_height=$(aa.content_div).height()}).bind("drag",function(af,ag){var ae=Math.min(Math.max(ag.original_height+ag.deltaY,aa.min_height_px),aa.max_height_px);$(aa.content_div).css("height",ae);aa.height_px=ae;aa.draw(true)}).bind("dragend",function(ae,af){aa.tile_cache.clear();ac=false;if(!ad){ab.hide()}aa.track_config.values.height=aa.height_px}).appendTo(aa.container_div)},predraw_init:function(){var aa=this,ab=aa.view.tracks.indexOf(aa);aa.vertical_range=undefined;return $.getJSON(aa.data_url,{stats:true,chrom:aa.view.chrom,low:null,high:null,hda_ldda:aa.hda_ldda,dataset_id:aa.dataset_id},function(ac){aa.container_div.addClass("line-track");var ae=ac.data;if(isNaN(parseFloat(aa.prefs.min_value))||isNaN(parseFloat(aa.prefs.max_value))){aa.prefs.min_value=ae.min;aa.prefs.max_value=ae.max;$("#track_"+ab+"_minval").val(aa.prefs.min_value);$("#track_"+ab+"_maxval").val(aa.prefs.max_value)}aa.vertical_range=aa.prefs.max_value-aa.prefs.min_value;aa.total_frequency=ae.total_frequency;aa.container_div.find(".yaxislabel").remove();var af=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+ab+"_minval").text(v(aa.prefs.min_value));var ad=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+ab+"_maxval").text(v(aa.prefs.max_value));ad.css({position:"absolute",top:"24px",left:"10px"});ad.prependTo(aa.container_div);af.css({position:"absolute",bottom:"2px",left:"10px"});af.prependTo(aa.container_div)})},draw_tile:function(ak,ae,ab,aj){if(this.vertical_range===undefined){return}var af=ab*M*ae,ad=M*ae,aa=Math.ceil(ad*aj),ah=this.height_px;var ac=this.view.canvas_manager.new_canvas();ac.width=aa,ac.height=ah;var ai=ac.getContext("2d");var ag=new I.LinePainter(ak.data,af,af+ad,this.prefs,this.mode);ag.draw(ai,aa,ah);return new b(ad,ae,ac)}});var e=function(aa,af,ae,ai,ah,ac,ad,ag){var ab=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];this.track_config=new V({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ah,onchange:function(){ab.tile_cache.clear();ab.draw()}});this.prefs=this.track_config.values;k.call(this,aa,af,af.viewport_container);J.call(this,ac,ad,ag);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=ae;this.dataset_id=ai;this.original_dataset_id=ai;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_cache=new N(20,this);this.left_offset=200;this.painter=I.LinkedFeaturePainter};o(e.prototype,J.prototype,{update_auto_mode:function(aa){if(this.mode=="Auto"){if(aa=="no_detail"){aa="feature spans"}else{if(aa=="summary_tree"){aa="coverage histogram"}}this.mode_div.text("Auto ("+aa+")")}},incremental_slots:function(ae,ab,ad){var ac=this.view.canvas_manager.dummy_context,aa=this.inc_slots[ae];if(!aa||(aa.mode!==ad)){aa=new (q.FeatureSlotter)(ae,ad==="Pack",x,function(af){return ac.measureText(af)});aa.mode=ad;this.inc_slots[ae]=aa}return aa.slot_features(ab)},get_summary_tree_data:function(ae,ah,ac,ap){if(ap>ac-ah){ap=ac-ah}var al=Math.floor((ac-ah)/ap),ao=[],ad=0;var af=0,ag=0,ak,an=0,ai=[],am,aj;var ab=function(at,ar,au,aq){at[0]=ar+au*aq;at[1]=ar+(au+1)*aq};while(an<ap&&af!==ae.length){var aa=false;for(;an<ap&&!aa;an++){ab(ai,ah,an,al);for(ag=af;ag<ae.length;ag++){ak=ae[ag].slice(1,3);if(is_overlap(ak,ai)){aa=true;break}}if(aa){break}}data_start_index=ag;ao[ao.length]=am=[ai[0],0];for(;ag<ae.length;ag++){ak=ae[ag].slice(1,3);if(is_overlap(ak,ai)){am[1]++}else{break}}if(am[1]>ad){ad=am[1]}an++}return{max:ad,delta:al,data:ao}},draw_tile:function(an,aw,aA,aj,ad){var at=this,aC=aA*M*aw,ab=(aA+1)*M*aw,ap=ab-aC,au=Math.ceil(ap*aj),ar=this.mode,aG=25,ae=this.left_offset,ao,af;if(ar==="Auto"){if(an.dataset_type==="summary_tree"){ar=an.dataset_type}else{if(an.extra_info==="no_detail"){ar="no_detail"}else{var aF=an.data;if(this.view.high-this.view.low>F){ar="Squish"}else{ar="Pack"}}}this.update_auto_mode(ar)}if(ar==="summary_tree"||ar==="Histogram"){af=this.summary_draw_height;this.container_div.find(".yaxislabel").remove();var aa=$("<div />").addClass("yaxislabel");aa.text(an.max);aa.css({position:"absolute",top:"22px",left:"10px"});aa.prependTo(this.container_div);var ac=this.view.canvas_manager.new_canvas();ac.width=au+ae;ac.height=af+O;if(an.dataset_type!="summary_tree"){var ak=this.get_summary_tree_data(an.data,aC,ab,200);if(an.max){ak.max=an.max}an=ak}var aD=new I.SummaryTreePainter(an,aC,ab,this.prefs);var av=ac.getContext("2d");av.translate(ae,O);aD.draw(av,au,af);return new m(aA,aw,ac,an.max)}var ao,ah=1;if(ar==="no_detail"||ar==="Squish"||ar==="Pack"){ah=this.incremental_slots(aj,an.data,ar);ao=this.inc_slots[aj].slots}var ai=[];if(an.data){var al=this.filters_manager.filters;for(var ax=0,az=an.data.length;ax<az;ax++){var ag=an.data[ax];var ay=false;var am;for(var aB=0,aE=al.length;aB<aE;aB++){am=al[aB];am.update_attrs(ag);if(!am.keep(ag)){ay=true;break}}if(!ay){ai.push(ag)}}}var aD=new (this.painter)(ai,aC,ab,this.prefs,ar,ad);var af=aD.get_required_height(ah)+A;var ac=this.view.canvas_manager.new_canvas();ac.width=au+ae;ac.height=af;var av=ac.getContext("2d");av.fillStyle=this.prefs.block_color;av.font=av.canvas.manager.default_font;av.textAlign="right";this.container_div.find(".yaxislabel").remove();if(an.message){$(ac).css({"border-top":"1px solid red"});av.fillStyle="red";av.textAlign="left";var aq=av.textBaseline;av.textBaseline="top";av.fillText(an.message,ae,0);av.textBaseline=aq;if(!an.data){return new b(aA,aw,ac,af)}}this.example_feature=(an.data.length?an.data[0]:undefined);av.translate(ae,A);aD.draw(av,au,af,ao);return new L(aA,aw,ac)}});var P=function(ad,ab,af,aa,ac,ae){e.call(this,ad,ab,af,aa,ac,ae);this.track_type="VcfTrack";this.painter=I.VariantPainter};o(P.prototype,J.prototype,e.prototype);var S=function(ad,ab,af,aa,ac,ae){e.call(this,ad,ab,af,aa,ac,ae);this.track_config=new V({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ac,onchange:function(){this.track.tile_cache.clear();this.track.draw()}});this.prefs=this.track_config.values;this.track_type="ReadTrack";this.painter=I.ReadPainter;this.make_name_popup_menu()};o(S.prototype,J.prototype,e.prototype);var Q=function(ae,ac,ag,aa,ad,af,ab){e.call(this,ae,ac,ag,aa,ad,af,{},ab);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};o(Q.prototype,J.prototype,e.prototype,{predraw_init:function(){var ab=this;var aa=function(){if(ab.data_cache.size()===0){setTimeout(aa,300)}else{ab.data_url=default_data_url;ab.data_query_wait=H;ab.dataset_state_url=converted_datasets_state_url;$.getJSON(ab.dataset_state_url,{dataset_id:ab.dataset_id,hda_ldda:ab.hda_ldda},function(ac){})}};aa()}});T.View=Y;T.LineTrack=l;T.FeatureTrack=e;T.ReadTrack=S};var slotting_module=function(c,b){var e=c("class").extend;var d=2,a=5;b.FeatureSlotter=function(j,h,f,g){this.slots={};this.start_end_dct={};this.w_scale=j;this.include_label=h;this.max_rows=f;this.measureText=g};e(b.FeatureSlotter.prototype,{slot_features:function(m){var p=this.w_scale,s=this.slots,h=this.start_end_dct,y=[],A=[],n=0,z=this.max_rows;for(var w=0,x=m.length;w<x;w++){var l=m[w],o=l[0];if(s[o]!==undefined){n=Math.max(n,s[o]);A.push(s[o])}else{y.push(w)}}var q=function(G,H){for(var F=0;F<=z;F++){var D=false,I=h[F];if(I!==undefined){for(var C=0,E=I.length;C<E;C++){var B=I[C];if(H>B[0]&&G<B[1]){D=true;break}}}if(!D){return F}}return -1};for(var w=0,x=y.length;w<x;w++){var l=m[y[w]],o=l[0],u=l[1],f=l[2],r=l[3],g=Math.floor(u*p),k=Math.ceil(f*p),v=this.measureText(r).width,j;if(r!==undefined&&this.include_label){v+=(d+a);if(g-v>=0){g-=v;j="left"}else{k+=v;j="right"}}var t=q(g,k);if(t>=0){if(h[t]===undefined){h[t]=[]}h[t].push([g,k]);s[o]=t;n=Math.max(n,t)}else{}}return n+1}})};var painters_module=function(j,w){var t=j("class").extend;var o=function(H,z,F,y,E,C){if(C===undefined){C=4}var B=y-z;var A=E-F;var D=Math.floor(Math.sqrt(B*B+A*A)/C);var I=B/D;var G=A/D;var x;for(x=0;x<D;x++,z+=I,F+=G){if(x%2!==0){continue}H.fillRect(z,F,C,1)}};var p=function(A,z,x,D){var C=z-D/2,B=z+D/2,E=x-Math.sqrt(D*3/2);A.beginPath();A.moveTo(C,E);A.lineTo(B,E);A.lineTo(z,x);A.lineTo(C,E);A.strokeStyle=this.fillStyle;A.fill();A.stroke();A.closePath()};var m=function(z,B,x,y,A){this.data=z;this.view_start=B;this.view_end=x;this.prefs=t({},this.default_prefs,y);this.mode=A};m.prototype.default_prefs={};var u=function(z,B,x,y,A){m.call(this,z,B,x,y,A)};u.prototype.default_prefs={show_counts:false};u.prototype.draw=function(M,z,L){var E=this.view_start,O=this.view_end-this.view_start,N=z/O;var J=this.data.data,I=this.data.delta,G=this.data.max,B=L;delta_x_px=Math.ceil(I*N);M.save();for(var C=0,D=J.length;C<D;C++){var H=Math.floor((J[C][0]-E)*N);var F=J[C][1];if(!F){continue}var K=F/G*L;if(F!==0&&K<1){K=1}M.fillStyle="black";M.fillRect(H,B-K,delta_x_px,K);var A=4;if(this.prefs.show_counts&&(M.measureText(F).width+A)<delta_x_px){M.fillStyle="#666";M.textAlign="center";M.fillText(F,H+(delta_x_px/2),10)}}M.restore()};var c=function(z,B,x,y,A){m.call(this,z,B,x,y,A)};c.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};c.prototype.draw=function(O,N,L){var F=false,H=this.prefs.min_value,D=this.prefs.max_value,K=D-H,z=L,A=this.view_start,M=this.view_end-this.view_start,B=N/M,I=this.mode,S=this.data;O.save();var T=Math.round(L+H/K*L);if(I!=="Intensity"){O.fillStyle="#aaa";O.fillRect(0,T,N,1)}O.beginPath();O.fillStyle=this.prefs.color;var R,E,C;if(S.length>1){C=Math.ceil((S[1][0]-S[0][0])*B)}else{C=10}for(var P=0,Q=S.length;P<Q;P++){R=Math.round((S[P][0]-A)*B);E=S[P][1];if(E===null){if(F&&I==="Filled"){O.lineTo(R,z)}F=false;continue}if(E<H){E=H}else{if(E>D){E=D}}if(I==="Histogram"){E=Math.round(E/K*z);O.fillRect(R,T,C,-E)}else{if(I==="Intensity"){E=255-Math.floor((E-H)/K*255);O.fillStyle="rgb("+E+","+E+","+E+")";O.fillRect(R,0,C,z)}else{E=Math.round(z-(E-H)/K*z);if(F){O.lineTo(R,E)}else{F=true;if(I==="Filled"){O.moveTo(R,z);O.lineTo(R,E)}else{O.moveTo(R,E)}}}}}if(I==="Filled"){if(F){O.lineTo(R,T);O.lineTo(0,T)}O.fill()}else{O.stroke()}var x=-1,J=-1;O.fillStyle=this.prefs.overflow_color;var G;for(var P=0,Q=S.length;P<Q;P++){E=S[P][1];R=Math.round((S[P][0]-A)*B);if(J>=0&&(E===null||E<D)){O.fillRect(J,0,G+C-J,2);J=-1}else{if(x>=0&&(E===null||E>H)){O.fillRect(x,L-2,G+C-x,2);x=-1}}if(E!==null&&E>D&&J<0){J=R}else{if(E!==null&&E<H&&x<0){x=R}}G=R}O.restore()};var n=function(z,B,x,y,A){m.call(this,z,B,x,y,A)};n.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};t(n.prototype,{get_required_height:function(y){var x=y_scale=this.get_row_height(),z=this.mode;if(z==="no_detail"||z==="Squish"||z==="Pack"){x=y*y_scale}return x+Math.max(Math.round(y_scale/2),5)},draw:function(J,A,I,F){var D=this.data,G=this.view_start,K=this.view_end;J.save();J.fillStyle=this.prefs.block_color;J.textAlign="right";var N=this.view_end-this.view_start,M=A/N,z=this.get_row_height();for(var C=0,E=D.length;C<E;C++){var L=D[C],B=L[0],x=L[1],y=L[2],H=(F&&F[B]!==undefined?F[B]:null);if((x<K&&y>G)&&(this.mode=="Dense"||H!==null)){this.draw_element(J,this.mode,L,H,G,K,M,z,A)}}J.restore()}});var d=10,h=3,l=5,v=10,f=1,r=3,e=3,a=9,k=2,g="#ccc";var q=function(z,B,x,y,A){n.call(this,z,B,x,y,A)};t(q.prototype,n.prototype,{get_row_height:function(){var y=this.mode,x;if(y==="Dense"){x=d}else{if(y==="no_detail"){x=h}else{if(y==="Squish"){x=l}else{x=v}}}return x},draw_element:function(J,C,R,E,L,ab,af,ag,x){var O=R[0],ad=R[1],V=R[2],M=R[3],W=Math.floor(Math.max(0,(ad-L)*af)),K=Math.ceil(Math.min(x,Math.max(0,(V-L)*af))),U=(C==="Dense"?0:(0+E))*ag,I,Z,N=null,ah=null,A=this.prefs.block_color,Y=this.prefs.label_color;if(C=="Dense"){E=1}if(C==="no_detail"){J.fillStyle=A;J.fillRect(W,U+5,K-W,f)}else{var H=R[4],T=R[5],X=R[6],B=R[7];if(T&&X){N=Math.floor(Math.max(0,(T-L)*af));ah=Math.ceil(Math.min(x,Math.max(0,(X-L)*af)))}var ae,P;if(C==="Squish"||C==="Dense"){ae=1;P=e}else{ae=5;P=a}if(!B){if(R.strand){if(R.strand==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand_inv")}else{if(R.strand==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand_inv")}}}else{J.fillStyle=A}J.fillRect(W,U,K-W,P)}else{var G,Q;if(C==="Squish"||C==="Dense"){J.fillStyle=g;G=U+Math.floor(e/2)+1;Q=1}else{if(H){var G=U;var Q=P;if(H==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand")}else{if(H==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand")}}}else{J.fillStyle=g;G+=(e/2)+1;Q=1}}J.fillRect(W,G,K-W,Q);for(var ac=0,z=B.length;ac<z;ac++){var D=B[ac],y=Math.floor(Math.max(0,(D[0]-L)*af)),S=Math.ceil(Math.min(x,Math.max((D[1]-L)*af)));if(y>S){continue}J.fillStyle=A;J.fillRect(y,U+(P-ae)/2+1,S-y,ae);if(N!==undefined&&X>T&&!(y>ah||S<N)){var aa=Math.max(y,N),F=Math.min(S,ah);J.fillRect(aa,U+1,F-aa,P);if(B.length==1&&C=="Pack"){if(H==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand_inv")}else{if(H==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand_inv")}}if(aa+14<F){aa+=2;F-=2}J.fillRect(aa,U+1,F-aa,P)}}}}if(C==="Pack"&&ad>L){J.fillStyle=Y;if(L===0&&W-J.measureText(M).width<0){J.textAlign="left";J.fillText(M,K+k,U+8)}else{J.textAlign="right";J.fillText(M,W-k,U+8)}J.fillStyle=A}}}});var b=function(z,B,x,y,A){n.call(this,z,B,x,y,A)};t(b.prototype,n.prototype,{draw_element:function(Q,L,F,B,T,z,I,R,O){var F=data[i],H=F[0],P=F[1],A=F[2],K=F[3],D=Math.floor(Math.max(0,(P-T)*I)),G=Math.ceil(Math.min(O,Math.max(0,(A-T)*I))),C=(L==="Dense"?0:(0+B))*R,x,U,y=null,J=null;if(no_label){Q.fillStyle=block_color;Q.fillRect(D+left_offset,C+5,G-D,1)}else{var S=F[4],N=F[5],E=F[6];x=9;U=1;Q.fillRect(D+left_offset,C,G-D,x);if(L!=="Dense"&&K!==undefined&&P>T){Q.fillStyle=label_color;if(T===0&&D-Q.measureText(K).width<0){Q.textAlign="left";Q.fillText(K,G+2+left_offset,C+8)}else{Q.textAlign="right";Q.fillText(K,D-2+left_offset,C+8)}Q.fillStyle=block_color}var M=S+" / "+N;if(P>T&&Q.measureText(M).width<(G-D)){Q.fillStyle="white";Q.textAlign="center";Q.fillText(M,left_offset+D+(G-D)/2,C+8);Q.fillStyle=block_color}}}});var s=function(A,C,x,z,B,y){n.call(this,A,C,x,z,B);this.ref_seq=y};s.prototype.default_prefs=t({},n.prototype.default_prefs,{show_insertions:false});t(s.prototype,n.prototype,{get_row_height:function(){var x,y=this.mode;if(y==="Dense"){x=d}else{if(y==="Squish"){x=l}else{x=v;if(this.prefs.show_insertions){x*=2}}}return x},draw_read:function(T,O,K,Y,z,S,H,E,D){T.textAlign="center";var R=this,y=[Y,z],N=0,U=0,Q=0;ref_seq=this.ref_seq,char_width_px=T.canvas.manager.char_width_px;var ad=[];if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){Q=Math.round(K/2)}if(!H){H=[[0,E.length]]}for(var L=0,W=H.length;L<W;L++){var I=H[L],A="MIDNSHP=X"[I[0]],M=I[1];if(A==="H"||A==="S"){N-=M}var F=S+N,ac=Math.floor(Math.max(0,(F-Y)*K)),G=Math.floor(Math.max(0,(F+M-Y)*K));if(ac===G){G+=1}switch(A){case"H":break;case"S":case"M":case"=":if(is_overlap([F,F+M],y)){var P=E.slice(U,U+M);if(Q>0){T.fillStyle=this.prefs.block_color;T.fillRect(ac-Q,D+1,G-ac,9);T.fillStyle=g;for(var aa=0,x=P.length;aa<x;aa++){if(this.prefs.show_differences&&ref_seq){var J=ref_seq[F-Y+aa];if(!J||J.toLowerCase()===P[aa].toLowerCase()){continue}}if(F+aa>=Y&&F+aa<=z){var ab=Math.floor(Math.max(0,(F+aa-Y)*K));T.fillText(P[aa],ab,D+9)}}}else{T.fillStyle=this.prefs.block_color;T.fillRect(ac,D+4,G-ac,e)}}U+=M;N+=M;break;case"N":T.fillStyle=g;T.fillRect(ac-Q,D+5,G-ac,1);N+=M;break;case"D":T.fillStyle="red";T.fillRect(ac-Q,D+4,G-ac,3);N+=M;break;case"P":break;case"I":var X=ac-Q;if(is_overlap([F,F+M],y)){var P=E.slice(U,U+M);if(this.prefs.show_insertions){var C=ac-(G-ac)/2;if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){T.fillStyle="yellow";T.fillRect(C-Q,D-9,G-ac,9);ad[ad.length]={type:"triangle",data:[X,D+4,5]};T.fillStyle=g;switch(seq_tile_overlap){case (OVERLAP_START):P=P.slice(Y-F);break;case (OVERLAP_END):P=P.slice(0,F-z);break;case (CONTAINED_BY):break;case (CONTAINS):P=P.slice(Y-F,F-z);break}for(var aa=0,x=P.length;aa<x;aa++){var ab=Math.floor(Math.max(0,(F+aa-Y)*K));T.fillText(P[aa],ab-(G-ac)/2,D)}}else{T.fillStyle="yellow";T.fillRect(C,D+(this.mode!=="Dense"?2:5),G-ac,(O!=="Dense"?e:r))}}else{if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){ad[ad.length]={type:"text",data:[P.length,X,D+9]}}else{}}}U+=M;break;case"X":U+=M;break}}T.fillStyle="yellow";var Z,B,ae;for(var V=0;V<ad.length;V++){Z=ad[V];B=Z.type;ae=Z.data;if(B==="text"){T.save();T.font="bold "+T.font;T.fillText(ae[0],ae[1],ae[2]);T.restore()}else{if(B=="triangle"){p(T,ae[0],ae[1],ae[2])}}}},draw_element:function(Q,L,D,A,T,y,H,R,O){var G=D[0],P=D[1],z=D[2],I=D[3],C=Math.floor(Math.max(0,(P-T)*H)),E=Math.ceil(Math.min(O,Math.max(0,(z-T)*H))),B=(L==="Dense"?0:(0+A))*R,U=this.prefs.block_color,F=this.prefs.label_color,N=0;if((L==="Pack"||this.mode==="Auto")&&H>Q.canvas.manager.char_width_px){var N=Math.round(H/2)}Q.fillStyle=U;if(D[5] instanceof Array){var M=Math.floor(Math.max(0,(D[4][0]-T)*H)),K=Math.ceil(Math.min(O,Math.max(0,(D[4][1]-T)*H))),J=Math.floor(Math.max(0,(D[5][0]-T)*H)),x=Math.ceil(Math.min(O,Math.max(0,(D[5][1]-T)*H)));if(D[4][1]>=T&&D[4][0]<=y&&D[4][2]){this.draw_read(Q,L,H,T,y,D[4][0],D[4][2],D[4][3],B)}if(D[5][1]>=T&&D[5][0]<=y&&D[5][2]){this.draw_read(Q,L,H,T,y,D[5][0],D[5][2],D[5][3],B)}if(J>K){Q.fillStyle=g;o(Q,K-N,B+5,J-N,B+5)}}else{Q.fillStyle=U;this.draw_read(Q,L,H,T,y,P,D[4],D[5],B)}if(L==="Pack"&&P>T){Q.fillStyle=this.prefs.label_color;var S=1;if(S===0&&C-Q.measureText(I).width<0){Q.textAlign="left";Q.fillText(I,E+k-N,B+8)}else{Q.textAlign="right";Q.fillText(I,C-k-N,B+8)}Q.fillStyle=U}}});w.SummaryTreePainter=u;w.LinePainter=c;w.LinkedFeaturePainter=q;w.ReadPainter=s;w.VariantPainter=b};(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 --- a/static/scripts/trackster.js Thu Apr 14 16:51:40 2011 -0400 +++ b/static/scripts/trackster.js Thu Apr 14 20:25:54 2011 -0400 @@ -155,6 +155,7 @@ } }); }; +exports.sortable = sortable; /** * Calculates step for slider with a given min, max. --- a/templates/library/common/browse_library.mako Thu Apr 14 16:51:40 2011 -0400 +++ b/templates/library/common/browse_library.mako Thu Apr 14 20:25:54 2011 -0400 @@ -48,14 +48,14 @@ <%def name="javascripts()"> ${parent.javascripts()} - ${h.js("json2", "jstorage")} + ${h.js("jstorage")} ${common_javascripts()} ${self.grid_javascripts()} </%def><%def name="grid_javascripts()"><script type="text/javascript"> - $(function() { + var init_libraries = function() { var storage_id = "library-expand-state-${trans.security.encode_id(library.id)}"; var restore_folder_state = function() { @@ -151,6 +151,9 @@ }); restore_folder_state(); + }; + $(function() { + init_libraries(); }); // Looks for changes in dataset state using an async request. Keeps --- a/templates/tracks/browser.mako Thu Apr 14 16:51:40 2011 -0400 +++ b/templates/tracks/browser.mako Thu Apr 14 20:25:54 2011 -0400 @@ -12,7 +12,7 @@ <%def name="stylesheets()"> ${parent.stylesheets()} - ${h.css( "history", "autocomplete_tagging", "trackster", "overcast/jquery-ui-1.8.5.custom" )} + ${h.css( "history", "autocomplete_tagging", "trackster", "overcast/jquery-ui-1.8.5.custom", "library" )} <style type="text/css"> #browser-container { @@ -55,7 +55,7 @@ <script type='text/javascript' src="${h.url_for('/static/scripts/excanvas.js')}"></script><![endif]--> -${h.js( "galaxy.base", "galaxy.panels", "json2", "jquery", "jquery.event.drag", "jquery.mousewheel", "jquery.autocomplete", "trackster", "jquery.ui.sortable.slider", "jquery.scrollTo", "farbtastic" )} +${h.js( "galaxy.base", "galaxy.panels", "json2", "jquery", "jstorage", "jquery.event.drag", "jquery.mousewheel", "jquery.autocomplete", "trackster", "jquery.ui.sortable.slider", "jquery.scrollTo", "farbtastic" )} <script type="text/javascript"> @@ -148,7 +148,7 @@ track_data.name, view, track_data.hda_ldda, track_data.dataset_id, track_data.prefs, track_data.filters, track_data.tool ); view.add_track(new_track); - ## Should replace with live event but can't get working + // Should replace with live event but can't get working sortable( new_track.container_div, ".draghandle" ); view.has_changes = true; $("#no-tracks").hide(); @@ -172,9 +172,8 @@ error: function() { alert( "Grid failed" ); }, success: function(table_html) { show_modal( - "Add Track — Select history/library, then datasets", - table_html, - { + "Select datasets for new tracks", + table_html, { "Cancel": function() { hide_modal(); }, --- a/templates/tracks/history_datasets_select_grid.mako Thu Apr 14 16:51:40 2011 -0400 +++ b/templates/tracks/history_datasets_select_grid.mako Thu Apr 14 20:25:54 2011 -0400 @@ -1,15 +1,5 @@ <%inherit file="/tracks/history_select_grid.mako"/><%def name="title()"> - ## - ## Provide link to go back to histories grid. - ## - <% - url_dict = dict( action="list_histories" ) - for filter, value in grid.cur_filter_dict.iteritems(): - url_dict[ "f-" + filter ] = value - %> - ## Use class 'label' to piggyback on URL functionality in parent template. - <a class="label" href="${h.url_for( **url_dict )}">Back to histories</a><h2>History '${grid.get_current_item( trans, **kwargs ).name}'</h2></%def> \ No newline at end of file --- a/templates/tracks/history_select_grid.mako Thu Apr 14 16:51:40 2011 -0400 +++ b/templates/tracks/history_select_grid.mako Thu Apr 14 20:25:54 2011 -0400 @@ -5,41 +5,78 @@ ## <%namespace file="../grid_base.mako" import="*" /> +${stylesheets()} +${grid_javascripts()} + +<%def name="select_header()"> + <script type="text/javascript"> + // Handle all label clicks. + var f = function() { + $(".addtracktab, #grid-table-body a").click(function() { + var parent_body = $(".divider").parent(); + if (parent_body.length !== 0) { + parent_body.load($(this).attr("href")); + f(); + return false; + } + }); + }; + // Need to process label URLs when document loaded and when grid changes. + $(document).ready(function() { + f(); + // $('#grid-table-body').bind('update', f); + }); + </script> + <style> + .addtracktab { + margin: 0px 5px; + padding: 5px; + display: block; + width: 35%; + text-align: center; + float: left; + background-color: #ccc; + border-bottom: 0px; + -webkit-border-top-left-radius: 10px; + -webkit-border-top-right-radius: 10px; + -moz-border-radius-topleft: 10px; + -moz-border-radius-topright: 10px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + } + .activetab { + border: 1px solid #aaa; + border-bottom: 0px; + background-color: white; + margin-bottom: -2px; + } + .divider { + clear: both; + border-top: 1px solid #aaa; + margin-bottom: 5px; + } + + </style> + + <% histories_active = data_libraries_active = "" %> + %if getattr(grid, "datasets_param", None): + %if grid.datasets_param == "f-history": + <% histories_active = " activetab" %> + %else: + <% data_libraries_active = " activetab" %> + %endif + %endif + <a class="addtracktab${histories_active}" href="${h.url_for( action='list_histories' )}">Histories</a> + <a class="addtracktab${data_libraries_active}" href="${h.url_for( action='list_libraries' )}">Data Libraries</a> + <div class="divider"></div> +</%def> + +${select_header()} ## Need to define title so that it can be overridden by child templates. <%def name="title()"></%def> ${self.title()} -${stylesheets()} -${grid_javascripts()} -## -## Load grid label and page links within a modal window. -## -<script type="text/javascript"> - // Handle all label clicks. - var f = function() { - $("a.label,.page-link>a").click(function() { - var parent_body = $(this).parents("div.body"); - if (parent_body.length !== 0) { - parent_body.load($(this).attr("href")); - return false; - } - }); - }; - // Need to process label URLs when document loaded and when grid changes. - $(document).ready(function() { - f(); - $('#grid-table-body').bind('update', f); - }); -</script> - -%if getattr(grid, "datasets_param", None): - %if grid.datasets_param == "f-history": - <a class="label" href="${h.url_for( action='list_libraries' )}">Show Data Libraries</a> - %else: - <a class="label" href="${h.url_for( action='list_histories' )}">Show Histories</a> - %endif - <br /><br /> -%endif ${render_grid_header( grid, False )} -${render_grid_table( grid, show_item_checkboxes=show_item_checkboxes )} \ No newline at end of file +${render_grid_table( grid, show_item_checkboxes=show_item_checkboxes )} + 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.