galaxy-commits
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions

galaxy-dist commit 14fd007fc550: Fix setting of minimum and maximum values for tracker slider filters.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1287549765 14400
# Node ID 14fd007fc550092df7ea23f1019ab2d99ba03ce2
# Parent 11031e92204b1590ff05119515673d37ae834188
Fix setting of minimum and maximum values for tracker slider filters.
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -462,11 +462,11 @@ var NumberFilter = function( name, index
// Index into payload to filter.
this.index = index;
// Filter low/high. These values are used to filter elements.
- this.low = Number.MIN_VALUE;
+ this.low = -Number.MAX_VALUE;
this.high = Number.MAX_VALUE;
// Slide min/max. These values are used to set/update slider.
this.slider_min = Number.MAX_VALUE;
- this.slider_max = Number.MIN_VALUE;
+ this.slider_max = -Number.MAX_VALUE;
// UI Slider element and label that is associated with filter.
this.slider = null;
this.slider_label = null;
@@ -571,15 +571,14 @@ var Track = function (name, view, parent
var name_span = $("<span class='name'>").appendTo(filter_th);
name_span.text(filter.name + " "); // Extra spacing to separate name and values
var values_span = $("<span class='values'>").appendTo(filter_th);
- values_span.text("[0-2]");
// TODO: generate custom interaction elements based on filter type.
var table_data = $("<td>").appendTo(table_row);
filter.control_element = $("<div id='" + filter.name + "-filter-control' style='width: 200px; position: relative'>").appendTo(table_data);
filter.control_element.slider({
range: true,
- min: 0,
- max: 1,
- values: [0, 1],
+ min: Number.MAX_VALUE,
+ max: -Number.MIN_VALUE,
+ values: [0, 0],
slide: function( event, ui ) {
var values = ui.values;
// Set new values in UI.
@@ -804,8 +803,9 @@ var TiledTrack = function() {
}
// Update filtering UI.
- for (var f = 0; f < track.filters.length; f++)
+ for (var f = 0; f < track.filters.length; f++) {
track.filters[f].update_ui_elt();
+ }
// Method complete; do not call it again.
clearInterval(intervalId);
}
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=50,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/st
rand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,d,c,b){this.container=a;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_i
d_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);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_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Clo
se 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_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();r
eturn false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new Referenc
eTrack(a))}a.chrom_data=d.chrom_info;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind
("dragstart",function(d){this.original_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.
container.offset().left,h=(a.high-a.low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(!c.chrom){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.re
set();c.redraw(true);for(var g in c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.reset_overview();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).re
move()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left
:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);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 Filter=functio
n(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=Number.MIN_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=Number.MIN_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[
this.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=function(b,a,d,c){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){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.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.fil
tering_div.hide();this.filtering_div.bind("drag",function(k){k.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);var g=$("<th class='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);d.text("[0-2]");var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:0,max:1,values:[0,1],slide:function(l,m){var k=m.values;d.text("["+k[0]+"-"+k[1]+"]");a.low=k[0];a.high=k[1];c.draw(true)},change:function(k,l){a.control_element.slider("option","slide").call(a.control_element,k,l)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)}
,init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_di
v.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined){d.mode_div=$("<div class='right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_modes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}};b["Edit configur
ation"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},j=function(){d.update_options(d.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.keyCode||m.which)===27){l()}else{if((m.keyCode||m.which)===13){j()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:l,OK:j})};if(d.filters.length>0){b["Show filters"]=function(){var j;if(!d.filtering_div.is(":visible")){j="Hide filters";d.filters_visible=true}else{j="Show filters";d.filters_visible=false}$("#"+d.name_div.attr("id")+"-menu").find("li").eq(2).text(j);d.filtering_div.toggle()}}b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};d.popup_menu=make_popupmenu(d.name_div,b);show_hide_popupmenu_options(d.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,h=g-m,f=this.view.r
esolution;var p=$("<div style='position: relative;'></div>"),q=this.content_div.width()/h,k;this.content_div.append(p),this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=new Object();while((a*DENSITY*f)<g){var n=this.content_div.width()+"_"+q+"_"+a;var e=this.tile_cache.get(n);if(!b&&e){var j=a*DENSITY*f;var d=(j-m)*q;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,p)}else{this.delayed_draw(this,n,m,g,a,f,p,q,l)}a+=1}var c=this;var o=setInterval(function(){if(l.length!=0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var r=0;r<c.filters.length;r++){c.filters[r].update_ui_elt()}clearInterval(o)}},50)},delayed_draw:function(c,h,g,e,b,d,j,k,f){var a=setTimeout(function(){if(!(g>c.view.high||e<c.view.low)){tile_element=c.draw_tile(d,b,j,k);if(tile_element){if(!c.initial_canvas){c.initial_canvas=$(tile_element).clone();var n=tile_element.get(0).getContext("2d");var l=c.initial_canvas.get(0).getContext("2d");var m=
n.getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,tile_element);c.show_tile(tile_element,j)}}delete f.id},50);f.id=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null
,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_
data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),o=e.get(0).getContext("2d"),k=f+"_"+b;if(p>PX_PER_CHAR){if(this.data_cache.get(k)===undefined){this.get_data(f,b);return}var n=this.data_cache.get(k);if(n===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*p+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*p-this.left_offset});for(var h=0,m=n.length;h<m;h++){var a=Math.round(h*p),j=Math.round(p/2);o.fillText(n[h],a+this.left_offset+j,10)}l.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=fu
nction(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#tr
ack_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;a.container_div.find(".yaxislabel").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:fu
nction(p,s,c,e){if(this.vertical_range===undefined){return}var t=s*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),w=p+"_"+s;if(this.data_cache.get(w)===undefined){this.get_data(p,s);return}var j=this.data_cache.get(w);if(j===null){return}b.css({position:"absolute",top:0,left:(t-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,u=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();o.fillStyle=this.prefs.color;if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var v,h;for(var q=0,r=data.length;q<r;q++){v=Math.round((data[q][0]-t)*e);h=data[q][1];if(h===null){if(k&&m==="Filled"){o.lineTo(v,d)}k=false;continue}if(h<l){h=l}else{if(h>g){h=g}}if(m==="Histogram"){h=Math.round(d-(h-l)/n*d);o.fillRect(v,h,f,d-h)}else{if(m==="Intensity"){h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")
";o.fillRect(v,0,f,d)}else{h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(v,h)}else{k=true;if(m==="Filled"){o.moveTo(v,d);o.lineTo(v,h)}else{o.moveTo(v,h)}}}}}if(m==="Filled"){if(k){o.lineTo(v,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(n){var a=$("<div />").addClass("form-row");var e="track_"+n+"_color",b=$("<label />").attr("for",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+n+"_minval",m=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),l=$("<input></input>").attr("id",h).val(d),k="track_"+n+"_maxval",g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j);return a.append(m).append(l).append(g).append(f).append(b).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val();color=$("#track_
"+c+"_color").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value||color!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.prefs.color=color;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATU
RE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"#444",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};t
his.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(v<=MAX_FEATURE_DEPTH){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_ti
le[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(r,m,s,b,q,f,h,e){r.textAlign="center";var l=0,p=Math.round(m/2);for(cig_id in h){var k=h[cig_id],d="MIDNSHP"[k[0]],n=k[1];if(d==="H"||d==="S"){l-=n}var g=q+l,v=Math.floor(Math.max(0,(g-s)*m)),j=Math.floor(Math.max(0,(g+n-s)*m));switch(d){case"S":case"H":case"M":var o=f.slice(l,n);if((this.mode==="Pack"||this.mode==="Auto")&&f!==undefined&&m>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(v+this.left_offset,e+1,j-v,9);r.fillStyle=CONNECTOR_COLOR;for(var t=0,a=o.length;t<a;t++){if(g+t>=s&&g+t<=b){var u=Math.floor(Math.max(0,(g+t-s)*m));r.fillText(o[t],u+this.left_offset+p,e+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(v+this.left_offset,e+4,j-v,3)}break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(v+this.left_offset,e+5,j-v,1);break;case"D":r.fillStyle="red";r.fillRect(v+this.left_offset,e+4,j-v,3);break;case"P":case"I":break}l+=n}},draw_tile:function(
ah,o,s,aw){var N=o*DENSITY*ah,am=(o+1)*DENSITY*ah,M=am-N;var ao=(!this.initial_canvas?"initial":N+"_"+am);var I=this.data_cache.get(ao);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,am]]=true;this.get_data(N,am);return}var a=Math.ceil(M*aw),S=$("<canvas class='tile'></canvas>"),aj=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,af=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_info==="no_detail")),X=this.left_offset,av,D,ax;if(I.dataset_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;ax=10}else{ax=(af?this.vertical_nodetail_px:this.vertical_detail_px);var A=(aw<0.0001?1/view.zoom_res:aw);D=this.incremental_slots(A,I.data,af,r)*ax+z;av=this.inc_slots[A]}}S.css({position:"absolute",top:0,left:(N-this.view.low)*aw-X});S.get(0).width=a+X;S.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=S.get(0).getContext("2d");J.fillStyle=l;J.font=t
his.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Z=I.data,L=I.max,q=I.avg,b=Math.ceil(I.delta*aw);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var aq=0,H=Z.length;aq<H;aq++){var ab=Math.floor((Z[aq][0]-N)*aw);var aa=Z[aq][1];if(!aa){continue}var an=aa/L*this.summary_draw_height;J.fillStyle="black";J.fillRect(ab+X,this.summary_draw_height-an,b,an);if(this.prefs.show_counts&&J.measureText(aa).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(aa,ab+X+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(S);return S}if(I.message){S.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+X,ax)}var ae=false;if(I.data.length!=0){ae=true;for(var at=0;at<this.filters.length;at++){if(!this.filters[at].applies_to(I.data[0])){ae=false}}}if(ae){S.
addClass(FILTERABLE_CLASS)}var au=I.data;var ap=0;for(var aq=0,H=au.length;aq<H;aq++){var T=au[aq],R=T[0],ar=T[1],ad=T[2],O=T[3];if(av[R]===undefined){continue}var ac=false;var V;for(var at=0;at<this.filters.length;at++){V=this.filters[at];V.update_attrs(T);if(!V.keep(T)){ac=true;break}}if(ac){continue}if(ar<=am&&ad>=N){var ag=Math.floor(Math.max(0,(ar-N)*aw)),K=Math.ceil(Math.min(a,Math.max(0,(ad-N)*aw))),Y=(r==="Dense"?1:(1+av[R]))*ax;if(I.dataset_type==="bai"){var v=T[4];J.fillStyle=l;if(T[5] instanceof Array){var E=Math.floor(Math.max(0,(T[5][0]-N)*aw)),Q=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-N)*aw))),C=Math.floor(Math.max(0,(T[6][0]-N)*aw)),w=Math.ceil(Math.min(a,Math.max(0,(T[6][1]-N)*aw)));if(T[5][1]>=N&&T[5][0]<=am){this.rect_or_text(J,aw,N,am,T[5][0],T[5][2],v,Y)}if(T[6][1]>=N&&T[6][0]<=am){this.rect_or_text(J,aw,N,am,T[6][0],T[6][2],v,Y)}if(C>Q){J.fillStyle=CONNECTOR_COLOR;J.fillRect(Q+X,Y+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,aw,N,am,ar,O,v,Y)}if(r!=
="Dense"&&!af&&ar>N){J.fillStyle=this.prefs.label_color;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(R,ag-2+X,Y+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var G=T[4],W=T[5],ai=T[6],h=T[7];var F,ak,P=null,ay=null;if(W&&ai){P=Math.floor(Math.max(0,(W-N)*aw));ay=Math.ceil(Math.min(a,Math.max(0,(ai-N)*aw)))}if(r!=="Dense"&&O!==undefined&&ar>N){J.fillStyle=aj;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}if(h){if(G){if(G=="+"){J.fillStyle=RIGHT_STRAND}else{if(G=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}for(var ao=0,g=h.length;ao<g;ao++){var u=h[ao],d=Math.floor(Math.max(0,(u[0]-N)*aw)),U=Math.ceil(Math.min(a,Math.max((u[1]-N)*aw)));if(d>U){continue}F=5;ak=3;J.fillRect(d+X,Y+ak,U-d,F);if(P!==undefined&&!(d>ay||
U<P)){F=9;ak=1;var al=Math.max(d,P),B=Math.min(U,ay);J.fillRect(al+X,Y+ak,B-al,F)}}}else{F=9;ak=1;J.fillRect(ag+X,Y+ak,K-ag,F);if(T.strand){if(T.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var t=T[4],n=T[5],c=T[6];F=9;ak=1;J.fillRect(ag+X,Y,K-ag,F);if(r!=="Dense"&&O!==undefined&&ar>N){J.fillStyle=aj;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}var m=t+" / "+n;if(ar>N&&J.measureText(m).width<(K-ag)){J.fillStyle="white";J.textAlign="center";J.fillText(m,X+ag+(K-ag)/2,Y+8);J.fillStyle=l}}}}}ap++}}return S},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(th
is.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="ReadTrack";this.vert
ical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=50,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/st
rand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,d,c,b){this.container=a;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_i
d_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);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_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Clo
se 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_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();r
eturn false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new Referenc
eTrack(a))}a.chrom_data=d.chrom_info;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind
("dragstart",function(d){this.original_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.
container.offset().left,h=(a.high-a.low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(!c.chrom){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.re
set();c.redraw(true);for(var g in c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.reset_overview();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).re
move()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left
:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);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 Filter=functio
n(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values"
,[this.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=function(b,a,d,c){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){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.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.f
iltering_div.hide();this.filtering_div.bind("drag",function(k){k.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);var g=$("<th class='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(l,m){var k=m.values;d.text("["+k[0]+"-"+k[1]+"]");a.low=k[0];a.high=k[1];c.draw(true)},change:function(k,l){a.control_element.slider("option","slide").call(a.control_element,k,l)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(thi
s.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending
"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined){d.mode_div=$("<div class='right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_modes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}}
;b["Edit configuration"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},j=function(){d.update_options(d.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.keyCode||m.which)===27){l()}else{if((m.keyCode||m.which)===13){j()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:l,OK:j})};if(d.filters.length>0){b["Show filters"]=function(){var j;if(!d.filtering_div.is(":visible")){j="Hide filters";d.filters_visible=true}else{j="Show filters";d.filters_visible=false}$("#"+d.name_div.attr("id")+"-menu").find("li").eq(2).text(j);d.filtering_div.toggle()}}b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};d.popup_menu=make_popupmenu(d.name_div,b);show_hide_popupmenu_options(d.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,h=
g-m,f=this.view.resolution;var p=$("<div style='position: relative;'></div>"),q=this.content_div.width()/h,k;this.content_div.append(p),this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=new Object();while((a*DENSITY*f)<g){var n=this.content_div.width()+"_"+q+"_"+a;var e=this.tile_cache.get(n);if(!b&&e){var j=a*DENSITY*f;var d=(j-m)*q;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,p)}else{this.delayed_draw(this,n,m,g,a,f,p,q,l)}a+=1}var c=this;var o=setInterval(function(){if(l.length!=0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var r=0;r<c.filters.length;r++){c.filters[r].update_ui_elt()}clearInterval(o)}},50)},delayed_draw:function(c,h,g,e,b,d,j,k,f){var a=setTimeout(function(){if(!(g>c.view.high||e<c.view.low)){tile_element=c.draw_tile(d,b,j,k);if(tile_element){if(!c.initial_canvas){c.initial_canvas=$(tile_element).clone();var n=tile_element.get(0).getContext("2d");var l=c.initial_canvas.get(0).getCon
text("2d");var m=n.getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,tile_element);c.show_tile(tile_element,j)}}delete f.id},50);f.id=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Tra
ck.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrac
k.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),o=e.get(0).getContext("2d"),k=f+"_"+b;if(p>PX_PER_CHAR){if(this.data_cache.get(k)===undefined){this.get_data(f,b);return}var n=this.data_cache.get(k);if(n===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*p+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*p-this.left_offset});for(var h=0,m=n.length;h<m;h++){var a=Math.round(h*p),j=Math.round(p/2);o.fillText(n[h],a+this.left_offset+j,10)}l.append(e);return e}this.content_div.css("height","0px")}})
;var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.
min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;a.container_div.find(".yaxislabel").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}
})}},draw_tile:function(p,s,c,e){if(this.vertical_range===undefined){return}var t=s*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),w=p+"_"+s;if(this.data_cache.get(w)===undefined){this.get_data(p,s);return}var j=this.data_cache.get(w);if(j===null){return}b.css({position:"absolute",top:0,left:(t-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,u=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();o.fillStyle=this.prefs.color;if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var v,h;for(var q=0,r=data.length;q<r;q++){v=Math.round((data[q][0]-t)*e);h=data[q][1];if(h===null){if(k&&m==="Filled"){o.lineTo(v,d)}k=false;continue}if(h<l){h=l}else{if(h>g){h=g}}if(m==="Histogram"){h=Math.round(d-(h-l)/n*d);o.fillRect(v,h,f,d-h)}else{if(m==="Intensity"){h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("
+h+","+h+","+h+")";o.fillRect(v,0,f,d)}else{h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(v,h)}else{k=true;if(m==="Filled"){o.moveTo(v,d);o.lineTo(v,h)}else{o.moveTo(v,h)}}}}}if(m==="Filled"){if(k){o.lineTo(v,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(n){var a=$("<div />").addClass("form-row");var e="track_"+n+"_color",b=$("<label />").attr("for",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+n+"_minval",m=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),l=$("<input></input>").attr("id",h).val(d),k="track_"+n+"_maxval",g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j);return a.append(m).append(l).append(g).append(f).append(b).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val()
;color=$("#track_"+c+"_color").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value||color!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.prefs.color=color;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(C
ACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"#444",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.
inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(v<=MAX_FEATURE_DEPTH){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=
[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(r,m,s,b,q,f,h,e){r.textAlign="center";var l=0,p=Math.round(m/2);for(cig_id in h){var k=h[cig_id],d="MIDNSHP"[k[0]],n=k[1];if(d==="H"||d==="S"){l-=n}var g=q+l,v=Math.floor(Math.max(0,(g-s)*m)),j=Math.floor(Math.max(0,(g+n-s)*m));switch(d){case"S":case"H":case"M":var o=f.slice(l,n);if((this.mode==="Pack"||this.mode==="Auto")&&f!==undefined&&m>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(v+this.left_offset,e+1,j-v,9);r.fillStyle=CONNECTOR_COLOR;for(var t=0,a=o.length;t<a;t++){if(g+t>=s&&g+t<=b){var u=Math.floor(Math.max(0,(g+t-s)*m));r.fillText(o[t],u+this.left_offset+p,e+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(v+this.left_offset,e+4,j-v,3)}break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(v+this.left_offset,e+5,j-v,1);break;case"D":r.fillStyle="red";r.fillRect(v+this.left_offset,e+4,j-v,3);break;case"P":case"I":break}l+=n}},dr
aw_tile:function(ah,o,s,aw){var N=o*DENSITY*ah,am=(o+1)*DENSITY*ah,M=am-N;var ao=(!this.initial_canvas?"initial":N+"_"+am);var I=this.data_cache.get(ao);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,am]]=true;this.get_data(N,am);return}var a=Math.ceil(M*aw),S=$("<canvas class='tile'></canvas>"),aj=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,af=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_info==="no_detail")),X=this.left_offset,av,D,ax;if(I.dataset_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;ax=10}else{ax=(af?this.vertical_nodetail_px:this.vertical_detail_px);var A=(aw<0.0001?1/view.zoom_res:aw);D=this.incremental_slots(A,I.data,af,r)*ax+z;av=this.inc_slots[A]}}S.css({position:"absolute",top:0,left:(N-this.view.low)*aw-X});S.get(0).width=a+X;S.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=S.get(0).getContext("2d");J.fil
lStyle=l;J.font=this.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Z=I.data,L=I.max,q=I.avg,b=Math.ceil(I.delta*aw);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var aq=0,H=Z.length;aq<H;aq++){var ab=Math.floor((Z[aq][0]-N)*aw);var aa=Z[aq][1];if(!aa){continue}var an=aa/L*this.summary_draw_height;J.fillStyle="black";J.fillRect(ab+X,this.summary_draw_height-an,b,an);if(this.prefs.show_counts&&J.measureText(aa).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(aa,ab+X+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(S);return S}if(I.message){S.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+X,ax)}var ae=false;if(I.data.length!=0){ae=true;for(var at=0;at<this.filters.length;at++){if(!this.filters[at].applies_to(I.data[0])){ae=
false}}}if(ae){S.addClass(FILTERABLE_CLASS)}var au=I.data;var ap=0;for(var aq=0,H=au.length;aq<H;aq++){var T=au[aq],R=T[0],ar=T[1],ad=T[2],O=T[3];if(av[R]===undefined){continue}var ac=false;var V;for(var at=0;at<this.filters.length;at++){V=this.filters[at];V.update_attrs(T);if(!V.keep(T)){ac=true;break}}if(ac){continue}if(ar<=am&&ad>=N){var ag=Math.floor(Math.max(0,(ar-N)*aw)),K=Math.ceil(Math.min(a,Math.max(0,(ad-N)*aw))),Y=(r==="Dense"?1:(1+av[R]))*ax;if(I.dataset_type==="bai"){var v=T[4];J.fillStyle=l;if(T[5] instanceof Array){var E=Math.floor(Math.max(0,(T[5][0]-N)*aw)),Q=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-N)*aw))),C=Math.floor(Math.max(0,(T[6][0]-N)*aw)),w=Math.ceil(Math.min(a,Math.max(0,(T[6][1]-N)*aw)));if(T[5][1]>=N&&T[5][0]<=am){this.rect_or_text(J,aw,N,am,T[5][0],T[5][2],v,Y)}if(T[6][1]>=N&&T[6][0]<=am){this.rect_or_text(J,aw,N,am,T[6][0],T[6][2],v,Y)}if(C>Q){J.fillStyle=CONNECTOR_COLOR;J.fillRect(Q+X,Y+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,aw,N,am
,ar,O,v,Y)}if(r!=="Dense"&&!af&&ar>N){J.fillStyle=this.prefs.label_color;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(R,ag-2+X,Y+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var G=T[4],W=T[5],ai=T[6],h=T[7];var F,ak,P=null,ay=null;if(W&&ai){P=Math.floor(Math.max(0,(W-N)*aw));ay=Math.ceil(Math.min(a,Math.max(0,(ai-N)*aw)))}if(r!=="Dense"&&O!==undefined&&ar>N){J.fillStyle=aj;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}if(h){if(G){if(G=="+"){J.fillStyle=RIGHT_STRAND}else{if(G=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}for(var ao=0,g=h.length;ao<g;ao++){var u=h[ao],d=Math.floor(Math.max(0,(u[0]-N)*aw)),U=Math.ceil(Math.min(a,Math.max((u[1]-N)*aw)));if(d>U){continue}F=5;ak=3;J.fillRect(d+X,Y+ak,U-d,F);if(P!==un
defined&&!(d>ay||U<P)){F=9;ak=1;var al=Math.max(d,P),B=Math.min(U,ay);J.fillRect(al+X,Y+ak,B-al,F)}}}else{F=9;ak=1;J.fillRect(ag+X,Y+ak,K-ag,F);if(T.strand){if(T.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var t=T[4],n=T[5],c=T[6];F=9;ak=1;J.fillRect(ag+X,Y,K-ag,F);if(r!=="Dense"&&O!==undefined&&ar>N){J.fillStyle=aj;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}var m=t+" / "+n;if(ar>N&&J.measureText(m).width<(K-ag)){J.fillStyle="white";J.textAlign="center";J.fillText(m,X+ag+(K-ag)/2,Y+8);J.fillStyle=l}}}}}ap++}}return S},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr
("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="Rea
dTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0

galaxy-dist commit 11031e92204b: trackster: Add proper CIGAR support to BAM display (properly displays matches, deletions, skipped bases, and clipping. Padding and insertions are skipped as of now as there is no good way to insert new space into the view.)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1287529137 14400
# Node ID 11031e92204b1590ff05119515673d37ae834188
# Parent ad9bb65d2d153af5db0ae497930eb35d17f63057
trackster: Add proper CIGAR support to BAM display (properly displays matches, deletions, skipped bases, and clipping. Padding and insertions are skipped as of now as there is no good way to insert new space into the view.)
- Don't re-add new datasets when refreshing after using "Add into current viz" link
- To prevent browser lockup, only display up to 50 lines of features by default (user-editable in future). TODO: add warning message when this occurs
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -4,8 +4,9 @@
var DENSITY = 200,
FEATURE_LEVELS = 10,
- MAX_FEATURE_DEPTH = 100,
- DATA_ERROR = "There was an error in indexing this dataset. ",
+ MAX_FEATURE_DEPTH = 50,
+ CONNECTOR_COLOR = "#ccc",
+ DATA_ERROR = "There was an error in indexing this dataset.",
DATA_NOCONVERTER = "A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",
DATA_NONE = "No data for this chrom/contig.",
DATA_PENDING = "Currently indexing... please wait",
@@ -75,12 +76,11 @@ var Cache = function( num_elements ) {
}
});
-var View = function( container, chrom, title, vis_id, dbkey ) {
+var View = function( container, title, vis_id, dbkey ) {
this.container = container;
this.vis_id = vis_id;
this.dbkey = dbkey;
this.title = title;
- this.chrom = chrom;
this.tracks = [];
this.label_tracks = [];
this.max_low = 0;
@@ -271,7 +271,7 @@ var View = function( container, chrom, t
}
if (chrom !== view.chrom) {
view.chrom = chrom;
- if (view.chrom === "") {
+ if (!view.chrom) {
// No chrom selected
view.intro_div.show();
} else {
@@ -1203,7 +1203,7 @@ var FeatureTrack = function ( name, view
this.data_cache = new Cache(20);
this.left_offset = 200;
- this.prefs = { 'block_color': 'black', 'label_color': 'black', 'show_counts': true };
+ this.prefs = { 'block_color': '#444', 'label_color': 'black', 'show_counts': true };
if (prefs.block_color !== undefined) { this.prefs.block_color = prefs.block_color; }
if (prefs.label_color !== undefined) { this.prefs.label_color = prefs.label_color; }
if (prefs.show_counts !== undefined) { this.prefs.show_counts = prefs.show_counts; }
@@ -1294,7 +1294,7 @@ var FeatureTrack = function ( name, view
var j = 0;
// Try to fit the feature to the first slot that doesn't overlap any other features in that slot
- while (true) {
+ while (j <= MAX_FEATURE_DEPTH) {
var found = true;
if (this.s_e_by_tile[level][j] !== undefined) {
for (var k = 0, k_len = this.s_e_by_tile[level][j].length; k < k_len; k++) {
@@ -1318,22 +1318,57 @@ var FeatureTrack = function ( name, view
return highest_slot;
},
- rect_or_text: function( ctx, w_scale, tile_low, tile_high, feature_start, name, x, x_len, y_center ) {
+ rect_or_text: function( ctx, w_scale, tile_low, tile_high, feature_start, orig_seq, cigar, y_center ) {
ctx.textAlign = "center";
- var gap = Math.round(w_scale / 2);
- if ( (this.mode === "Pack" || this.mode === "Auto") && name !== undefined && w_scale > PX_PER_CHAR) {
- ctx.fillStyle = this.prefs.block_color;
- ctx.fillRect(x, y_center + 1, x_len, 9);
- ctx.fillStyle = "#eee";
- for (var c = 0, str_len = name.length; c < str_len; c++) {
- if (feature_start + c >= tile_low && feature_start + c <= tile_high) {
- var c_start = Math.floor( Math.max(0, (feature_start + c - tile_low) * w_scale) );
- ctx.fillText(name[c], c_start + this.left_offset + gap, y_center + 9);
- }
+ var cur_offset = 0,
+ gap = Math.round(w_scale / 2);
+
+ for (cig_id in cigar) {
+ var cig = cigar[cig_id],
+ cig_op = "MIDNSHP"[cig[0]],
+ cig_len = cig[1];
+
+ if (cig_op === "H" || cig_op === "S") {
+ // Go left if it clips
+ cur_offset -= cig_len;
}
- } else {
- ctx.fillStyle = this.prefs.block_color;
- ctx.fillRect(x, y_center + 4, x_len, 3);
+ var seq_start = feature_start + cur_offset,
+ s_start = Math.floor( Math.max(0, (seq_start - tile_low) * w_scale) ),
+ s_end = Math.floor( Math.max(0, (seq_start + cig_len - tile_low) * w_scale) );
+
+ switch (cig_op) {
+ case "S": // Soft clipping
+ case "H": // Hard clipping
+ case "M": // Match
+ var seq = orig_seq.slice(cur_offset, cig_len);
+ if ( (this.mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > PX_PER_CHAR) {
+ ctx.fillStyle = this.prefs.block_color;
+ ctx.fillRect(s_start + this.left_offset, y_center + 1, s_end - s_start, 9);
+ ctx.fillStyle = CONNECTOR_COLOR;
+ for (var c = 0, str_len = seq.length; c < str_len; c++) {
+ if (seq_start + c >= tile_low && seq_start + c <= tile_high) {
+ var c_start = Math.floor( Math.max(0, (seq_start + c - tile_low) * w_scale) );
+ ctx.fillText(seq[c], c_start + this.left_offset + gap, y_center + 9);
+ }
+ }
+ } else {
+ ctx.fillStyle = this.prefs.block_color;
+ ctx.fillRect(s_start + this.left_offset, y_center + 4, s_end - s_start, 3);
+ }
+ break;
+ case "N": // Skipped bases
+ ctx.fillStyle = CONNECTOR_COLOR;
+ ctx.fillRect(s_start + this.left_offset, y_center + 5, s_end - s_start, 1);
+ break;
+ case "D": // Deletion
+ ctx.fillStyle = "red";
+ ctx.fillRect(s_start + this.left_offset, y_center + 4, s_end - s_start, 3);
+ break;
+ case "P": // TODO: No good way to draw insertions/padding right now, so ignore
+ case "I":
+ break;
+ }
+ cur_offset += cig_len;
}
},
draw_tile: function( resolution, tile_index, parent_element, w_scale ) {
@@ -1465,6 +1500,10 @@ var FeatureTrack = function ( name, view
feature_start = feature[1],
feature_end = feature[2],
feature_name = feature[3];
+
+ if (slots[feature_uid] === undefined) {
+ continue;
+ }
// Apply filters to feature.
var hide_feature = false;
@@ -1495,18 +1534,18 @@ var FeatureTrack = function ( name, view
b2_end = Math.ceil( Math.min(width, Math.max(0, (feature[6][1] - tile_low) * w_scale)) );
if (feature[5][1] >= tile_low && feature[5][0] <= tile_high) {
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], b1_start + left_offset, b1_end - b1_start, y_center);
+ this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], cigar, y_center);
}
if (feature[6][1] >= tile_low && feature[6][0] <= tile_high) {
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[6][0], feature[6][2], b2_start + left_offset, b2_end - b2_start, y_center);
+ this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[6][0], feature[6][2], cigar, y_center);
}
if (b2_start > b1_end) {
- ctx.fillStyle = "#999";
+ ctx.fillStyle = CONNECTOR_COLOR;
ctx.fillRect(b1_end + left_offset, y_center + 5, b2_start - b1_end, 1);
}
} else {
ctx.fillStyle = block_color;
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature_start, feature_name, f_start + left_offset, f_end - f_start, y_center);
+ this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature_start, feature_name, cigar, y_center);
}
if (mode !== "Dense" && !no_detail && feature_start > tile_low) {
// Draw label
--- a/lib/galaxy/visualization/tracks/data_providers.py
+++ b/lib/galaxy/visualization/tracks/data_providers.py
@@ -193,20 +193,17 @@ class BamDataProvider( TracksDataProvide
message = "Only the first %s pairs are being displayed." % MAX_VALS
break
qname = read.qname
- if no_detail:
- seq = len(read.seq)
- else:
- seq = read.seq
+ seq = read.seq
+ read_len = sum( [cig[1] for cig in read.cigar] ) # Use cigar to determine length
if read.is_proper_pair:
if qname in paired_pending: # one in dict is always first
pair = paired_pending[qname]
- results.append( [ qname, pair['start'], read.pos + read.rlen, seq, read.cigar, [pair['start'], pair['end'], pair['seq']], [read.pos, read.pos + read.rlen, seq] ] )
- # results.append( [read.qname, pair['start'], read.pos + read.rlen, qname, [pair['start'], pair['end']], [read.pos, read.pos + read.rlen] ] )
+ results.append( [ qname, pair['start'], read.pos + read_len, seq, read.cigar, [pair['start'], pair['end'], pair['seq']], [read.pos, read.pos + read_len, seq] ] )
del paired_pending[qname]
else:
- paired_pending[qname] = { 'start': read.pos, 'end': read.pos + read.rlen, 'seq': seq, 'mate_start': read.mpos, 'rlen': read.rlen, 'cigar': read.cigar }
+ paired_pending[qname] = { 'start': read.pos, 'end': read.pos + read_len, 'seq': seq, 'mate_start': read.mpos, 'rlen': read_len, 'cigar': read.cigar }
else:
- results.append( [qname, read.pos, read.pos + read.rlen, seq, read.cigar] )
+ results.append( [qname, read.pos, read.pos + read_len, seq, read.cigar] )
# take care of reads whose mates are out of range
for qname, read in paired_pending.iteritems():
if read['mate_start'] < read['start']:
--- a/lib/galaxy/web/controllers/tracks.py
+++ b/lib/galaxy/web/controllers/tracks.py
@@ -159,9 +159,11 @@ class TracksController( BaseController,
vis = session.query( model.Visualization ).get( decoded_id )
viz_config = self.get_visualization_config( trans, vis )
- # Set config chrom.
- viz_config[ 'chrom' ] = chrom
- return trans.fill_template( 'tracks/browser.mako', config=viz_config, add_dataset=kwargs.get("dataset_id", None) )
+ new_dataset = kwargs.get("dataset_id", None)
+ if new_dataset is not None:
+ if trans.security.decode_id(new_dataset) in [ d["dataset_id"] for d in viz_config.get("tracks") ]:
+ new_dataset = None # Already in browser, so don't add
+ return trans.fill_template( 'tracks/browser.mako', config=viz_config, add_dataset=new_dataset )
@web.json
def chroms(self, trans, vis_id=None, dbkey=None ):
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -74,7 +74,7 @@
$(function() {
%if config:
- view = new View( $("#center"), "${config.get('chrom')}", "${config.get('title') | h}", "${config.get('vis_id')}", "${config.get('dbkey')}" );
+ view = new View( $("#center"), "${config.get('title') | h}", "${config.get('vis_id')}", "${config.get('dbkey')}" );
view.editor = true;
%for track in config.get('tracks'):
view.add_track(
@@ -84,7 +84,7 @@
init();
%else:
var continue_fn = function() {
- view = new View( $("#center"), undefined, $("#new-title").val(), undefined, $("#new-dbkey").val() );
+ view = new View( $("#center"), $("#new-title").val(), undefined, $("#new-dbkey").val() );
view.editor = true;
init();
hide_modal();
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";r
ight_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_coun
ter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);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_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Ove
rview</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_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return
false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack
(a))}a.chrom_data=d.chrom_info;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("drag
start",function(d){this.original_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.contai
ner.offset().left,h=(a.high-a.low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(c.chrom===""){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.rese
t();c.redraw(true);for(var g in c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.reset_overview();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remo
ve()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a
,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);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 Filter=function(
b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=Number.MIN_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=Number.MIN_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[th
is.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=function(b,a,d,c){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){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.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.filte
ring_div.hide();this.filtering_div.bind("drag",function(k){k.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);var g=$("<th class='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);d.text("[0-2]");var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:0,max:1,values:[0,1],slide:function(l,m){var k=m.values;d.text("["+k[0]+"-"+k[1]+"]");a.low=k[0];a.high=k[1];c.draw(true)},change:function(k,l){a.control_element.slider("option","slide").call(a.control_element,k,l)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},i
nit_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.
addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined){d.mode_div=$("<div class='right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_modes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}};b["Edit configurat
ion"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},j=function(){d.update_options(d.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.keyCode||m.which)===27){l()}else{if((m.keyCode||m.which)===13){j()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:l,OK:j})};if(d.filters.length>0){b["Show filters"]=function(){var j;if(!d.filtering_div.is(":visible")){j="Hide filters";d.filters_visible=true}else{j="Show filters";d.filters_visible=false}$("#"+d.name_div.attr("id")+"-menu").find("li").eq(2).text(j);d.filtering_div.toggle()}}b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};d.popup_menu=make_popupmenu(d.name_div,b);show_hide_popupmenu_options(d.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,h=g-m,f=this.view.res
olution;var p=$("<div style='position: relative;'></div>"),q=this.content_div.width()/h,k;this.content_div.append(p),this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=new Object();while((a*DENSITY*f)<g){var n=this.content_div.width()+"_"+q+"_"+a;var e=this.tile_cache.get(n);if(!b&&e){var j=a*DENSITY*f;var d=(j-m)*q;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,p)}else{this.delayed_draw(this,n,m,g,a,f,p,q,l)}a+=1}var c=this;var o=setInterval(function(){if(l.length!=0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var r=0;r<c.filters.length;r++){c.filters[r].update_ui_elt()}clearInterval(o)}},50)},delayed_draw:function(c,h,g,e,b,d,j,k,f){var a=setTimeout(function(){if(!(g>c.view.high||e<c.view.low)){tile_element=c.draw_tile(d,b,j,k);if(tile_element){if(!c.initial_canvas){c.initial_canvas=$(tile_element).clone();var n=tile_element.get(0).getContext("2d");var l=c.initial_canvas.get(0).getContext("2d");var m=n.
getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,tile_element);c.show_tile(tile_element,j)}}delete f.id},50);f.id=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a
,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_da
ta:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),o=e.get(0).getContext("2d"),k=f+"_"+b;if(p>PX_PER_CHAR){if(this.data_cache.get(k)===undefined){this.get_data(f,b);return}var n=this.data_cache.get(k);if(n===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*p+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*p-this.left_offset});for(var h=0,m=n.length;h<m;h++){var a=Math.round(h*p),j=Math.round(p/2);o.fillText(n[h],a+this.left_offset+j,10)}l.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=func
tion(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#trac
k_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;a.container_div.find(".yaxislabel").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:func
tion(p,s,c,e){if(this.vertical_range===undefined){return}var t=s*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),w=p+"_"+s;if(this.data_cache.get(w)===undefined){this.get_data(p,s);return}var j=this.data_cache.get(w);if(j===null){return}b.css({position:"absolute",top:0,left:(t-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,u=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();o.fillStyle=this.prefs.color;if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var v,h;for(var q=0,r=data.length;q<r;q++){v=Math.round((data[q][0]-t)*e);h=data[q][1];if(h===null){if(k&&m==="Filled"){o.lineTo(v,d)}k=false;continue}if(h<l){h=l}else{if(h>g){h=g}}if(m==="Histogram"){h=Math.round(d-(h-l)/n*d);o.fillRect(v,h,f,d-h)}else{if(m==="Intensity"){h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";
o.fillRect(v,0,f,d)}else{h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(v,h)}else{k=true;if(m==="Filled"){o.moveTo(v,d);o.lineTo(v,h)}else{o.moveTo(v,h)}}}}}if(m==="Filled"){if(k){o.lineTo(v,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(n){var a=$("<div />").addClass("form-row");var e="track_"+n+"_color",b=$("<label />").attr("for",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+n+"_minval",m=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),l=$("<input></input>").attr("id",h).val(d),k="track_"+n+"_maxval",g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j);return a.append(m).append(l).append(g).append(f).append(b).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val();color=$("#track_"+
c+"_color").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value||color!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.prefs.color=color;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE
);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"black",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};th
is.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,
f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(ah,o,s,aw){var N=o*DENSITY*ah,am=(o+1)*DENSITY*ah,M=am-N;var ao=(!this.initial_canvas?"initial":N+"_"+am);var I=this.data_cache.get(ao);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,am]]=true;this.get_data(N,am);return}var a=Math.ceil(M*aw),S=$("<canvas class='tile'></canvas>"),aj=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,af=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_inf
o==="no_detail")),X=this.left_offset,av,D,ax;if(I.dataset_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;ax=10}else{ax=(af?this.vertical_nodetail_px:this.vertical_detail_px);var A=(aw<0.0001?1/view.zoom_res:aw);D=this.incremental_slots(A,I.data,af,r)*ax+z;av=this.inc_slots[A]}}S.css({position:"absolute",top:0,left:(N-this.view.low)*aw-X});S.get(0).width=a+X;S.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=S.get(0).getContext("2d");J.fillStyle=l;J.font=this.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Z=I.data,L=I.max,q=I.avg,b=Math.ceil(I.delta*aw);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var aq=0,H=Z.length;aq<H;aq++){var ab=Math.floor((Z[aq][0]-N)*aw);var aa=Z[aq][1];if(!aa){continue}var an=aa/L*this.summary_draw_height;J.fillStyle="black";J.fil
lRect(ab+X,this.summary_draw_height-an,b,an);if(this.prefs.show_counts&&J.measureText(aa).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(aa,ab+X+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(S);return S}if(I.message){S.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+X,ax)}var ae=false;if(I.data.length!=0){ae=true;for(var at=0;at<this.filters.length;at++){if(!this.filters[at].applies_to(I.data[0])){ae=false}}}if(ae){S.addClass(FILTERABLE_CLASS)}var au=I.data;var ap=0;for(var aq=0,H=au.length;aq<H;aq++){var T=au[aq],R=T[0],ar=T[1],ad=T[2],O=T[3];var ac=false;var V;for(var at=0;at<this.filters.length;at++){V=this.filters[at];V.update_attrs(T);if(!V.keep(T)){ac=true;break}}if(ac){continue}if(ar<=am&&ad>=N){var ag=Math.floor(Math.max(0,(ar-N)*aw)),K=Math.ceil(Math.min(a,Math.max(0,(ad-N)*aw))),Y=(r==="Dense"?1:(1+av[R]))*ax;if(I.dataset_type==="bai"){var v=T[4];J.fillStyle=l;if(T[5] in
stanceof Array){var E=Math.floor(Math.max(0,(T[5][0]-N)*aw)),Q=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-N)*aw))),C=Math.floor(Math.max(0,(T[6][0]-N)*aw)),w=Math.ceil(Math.min(a,Math.max(0,(T[6][1]-N)*aw)));if(T[5][1]>=N&&T[5][0]<=am){this.rect_or_text(J,aw,N,am,T[5][0],T[5][2],E+X,Q-E,Y)}if(T[6][1]>=N&&T[6][0]<=am){this.rect_or_text(J,aw,N,am,T[6][0],T[6][2],C+X,w-C,Y)}if(C>Q){J.fillStyle="#999";J.fillRect(Q+X,Y+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,aw,N,am,ar,O,ag+X,K-ag,Y)}if(r!=="Dense"&&!af&&ar>N){J.fillStyle=this.prefs.label_color;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(R,ag-2+X,Y+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var G=T[4],W=T[5],ai=T[6],h=T[7];var F,ak,P=null,ay=null;if(W&&ai){P=Math.floor(Math.max(0,(W-N)*aw));ay=Math.ceil(Math.min(a,Math.max(0,(ai-N)*aw)))}if(r!=="Dense"&&O!==undefined&&ar>N){J.fil
lStyle=aj;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}if(h){if(G){if(G=="+"){J.fillStyle=RIGHT_STRAND}else{if(G=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}for(var ao=0,g=h.length;ao<g;ao++){var u=h[ao],d=Math.floor(Math.max(0,(u[0]-N)*aw)),U=Math.ceil(Math.min(a,Math.max((u[1]-N)*aw)));if(d>U){continue}F=5;ak=3;J.fillRect(d+X,Y+ak,U-d,F);if(P!==undefined&&!(d>ay||U<P)){F=9;ak=1;var al=Math.max(d,P),B=Math.min(U,ay);J.fillRect(al+X,Y+ak,B-al,F)}}}else{F=9;ak=1;J.fillRect(ag+X,Y+ak,K-ag,F);if(T.strand){if(T.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var t=T[4],n=T[5],c=T[6];F=9;ak=1;J.fillRect(ag+X,Y,K-ag,F);if(r!=="Dense"&&O!==undefined&&ar>N){J.fillStyle=aj;if(o===0&&a
g-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}var m=t+" / "+n;if(ar>N&&J.measureText(m).width<(K-ag)){J.fillStyle="white";J.textAlign="center";J.fillText(m,X+ag+(K-ag)/2,Y+8);J.fillStyle=l}}}}}ap++}}return S},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_opti
ons:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=50,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/st
rand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,d,c,b){this.container=a;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_i
d_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);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_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Clo
se 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_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();r
eturn false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new Referenc
eTrack(a))}a.chrom_data=d.chrom_info;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind
("dragstart",function(d){this.original_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.
container.offset().left,h=(a.high-a.low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(!c.chrom){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.re
set();c.redraw(true);for(var g in c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.reset_overview();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).re
move()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left
:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);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 Filter=functio
n(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=Number.MIN_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=Number.MIN_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[
this.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=function(b,a,d,c){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){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.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.fil
tering_div.hide();this.filtering_div.bind("drag",function(k){k.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);var g=$("<th class='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);d.text("[0-2]");var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:0,max:1,values:[0,1],slide:function(l,m){var k=m.values;d.text("["+k[0]+"-"+k[1]+"]");a.low=k[0];a.high=k[1];c.draw(true)},change:function(k,l){a.control_element.slider("option","slide").call(a.control_element,k,l)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)}
,init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_di
v.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined){d.mode_div=$("<div class='right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_modes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}};b["Edit configur
ation"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},j=function(){d.update_options(d.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.keyCode||m.which)===27){l()}else{if((m.keyCode||m.which)===13){j()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:l,OK:j})};if(d.filters.length>0){b["Show filters"]=function(){var j;if(!d.filtering_div.is(":visible")){j="Hide filters";d.filters_visible=true}else{j="Show filters";d.filters_visible=false}$("#"+d.name_div.attr("id")+"-menu").find("li").eq(2).text(j);d.filtering_div.toggle()}}b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};d.popup_menu=make_popupmenu(d.name_div,b);show_hide_popupmenu_options(d.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,h=g-m,f=this.view.r
esolution;var p=$("<div style='position: relative;'></div>"),q=this.content_div.width()/h,k;this.content_div.append(p),this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=new Object();while((a*DENSITY*f)<g){var n=this.content_div.width()+"_"+q+"_"+a;var e=this.tile_cache.get(n);if(!b&&e){var j=a*DENSITY*f;var d=(j-m)*q;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,p)}else{this.delayed_draw(this,n,m,g,a,f,p,q,l)}a+=1}var c=this;var o=setInterval(function(){if(l.length!=0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var r=0;r<c.filters.length;r++){c.filters[r].update_ui_elt()}clearInterval(o)}},50)},delayed_draw:function(c,h,g,e,b,d,j,k,f){var a=setTimeout(function(){if(!(g>c.view.high||e<c.view.low)){tile_element=c.draw_tile(d,b,j,k);if(tile_element){if(!c.initial_canvas){c.initial_canvas=$(tile_element).clone();var n=tile_element.get(0).getContext("2d");var l=c.initial_canvas.get(0).getContext("2d");var m=
n.getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,tile_element);c.show_tile(tile_element,j)}}delete f.id},50);f.id=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null
,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_
data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),o=e.get(0).getContext("2d"),k=f+"_"+b;if(p>PX_PER_CHAR){if(this.data_cache.get(k)===undefined){this.get_data(f,b);return}var n=this.data_cache.get(k);if(n===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*p+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*p-this.left_offset});for(var h=0,m=n.length;h<m;h++){var a=Math.round(h*p),j=Math.round(p/2);o.fillText(n[h],a+this.left_offset+j,10)}l.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=fu
nction(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#tr
ack_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;a.container_div.find(".yaxislabel").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:fu
nction(p,s,c,e){if(this.vertical_range===undefined){return}var t=s*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),w=p+"_"+s;if(this.data_cache.get(w)===undefined){this.get_data(p,s);return}var j=this.data_cache.get(w);if(j===null){return}b.css({position:"absolute",top:0,left:(t-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,u=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();o.fillStyle=this.prefs.color;if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var v,h;for(var q=0,r=data.length;q<r;q++){v=Math.round((data[q][0]-t)*e);h=data[q][1];if(h===null){if(k&&m==="Filled"){o.lineTo(v,d)}k=false;continue}if(h<l){h=l}else{if(h>g){h=g}}if(m==="Histogram"){h=Math.round(d-(h-l)/n*d);o.fillRect(v,h,f,d-h)}else{if(m==="Intensity"){h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")
";o.fillRect(v,0,f,d)}else{h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(v,h)}else{k=true;if(m==="Filled"){o.moveTo(v,d);o.lineTo(v,h)}else{o.moveTo(v,h)}}}}}if(m==="Filled"){if(k){o.lineTo(v,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(n){var a=$("<div />").addClass("form-row");var e="track_"+n+"_color",b=$("<label />").attr("for",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+n+"_minval",m=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),l=$("<input></input>").attr("id",h).val(d),k="track_"+n+"_maxval",g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j);return a.append(m).append(l).append(g).append(f).append(b).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val();color=$("#track_
"+c+"_color").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value||color!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.prefs.color=color;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATU
RE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"#444",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};t
his.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(v<=MAX_FEATURE_DEPTH){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_ti
le[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(r,m,s,b,q,f,h,e){r.textAlign="center";var l=0,p=Math.round(m/2);for(cig_id in h){var k=h[cig_id],d="MIDNSHP"[k[0]],n=k[1];if(d==="H"||d==="S"){l-=n}var g=q+l,v=Math.floor(Math.max(0,(g-s)*m)),j=Math.floor(Math.max(0,(g+n-s)*m));switch(d){case"S":case"H":case"M":var o=f.slice(l,n);if((this.mode==="Pack"||this.mode==="Auto")&&f!==undefined&&m>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(v+this.left_offset,e+1,j-v,9);r.fillStyle=CONNECTOR_COLOR;for(var t=0,a=o.length;t<a;t++){if(g+t>=s&&g+t<=b){var u=Math.floor(Math.max(0,(g+t-s)*m));r.fillText(o[t],u+this.left_offset+p,e+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(v+this.left_offset,e+4,j-v,3)}break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(v+this.left_offset,e+5,j-v,1);break;case"D":r.fillStyle="red";r.fillRect(v+this.left_offset,e+4,j-v,3);break;case"P":case"I":break}l+=n}},draw_tile:function(
ah,o,s,aw){var N=o*DENSITY*ah,am=(o+1)*DENSITY*ah,M=am-N;var ao=(!this.initial_canvas?"initial":N+"_"+am);var I=this.data_cache.get(ao);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,am]]=true;this.get_data(N,am);return}var a=Math.ceil(M*aw),S=$("<canvas class='tile'></canvas>"),aj=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,af=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_info==="no_detail")),X=this.left_offset,av,D,ax;if(I.dataset_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;ax=10}else{ax=(af?this.vertical_nodetail_px:this.vertical_detail_px);var A=(aw<0.0001?1/view.zoom_res:aw);D=this.incremental_slots(A,I.data,af,r)*ax+z;av=this.inc_slots[A]}}S.css({position:"absolute",top:0,left:(N-this.view.low)*aw-X});S.get(0).width=a+X;S.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=S.get(0).getContext("2d");J.fillStyle=l;J.font=t
his.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Z=I.data,L=I.max,q=I.avg,b=Math.ceil(I.delta*aw);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var aq=0,H=Z.length;aq<H;aq++){var ab=Math.floor((Z[aq][0]-N)*aw);var aa=Z[aq][1];if(!aa){continue}var an=aa/L*this.summary_draw_height;J.fillStyle="black";J.fillRect(ab+X,this.summary_draw_height-an,b,an);if(this.prefs.show_counts&&J.measureText(aa).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(aa,ab+X+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(S);return S}if(I.message){S.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+X,ax)}var ae=false;if(I.data.length!=0){ae=true;for(var at=0;at<this.filters.length;at++){if(!this.filters[at].applies_to(I.data[0])){ae=false}}}if(ae){S.
addClass(FILTERABLE_CLASS)}var au=I.data;var ap=0;for(var aq=0,H=au.length;aq<H;aq++){var T=au[aq],R=T[0],ar=T[1],ad=T[2],O=T[3];if(av[R]===undefined){continue}var ac=false;var V;for(var at=0;at<this.filters.length;at++){V=this.filters[at];V.update_attrs(T);if(!V.keep(T)){ac=true;break}}if(ac){continue}if(ar<=am&&ad>=N){var ag=Math.floor(Math.max(0,(ar-N)*aw)),K=Math.ceil(Math.min(a,Math.max(0,(ad-N)*aw))),Y=(r==="Dense"?1:(1+av[R]))*ax;if(I.dataset_type==="bai"){var v=T[4];J.fillStyle=l;if(T[5] instanceof Array){var E=Math.floor(Math.max(0,(T[5][0]-N)*aw)),Q=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-N)*aw))),C=Math.floor(Math.max(0,(T[6][0]-N)*aw)),w=Math.ceil(Math.min(a,Math.max(0,(T[6][1]-N)*aw)));if(T[5][1]>=N&&T[5][0]<=am){this.rect_or_text(J,aw,N,am,T[5][0],T[5][2],v,Y)}if(T[6][1]>=N&&T[6][0]<=am){this.rect_or_text(J,aw,N,am,T[6][0],T[6][2],v,Y)}if(C>Q){J.fillStyle=CONNECTOR_COLOR;J.fillRect(Q+X,Y+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,aw,N,am,ar,O,v,Y)}if(r!=
="Dense"&&!af&&ar>N){J.fillStyle=this.prefs.label_color;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(R,ag-2+X,Y+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var G=T[4],W=T[5],ai=T[6],h=T[7];var F,ak,P=null,ay=null;if(W&&ai){P=Math.floor(Math.max(0,(W-N)*aw));ay=Math.ceil(Math.min(a,Math.max(0,(ai-N)*aw)))}if(r!=="Dense"&&O!==undefined&&ar>N){J.fillStyle=aj;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}if(h){if(G){if(G=="+"){J.fillStyle=RIGHT_STRAND}else{if(G=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}for(var ao=0,g=h.length;ao<g;ao++){var u=h[ao],d=Math.floor(Math.max(0,(u[0]-N)*aw)),U=Math.ceil(Math.min(a,Math.max((u[1]-N)*aw)));if(d>U){continue}F=5;ak=3;J.fillRect(d+X,Y+ak,U-d,F);if(P!==undefined&&!(d>ay||
U<P)){F=9;ak=1;var al=Math.max(d,P),B=Math.min(U,ay);J.fillRect(al+X,Y+ak,B-al,F)}}}else{F=9;ak=1;J.fillRect(ag+X,Y+ak,K-ag,F);if(T.strand){if(T.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(ag+X,Y,K-ag,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(af){J.fillStyle=l;J.fillRect(ag+X,Y+5,K-ag,1)}else{var t=T[4],n=T[5],c=T[6];F=9;ak=1;J.fillRect(ag+X,Y,K-ag,F);if(r!=="Dense"&&O!==undefined&&ar>N){J.fillStyle=aj;if(o===0&&ag-J.measureText(O).width<0){J.textAlign="left";J.fillText(O,K+2+X,Y+8)}else{J.textAlign="right";J.fillText(O,ag-2+X,Y+8)}J.fillStyle=l}var m=t+" / "+n;if(ar>N&&J.measureText(m).width<(K-ag)){J.fillStyle="white";J.textAlign="center";J.fillText(m,X+ag+(K-ag)/2,Y+8);J.fillStyle=l}}}}}ap++}}return S},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(th
is.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="ReadTrack";this.vert
ical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0

galaxy-dist commit ad9bb65d2d15: mutation viz tool help cleanup
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287520820 14400
# Node ID ad9bb65d2d153af5db0ae497930eb35d17f63057
# Parent 35b379691524c768ec84f86477f1ab49859afec2
mutation viz tool help cleanup
--- a/tools/mutation/visualize.xml
+++ b/tools/mutation/visualize.xml
@@ -20,7 +20,7 @@
<repeat name="sample_chooser" title="Sample"><param name="name" type="text" label="Label" help="Optional" />
- <param name="a_col" type="data_column" data_ref="input1" multiple="false" numerical="false" label="A Column" help="" />
+ <param name="a_col" type="data_column" data_ref="input1" multiple="false" numerical="false" label="Base A Column" help="" /><param name="totals_col" type="data_column" data_ref="input1" multiple="false" numerical="false" label="Totals Column" help="" /></repeat>
@@ -60,27 +60,42 @@
</test></tests><help>
-
-**Example**
+**What it does**
This tool allows you to visualize mutations described in a tabular input file. It generates an SVG image which can be viewed in any web browser.
+You will need to specify the position and reference columns in the input file. Then click on the 'Add new Sample' to add samples in the input file that you would like to visualize. For each sample you select, specify the column for base 'A', the totals column and enter a name.
+This tool assumes the columns specifying bases A, C, G, T are placed consecutively and in that order in an input file.
+
+Interactivity: If interactive zoom option is selected, then the resultant image can be zoomed in or out using the scroll mouse wheel and can be panned by dragging the image using left mouse button.
+
+-----
+
+**General Example**
+
Given the input file::
- gm blood gm cheek
chrM 72 73 G 26394 4 49 0 26447 26398 1 23389 3 45 0 23437 23392 1
chrM 149 150 T 11 50422 2 96 50531 50435 1 4 45417 1 65 45487 45422 1
-You will need to specify the position and reference columns in the input file. Then click on the 'Add new Sample' to add samples in the input file that you would like to visualize. For each sample you select, specify the column for base 'A' and the totals column.
-This tool assumes the columns specifying bases A, C, G, T are placed consecutively and in that order in an input file.
+To visualize the two samples in the input file, the following parameters are selected before running the tool::
+
+ Position column: 2
+ Reference Base column: 4
+ Sample 1 Label: gm blood
+ Sample 1 Base A column: 5
+ Sample 1 Totals column: 9
+ Sample 2 Label: gm cheek
+ Sample 2 Base A column: 12
+ Sample 2 Totals column: 16
-Visualization:
+Visualization output:
.. image:: ../static/images/mutation_visualization_example.png
:width: 150
-Interactivity::
- If interactive zoom option is selected, then the resultant image can be zoomed in or out using the scroll mouse wheel and can be panned by dragging the image using left mouse button.
+Here the left-most column represents the position and the background color is the reference base color. Each column on its right describe each sample.
+In the output above, the blue bar is the longest, which means that base A is maximum in position 72 for both the samples.
</help></tool>
1
0

galaxy-dist commit 6372b67c9e37: mutation viz tool test data files
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287517282 14400
# Node ID 6372b67c9e370b3a80159bcc719e13d50ddc018f
# Parent e029c860e71710d69f725e5c136b7e55fa529a42
mutation viz tool test data files
--- /dev/null
+++ b/test-data/mutation_data1_zoom3x.svg
@@ -0,0 +1,639 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg style="stroke-linejoin:round; stroke:black; stroke-width:0.5pt; text-anchor:middle; fill:none" xmlns="http://www.w3.org/2000/svg" font-family="Helvetica, Arial, FreeSans, Sans, sans, sans-serif" height="1980px" width="208px" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 116 496">
+
+<g id="viewport">
+
+<text y="4" x="12" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">A</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="14" fill="blue" />
+
+<text y="4" x="22" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">C</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="24" fill="green" />
+
+<text y="4" x="32" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">G</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="34" fill="orange" />
+
+<text y="4" x="42" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">T</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="44" fill="red" />
+
+<text y="25" x="23" stroke="none" transform="rotate(-90 23,25)" fill="black"><tspan style="font-family:Verdana;font-size:25%">s1</tspan></text>
+
+<text y="42" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">72</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="38" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="38" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="38" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="39.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="41.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="42.5" x="16" fill="red" />
+
+<text y="50" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">149</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="46" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="46" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="46" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="47.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="49.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="50.5" x="16" fill="red" />
+
+<text y="58" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">194</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="54" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="54" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="54" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="55.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="57.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="58.5" x="16" fill="red" />
+
+<text y="66" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">299</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="62" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="62" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="62" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="63.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="65.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="66.5" x="16" fill="red" />
+
+<text y="74" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">309</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="70" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="70" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="70" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="11" stroke="none" y="71.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="73.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="2" stroke="none" y="74.5" x="16" fill="red" />
+
+<text y="82" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">310</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="78" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="78" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="78" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="4" stroke="none" y="79.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="81.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="9" stroke="none" y="82.5" x="16" fill="red" />
+
+<text y="90" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">409</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="86" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="86" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="86" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="87.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="89.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="90.5" x="16" fill="red" />
+
+<text y="98" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">2353</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="94" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="94" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="94" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="95.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="97.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="98.5" x="16" fill="red" />
+
+<text y="106" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">2484</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="102" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="102" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="102" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="103.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="105.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="106.5" x="16" fill="red" />
+
+<text y="114" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">2707</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="110" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="110" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="110" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="111.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="113.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="114.5" x="16" fill="red" />
+
+<text y="122" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">3011</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="118" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="118" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="118" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="119.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="121.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="122.5" x="16" fill="red" />
+
+<text y="130" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">3434</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="126" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="126" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="126" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="127.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="129.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="130.5" x="16" fill="red" />
+
+<text y="138" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">3480</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="134" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="134" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="134" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="135.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="137.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="138.5" x="16" fill="red" />
+
+<text y="146" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">5063</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="142" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="142" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="142" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="143.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="145.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="146.5" x="16" fill="red" />
+
+<text y="154" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">5580</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="150" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="150" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="150" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="151.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="153.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="154.5" x="16" fill="red" />
+
+<text y="162" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">7028</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="158" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="158" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="158" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="159.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="161.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="162.5" x="16" fill="red" />
+
+<text y="170" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">8701</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="166" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="166" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="166" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="167.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="169.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="170.5" x="16" fill="red" />
+
+<text y="178" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">8992</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="174" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="174" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="174" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="8" stroke="none" y="175.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="177.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="5" stroke="none" y="178.5" x="16" fill="red" />
+
+<text y="186" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">9377</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="182" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="182" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="182" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="183.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="185.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="186.5" x="16" fill="red" />
+
+<text y="194" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">9540</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="190" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="190" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="190" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="191.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="193.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="194.5" x="16" fill="red" />
+
+<text y="202" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10398</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="198" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="198" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="198" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="199.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="201.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="202.5" x="16" fill="red" />
+
+<text y="210" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10550</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="206" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="206" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="206" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="207.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="209.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="210.5" x="16" fill="red" />
+
+<text y="218" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10819</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="214" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="214" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="214" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="215.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="217.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="218.5" x="16" fill="red" />
+
+<text y="226" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10873</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="222" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="222" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="222" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="223.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="225.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="226.5" x="16" fill="red" />
+
+<text y="234" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11017</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="230" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="230" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="230" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="231.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="233.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="234.5" x="16" fill="red" />
+
+<text y="242" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11299</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="238" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="238" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="238" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="239.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="241.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="242.5" x="16" fill="red" />
+
+<text y="250" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11719</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="246" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="246" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="246" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="247.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="249.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="250.5" x="16" fill="red" />
+
+<text y="258" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11722</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="254" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="254" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="254" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="255.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="257.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="258.5" x="16" fill="red" />
+
+<text y="266" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">12705</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="262" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="262" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="262" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="263.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="265.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="266.5" x="16" fill="red" />
+
+<text y="274" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">12850</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="270" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="270" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="270" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="271.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="273.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="274.5" x="16" fill="red" />
+
+<text y="282" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14053</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="278" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="278" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="278" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="279.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="281.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="282.5" x="16" fill="red" />
+
+<text y="290" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14212</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="286" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="286" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="286" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="287.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="289.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="290.5" x="16" fill="red" />
+
+<text y="298" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14580</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="294" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="294" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="294" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="295.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="297.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="298.5" x="16" fill="red" />
+
+<text y="306" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14766</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="302" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="302" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="302" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="303.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="305.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="306.5" x="16" fill="red" />
+
+<text y="314" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14905</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="310" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="310" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="310" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="311.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="313.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="314.5" x="16" fill="red" />
+
+<text y="322" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">15301</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="318" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="318" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="318" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="319.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="321.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="322.5" x="16" fill="red" />
+
+<text y="330" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">15932</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="326" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="326" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="326" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="327.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="329.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="330.5" x="16" fill="red" />
+
+<text y="338" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16172</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="334" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="334" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="334" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="335.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="337.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="338.5" x="16" fill="red" />
+
+<text y="346" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16183</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="342" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="342" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="342" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="343.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="345.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="346.5" x="16" fill="red" />
+
+<text y="354" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16184</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="350" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="350" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="350" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="351.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="353.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="354.5" x="16" fill="red" />
+
+<text y="362" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16189</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="358" x="0" fill="green" />
+
+<text y="370" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16190</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="366" x="0" fill="green" />
+
+<text y="378" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16224</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="374" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="374" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="374" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="375.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="377.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="378.5" x="16" fill="red" />
+
+<text y="386" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16240</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="382" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="382" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="382" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="383.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="385.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="386.5" x="16" fill="red" />
+
+<text y="394" x="7" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16321</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="390" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="390" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="390" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="391.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="393.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="394.5" x="16" fill="red" />
+
+</g>
+
+</svg>
+
--- /dev/null
+++ b/test-data/mutation_data1_interactive.svg
@@ -0,0 +1,868 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
+<script type="text/javascript">
+/**
+ * SVGPan library 1.2
+ * ====================
+ *
+ * Given an unique existing element with id "viewport", including the
+ * the library into any SVG adds the following capabilities:
+ *
+ * - Mouse panning
+ * - Mouse zooming (using the wheel)
+ * - Object dargging
+ *
+ * Known issues:
+ *
+ * - Zooming (while panning) on Safari has still some issues
+ *
+ * Releases:
+ *
+ * 1.2, Sat Mar 20 08:42:50 GMT 2010, Zeng Xiaohui
+ * Fixed a bug with browser mouse handler interaction
+ *
+ * 1.1, Wed Feb 3 17:39:33 GMT 2010, Zeng Xiaohui
+ * Updated the zoom code to support the mouse wheel on Safari/Chrome
+ *
+ * 1.0, Andrea Leofreddi
+ * First release
+ *
+ * This code is licensed under the following BSD license:
+ *
+ * Copyright 2009-2010 Andrea Leofreddi (a.leofreddi(a)itcharm.com) All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Andrea Leofreddi ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Andrea Leofreddi OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of Andrea Leofreddi.
+ */
+
+var root = document.documentElement;
+
+var state = 'none', stateTarget, stateOrigin, stateTf;
+
+setupHandlers(root);
+
+/**
+ * Register handlers
+ */
+function setupHandlers(root){
+ setAttributes(root, {
+ "onmouseup" : "add(evt)",
+ "onmousedown" : "handleMouseDown(evt)",
+ "onmousemove" : "handleMouseMove(evt)",
+ "onmouseup" : "handleMouseUp(evt)",
+ //"onmouseout" : "handleMouseUp(evt)", // Decomment this to stop the pan functionality when dragging out of the SVG element
+ });
+
+ if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0)
+ window.addEventListener('mousewheel', handleMouseWheel, false); // Chrome/Safari
+ else
+ window.addEventListener('DOMMouseScroll', handleMouseWheel, false); // Others
+}
+
+/**
+ * Instance an SVGPoint object with given event coordinates.
+ */
+function getEventPoint(evt) {
+ var p = root.createSVGPoint();
+
+ p.x = evt.clientX;
+ p.y = evt.clientY;
+
+ return p;
+}
+
+/**
+ * Sets the current transform matrix of an element.
+ */
+function setCTM(element, matrix) {
+ var s = "matrix(" + matrix.a + "," + matrix.b + "," + matrix.c + "," + matrix.d + "," + matrix.e + "," + matrix.f + ")";
+
+ element.setAttribute("transform", s);
+}
+
+/**
+ * Dumps a matrix to a string (useful for debug).
+ */
+function dumpMatrix(matrix) {
+ var s = "[ " + matrix.a + ", " + matrix.c + ", " + matrix.e + "\n " + matrix.b + ", " + matrix.d + ", " + matrix.f + "\n 0, 0, 1 ]";
+
+ return s;
+}
+
+/**
+ * Sets attributes of an element.
+ */
+function setAttributes(element, attributes){
+ for (i in attributes)
+ element.setAttributeNS(null, i, attributes[i]);
+}
+
+/**
+ * Handle mouse move event.
+ */
+function handleMouseWheel(evt) {
+ if(evt.preventDefault)
+ evt.preventDefault();
+
+ evt.returnValue = false;
+
+ var svgDoc = evt.target.ownerDocument;
+
+ var delta;
+
+ if(evt.wheelDelta)
+ delta = evt.wheelDelta / 3600; // Chrome/Safari
+ else
+ delta = evt.detail / -90; // Mozilla
+
+ var z = 1 + delta; // Zoom factor: 0.9/1.1
+
+ var g = svgDoc.getElementById("viewport");
+
+ var p = getEventPoint(evt);
+
+ p = p.matrixTransform(g.getCTM().inverse());
+
+ // Compute new scale matrix in current mouse position
+ var k = root.createSVGMatrix().translate(p.x, p.y).scale(z).translate(-p.x, -p.y);
+
+ setCTM(g, g.getCTM().multiply(k));
+
+ stateTf = stateTf.multiply(k.inverse());
+}
+
+/**
+ * Handle mouse move event.
+ */
+function handleMouseMove(evt) {
+ if(evt.preventDefault)
+ evt.preventDefault();
+
+ evt.returnValue = false;
+
+ var svgDoc = evt.target.ownerDocument;
+
+ var g = svgDoc.getElementById("viewport");
+
+ if(state == 'pan') {
+ // Pan mode
+ var p = getEventPoint(evt).matrixTransform(stateTf);
+
+ setCTM(g, stateTf.inverse().translate(p.x - stateOrigin.x, p.y - stateOrigin.y));
+ } else if(state == 'move') {
+ // Move mode
+ var p = getEventPoint(evt).matrixTransform(g.getCTM().inverse());
+
+ setCTM(stateTarget, root.createSVGMatrix().translate(p.x - stateOrigin.x, p.y - stateOrigin.y).multiply(g.getCTM().inverse()).multiply(stateTarget.getCTM()));
+
+ stateOrigin = p;
+ }
+}
+
+/**
+ * Handle click event.
+ */
+function handleMouseDown(evt) {
+ if(evt.preventDefault)
+ evt.preventDefault();
+
+ evt.returnValue = false;
+
+ var svgDoc = evt.target.ownerDocument;
+
+ var g = svgDoc.getElementById("viewport");
+
+ if(evt.target.tagName == "svg") {
+ // Pan mode
+ state = 'pan';
+
+ stateTf = g.getCTM().inverse();
+
+ stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
+ }
+ /*else {
+ // Move mode
+ state = 'move';
+
+ stateTarget = evt.target;
+
+ stateTf = g.getCTM().inverse();
+
+ stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
+ }*/
+}
+/**
+ * Handle mouse button release event.
+ */
+function handleMouseUp(evt) {
+ if(evt.preventDefault)
+ evt.preventDefault();
+
+ evt.returnValue = false;
+
+ var svgDoc = evt.target.ownerDocument;
+
+ if(state == 'pan' || state == 'move') {
+ // Quit pan mode
+ state = '';
+ }
+}
+</script>
+
+<g id="viewport">
+
+<text y="4" x="12" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">A</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="14" fill="blue" />
+
+<text y="4" x="22" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">C</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="24" fill="green" />
+
+<text y="4" x="32" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">G</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="34" fill="orange" />
+
+<text y="4" x="42" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:20%">T</tspan></text>
+
+<rect fill-opacity="0.5" height="3" width="4" stroke="none" y="1" x="44" fill="red" />
+
+<text y="35" x="23" stroke="none" transform="rotate(-90 23,35)" fill="black"><tspan style="font-family:Verdana;font-size:25%">s1</tspan></text>
+
+<text y="42" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">72</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="38" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="38" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="38" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="39.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="41.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="42.5" x="16" fill="red" />
+
+<text y="50" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">149</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="46" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="46" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="46" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="47.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="49.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="50.5" x="16" fill="red" />
+
+<text y="58" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">194</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="54" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="54" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="54" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="55.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="57.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="58.5" x="16" fill="red" />
+
+<text y="66" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">299</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="62" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="62" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="62" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="63.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="65.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="66.5" x="16" fill="red" />
+
+<text y="74" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">309</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="70" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="70" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="70" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="11" stroke="none" y="71.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="73.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="2" stroke="none" y="74.5" x="16" fill="red" />
+
+<text y="82" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">310</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="78" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="78" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="78" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="4" stroke="none" y="79.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="81.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="9" stroke="none" y="82.5" x="16" fill="red" />
+
+<text y="90" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">409</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="86" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="86" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="86" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="87.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="89.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="90.5" x="16" fill="red" />
+
+<text y="98" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">2353</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="94" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="94" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="94" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="95.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="97.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="98.5" x="16" fill="red" />
+
+<text y="106" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">2484</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="102" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="102" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="102" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="103.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="105.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="106.5" x="16" fill="red" />
+
+<text y="114" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">2707</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="110" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="110" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="110" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="111.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="113.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="114.5" x="16" fill="red" />
+
+<text y="122" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">3011</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="118" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="118" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="118" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="119.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="121.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="122.5" x="16" fill="red" />
+
+<text y="130" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">3434</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="126" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="126" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="126" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="127.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="129.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="130.5" x="16" fill="red" />
+
+<text y="138" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">3480</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="134" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="134" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="134" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="135.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="137.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="138.5" x="16" fill="red" />
+
+<text y="146" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">5063</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="142" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="142" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="142" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="143.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="145.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="146.5" x="16" fill="red" />
+
+<text y="154" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">5580</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="150" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="150" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="150" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="151.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="153.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="154.5" x="16" fill="red" />
+
+<text y="162" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">7028</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="158" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="158" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="158" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="159.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="161.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="162.5" x="16" fill="red" />
+
+<text y="170" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">8701</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="166" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="166" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="166" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="167.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="169.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="170.5" x="16" fill="red" />
+
+<text y="178" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">8992</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="174" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="174" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="174" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="8" stroke="none" y="175.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="177.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="5" stroke="none" y="178.5" x="16" fill="red" />
+
+<text y="186" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">9377</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="182" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="182" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="182" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="183.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="185.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="186.5" x="16" fill="red" />
+
+<text y="194" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">9540</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="190" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="190" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="190" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="191.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="193.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="194.5" x="16" fill="red" />
+
+<text y="202" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10398</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="198" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="198" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="198" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="199.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="201.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="202.5" x="16" fill="red" />
+
+<text y="210" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10550</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="206" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="206" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="206" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="207.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="209.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="210.5" x="16" fill="red" />
+
+<text y="218" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10819</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="214" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="214" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="214" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="215.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="217.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="218.5" x="16" fill="red" />
+
+<text y="226" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">10873</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="222" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="222" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="222" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="223.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="225.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="226.5" x="16" fill="red" />
+
+<text y="234" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11017</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="230" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="230" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="230" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="231.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="233.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="234.5" x="16" fill="red" />
+
+<text y="242" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11299</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="238" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="238" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="238" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="239.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="241.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="242.5" x="16" fill="red" />
+
+<text y="250" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11719</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="246" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="246" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="246" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="247.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="249.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="250.5" x="16" fill="red" />
+
+<text y="258" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">11722</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="254" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="254" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="254" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="255.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="257.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="258.5" x="16" fill="red" />
+
+<text y="266" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">12705</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="262" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="262" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="262" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="263.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="265.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="266.5" x="16" fill="red" />
+
+<text y="274" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">12850</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="270" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="270" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="270" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="271.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="273.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="274.5" x="16" fill="red" />
+
+<text y="282" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14053</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="278" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="278" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="278" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="279.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="281.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="282.5" x="16" fill="red" />
+
+<text y="290" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14212</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="286" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="286" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="286" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="287.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="289.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="290.5" x="16" fill="red" />
+
+<text y="298" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14580</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="294" x="0" fill="orange" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="294" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="294" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="295.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="297.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="298.5" x="16" fill="red" />
+
+<text y="306" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14766</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="302" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="302" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="302" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="303.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="305.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="306.5" x="16" fill="red" />
+
+<text y="314" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">14905</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="310" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="310" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="310" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="311.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="313.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="314.5" x="16" fill="red" />
+
+<text y="322" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">15301</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="318" x="0" fill="blue" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="318" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="318" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="319.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="321.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="322.5" x="16" fill="red" />
+
+<text y="330" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">15932</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="326" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="326" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="326" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="327.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="329.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="330.5" x="16" fill="red" />
+
+<text y="338" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16172</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="334" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="334" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="334" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="335.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="337.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="338.5" x="16" fill="red" />
+
+<text y="346" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16183</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="342" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="342" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="342" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="343.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="345.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="346.5" x="16" fill="red" />
+
+<text y="354" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16184</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="350" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="350" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="350" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="351.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="353.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="354.5" x="16" fill="red" />
+
+<text y="362" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16189</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="358" x="0" fill="green" />
+
+<text y="370" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16190</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="366" x="0" fill="green" />
+
+<text y="378" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16224</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="374" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="374" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="374" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="375.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="0" stroke="none" y="377.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="378.5" x="16" fill="red" />
+
+<text y="386" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16240</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="382" x="0" fill="green" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="382" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="382" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="383.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="385.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="386.5" x="16" fill="red" />
+
+<text y="394" x="0" stroke="none" fill="black"><tspan style="font-family:Verdana;font-size:25%">16321</tspan></text>
+
+<rect fill-opacity="0.2" height="6" width="14" stroke="none" y="390" x="0" fill="red" />
+
+<rect fill-opacity="0.25" height="6" width="12" stroke="none" y="390" x="16" fill="grey" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="390" x="16" fill="blue" />
+
+<rect fill-opacity="0.6" height="1.5" width="12" stroke="none" y="391.5" x="16" fill="green" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="393.0" x="16" fill="orange" />
+
+<rect fill-opacity="0.6" height="1.5" width="1" stroke="none" y="394.5" x="16" fill="red" />
+
+</g>
+
+</svg>
+
--- /dev/null
+++ b/test-data/mutation_data1.txt
@@ -0,0 +1,1 @@
+chrM 72 73 G 26394 4 49 0 26447 26398 1 23389 3 45 0 23437 23392 1 3133 0 5 0 3138 3133 1 4087 0 6 0 4093 4087 1 9544 0 18 0 9562 9544 1 14437 1 22 1 14461 14439 1 11325 0 3 1 11329 11326 1 3595 0 9 1 3605 3596 1 12029 0 14 0 12043 12029 1 10441 0 21 0 10462 10441 1
chrM 149 150 T 11 50422 2 96 50531 50435 1 4 45417 1 65 45487 45422 1 0 4050 0 2 4052 4050 1 0 4488 0 4 4492 4488 1 3 18713 0 22 18738 18716 1 7 26855 0 33 26895 26862 1 1 13677 1 6 13685 13679 1 0 4635 0 13 4648 4635 1 4 26401 3 44 26452 26408 1 5 19462 0 18 19485 19467 1
chrM 194 195 C 0 102 2 58672 58776 58674 1 1 191 0 52080 52272 52081 1 3 8 0 3709 3720 3712 1 3 7 1 4600 4611 4604 1 1 35 1 21266 21303 21268 1 4 73 1 30175 30253 30180 1 6 14 0 13695 13715 13701 1 1 7 0 4786 4794 4787 1 2 31 1 31363 31397 31366 1 1 29 3 21865 21898 21869 1
chrM 299 300 A 18619 88 12 0 18719 100 0 18153 84 5 0 18242 89 0 568 32 0 0 623 32 2 774 31 0 0 828 31 2 6658 22 1 0 6681 23 0 10589 37 5 0 10631 42 0 2288 85 1 0 2455 86 2 637 30 0 0 696 30 2 8133 41 2 0 8176 43 0 7327 26 5 0 7358 31 0
chrM 309 310 C 6 11340 0 1433 12779 1439 2 3 11229 0 1336 12568 1339 2 1 778 0 4 783 5 0 0 1065 0 3 1069 3 0 0 4297 0 464 4761 464 2 1 6162 1 765 6929 767 2 0 3075 0 6 3083 6 0 0 875 0 1 876 1 0 1 5064 0 644 5709 645 2 2 4468 0 582 5052 584 2
chrM 310 311 T 1 1362 0 3775 5138 1363 2 1 1389 1 4222 5613 1391 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 448 0 1636 2085 449 2 0 795 0 2176 2971 795 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 567 0 2128 2695 567 2 0 558 0 1397 1955 558 2
chrM 409 410 A 2 3 1 30151 30157 30155 1 2 13 3 30355 30373 30371 1 1 0 0 2752 2754 2752 1 1 1 0 2996 2998 2997 1 1 2 0 12262 12265 12264 1 4 8 1 16960 16973 16969 1 3 8 0 8837 8853 8845 1 0 0 0 2942 2942 2942 1 0 3 1 16259 16263 16263 1 1 3 0 11363 11367 11366 1
chrM 2353 2354 C 3 34 3 63620 63660 63626 1 4 15 1 58084 58104 58089 1 1 0 0 2981 2982 2982 1 0 3 0 4267 4271 4267 1 0 7 0 23235 23242 23235 1 5 12 0 35778 35795 35783 1 5 3 0 12254 12264 12259 1 3 1 0 3923 3928 3926 1 4 7 2 32378 32391 32384 1 2 6 0 24366 24374 24368 1
chrM 2484 2485 C 0 20 0 27765 27785 27765 1 2 29 0 24596 24627 24598 1 0 1 0 698 699 698 1 0 5 0 879 884 879 1 0 8 1 10159 10168 10160 1 2 23 1 16036 16062 16039 1 2 5 0 2555 2562 2557 1 0 3 0 761 764 761 1 0 4 2 12896 12902 12898 1 0 14 0 10916 10930 10916 1
chrM 2707 2708 g 27267 1 48 1 27317 27269 1 25550 1 42 1 25594 25552 1 2662 1 4 0 2667 2663 1 3230 0 1 0 3231 3230 1 10833 0 5 1 10839 10834 1 16605 0 24 2 16631 16607 1 9785 0 3 1 9791 9786 1 3116 0 6 1 3123 3117 1 13825 1 33 0 13859 13826 1 10957 0 14 0 10971 10957 1
chrM 3011 3012 G 75871 4 113 2 75990 75877 1 53124 4 84 4 53216 53132 1 8422 0 67 1 8491 8423 1 6613 2 7 0 6622 6615 1 22042 1 37 2 22082 22045 1 28451 4 43 4 28502 28459 1 18438 2 12 12 18464 18452 1 9704 1 10 2 9718 9707 1 37763 2 132 2 37899 37767 1 33885 3 62 3 33953 33891 1
chrM 3434 3435 A 38932 0 22 0 38954 22 0 28983 0 13 0 28996 13 0 1994 0 37 0 2031 37 2 1889 0 5 0 1894 5 0 10426 0 4 0 10430 4 0 10332 0 8 0 10340 8 0 5307 1 4 0 5312 5 0 1790 0 2 1 1793 3 0 25278 0 103 0 25381 103 0 14218 0 17 0 14235 17 0
chrM 3480 3481 A 22066 0 45 1 22112 46 0 17217 1 20 0 17238 21 0 1704 0 37 0 1741 37 2 1732 0 3 0 1735 3 0 6049 2 6 1 6058 9 0 5498 1 6 0 5505 7 0 4669 0 7 0 4676 7 0 1589 0 0 0 1589 0 0 14664 0 95 0 14759 95 0 8272 0 21 1 8294 22 0
chrM 5063 5064 T 3 91 5 79483 79582 99 0 4 59 3 59163 59229 66 0 0 45 0 2293 2338 45 2 1 46 0 2247 2294 47 2 0 16 1 20733 20750 17 0 0 22 0 20220 20242 22 0 2 4 0 5222 5228 6 0 0 5 0 2068 2073 5 0 4 31 2 49253 49290 37 0 2 37 2 28632 28673 41 0
chrM 5580 5581 C 2 13 1 12180 12196 12183 1 0 10 0 8677 8687 8677 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 0 3115 3119 3116 1 0 1 0 2806 2807 2806 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 5995 6001 5995 1 0 6 0 3799 3805 3799 1
chrM 7028 7029 T 8 5269 1 105 5383 5278 2 4 3685 2 55 3746 3691 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1562 0 51 1614 1563 2 1 1396 0 47 1444 1397 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3503 0 341 3847 3506 2 2 1928 0 67 1997 1930 2
chrM 8701 8702 G 65164 7 68 1 65240 65172 1 51607 3 70 1 51681 51611 1 3206 0 2 0 3208 3206 1 3036 0 8 0 3045 3036 1 18911 0 22 0 18933 18911 1 17348 1 21 1 17371 17350 1 7376 0 7 0 7384 7376 1 2752 0 6 0 2758 2752 1 44676 5 36 1 44718 44682 1 24266 1 33 3 24303 24270 1
chrM 8992 8993 C 6 32924 2 16918 49850 16926 2 9 20572 2 16675 37258 16686 2 0 1292 0 587 1879 587 2 0 1324 0 607 1931 607 2 1 9979 0 5030 15010 5031 2 2 9001 3 4879 13885 4884 2 1 2413 0 2171 4585 2172 2 1 828 0 604 1433 605 2 8 22642 1 10798 33449 10807 2 6 12485 0 5968 18459 5974 2
chrM 9377 9378 G 29155 4 68 3 29230 29162 1 22590 1 52 1 22644 22592 1 1311 0 5 0 1316 1311 1 1413 1 4 0 1418 1414 1 8996 0 18 0 9014 8996 1 8356 2 21 0 8379 8358 1 3699 0 5 0 3704 3699 1 1000 0 8 0 1008 1000 1 20883 0 37 1 20921 20884 1 10550 2 27 0 10579 10552 1
chrM 9540 9541 C 4 8 4 28819 28835 28827 1 0 9 1 22950 22960 22951 1 0 1 0 2325 2327 2325 1 0 3 0 2325 2328 2325 1 0 1 2 7816 7819 7818 1 0 2 0 7913 7915 7913 1 0 2 0 5783 5786 5783 1 0 0 0 2036 2036 2036 1 0 5 1 16604 16610 16605 1 0 4 1 11200 11205 11201 1
chrM 10398 10399 G 66134 2 150 8 66294 66144 1 48839 0 93 2 48934 48841 1 2035 0 43 0 2078 2035 2 2565 0 11 0 2576 2565 1 17496 0 24 2 17522 17498 1 16169 1 27 0 16197 16170 1 5940 0 4 1 5945 5941 1 2232 0 5 1 2238 2233 1 36668 4 232 2 36906 36674 1 22711 1 66 0 22778 22712 1
chrM 10550 10551 A 74049 6 63 2 74120 71 0 56316 0 47 0 56363 47 0 3414 0 62 0 3476 62 2 3268 0 3 0 3271 3 0 20413 0 20 1 20434 21 0 20500 1 23 0 20524 24 0 8413 0 4 3 8420 7 0 2905 1 0 0 2906 1 0 49435 3 246 1 49685 250 0 26154 0 39 0 26193 39 0
chrM 10819 10820 G 102048 8 109 0 102165 102056 1 98352 15 73 1 98441 98368 1 11816 1 8 1 11849 11818 1 17967 2 17 1 18020 17970 1 34660 5 38 0 34703 34665 1 45769 5 42 1 45817 45775 1 45832 2 18 6 45917 45840 1 21529 2 17 2 21603 21533 1 55823 7 41 1 55872 55831 1 41514 1 39 1 41555 41516 1
chrM 10873 10874 C 4 334 8 101706 102052 101718 1 6 306 5 110569 110886 110580 1 0 7 0 3345 3352 3345 1 0 8 1 3306 3315 3307 1 1 128 1 41600 41730 41602 1 3 130 3 51874 52010 51880 1 2 16 0 8571 8589 8573 1 0 11 0 3417 3428 3417 1 3 176 4 67437 67620 67444 1 2 92 1 39849 39944 39852 1
chrM 11017 11018 C 2 107 2 56456 56567 56460 1 0 81 1 47605 47687 47606 1 3 14 0 4468 4485 4471 1 5 28 0 8816 8849 8821 1 1 24 0 18568 18593 18569 1 0 28 2 21379 21409 21381 1 8 44 2 28099 28154 28109 1 2 40 5 12017 12064 12024 1 1 36 3 33901 33941 33905 1 1 39 0 20246 20286 20247 1
chrM 11299 11300 T 10 336 9 110226 110581 355 0 11 245 5 88175 88436 261 0 1 105 1 6018 6125 107 2 0 26 0 6381 6407 26 0 3 90 3 34717 34813 96 0 5 122 0 43156 43283 127 0 2 55 0 16730 16787 57 0 1 31 0 8903 8935 32 0 8 365 7 62861 63241 380 0 5 134 6 39079 39224 145 0
chrM 11719 11720 A 99 2 39249 3 39353 39254 1 62 4 34101 8 34175 34113 1 1 0 1332 0 1333 1332 1 1 0 1821 1 1823 1822 1 26 0 14441 0 14467 14441 1 33 0 20179 2 20214 20181 1 4 0 5059 1 5064 5060 1 2 0 1607 0 1609 1607 1 58 3 17478 1 17540 17482 1 30 0 15111 1 15142 15112 1
chrM 11722 11723 C 1 35 0 41858 41894 41859 1 1 29 0 36410 36440 36411 1 0 3 0 1385 1388 1385 1 0 2 0 1935 1937 1935 1 0 6 0 15395 15401 15395 1 0 15 0 21603 21618 21603 1 0 6 2 5159 5167 5161 1 1 2 1 1664 1668 1666 1 0 7 0 18965 18972 18965 1 0 13 1 16136 16150 16137 1
chrM 12705 12706 T 10 75459 0 22 75491 75469 1 10 65631 1 17 65659 65642 1 0 3062 1 0 3063 3063 1 1 4062 0 1 4065 4063 1 3 25753 0 7 25763 25756 1 5 37515 0 12 37532 37520 1 0 11340 0 9 11349 11340 1 0 4052 0 1 4053 4052 1 8 34266 0 3 34277 34274 1 8 27100 0 7 27115 27108 1
chrM 12850 12851 G 46567 1 36 1 46605 46569 1 40398 2 31 0 40431 40400 1 1317 0 0 0 1317 1317 1 1893 0 3 0 1896 1893 1 16848 2 4 0 16854 16850 1 24019 1 20 0 24040 24020 1 4794 0 7 0 4801 4794 1 1550 0 1 0 1551 1550 1 21752 0 13 0 21765 21752 1 17627 0 18 0 17645 17627 1
chrM 14053 14054 A 26124 15 101 4 26244 120 0 26956 4 63 3 27026 70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8438 5 15 3 8461 23 0 13898 4 45 3 13950 52 0 687 1 9 2 699 12 1 0 0 0 0 0 0 0 9397 4 23 0 9424 27 0 9886 4 25 0 9915 29 0
chrM 14212 14213 C 2 41 1 56177 56221 56180 1 1 28 1 51914 51944 51916 1 1 2 0 1716 1719 1717 1 0 2 0 2198 2200 2198 1 0 2 2 19614 19618 19616 1 1 23 1 29488 29513 29490 1 1 3 0 6082 6087 6083 1 0 0 0 2066 2066 2066 1 0 9 0 28450 28459 28450 1 0 17 0 21138 21155 21138 1
chrM 14580 14581 G 45013 2 25 1 45041 45016 1 41510 2 24 0 41536 41512 1 2618 0 0 0 2618 2618 1 3842 0 2 2 3846 3844 1 15738 1 8 0 15747 15739 1 23187 1 22 1 23211 23189 1 9996 0 4 1 10001 9997 1 4043 0 1 0 4044 4043 1 19632 1 3 0 19636 19633 1 16565 0 16 0 16581 16565 1
chrM 14766 14767 T 6 46856 3 61 46926 46865 1 6 43558 2 35 43601 43566 1 0 2111 0 2 2113 2111 1 0 3170 0 1 3171 3170 1 2 17178 1 17 17198 17181 1 4 23031 1 30 23066 23036 1 3 8510 0 7 8520 8513 1 1 3048 0 6 3055 3049 1 1 20274 0 51 20326 20275 1 2 17619 0 37 17658 17621 1
chrM 14905 14906 A 15 1 39481 7 39504 39489 1 10 0 35463 9 35482 35472 1 1 0 2479 0 2480 2479 1 0 0 3393 0 3393 3393 1 5 1 15201 0 15207 15202 1 5 1 22237 5 22248 22243 1 1 1 9729 2 9733 9732 1 2 0 3152 0 3154 3152 1 9 0 19057 3 19069 19060 1 4 0 14805 2 14811 14807 1
chrM 15301 15302 A 19 3 46253 2 46277 46258 1 15 0 40199 2 40216 40201 1 0 0 3325 0 3325 3325 1 0 0 4466 0 4466 4466 1 7 1 16415 1 16424 16417 1 6 0 22924 3 22933 22927 1 8 0 12264 5 12277 12269 1 0 0 4301 1 4302 4302 1 5 1 22130 2 22138 22133 1 7 0 18198 0 18205 18198 1
chrM 15932 15933 C 6 15 3 59133 59157 59142 1 0 20 2 54009 54031 54011 1 0 0 0 3323 3323 3323 1 0 6 0 5061 5067 5061 1 0 8 0 21128 21136 21128 1 1 24 0 32868 32893 32869 1 2 3 0 13485 13492 13487 1 0 3 1 5238 5242 5239 1 2 3 0 20445 20450 20447 1 1 14 0 20645 20660 20646 1
chrM 16172 16173 C 4 26 0 10165 10195 10169 1 2 8 0 9289 9299 9291 1 0 15 0 1380 1395 1380 1 0 5 0 1429 1434 1429 1 0 0 1 3986 3987 3987 1 0 2 1 5510 5513 5511 1 0 8 0 4092 4100 4092 1 0 3 0 1404 1407 1404 1 0 3 0 4706 4709 4706 1 0 10 0 3883 3893 3883 1
chrM 16183 16184 C 2687 5 2 0 2694 2689 1 2563 4 1 0 2568 2564 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1174 2 0 0 1176 1174 1 1520 4 0 0 1524 1520 1 477 3 0 1 698 478 1 0 0 0 0 0 0 0 1174 1 0 0 1175 1174 1 1133 1 0 0 1134 1133 1
chrM 16184 16185 C 0 2210 0 0 2210 0 0 0 2051 0 0 2051 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 888 0 0 888 0 0 0 1181 0 0 1181 0 0 306 663 2 0 972 308 2 0 0 0 0 0 0 0 0 924 0 0 924 0 0 0 914 0 0 914 0 0
chrM 16189 16190 C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 987 0 26 1013 26 2 0 1079 0 39 1118 39 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2974 0 98 3072 98 2 0 998 0 36 1034 36 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
chrM 16190 16191 C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 0 931 980 931 2 0 61 0 1080 1141 1080 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 188 0 2842 3030 2842 2 0 55 0 951 1006 951 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
chrM 16224 16225 T 4 17135 0 11 17150 17139 1 1 14988 0 0 14989 14989 1 0 1957 0 0 1957 1957 1 0 2510 0 2 2513 2510 1 0 6840 0 1 6841 6840 1 2 8277 0 9 8288 8279 1 1 6934 0 3 6938 6935 1 0 2431 1 0 2432 2432 1 1 8744 0 2 8747 8745 1 2 6450 1 3 6456 6453 1
chrM 16240 16241 C 1 48 1 22188 22238 22190 1 0 26 1 19721 19748 19722 1 0 3 0 2305 2308 2305 1 0 5 0 3050 3055 3050 1 0 11 2 8824 8837 8826 1 0 26 0 10813 10839 10813 1 1 7 0 8378 8387 8379 1 0 5 0 2884 2889 2884 1 1 26 0 11620 11647 11621 1 0 9 0 8493 8502 8493 1
chrM 16321 16322 T 4 55783 1 23 55811 55788 1 4 48176 0 16 48196 48180 1 0 4551 1 2 4554 4552 1 0 4846 0 3 4849 4846 1 3 20330 0 11 20344 20333 1 4 27565 0 12 27581 27569 1 2 14910 0 3 14916 14912 1 0 5105 0 2 5108 5105 1 1 26605 0 10 26616 26606 1 5 21141 0 8 21154 21146 1
1
0

20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287147090 14400
# Node ID d4b85e30e56d605edc2236ccba5cde41bda1510a
# Parent fb2a31820ccff6f02bb24a0632f214bfef0a8b0a
sample tracking
- create request search+select box bug fixed.
- sample datasets grid operations fixed
--- a/templates/requests/common/sample_datasets.mako
+++ b/templates/requests/common/sample_datasets.mako
@@ -1,5 +1,5 @@
<%def name="render_sample_datasets( sample )">
- ${len( sample.transferred_dataset_files )}/${len( sample.datasets )}
+ ${len( sample.transferred_dataset_files )} / ${len( sample.datasets )}
</%def>
${render_sample_datasets( sample )}
--- a/templates/requests/common/create_request.mako
+++ b/templates/requests/common/create_request.mako
@@ -21,7 +21,7 @@
%endif
<div class="toolForm">
- <div class="toolFormTitle">Create a new request</div>
+ <div class="toolFormTitle">Create a new sequencing request</div>
%if len( request_type_select_field.options ) == 1:
There are no sequencer configurations available for ${trans.user.email} to create sequencing requests.
%else:
--- a/templates/admin/requests/get_data.mako
+++ b/templates/admin/requests/get_data.mako
@@ -104,7 +104,9 @@
<option value="${f}">${f}</option>
%endfor
</select>
- <br/>
+ </div>
+ <div class="form-row">
+ <div id="file_details" class="toolParamHelp" style="clear: both;background-color:#FAFAFA;"></div></div><div class="form-row"><input type="submit" name="select_show_datasets_button" value="Select & show datasets"/>
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -140,9 +140,20 @@ class RequestsCommon( BaseController, Us
request_type = None
# user_id will not be 'none' if an admin user is submitting this request on behalf of another user
# and they selected that user's id from the user_id SelectField.
+ user_id_encoded = True
user_id = params.get( 'user_id', 'none' )
if user_id != 'none':
- user = trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( user_id ) )
+ try:
+ user = trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( user_id ) )
+ except TypeError, e:
+ # We must have an email address rather than an encoded user id
+ # This is because the galaxy.base.js creates a search+select box
+ # when there are more than 20 items in a selectfield
+ user = trans.sa_session.query( trans.model.User ) \
+ .filter( trans.model.User.table.c.email==util.restore_text( user_id ) ) \
+ .first()
+ user_id_encoded = False
+
elif not is_admin:
user = trans.user
else:
@@ -152,6 +163,9 @@ class RequestsCommon( BaseController, Us
if is_admin and user_id == 'none':
message = 'Select the user on behalf of whom you are submitting this request.'
status = 'error'
+ elif user is None:
+ message = 'Invalid user ID (%s)' % str(user_id)
+ status = 'error'
elif not name:
message = 'Enter the name of the request.'
status = 'error'
@@ -170,10 +184,6 @@ class RequestsCommon( BaseController, Us
widgets = []
if request_type is not None or status == 'error':
# Either the user selected a request_type or an error exists on the form.
- if is_admin:
- widgets.append( dict( label='Select user',
- widget=self.__build_user_id_select_field( trans, selected_value=user_id ),
- helptext='Submit the request on behalf of the selected user (Required)'))
widgets.append( dict( label='Name of the Experiment',
widget=TextField( 'name', 40, util.restore_text( params.get( 'name', '' ) ) ),
helptext='(Required)') )
@@ -182,9 +192,20 @@ class RequestsCommon( BaseController, Us
helptext='(Optional)') )
if request_type is not None:
widgets += request_type.request_form.get_widgets( user, **kwd )
- # In case there is an error on the form, make sure to populate widget fields with anything the user
- # may have already entered.
- self.populate_widgets_from_kwd( trans, widgets, **kwd )
+ # In case there is an error on the form, make sure to populate widget fields with anything the user
+ # may have already entered.
+ self.populate_widgets_from_kwd( trans, widgets, **kwd )
+ if request_type is not None or status == 'error':
+ # Either the user selected a request_type or an error exists on the form.
+ if is_admin:
+ if not user_id_encoded:
+ selected_user_id = trans.security.encode_id( user.id )
+ else:
+ selected_user_id = user_id
+ user_widget = dict( label='Select user',
+ widget=self.__build_user_id_select_field( trans, selected_value=selected_user_id ),
+ helptext='Submit the request on behalf of the selected user (Required)')
+ widgets = [ user_widget ] + widgets
return trans.fill_template( '/requests/common/create_request.mako',
cntrller=cntrller,
request_type_select_field=request_type_select_field,
@@ -873,7 +894,7 @@ class RequestsCommon( BaseController, Us
# Build the library_select_field and folder_select_field for the new sample being added.
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans,
user=request.user,
- sample_index=sample_index,
+ sample_index=len( current_samples ),
libraries=libraries,
sample=None,
library_id=library_id,
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -184,23 +184,6 @@ class RequestsAdmin( BaseController, Use
**kwd ) )
# Render the list view
return self.request_grid( trans, **kwd )
- @web.json
- def get_file_details( self, trans, id, folder_path ):
- def print_ticks( d ):
- # pexpect timeout method
- pass
- # Avoid caching
- trans.response.headers['Pragma'] = 'no-cache'
- trans.response.headers['Expires'] = '0'
- request = trans.sa_session.query( trans.model.Request ).get( int( id ) )
- datatx_info = request.type.datatx_info
- cmd = 'ssh %s@%s "ls -oghp \'%s\'"' % ( datatx_info['username'],
- datatx_info['host'],
- folder_path )
- output = pexpect.run( cmd,
- events={ '.ssword:*' : datatx_info[ 'password'] + '\r\n', pexpect.TIMEOUT : print_ticks },
- timeout=10 )
- return unicode( output.replace( '\n', '<br/>' ) )
@web.expose
@web.require_admin
def reject( self, trans, **kwd ):
@@ -244,11 +227,6 @@ class RequestsAdmin( BaseController, Use
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- sample_id = params.get( 'sample_id', None )
- try:
- sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id ( sample_id ) )
- except:
- return invalid_id_redirect( trans, 'requests_admin', sample_id )
if 'operation' in kwd:
operation = kwd[ 'operation' ].lower()
sample_dataset_id = params.get( 'id', None )
@@ -268,7 +246,9 @@ class RequestsAdmin( BaseController, Use
not_deleted = []
for sample_dataset in selected_sample_datasets:
# Make sure the dataset has been transferred before deleting it.
- if sample_dataset in sample.untransferred_dataset_files:
+ if sample_dataset in sample_dataset.sample.untransferred_dataset_files:
+ # save the sample to which these datasets belong to
+ sample = sample_dataset.sample
trans.sa_session.delete( sample_dataset )
trans.sa_session.flush()
else:
@@ -279,7 +259,7 @@ class RequestsAdmin( BaseController, Use
message = message + ' %s could not be deleted because their transfer status is not "Not Started". ' % str( not_deleted )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
- sample_id=sample_id,
+ sample_id=trans.security.encode_id( sample.id ),
status=status,
message=message ) )
elif operation == "rename":
@@ -288,7 +268,7 @@ class RequestsAdmin( BaseController, Use
# has not yet been transferred.
no_datasets_transferred = True
for selected_sample_dataset in selected_sample_datasets:
- if selected_sample_dataset in sample.untransferred_dataset_files:
+ if selected_sample_dataset in selected_sample_dataset.sample.untransferred_dataset_files:
no_datasets_transferred = False
break
if no_datasets_transferred:
@@ -296,15 +276,20 @@ class RequestsAdmin( BaseController, Use
message = 'A dataset can be renamed only if it is in the "Not Started" state.'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
- sample_id=sample_id,
+ sample_id=trans.security.encode_id( selected_sample_datasets[0].sample.id ),
status=status,
message=message ) )
return trans.fill_template( '/admin/requests/rename_datasets.mako',
- sample=sample,
+ sample=selected_sample_datasets[0].sample,
id_list=id_list )
elif operation == "start transfer":
- self.__start_datatx( trans, sample, selected_sample_datasets )
+ self.__start_datatx( trans, selected_sample_datasets[0].sample, selected_sample_datasets )
# Render the grid view
+ sample_id = params.get( 'sample_id', None )
+ try:
+ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id ( sample_id ) )
+ except:
+ return invalid_id_redirect( trans, 'requests_admin', sample_id )
request_id = trans.security.encode_id( sample.request.id )
library_id = trans.security.encode_id( sample.library.id )
self.datatx_grid.title = 'Datasets of sample "%s"' % sample.name
@@ -395,6 +380,10 @@ class RequestsAdmin( BaseController, Use
if folder_path[-1] == os.sep:
folder_path = os.path.dirname( folder_path[:-1] )
folder_path = self.__check_path( folder_path )
+ elif params.get( 'open_folder', False ):
+ if len(selected_files) == 1:
+ folder_path = os.path.join(folder_path, selected_files[0])
+ folder_path = self.__check_path( folder_path )
elif params.get( 'select_show_datasets_button', False ) or params.get( 'select_more_button', False ):
# get the sample these datasets are associated with
try:
@@ -443,8 +432,26 @@ class RequestsAdmin( BaseController, Use
status=status,
message=message )
@web.json
+ def get_file_details( self, trans, id, folder_path ):
+ def print_ticks( d ):
+ # pexpect timeout method
+ pass
+ # Avoid caching
+ trans.response.headers['Pragma'] = 'no-cache'
+ trans.response.headers['Expires'] = '0'
+ request = trans.sa_session.query( trans.model.Request ).get( int( id ) )
+ datatx_info = request.type.datatx_info
+ cmd = 'ssh %s@%s "ls -oghp \'%s\'"' % ( datatx_info['username'],
+ datatx_info['host'],
+ folder_path )
+ output = pexpect.run( cmd,
+ events={ '.ssword:*' : datatx_info[ 'password'] + '\r\n', pexpect.TIMEOUT : print_ticks },
+ timeout=10 )
+ return unicode( output.replace( '\n', '<br/>' ) )
+ @web.json
def open_folder( self, trans, id, folder_path ):
def print_ticks( d ):
+ # pexpect timeout method
pass
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -340,8 +340,7 @@ class UsesFormDefinitionWidgets:
widget_dict[ 'widget' ] = widget
else:
# An existing address object was selected
- address_obj = trans.sa_session.query( trans.app.model.UserAddress ).get( int( value ) )
- widget_dict[ 'widget' ] = address_obj
+ widget_dict[ 'widget' ] = widget
# Populate the AddressField params with the form field contents
widget_params_dict = {}
for field_name, label, help_text in widget.fields():
1
0

galaxy-dist commit 03b74e3675f0: sample tracking functional tests are fixed
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287161361 14400
# Node ID 03b74e3675f0344005ad491f74d2fb0aa56cb010
# Parent d4b85e30e56d605edc2236ccba5cde41bda1510a
sample tracking functional tests are fixed
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1540,7 +1540,7 @@ class TwillTestCase( unittest.TestCase )
def add_bar_codes( self, request_id, request_name, bar_codes, samples, strings_displayed_after_submit=[] ):
# We have to simulate the form submission here since twill barfs on the page
# gvk - 9/22/10 - TODO: make sure the mako template produces valid html
- url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s&edit_samples_button=Edit+samples" % ( self.url, request_id )
+ url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s&managing_samples=True" % ( self.url, request_id )
for index, field_value in enumerate( bar_codes ):
sample_field_name = "sample_%i_name" % index
sample_field_value = samples[ index ].name.replace( ' ', '+' )
@@ -1551,20 +1551,23 @@ class TwillTestCase( unittest.TestCase )
self.visit_url( url )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
- def change_sample_state( self, request_id, request_name, sample_name, sample_id, new_sample_state_id, new_state_name, comment='',
+ def change_sample_state( self, request_id, request_name, sample_names, sample_ids, new_sample_state_id, new_state_name, comment='',
strings_displayed=[], strings_displayed_after_submit=[] ):
# We have to simulate the form submission here since twill barfs on the page
# gvk - 9/22/10 - TODO: make sure the mako template produces valid html
url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s" % ( self.url, request_id )
- # select_sample_%i=true must be included twice to simulate a CheckboxField checked setting.
- url += "&comment=%s&select_sample_%i=true&select_sample_%i=true&sample_state_id=%i" % ( comment, sample_id, sample_id, new_sample_state_id )
+ url += "&comment=%s&sample_state_id=%s" % ( comment, self.security.encode_id( new_sample_state_id ) )
+ # select_sample_%i=true must be included twice for each sample to simulate a CheckboxField checked setting.
+ for sample_id in sample_ids:
+ url += "&select_sample_%i=true&select_sample_%i=true" % ( sample_id, sample_id )
url += "&sample_operation=Change%20state&refresh=true"
url += "&change_state_button=Save"
self.visit_url( url )
self.check_page_for_string( 'Sequencing Request "%s"' % request_name )
- self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%i" % ( self.url, sample_id ) )
- self.check_page_for_string( 'Events for Sample "%s"' % sample_name )
- self.check_page_for_string( new_state_name )
+ for sample_id, sample_name in zip( sample_ids, sample_names ):
+ self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%s" % ( self.url, self.security.encode_id( sample_id ) ) )
+ self.check_page_for_string( 'Events for Sample "%s"' % sample_name )
+ self.check_page_for_string( new_state_name )
def add_user_address( self, user_id, address_dict ):
self.home()
self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) )
--- a/test/functional/test_forms_and_requests.py
+++ b/test/functional/test_forms_and_requests.py
@@ -209,7 +209,7 @@ class TestFormsAndRequests( TwillTestCas
name=name,
desc=desc,
field_value_tuples=field_value_tuples,
- strings_displayed=[ 'Create a new request',
+ strings_displayed=[ 'Create a new sequencing request',
test_field_name1,
test_field_name2,
test_field_name3 ],
@@ -272,8 +272,6 @@ class TestFormsAndRequests( TwillTestCas
def test_040_request_lifecycle( self ):
"""Testing request life-cycle as it goes through all the states"""
# logged in as regular_user1
- """
- TODO: debug this test case...
self.logout()
self.login( email=admin_user.email )
self.check_request_grid( cntrller='requests_admin',
@@ -292,19 +290,18 @@ class TestFormsAndRequests( TwillTestCas
samples=request_one.samples,
strings_displayed_after_submit=strings_displayed_after_submit )
# Change the states of all the samples of this request to ultimately be COMPLETE
- for sample in request_one.samples:
- self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- sample_name=sample.name,
- sample_id=self.security.encode_id( sample.id ),
- new_sample_state_id=request_type1.states[1].id,
- new_state_name=request_type1.states[1].name )
- self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- sample_name=sample.name,
- sample_id=self.security.encode_id( sample.id ),
- new_sample_state_id=request_type1.states[2].id,
- new_state_name=request_type1.states[2].name )
+ self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
+ request_name=request_one.name,
+ sample_names=[ sample.name for sample in request_one.samples ],
+ sample_ids=[ sample.id for sample in request_one.samples ],
+ new_sample_state_id=request_type1.states[1].id,
+ new_state_name=request_type1.states[1].name )
+ self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
+ request_name=request_one.name,
+ sample_names=[ sample.name for sample in request_one.samples ],
+ sample_ids=[ sample.id for sample in request_one.samples ],
+ new_sample_state_id=request_type1.states[2].id,
+ new_state_name=request_type1.states[2].name )
refresh( request_one )
self.logout()
self.login( email=regular_user1.email )
@@ -314,7 +311,7 @@ class TestFormsAndRequests( TwillTestCas
strings_displayed=[ request_one.name ] )
assert request_one.state is not request_one.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
% ( request_one.name, request_one.states.COMPLETE )
- """
+
def test_045_admin_create_request_on_behalf_of_regular_user( self ):
"""Testing creating and submitting a request as an admin on behalf of a regular user"""
# Logged in as regular_user1
@@ -332,7 +329,7 @@ class TestFormsAndRequests( TwillTestCas
name=name,
desc=desc,
field_value_tuples=field_value_tuples,
- strings_displayed=[ 'Create a new request',
+ strings_displayed=[ 'Create a new sequencing request',
test_field_name1,
test_field_name2,
test_field_name3 ],
1
0

galaxy-dist commit e029c860e717: Added tests and more help to mutation visualization tool
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287517130 14400
# Node ID e029c860e71710d69f725e5c136b7e55fa529a42
# Parent 7c80b7c2aa6aef5fba1b3a08e6426f5c84a125b4
Added tests and more help to mutation visualization tool
--- a/tools/mutation/visualize.xml
+++ b/tools/mutation/visualize.xml
@@ -37,16 +37,42 @@
<outputs><data format="svg" name="out_file1" /></outputs>
+ <tests>
+ <test>
+ <param name="input1" value="mutation_data1.txt" ftype="tabular" />
+ <param name="position_col" value="2" />
+ <param name="ref_col" value="4" />
+ <param name="zoom_value" value="interactive" />
+ <param name="name" value="s1" />
+ <param name="a_col" value="5" />
+ <param name="totals_col" value="9" />
+ <output name="output" file="mutation_data1_interactive.svg" ftype="svg" />
+ </test>
+ <test>
+ <param name="input1" value="mutation_data1.txt" ftype="tabular" />
+ <param name="position_col" value="2" />
+ <param name="ref_col" value="4" />
+ <param name="zoom_value" value="3" />
+ <param name="name" value="s1" />
+ <param name="a_col" value="5" />
+ <param name="totals_col" value="9" />
+ <output name="output" file="mutation_data1_zoom3x.svg" ftype="svg" />
+ </test>
+ </tests><help>
**Example**
-
+This tool allows you to visualize mutations described in a tabular input file. It generates an SVG image which can be viewed in any web browser.
+
Given the input file::
gm blood gm cheek
chrM 72 73 G 26394 4 49 0 26447 26398 1 23389 3 45 0 23437 23392 1
chrM 149 150 T 11 50422 2 96 50531 50435 1 4 45417 1 65 45487 45422 1
+
+You will need to specify the position and reference columns in the input file. Then click on the 'Add new Sample' to add samples in the input file that you would like to visualize. For each sample you select, specify the column for base 'A' and the totals column.
+This tool assumes the columns specifying bases A, C, G, T are placed consecutively and in that order in an input file.
Visualization:
@@ -54,7 +80,7 @@ Visualization:
:width: 150
Interactivity::
- If interactive zoom/pan option is checked then the resultant image can be zoomed in or out: scroll mouse wheel; pan: drag using left mouse button.
+ If interactive zoom option is selected, then the resultant image can be zoomed in or out using the scroll mouse wheel and can be panned by dragging the image using left mouse button.
</help></tool>
--- a/tool_conf.xml.main
+++ b/tool_conf.xml.main
@@ -134,6 +134,7 @@
<tool file="visualization/GMAJ.xml" /><tool file="visualization/build_ucsc_custom_track.xml" /><tool file="maf/vcf_to_maf_customtrack.xml" />
+ <tool file="mutation/visualize.xml" /></section><section name="Regional Variation" id="regVar"><tool file="regVariation/windowSplitter.xml" />
--- a/tools/mutation/visualize.py
+++ b/tools/mutation/visualize.py
@@ -367,7 +367,6 @@ if __name__ == '__main__':
parser.add_option('-z', '--zoom', dest='zoom', action='store', default='1')
parser.add_option('-p', '--position_col', dest='position_col', action='store', default='c0')
parser.add_option('-r', '--ref_col', dest='ref_col', action='store', default='c1')
- #parser.add_option('-n', '--interactive', dest='interactive', action='store_false', default='True')
(opts, args) = parser.parse_args()
mainsvg(opts, args)
sys.exit(1)
1
0

galaxy-dist commit 1f4d6b25a84e: Fix for Integer/FloatToolParameter.get_html_field() when 'value' is provided as an integer/float.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dan Blankenberg <dan(a)bx.psu.edu>
# Date 1287167414 14400
# Node ID 1f4d6b25a84e785c3feee1733a19ac10877a985b
# Parent 74fa7c7c0db8ed06aeda6948d286432b61e7feb0
Fix for Integer/FloatToolParameter.get_html_field() when 'value' is provided as an integer/float.
Fixes an issue seen when saving workflows: If an integer or float tool parameter is changed to a value of 0 or 0.0 and saved, the form field would be redisplayed using the default tool value; and not the value that is now saved in the database.
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -197,6 +197,10 @@ class IntegerToolParameter( TextToolPara
raise ValueError( "An integer is required" )
elif self.value is None:
raise ValueError( "The settings for this field require a 'value' setting and optionally a default value which must be an integer" )
+ def get_html_field( self, trans=None, value=None, other_values={} ):
+ if isinstance( value, int ):
+ value = str( value )
+ return super( IntegerToolParameter, self ).get_html_field( trans=trans, value=value, other_values=other_values )
def from_html( self, value, trans=None, other_values={} ):
try:
return int( value )
@@ -235,6 +239,10 @@ class FloatToolParameter( TextToolParame
raise ValueError( "A real number is required" )
elif self.value is None:
raise ValueError( "The settings for this field require a 'value' setting and optionally a default value which must be a real number" )
+ def get_html_field( self, trans=None, value=None, other_values={} ):
+ if isinstance( value, float ):
+ value = str( value )
+ return super( FloatToolParameter, self ).get_html_field( trans=trans, value=value, other_values=other_values )
def from_html( self, value, trans=None, other_values={} ):
try:
return float( value )
1
0

galaxy-dist commit fb2a31820ccf: A bit of code cleanup / optimization in sample tracking.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1287069813 14400
# Node ID fb2a31820ccff6f02bb24a0632f214bfef0a8b0a
# Parent c8173a50bc9bdb0c8e07807c1b73be746557647f
A bit of code cleanup / optimization in sample tracking.
--- a/templates/requests/common/manage_request.mako
+++ b/templates/requests/common/manage_request.mako
@@ -163,7 +163,7 @@
</div></div>
-%if request.has_samples_without_library_destinations:
+%if request.samples_without_library_destinations:
${render_msg( "Select a target data library and folder for all the samples before starting the sequence run", "warning" )}
%endif
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1647,12 +1647,12 @@ class Request( object ):
def is_complete( self ):
return self.state == self.states.COMPLETE
@property
- def has_samples_without_library_destinations( self ):
+ def samples_without_library_destinations( self ):
# Return all samples that are not associated with a library
samples = []
- for s in self.samples:
- if not s.library:
- samples.append( s.name )
+ for sample in self.samples:
+ if not sample.library:
+ samples.append( sample )
return samples
def send_email_notification( self, trans, common_state, final_state=False ):
# Check if an email notification is configured to be sent when the samples
@@ -1774,25 +1774,25 @@ class Sample( object ):
return None
@property
def untransferred_dataset_files( self ):
- count = 0
- for df in self.datasets:
- if df.status == self.transfer_status.NOT_STARTED:
- count = count + 1
- return count
+ untransferred_datasets = []
+ for dataset in self.datasets:
+ if dataset.status == self.transfer_status.NOT_STARTED:
+ untransferred_datasets.append( dataset )
+ return untransferred_datasets
@property
def inprogress_dataset_files( self ):
- count = 0
- for df in self.datasets:
- if df.status not in [self.transfer_status.NOT_STARTED, self.transfer_status.COMPLETE]:
- count = count + 1
- return count
+ inprogress_datasets = []
+ for dataset in self.datasets:
+ if dataset.status not in [ self.transfer_status.NOT_STARTED, self.transfer_status.COMPLETE ]:
+ inprogress_datasets.append( dataset )
+ return inprogress_datasets
@property
def transferred_dataset_files( self ):
- count = 0
- for df in self.datasets:
- if df.status == self.transfer_status.COMPLETE:
- count = count + 1
- return count
+ transferred_datasets = []
+ for dataset in self.datasets:
+ if dataset.status == self.transfer_status.COMPLETE:
+ transferred_datasets.append( dataset )
+ return transferred_datasets
def dataset_size( self, filepath ):
def print_ticks(d):
pass
--- a/templates/requests/common/sample_datasets.mako
+++ b/templates/requests/common/sample_datasets.mako
@@ -1,5 +1,5 @@
<%def name="render_sample_datasets( sample )">
- ${sample.transferred_dataset_files} / ${len( sample.datasets )}
+ ${len( sample.transferred_dataset_files )}/${len( sample.datasets )}
</%def>
${render_sample_datasets( sample )}
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -244,6 +244,11 @@ class RequestsAdmin( BaseController, Use
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
+ sample_id = params.get( 'sample_id', None )
+ try:
+ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id ( sample_id ) )
+ except:
+ return invalid_id_redirect( trans, 'requests_admin', sample_id )
if 'operation' in kwd:
operation = kwd[ 'operation' ].lower()
sample_dataset_id = params.get( 'id', None )
@@ -262,48 +267,44 @@ class RequestsAdmin( BaseController, Use
elif operation == "delete":
not_deleted = []
for sample_dataset in selected_sample_datasets:
- sample_id = sample_dataset.sample.id
- if sample_dataset.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
+ # Make sure the dataset has been transferred before deleting it.
+ if sample_dataset in sample.untransferred_dataset_files:
trans.sa_session.delete( sample_dataset )
trans.sa_session.flush()
else:
not_deleted.append( sample_dataset.name )
- message = '%i datasets have been deleted. ' % ( len( id_list ) - len( not_deleted ) )
+ message = '%i datasets have been deleted.' % ( len( id_list ) - len( not_deleted ) )
if not_deleted:
status = 'warning'
- message = message + '%s could not be deleted because their transfer status is not "Not Started". ' % str( not_deleted )
+ message = message + ' %s could not be deleted because their transfer status is not "Not Started". ' % str( not_deleted )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
- sample_id=trans.security.encode_id( sample_id ),
+ sample_id=sample_id,
status=status,
message=message ) )
elif operation == "rename":
- # if none of the selected sample datasets are in the NOT_STARTED state,
- # then display error message
- flag = True
- for sd in selected_sample_datasets:
- if sd.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
- flag = False
+ # If one of the selected sample datasets is in the NOT_STARTED state,
+ # then display an error message. A NOT_STARTED state implies the dataset
+ # has not yet been transferred.
+ no_datasets_transferred = True
+ for selected_sample_dataset in selected_sample_datasets:
+ if selected_sample_dataset in sample.untransferred_dataset_files:
+ no_datasets_transferred = False
break
- if flag:
+ if no_datasets_transferred:
status = 'error'
- message = 'A dataset can be renamed only if it is in the <b>Not Started</b> state.'
+ message = 'A dataset can be renamed only if it is in the "Not Started" state.'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
- sample_id=trans.security.encode_id( selected_sample_datasets[0].sample.id ),
+ sample_id=sample_id,
status=status,
message=message ) )
return trans.fill_template( '/admin/requests/rename_datasets.mako',
- sample=selected_sample_datasets[0].sample,
+ sample=sample,
id_list=id_list )
elif operation == "start transfer":
- self.__start_datatx( trans, selected_sample_datasets[0].sample, selected_sample_datasets )
+ self.__start_datatx( trans, sample, selected_sample_datasets )
# Render the grid view
- sample_id = params.get( 'sample_id', None )
- try:
- sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id ( sample_id ) )
- except:
- return invalid_id_redirect( trans, 'requests_admin', sample_id )
request_id = trans.security.encode_id( sample.request.id )
library_id = trans.security.encode_id( sample.library.id )
self.datatx_grid.title = 'Datasets of sample "%s"' % sample.name
@@ -392,25 +393,26 @@ class RequestsAdmin( BaseController, Use
folder_path = self.__check_path( folder_path )
if params.get( 'folder_up', False ):
if folder_path[-1] == os.sep:
- folder_path = os.path.dirname(folder_path[:-1])
+ folder_path = os.path.dirname( folder_path[:-1] )
folder_path = self.__check_path( folder_path )
elif params.get( 'select_show_datasets_button', False ) or params.get( 'select_more_button', False ):
# get the sample these datasets are associated with
try:
sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( selected_sample_id ) )
- if sample.name in sample.request.has_samples_without_library_destinations:
- raise Exception()
except:
- # if no sample (with associated library & folder) has been selected
+ return invalid_id_redirect( trans, 'requests_admin', selected_sample_id )
+ if sample in sample.request.samples_without_library_destinations:
+ # Display an error if a sample has been selected that
+ # has not yet been associated with a destination library.
status = 'error'
- message = 'Select a sample with associated data library and folder before selecting the dataset(s).'
+ message = 'Select a sample with associated data library and folder before selecting the datasets.'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='get_data',
- request_id=trans.security.encode_id( request.id ),
+ request_id=request_id,
folder_path=folder_path,
status=status,
message=message ) )
- # save the sample datasets
+ # Save the sample datasets
sample_dataset_file_names = self.__save_sample_datasets( trans, sample, selected_files, folder_path )
if sample_dataset_file_names:
message = 'Datasets (%s) have been selected for sample (%s)' % \
@@ -419,7 +421,7 @@ class RequestsAdmin( BaseController, Use
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
request_id=request_id,
- sample_id=trans.security.encode_id( sample.id ),
+ sample_id=selected_sample_id,
message=message,
status=status ) )
else: # 'select_more_button' was clicked
--- a/templates/requests/common/find_samples.mako
+++ b/templates/requests/common/find_samples.mako
@@ -71,7 +71,7 @@
%else:
State: ${sample.state.name}<br/>
%endif
- Datasets: <a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.transferred_dataset_files}/${len( sample.datasets )}</a><br/>
+ Datasets: <a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}/${len( sample.datasets )}</a><br/>
%if is_admin:
<i>User: ${sample.request.user.email}</i>
%endif
1
0

galaxy-dist commit 7c80b7c2aa6a: Add descriptive labels to output dataset names for MACS peakcalling tool.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dan Blankenberg <dan(a)bx.psu.edu>
# Date 1287508435 14400
# Node ID 7c80b7c2aa6aef5fba1b3a08e6426f5c84a125b4
# Parent 9c80bcb0bfa49d553428aca22043a8a68f773c65
Add descriptive labels to output dataset names for MACS peakcalling tool.
--- a/tools/peak_calling/macs_wrapper.xml
+++ b/tools/peak_calling/macs_wrapper.xml
@@ -74,22 +74,22 @@
<param name="futurefdr" label="Perform the new peak detection method (futurefdr)" type="boolean" truevalue="--futurefdr" falsevalue="" checked="False" help="The default method only consider the peak location, 1k, 5k, and 10k regions in the control data; whereas the new future method also consider the 5k, 10k regions in treatment data to calculate local bias."/></inputs><outputs>
- <data name="output_bed_file" format="bed"/>
- <data name="output_xls_to_interval_peaks_file" format="interval">
+ <data name="output_bed_file" format="bed" label="${tool.name} on ${on_string} (peaks: bed)"/>
+ <data name="output_xls_to_interval_peaks_file" format="interval" label="${tool.name} on ${on_string} (peaks: interval)"><filter>xls_to_interval is True</filter></data>
- <data name="output_xls_to_interval_negative_peaks_file" format="interval">
+ <data name="output_xls_to_interval_negative_peaks_file" format="interval" label="${tool.name} on ${on_string} (negative peaks: interval)"><filter>xls_to_interval is True</filter><filter>input_type['input_control_file1'] is not None</filter></data>
- <data name="output_treatment_wig_file" format="wig">
+ <data name="output_treatment_wig_file" format="wig" label="${tool.name} on ${on_string} (treatment: wig)"><filter>wig_type['wig_type_selector']=='wig'</filter></data>
- <data name="output_control_wig_file" format="wig">
+ <data name="output_control_wig_file" format="wig" label="${tool.name} on ${on_string} (control: wig)"><filter>wig_type['wig_type_selector'] == 'wig'</filter><filter>input_type['input_control_file1'] is not None</filter></data>
- <data name="output_extra_files" format="html"/>
+ <data name="output_extra_files" format="html" label="${tool.name} on ${on_string} (html report)"/></outputs><configfiles><configfile name="options_file"><%
1
0