galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
April 2011
- 1 participants
- 112 discussions
11 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/b6beb68c36b0/
changeset: r5364:b6beb68c36b0
user: greg
date: 2011-04-11 16:37:14
summary: Fix for rating a tool in the tool shed.
affected #: 1 file (206 bytes)
--- a/templates/webapps/community/common/rate_tool.mako Mon Apr 11 09:39:55 2011 -0400
+++ b/templates/webapps/community/common/rate_tool.mako Mon Apr 11 10:37:14 2011 -0400
@@ -146,7 +146,13 @@
</div><div class="form-row"><label>Your Rating:</label>
- ${render_star_rating( 'rating', tra.rating )}
+ <%
+ if tra and tra.rating:
+ rating = tra.rating
+ else:
+ rating = 0
+ %>
+ ${render_star_rating( 'rating', rating )}
<div style="clear: both"></div></div><div class="form-row">
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
11 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/e7873feacc48/
changeset: r5363:e7873feacc48
user: jgoecks
date: 2011-04-11 15:39:55
summary: Add tool 'Filter GTF by attribute values list.' Tool filters a GTF based on a list of attribute values; this tool is especially useful as a downstream analysis tool for filtering GTF files based on Cuffdiff outputs. Functional tests are included as well.
affected #: 12 files (140 bytes)
--- a/tool_conf.xml.main Fri Apr 08 17:07:08 2011 -0400
+++ b/tool_conf.xml.main Mon Apr 11 09:39:55 2011 -0400
@@ -78,6 +78,7 @@
<tool file="filters/gff/extract_GFF_Features.xml" /><tool file="filters/gff/gff_filter_by_attribute.xml" /><tool file="filters/gff/gff_filter_by_feature_count.xml" />
+ <tool file="filters/gff/gtf_filter_by_attribute_values_list.xml" /></section><section name="Join, Subtract and Group" id="group"><tool file="filters/joiner.xml" />
--- a/tool_conf.xml.sample Fri Apr 08 17:07:08 2011 -0400
+++ b/tool_conf.xml.sample Mon Apr 11 09:39:55 2011 -0400
@@ -67,6 +67,7 @@
<tool file="filters/gff/extract_GFF_Features.xml" /><tool file="filters/gff/gff_filter_by_attribute.xml" /><tool file="filters/gff/gff_filter_by_feature_count.xml" />
+ <tool file="filters/gff/gtf_filter_by_attribute_values_list.xml" /></section><section name="Join, Subtract and Group" id="group"><tool file="filters/joiner.xml" />
--- a/tools/filters/gff/extract_GFF_Features.xml Fri Apr 08 17:07:08 2011 -0400
+++ b/tools/filters/gff/extract_GFF_Features.xml Mon Apr 11 09:39:55 2011 -0400
@@ -1,5 +1,5 @@
<tool id="Extract_features1" name="Extract features">
- <description> from GFF file</description>
+ <description> from GFF data</description><command interpreter="python">extract_GFF_Features.py $input1 $out_file1 ${column_choice.col} ${column_choice.feature}</command><inputs><param format="gff" name="input1" type="data" label="Select GFF data"/>
--- a/tools/filters/gff/gff_filter_by_attribute.xml Fri Apr 08 17:07:08 2011 -0400
+++ b/tools/filters/gff/gff_filter_by_attribute.xml Mon Apr 11 09:39:55 2011 -0400
@@ -1,4 +1,4 @@
-<tool id="gff_filter_by_attribute" name="Filter GFF file by attribute" version="0.1">
+<tool id="gff_filter_by_attribute" name="Filter GFF data by attribute" version="0.1"><description>using simple expressions</description><command interpreter="python">
gff_filter_by_attribute.py $input $out_file1 "$attribute_type" "$attribute_name" "$cond"
--- a/tools/filters/gff/gff_filter_by_feature_count.xml Fri Apr 08 17:07:08 2011 -0400
+++ b/tools/filters/gff/gff_filter_by_feature_count.xml Mon Apr 11 09:39:55 2011 -0400
@@ -1,4 +1,4 @@
-<tool id="gff_filter_by_feature_count" name="Filter GFF file by feature count" version="0.1">
+<tool id="gff_filter_by_feature_count" name="Filter GFF data by feature count" version="0.1"><description>using simple expressions</description><command interpreter="python">
gff_filter_by_feature_count.py $input_file1 $out_file1 "$feature_name" "$cond"
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
08 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/65d680dc05fb/
changeset: r5362:65d680dc05fb
user: jgoecks
date: 2011-04-08 23:07:08
summary: Trackster: fix (a) bug that was not setting appropriate CSS class for track content divs and (b) padding issues with different track states. Also increase bottom border to better delineate tracks.
affected #: 4 files (397 bytes)
--- a/static/june_2007_style/blue/trackster.css Fri Apr 08 16:43:45 2011 -0400
+++ b/static/june_2007_style/blue/trackster.css Fri Apr 08 17:07:08 2011 -0400
@@ -22,13 +22,13 @@
.track{background:white;}
.track-header{text-align:left;padding:4px 0px;color:#666;}
.track-header .menubutton{margin-left:0px;}
-.track-content{overflow:hidden;text-align:center;border-top:1px solid #eee;border-bottom:1px solid #eee;background:#eee url('/static/images/tracks/diag_bg.gif');min-height:16px;}
+.track-content{overflow:hidden;text-align:center;border-top:1px solid #eee;border-bottom:2px solid #eee;background:#eee url('/static/images/tracks/diag_bg.gif');min-height:16px;}
.label-track .track-content{background:white;}
.track-tile{background:white;}
.track-tile canvas{position:relative;z-index:100;border:solid white;border-width:2px 0px 0px 0px;}
-.track.error .track-content{background-color:#ECB4AF;background-image:none;padding:2px 0;}
-.track.nodata .track-content{background-color:#eee;background-image:none;padding:2px 0;}
-.track.pending .track-content{background-color:white;background-image:none;padding:2px 0;}
+.track.error .track-content{background-color:#ECB4AF;background-image:none;}
+.track.nodata .track-content{background-color:#eee;background-image:none;}
+.track.pending .track-content{background-color:white;background-image:none;}
.loading{min-height:100px;}
.label-track{font-size:10px;border:none;padding:0;margin:0;height:1.5em;overflow:hidden;}
.label-track .label{border-left:solid #999 1px;padding:1px;padding-bottom:2px;display:inline-block;}
--- a/static/june_2007_style/trackster.css.tmpl Fri Apr 08 16:43:45 2011 -0400
+++ b/static/june_2007_style/trackster.css.tmpl Fri Apr 08 17:07:08 2011 -0400
@@ -147,7 +147,7 @@
overflow: hidden;
text-align: center;
border-top: 1px solid #eee;
- border-bottom: 1px solid #eee;
+ border-bottom: 2px solid #eee;
background: #eee url('/static/images/tracks/diag_bg.gif');
min-height: 16px;
}
--- a/static/scripts/packed/trackster.js Fri Apr 08 16:43:45 2011 -0400
+++ b/static/scripts/packed/trackster.js Fri Apr 08 17:07:08 2011 -0400
@@ -1,1 +1,1 @@
-var extend=function(){var c=arguments[0];for(var b=1;b<arguments.length;b++){var a=arguments[b];for(key in a){c[key]=a[key]}}};var trackster_module=function(f,Q){var o=f("slotting"),G=f("painters");var V=function(W,X){this.document=W;this.default_font=X!==undefined?X:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};extend(V.prototype,{load_pattern:function(W,aa){var X=this.patterns,Y=this.dummy_context,Z=new Image();Z.src=image_path+aa;Z.onload=function(){X[W]=Y.createPattern(Z,"repeat")}},get_pattern:function(W){return this.patterns[W]},new_canvas:function(){var W=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(W)}W.manager=this;return W}});var B=function(W,X){W.bind("drag",{handle:X,relative:true},function(ab,ac){var aa=$(this).parent();var Z=aa.children();var Y;for(Y=0;Y<Z.length;Y++){if(ac.offsetY<$(Z.get(Y)).position().top){break}}if(Y===Z.length){if(this!==Z.get(Y-1)){aa.append(this)}}else{if(this!==Z.get(Y)){$(this).insertBefore(Z.get(Y))}}})};var h=function(Y,W){var X=W-Y;return(X<=2?0.01:(X<=100?1:(X<=1000?5:10)))};var C=9,z=10,L=C+2,w=100,D=12000,J=200,r=10,F=5000,s=100,m="There was an error in indexing this dataset. ",E="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",A="No data for this chrom/contig.",p="Currently indexing... please wait",u="Tool cannot be rerun: ",a="Loading data...",R="Ready for display",d=10,q=5,y=5;function t(W){return Math.round(W*1000)/1000}var c=function(W){this.num_elements=W;this.clear()};extend(c.prototype,{get:function(X){var W=this.key_ary.indexOf(X);if(W!==-1){this.move_key_to_end(X,W)}return this.obj_cache[X]},set:function(X,Y){if(!this.obj_cache[X]){if(this.key_ary.length>=this.num_elements){var W=this.key_ary.shift();delete this.obj_cache[W]}this.key_ary.push(X)}this.obj_cache[X]=Y;return Y},move_key_to_end:function(X,W){this.key_ary.splice(W,1);this.key_ary.push(X)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var K=function(X,W,Y){c.call(this,X);this.track=W;this.subset=(Y!==undefined?Y:true)};extend(K.prototype,c.prototype,{load_data:function(ad,ae,Z,ac,W,ab){var Y={chrom:ad,low:ae,high:Z,mode:ac,resolution:W,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(Y,ab);var af=[];for(var aa=0;aa<this.track.filters.length;aa++){af[af.length]=this.track.filters[aa].name}Y.filter_cols=JSON.stringify(af);var X=this;return $.getJSON(this.track.data_url,Y,function(ag){X.set_data(ae,Z,ac,ag)})},get_data:function(Y,W,ab,ac,X,aa){var Z=this.get(this.gen_key(W,ab,ac));if(Z){return Z}Z=this.load_data(Y,W,ab,ac,X,aa);this.set_data(W,ab,ac,Z);return Z},set_data:function(X,Y,Z,W){return this.set(this.gen_key(X,Y,Z),W)},gen_key:function(W,Y,Z){var X=W+"_"+Y+"_"+Z;return X},split_key:function(W){return W.split("_")}});var U=function(W,Z,Y,X,aa){this.container=W;this.chrom=null;this.vis_id=Y;this.dbkey=X;this.title=Z;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(aa);this.canvas_manager=new V(W.get(0).ownerDocument);this.reset()};extend(U.prototype,{init:function(Z){var Y=this.container,W=this;this.top_container=$("<div/>").addClass("top-container").appendTo(Y);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(Y);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(Y);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var X=function(aa){if(aa.type==="focusout"||(aa.keyCode||aa.which)===13||(aa.keyCode||aa.which)===27){if((aa.keyCode||aa.which)!==27){W.go_to($(this).val())}$(this).hide();$(this).val("");W.location_span.show();W.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",X).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").appendTo(this.nav_controls);this.location_span.bind("click",function(){W.location_span.hide();W.chrom_select.hide();W.nav_input.val(W.chrom+":"+W.low+"-"+W.high);W.nav_input.css("display","inline-block");W.nav_input.select();W.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a id='zoom-out' />").click(function(){W.zoom_out();W.redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){W.zoom_in();W.redraw()}).appendTo(this.nav_controls);this.load_chroms({low:0},Z);this.chrom_select.bind("change",function(){W.change_chrom(W.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(aa){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(aa){W.zoom_in(aa.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(aa,ab){this.current_x=ab.offsetX}).bind("drag",function(aa,ac){var ad=ac.offsetX-this.current_x;this.current_x=ac.offsetX;var ab=Math.round(ad/W.viewport_container.width()*(W.max_high-W.max_low));W.move_delta(-ab)});this.overview_close.bind("click",function(){for(var ab=0,aa=W.tracks.length;ab<aa;ab++){W.tracks[ab].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",W.overview_box.height());W.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(aa,ab){if(aa.clientX>W.viewport_container.width()-16){return false}}).bind("dragstart",function(aa,ab){ab.original_low=W.low;ab.current_height=aa.clientY;ab.current_x=ab.offsetX}).bind("drag",function(ac,ae){var aa=$(this);var af=ae.offsetX-ae.current_x;var ab=aa.scrollTop()-(ac.clientY-ae.current_height);aa.scrollTop(ab);ae.current_height=ac.clientY;ae.current_x=ae.offsetX;var ad=Math.round(af/W.viewport_container.width()*(W.high-W.low));W.move_delta(ad)}).bind("mousewheel",function(ac,ae,ab,aa){if(ab){var ad=Math.round(-ab/W.viewport_container.width()*(W.high-W.low));W.move_delta(ad)}});this.top_labeltrack.bind("dragstart",function(aa,ab){return $("<div />").css({height:W.content_div.height()+W.top_labeltrack.height()+W.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ae,af){$(af.proxy).css({left:Math.min(ae.pageX,af.startX),width:Math.abs(ae.pageX-af.startX)});var ab=Math.min(ae.pageX,af.startX)-W.container.offset().left,aa=Math.max(ae.pageX,af.startX)-W.container.offset().left,ad=(W.high-W.low),ac=W.viewport_container.width();W.update_location(Math.round(ab/ac*ad)+W.low,Math.round(aa/ac*ad)+W.low)}).bind("dragend",function(af,ag){var ab=Math.min(af.pageX,ag.startX),aa=Math.max(af.pageX,ag.startX),ad=(W.high-W.low),ac=W.viewport_container.width(),ae=W.low;W.low=Math.round(ab/ac*ad)+ae;W.high=Math.round(aa/ac*ad)+ae;$(ag.proxy).remove();W.redraw()});this.add_label_track(new T(this,this.top_labeltrack));this.add_label_track(new T(this,this.nav_labeltrack));$(window).bind("resize",function(){W.resize_window()});$(document).bind("redraw",function(){W.redraw()});this.reset();$(window).trigger("resize")},update_location:function(W,X){this.location_span.text(commatize(W)+" - "+commatize(X));this.nav_input.val(this.chrom+":"+commatize(W)+"-"+commatize(X))},load_chroms:function(X,Y){X.num=s;$.extend(X,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var W=this;$.ajax({url:chrom_url,data:X,dataType:"json",success:function(aa){if(aa.chrom_info.length===0){alert("Invalid chromosome: "+X.chrom);return}if(aa.reference){W.add_label_track(new x(W))}W.chrom_data=aa.chrom_info;var ad='<option value="">Select Chrom/Contig</option>';for(var ac=0,Z=W.chrom_data.length;ac<Z;ac++){var ab=W.chrom_data[ac].chrom;ad+='<option value="'+ab+'">'+ab+"</option>"}if(aa.prev_chroms){ad+='<option value="previous">Previous '+s+"</option>"}if(aa.next_chroms){ad+='<option value="next">Next '+s+"</option>"}W.chrom_select.html(ad);if(Y){Y()}W.chrom_start_index=aa.start_index},error:function(){alert("Could not load chroms for this dbkey:",W.dbkey)}})},change_chrom:function(aa,X,ac){if(!aa||aa==="None"){return}var Z=this;if(aa==="previous"){Z.load_chroms({low:this.chrom_start_index-s});return}if(aa==="next"){Z.load_chroms({low:this.chrom_start_index+s});return}var ab=$.grep(Z.chrom_data,function(ae,af){return ae.chrom===aa})[0];if(ab===undefined){Z.load_chroms({chrom:aa},function(){Z.change_chrom(aa,X,ac)});return}else{if(aa!==Z.chrom){Z.chrom=aa;if(!Z.chrom){Z.intro_div.show()}else{Z.intro_div.hide()}Z.chrom_select.val(Z.chrom);Z.max_high=ab.len-1;Z.reset();Z.redraw(true);for(var ad=0,W=Z.tracks.length;ad<W;ad++){var Y=Z.tracks[ad];if(Y.init){Y.init()}}}if(X!==undefined&&ac!==undefined){Z.low=Math.max(X,0);Z.high=Math.min(ac,Z.max_high)}Z.reset_overview();Z.redraw()}},go_to:function(aa){var ae=this,W,Z,X=aa.split(":"),ac=X[0],ad=X[1];if(ad!==undefined){try{var ab=ad.split("-");W=parseInt(ab[0].replace(/,/g,""),10);Z=parseInt(ab[1].replace(/,/g,""),10)}catch(Y){return false}}ae.change_chrom(ac,W,Z)},move_fraction:function(Y){var W=this;var X=W.high-W.low;this.move_delta(Y*X)},move_delta:function(Y){var W=this;var X=W.high-W.low;if(W.low-Y<W.max_low){W.low=W.max_low;W.high=W.max_low+X}else{if(W.high-Y>W.max_high){W.high=W.max_high;W.low=W.max_high-X}else{W.high-=Y;W.low-=Y}}W.redraw()},add_track:function(W){W.view=this;W.track_id=this.track_id_counter;this.tracks.push(W);if(W.init){W.init()}W.container_div.attr("id","track_"+W.track_id);B(W.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(W){W.view=this;this.label_tracks.push(W)},remove_track:function(W){this.has_changes=true;W.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(W)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(ad){var ac=this.high-this.low,ab=this.low,X=this.high;if(ab<this.max_low){ab=this.max_low}if(X>this.max_high){X=this.max_high}if(this.high!==0&&ac<this.min_separation){X=ab+this.min_separation}this.low=Math.floor(ab);this.high=Math.ceil(X);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(r,Math.max(0,Math.ceil(Math.log(this.resolution,r)/Math.log(r))));var W=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var aa=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=13;this.overview_box.css({left:W,width:Math.max(ae,aa)}).show();if(aa<ae){this.overview_box.css("left",W-(ae-aa)/2)}if(this.overview_highlight){this.overview_highlight.css({left:W,width:aa})}this.update_location(this.low,this.high);if(!ad){for(var Y=0,Z=this.tracks.length;Y<Z;Y++){if(this.tracks[Y]&&this.tracks[Y].enabled){this.tracks[Y].draw()}}for(Y=0,Z=this.label_tracks.length;Y<Z;Y++){this.label_tracks[Y].draw()}}},zoom_in:function(X,Y){if(this.max_high===0||this.high-this.low<this.min_separation){return}var Z=this.high-this.low,aa=Z/2+this.low,W=(Z/this.zoom_factor)/2;if(X){aa=X/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(aa-W);this.high=Math.round(aa+W);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var X=this.high-this.low,Y=X/2+this.low,W=(X*this.zoom_factor)/2;this.low=Math.round(Y-W);this.high=Math.round(Y+W);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var n=function(X,aa){this.track=X;this.name=aa.name;this.params=[];var ai=aa.params;for(var Y=0;Y<ai.length;Y++){var ad=ai[Y],W=ad.name,ah=ad.label,Z=unescape(ad.html),af=ad.type;if(af==="number"){this.params[this.params.length]=new g(W,ah,Z,ad.min,ad.max)}else{if(af=="select"){this.params[this.params.length]=new I(W,ah,Z)}else{console.log("WARNING: unrecognized tool parameter type:",W,af)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ak){ak.stopPropagation()}).bind("click",function(ak){ak.stopPropagation()}).bind("dblclick",function(ak){ak.stopPropagation()});var ag=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ae=this.params;var ab=this;$.each(this.params,function(al,ao){var an=$("<div>").addClass("param-row").appendTo(ab.parent_div);var ak=$("<div>").addClass("param-label").text(ao.label).appendTo(an);var am=$("<div/>").addClass("slider").html(ao.html).appendTo(an);$("<div style='clear: both;'/>").appendTo(an)});this.parent_div.find("input").click(function(){$(this).select()});var aj=$("<div>").addClass("slider-row").appendTo(this.parent_div);var ac=$("<input type='submit'>").attr("value","Run").appendTo(aj);var ab=this;ac.click(function(){ab.run()})};extend(n.prototype,{get_param_values_dict:function(){var W={};this.parent_div.find(":input").each(function(){var X=$(this).attr("name"),Y=$(this).val();W[X]=JSON.stringify(Y)});return W},get_param_values:function(){var X=[];var W={};this.parent_div.find(":input").each(function(){var Y=$(this).attr("name"),Z=$(this).val();if(Y){X[X.length]=Z}});return X},run:function(){var X={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name};$.extend(X,this.get_param_values_dict());var Z=this.track,Y=X.tool_id+Z.tool_region_and_parameters_str(X.chrom,X.low,X.high),aa;if(Z.track_type==="FeatureTrack"){aa=new N(Y,view,Z.hda_ldda,undefined,{},{},Z)}this.track.add_track(aa);aa.content_div.text("Starting job.");var W=function(){$.getJSON(run_tool_url,X,function(ab){if(ab==="no converter"){aa.container_div.addClass("error");aa.content_div.text(E)}else{if(ab.error){aa.container_div.addClass("error");aa.content_div.text(u+ab.message)}else{if(ab==="pending"){aa.container_div.addClass("pending");aa.content_div.text("Converting input data so that it can be easily reused.");setTimeout(W,2000)}else{aa.dataset_id=ab.dataset_id;aa.content_div.text("Running job.");aa.init()}}}})};W()}});var I=function(X,W,Y){this.name=X;this.label=W;this.html=Y};var g=function(Y,X,aa,Z,W){I.call(this,Y,X,aa);this.min=Z;this.max=W};var j=function(X,W,Y){this.name=X;this.index=W;this.value=Y};var O=function(X,W){this.name=X;this.index=W;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};extend(O.prototype,{applies_to:function(W){if(W.length>this.index){return true}return false},keep:function(W){if(!this.applies_to(W)){return true}return(W[this.index]>=this.low&&W[this.index]<=this.high)},update_attrs:function(X){var W=false;if(!this.applies_to(X)){return W}if(X[this.index]<this.min){this.min=Math.floor(X[this.index]);W=true}if(X[this.index]>this.max){this.max=Math.ceil(X[this.index]);W=true}return W},update_ui_elt:function(){var X=this.slider.slider("option","min"),W=this.slider.slider("option","max");if(this.min<X||this.max>W){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",h(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var v=function(W){var ac=[];for(var Z=0;Z<W.length;Z++){var ab=W[Z];var Y=ab.name,aa=ab.type,X=ab.index;if(aa==="int"||aa==="float"){ac[Z]=new O(Y,X)}else{ac[Z]=new j(Y,X,aa)}}return ac};var S=function(W){this.track=W.track;this.params=W.params;this.values={};if(W.saved_values){this.restore_values(W.saved_values)}this.onchange=W.onchange};extend(S.prototype,{restore_values:function(W){var X=this;$.each(this.params,function(Y,Z){if(W[Z.key]!==undefined){X.values[Z.key]=W[Z.key]}else{X.values[Z.key]=Z.default_value}})},build_form:function(){var X=this;var W=$("<div />");$.each(this.params,function(ab,Z){if(!Z.hidden){var Y="param_"+ab;var ag=$("<div class='form-row' />").appendTo(W);ag.append($("<label />").attr("for",Y).text(Z.label+":"));if(Z.type==="bool"){ag.append($('<input type="checkbox" />').attr("id",Y).attr("name",Y).attr("checked",X.values[Z.key]))}else{if(Z.type==="color"){var ad=X.values[Z.key];var ac=$("<input />").attr("id",Y).attr("name",Y).val(ad);var ae=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var aa=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(ae);var af=$("<div/>").appendTo(aa).farbtastic({width:100,height:100,callback:ac,color:ad});$("<div />").append(ac).append(ae).appendTo(ag).bind("click",function(ah){ae.css({left:$(this).position().left+($(ac).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){ae.hide();$(document).unbind("click.color-picker")});ah.stopPropagation()})}else{ag.append($("<input />").attr("id",Y).attr("name",Y).val(X.values[Z.key]))}}}});return W},update_from_form:function(W){var Y=this;var X=false;$.each(this.params,function(Z,ab){if(!ab.hidden){var ac="param_"+Z;var aa=W.find("#"+ac).val();if(ab.type==="float"){aa=parseFloat(aa)}else{if(ab.type==="int"){aa=parseInt(aa)}else{if(ab.type==="bool"){aa=W.find("#"+ac).is(":checked")}}}if(aa!==Y.values[ab.key]){Y.values[ab.key]=aa;X=true}}});if(X){this.onchange()}}});var b=function(W,X,Y){this.track=W;this.canvas=X;this.histo_max=Y};var k=function(X,W,aa,Y,Z){this.name=X;this.view=W;this.parent_element=aa;this.data_url=(Y?Y:default_data_url);this.data_url_extra_params={};this.data_query_wait=(Z?Z:F);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};extend(k.prototype,{init:function(){var W=this;W.enabled=false;W.tile_cache.clear();W.data_cache.clear();W.initial_canvas=undefined;W.content_div.css("height","auto");W.container_div.removeClass("nodata error pending");if(!W.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:W.hda_ldda,dataset_id:W.dataset_id,chrom:W.view.chrom},function(X){if(!X||X==="error"||X.kind==="error"){W.container_div.addClass("error");W.content_div.text(m);if(X.message){var Z=W.view.tracks.indexOf(W);var Y=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+X.message+"</pre>",{Close:hide_modal})});W.content_div.append(Y)}}else{if(X==="no converter"){W.container_div.addClass("error");W.content_div.text(E)}else{if(X==="no data"||(X.data!==undefined&&(X.data===null||X.data.length===0))){W.container_div.addClass("nodata");W.content_div.text(A)}else{if(X==="pending"){W.container_div.addClass("pending");W.content_div.text(p);setTimeout(function(){W.init()},W.data_query_wait)}else{if(X.status==="data"){if(X.valid_chroms){W.valid_chroms=X.valid_chroms;W.make_name_popup_menu()}W.content_div.text(R);if(W.view.chrom){W.content_div.text("");W.content_div.css("height",W.height_px+"px");W.enabled=true;$.when(W.predraw_init()).done(function(){W.draw()})}}}}}}})},predraw_init:function(){},update_name:function(W){this.old_name=this.name;this.name=W;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var H=function(X,ad,ag){var Y=this,ah=Y.view;this.filters=(X!==undefined?v(X):[]);this.filters_available=false;this.filters_visible=false;this.tool=(ad!==undefined&&obj_length(ad)>0?new n(this,ad):undefined);this.parent_track=ag;this.child_tracks=[];if(Y.hidden){return}var af=function(ai,aj,ak){ai.click(function(){var al=aj.text();max=parseFloat(ak.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(ak.slider("option","values")){input_size=2*input_size+1;multi_value=true}aj.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",al).appendTo(aj).focus().select().click(function(am){am.stopPropagation()}).blur(function(){$(this).remove();aj.text(al)}).keyup(function(aq){if(aq.keyCode===27){$(this).trigger("blur")}else{if(aq.keyCode===13){var ao=ak.slider("option","min"),am=ak.slider("option","max"),ap=function(ar){return(isNaN(ar)||ar>am||ar<ao)},an=$(this).val();if(!multi_value){an=parseFloat(an);if(ap(an)){alert("Parameter value must be in the range ["+ao+"-"+am+"]");return $(this)}}else{an=an.split("-");an=[parseFloat(an[0]),parseFloat(an[1])];if(ap(an[0])||ap(an[1])){alert("Parameter value must be in the range ["+ao+"-"+am+"]");return $(this)}}ak.slider((multi_value?"values":"value"),an)}}})})};if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filters_div=$("<div/>").addClass("filters").hide();this.header_div.after(this.filters_div);this.filters_div.bind("drag",function(ai){ai.stopPropagation()}).bind("click",function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()});$.each(this.filters,function(ao,aj){var al=$("<div/>").addClass("slider-row").appendTo(Y.filters_div);var ai=$("<div/>").addClass("slider-label").appendTo(al);var aq=$("<span/>").addClass("slider-name").text(aj.name+" ").appendTo(ai);var ak=$("<span/>");var am=$("<span/>").addClass("slider-value").appendTo(ai).append("[").append(ak).append("]");var ap=$("<div/>").addClass("slider").appendTo(al);aj.control_element=$("<div/>").attr("id",aj.name+"-filter-control").appendTo(ap);var an=[0,0];aj.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(ar,at){an=at.values;ak.text(at.values[0]+"-"+at.values[1]);setTimeout(function(){if(at.values[0]==an[0]&&at.values[1]==an[1]){var au=at.values;ak.text(au[0]+"-"+au[1]);aj.low=au[0];aj.high=au[1];Y.draw(true,true)}},50)},change:function(ar,at){aj.control_element.slider("option","slide").call(aj.control_element,ar,at)}});aj.slider=aj.control_element;aj.slider_label=ak;af(am,ak,aj.control_element);$("<div style='clear: both;'/>").appendTo(al)});if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}Y.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();Y.container_div.append(Y.child_tracks_container);if(Y.display_modes!==undefined){if(Y.mode_div===undefined){Y.mode_div=$("<div class='right-float menubutton popup' />").appendTo(Y.header_div);var aa=(Y.track_config&&Y.track_config.values.mode?Y.track_config.values.mode:Y.display_modes[0]);Y.mode=aa;Y.mode_div.text(aa);var Z=function(ai){Y.mode_div.text(ai);Y.mode=ai;Y.track_config.values.mode=ai;Y.tile_cache.clear();Y.draw()};var W={};for(var ab=0,ae=Y.display_modes.length;ab<ae;ab++){var ac=Y.display_modes[ab];W[ac]=function(ai){return function(){Z(ai)}}(ac)}make_popupmenu(Y.mode_div,W)}else{Y.mode_div.hide()}}this.make_name_popup_menu()};extend(H.prototype,k.prototype,{make_name_popup_menu:function(){var X=this;var W={};W["Edit configuration"]=function(){var ad=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ab=function(){X.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ac=function(ae){if((ae.keyCode||ae.which)===27){ad()}else{if((ae.keyCode||ae.which)===13){ab()}}};$(window).bind("keypress.check_enter_esc",ac);show_modal("Configure Track",X.track_config.build_form(),{Cancel:ad,OK:ab})};if(X.filters_available>0){var aa=(X.filters_div.is(":visible")?"Hide filters":"Show filters");W[aa]=function(){X.filters_visible=(X.filters_div.is(":visible"));X.filters_div.toggle();X.make_name_popup_menu()}}if(X.tool){var aa=(X.dynamic_tool_div.is(":visible")?"Hide tool":"Show tool");W[aa]=function(){if(!X.dynamic_tool_div.is(":visible")){X.update_name(X.name+X.tool_region_and_parameters_str())}else{menu_option_text="Show dynamic tool";X.revert_name()}X.dynamic_tool_div.toggle();X.make_name_popup_menu()}}if(X.valid_chroms){W["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+X.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}var Y=view;var Z=function(){$("#no-tracks").show()};if(this.parent_track){Y=this.parent_track;Z=function(){}}W.Remove=function(){Y.remove_track(X);if(Y.num_tracks===0){Z()}};make_popupmenu(X.name_div,W)},draw:function(W,Z){var an=this.view.low,ac=this.view.high,ae=ac-an,ag=this.view.container.width(),ab=ag/ae,ah=this.view.resolution,aa=$("<div style='position: relative;'></div>");if(!Z){this.content_div.children().remove()}this.content_div.append(aa);this.max_height=0;var aj=Math.floor(an/ah/J);var Y={};while((aj*J*ah)<ac){var am=ag+"_"+ab+"_"+aj;var ad=this.tile_cache.get(am);var ak=aj*J*this.view.resolution;var X=ak+J*this.view.resolution;if(!W&&ad){this.show_tile(ad,aa,ak,ab)}else{this.delayed_draw(W,am,ak,X,aj,ah,aa,ab,Y)}aj+=1}var af=this;var al=setInterval(function(){if(obj_length(Y)===0){clearInterval(al);if(Z){var aq=af.content_div.children();var ap=false;for(var ar=aq.length-1,ao=0;ar>=ao;ar--){var av=$(aq[ar]);if(ap){av.remove()}else{if(av.children().length!==0){ap=true}}}}for(var au=0;au<af.filters.length;au++){af.filters[au].update_ui_elt()}var at=false;if(af.example_feature){for(var au=0;au<af.filters.length;au++){if(af.filters[au].applies_to(af.example_feature)){at=true;break}}}if(af.filters_available!==at){af.filters_available=at;if(!af.filters_available){af.filters_div.hide()}af.make_name_popup_menu()}}},50);for(var ai=0;ai<this.child_tracks.length;ai++){this.child_tracks[ai].draw(W,Z)}},delayed_draw:function(X,ae,ac,ag,Y,aa,af,ah,ab){var Z=this;var ad=function(ap,ai,ak,aj,an,ao,al){returned_tile=Z.draw_tile(ai,ak,aj,an,ao,al);var am=$("<div class='track-tile'>").prepend(returned_tile);tile_element=am;Z.tile_cache.set(ae,tile_element);Z.show_tile(tile_element,an,ac,ao);delete ab[ap]};var W=setTimeout(function(){if(ac<=Z.view.high&&ag>=Z.view.low){var ai=(X?undefined:Z.tile_cache.get(ae));if(ai){Z.show_tile(ai,af,ac,ah);delete ab[W]}else{$.when(Z.data_cache.get_data(view.chrom,ac,ag,Z.mode,aa,Z.data_url_extra_params)).then(function(aj){if(view.reference_track&&ah>view.canvas_manager.char_width_px){$.when(view.reference_track.data_cache.get_data(view.chrom,ac,ag,Z.mode,aa,view.reference_track.data_url_extra_params)).then(function(ak){ad(W,aj,aa,Y,af,ah,ak)})}else{ad(W,aj,aa,Y,af,ah)}})}}},50);ab[W]=true},show_tile:function(W,ab,Z,ac){var X=this;var Y=this.view.high-this.view.low,aa=(Z-this.view.low)*ac;if(this.left_offset){aa-=this.left_offset}W.css({position:"absolute",top:0,left:aa,height:""});ab.append(W);X.max_height=Math.max(X.max_height,W.height());X.content_div.css("height",X.max_height+"px");ab.children().css("height",X.max_height+"px")},set_overview:function(){var W=this.view;if(this.initial_canvas&&this.is_overview){W.overview_close.show();W.overview_viewport.append(this.initial_canvas);W.overview_highlight.show().height(this.initial_canvas.height());W.overview_viewport.height(this.initial_canvas.height()+W.overview_box.height())}$(window).trigger("resize")},tool_region_and_parameters_str:function(Y,W,Z){var X=this,aa=(Y!==undefined&&W!==undefined&&Z!==undefined?Y+":"+W+"-"+Z:"all");return" - region=["+aa+"], parameters=["+X.tool.get_param_values().join(", ")+"]"},add_track:function(W){W.track_id=this.track_id+"_"+this.child_tracks.length;W.container_div.attr("id","track_"+W.track_id);this.child_tracks_container.append(W.container_div);B(W.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(W);this.view.has_changes=true},remove_track:function(W){W.container_div.fadeOut("slow",function(){$(this).remove()})}});var T=function(W,X){this.track_type="LabelTrack";this.hidden=true;k.call(this,null,W,X);this.container_div.addClass("label-track")};extend(T.prototype,k.prototype,{draw:function(){var Y=this.view,Z=Y.high-Y.low,ac=Math.floor(Math.pow(10,Math.floor(Math.log(Z)/Math.log(10)))),W=Math.floor(Y.low/ac)*ac,aa=this.view.container.width(),X=$("<div style='position: relative; height: 1.3em;'></div>");while(W<Y.high){var ab=(W-Y.low)/Z*aa;X.append($("<div class='label'>"+commatize(W)+"</div>").css({position:"absolute",left:ab-1}));W+=ac}this.content_div.children(":first").remove();this.content_div.append(X)}});var x=function(W){this.track_type="ReferenceTrack";this.hidden=true;k.call(this,null,W,W.top_labeltrack);H.call(this);W.reference_track=this;this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:W.dbkey};this.data_cache=new K(y,this,false);this.tile_cache=new c(q)};extend(x.prototype,H.prototype,{draw_tile:function(ag,ab,X,ad,ah){var aa=this,Y=J*ab;if(ah>this.view.canvas_manager.char_width_px){if(ag===null){aa.content_div.css("height","0px");return}var Z=this.view.canvas_manager.new_canvas();var af=Z.getContext("2d");Z.width=Math.ceil(Y*ah+aa.left_offset);Z.height=aa.height_px;af.font=af.canvas.manager.default_font;af.textAlign="center";for(var ac=0,ae=ag.length;ac<ae;ac++){var W=Math.round(ac*ah);af.fillText(ag[ac],W+aa.left_offset,10)}return Z}this.content_div.css("height","0px")}});var l=function(aa,Y,ab,W,Z){var X=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";k.call(this,aa,Y,Y.viewport_container);H.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=ab;this.dataset_id=W;this.original_dataset_id=W;this.data_cache=new K(y,this);this.tile_cache=new c(q);this.track_config=new S({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:Z,onchange:function(){X.vertical_range=X.prefs.max_value-X.prefs.min_value;$("#linetrack_"+X.track_id+"_minval").text(X.prefs.min_value);$("#linetrack_"+X.track_id+"_maxval").text(X.prefs.max_value);X.tile_cache.clear();X.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;this.add_resize_handle()};extend(l.prototype,H.prototype,{add_resize_handle:function(){var W=this;var Z=false;var Y=false;var X=$("<div class='track-resize'>");$(W.container_div).hover(function(){Z=true;X.show()},function(){Z=false;if(!Y){X.hide()}});X.hide().bind("dragstart",function(aa,ab){Y=true;ab.original_height=$(W.content_div).height()}).bind("drag",function(ab,ac){var aa=Math.min(Math.max(ac.original_height+ac.deltaY,W.min_height_px),W.max_height_px);$(W.content_div).css("height",aa);W.height_px=aa;W.draw(true)}).bind("dragend",function(aa,ab){W.tile_cache.clear();Y=false;if(!Z){X.hide()}W.track_config.values.height=W.height_px}).appendTo(W.container_div)},predraw_init:function(){var W=this,X=W.view.tracks.indexOf(W);W.vertical_range=undefined;return $.getJSON(W.data_url,{stats:true,chrom:W.view.chrom,low:null,high:null,hda_ldda:W.hda_ldda,dataset_id:W.dataset_id},function(Y){W.container_div.addClass("line-track");var aa=Y.data;if(isNaN(parseFloat(W.prefs.min_value))||isNaN(parseFloat(W.prefs.max_value))){W.prefs.min_value=aa.min;W.prefs.max_value=aa.max;$("#track_"+X+"_minval").val(W.prefs.min_value);$("#track_"+X+"_maxval").val(W.prefs.max_value)}W.vertical_range=W.prefs.max_value-W.prefs.min_value;W.total_frequency=aa.total_frequency;W.container_div.find(".yaxislabel").remove();var ab=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+X+"_minval").text(t(W.prefs.min_value));var Z=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+X+"_maxval").text(t(W.prefs.max_value));Z.css({position:"absolute",top:"24px",left:"10px"});Z.prependTo(W.container_div);ab.css({position:"absolute",bottom:"2px",left:"10px"});ab.prependTo(W.container_div)})},draw_tile:function(ah,aa,X,ae,ag){if(this.vertical_range===undefined){return}var ab=X*J*aa,Z=J*aa,W=Math.ceil(Z*ag),ad=this.height_px;var Y=this.view.canvas_manager.new_canvas();Y.width=W,Y.height=ad;var af=Y.getContext("2d");var ac=new G.LinePainter(ah.data,ab,ab+Z,this.prefs.min_value,this.prefs.max_value,this.prefs.color,this.mode);ac.draw(af,W,ad);return Y}});var e=function(W,ab,aa,ae,ad,Y,Z,ac){var X=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];this.track_config=new S({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ad,onchange:function(){X.tile_cache.clear();X.draw()}});this.prefs=this.track_config.values;k.call(this,W,ab,ab.viewport_container);H.call(this,Y,Z,ac);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=aa;this.dataset_id=ae;this.original_dataset_id=ae;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_cache=new K(20,this);this.left_offset=200;this.painter=G.LinkedFeaturePainter};extend(e.prototype,H.prototype,{update_auto_mode:function(W){if(this.mode=="Auto"){if(W=="no_detail"){W="reduced to feature spans"}else{if(W=="summary_tree"){W="reduced to coverage histogram"}}this.mode_div.text("Auto ("+W+")")}},incremental_slots:function(aa,X,Z){var Y=this.view.canvas_manager.dummy_context,W=this.inc_slots[aa];if(!W||(W.mode!==Z)){W=new (o.FeatureSlotter)(aa,Z==="Pack",w,function(ab){return Y.measureText(ab)});W.mode=Z;this.inc_slots[aa]=W}return W.slot_features(X)},draw_tile:function(ai,aq,av,ae,ag,Z){var an=this,ax=av*J*aq,X=(av+1)*J*aq,ak=X-ax,ao=Math.ceil(ak*ag),am=this.mode,aB=25,aa=this.left_offset,aj,ab;if(am==="Auto"){if(ai.dataset_type==="summary_tree"){am=ai.dataset_type}else{if(ai.extra_info==="no_detail"){am="no_detail"}else{var aA=ai.data;if((aA.length&&aA.length<4)||(this.view.high-this.view.low>D)){am="Squish"}else{am="Pack"}}}this.update_auto_mode(am)}if(am==="summary_tree"){ab=this.summary_draw_height;ae.parent().css("height",Math.max(this.height_px,ab)+"px");this.container_div.find(".yaxislabel").remove();var W=$("<div />").addClass("yaxislabel");W.text(ai.max);W.css({position:"absolute",top:"22px",left:"10px"});W.prependTo(this.container_div);var Y=this.view.canvas_manager.new_canvas();Y.width=ao+aa;Y.height=ab+L;var ay=new G.SummaryTreePainter(ai.data,ai.delta,ai.max,ax,X,this.prefs.show_counts);var ap=Y.getContext("2d");ap.translate(aa,L);ay.draw(ap,ao,ab);return Y}var aj,ad=1;if(am==="no_detail"||am==="Squish"||am==="Pack"){ad=this.incremental_slots(ag,ai.data,am);aj=this.inc_slots[ag].slots}var af=[];if(ai.data){for(var ar=0,au=ai.data.length;ar<au;ar++){var ac=ai.data[ar];var at=false;var ah;for(var aw=0,az=this.filters.length;aw<az;aw++){ah=this.filters[aw];ah.update_attrs(ac);if(!ah.keep(ac)){at=true;break}}if(!at){af.push(ac)}}}var ay=new (this.painter)(af,ax,X,this.prefs,am,Z);var ab=ay.get_required_height(ad)+z;var Y=this.view.canvas_manager.new_canvas();Y.width=ao+aa;Y.height=ab;ae.parent().css("height",Math.max(this.height_px,ab)+"px");var ap=Y.getContext("2d");ap.fillStyle=this.prefs.block_color;ap.font=ap.canvas.manager.default_font;ap.textAlign="right";this.container_div.find(".yaxislabel").remove();if(ai.message){$(Y).css({"border-top":"1px solid red"});ap.fillStyle="red";ap.textAlign="left";var al=ap.textBaseline;ap.textBaseline="top";ap.fillText(ai.message,aa,0);ap.textBaseline=al;if(!ai.data){return Y}}this.example_feature=(ai.data.length?ai.data[0]:undefined);ap.translate(aa,z);ay.draw(ap,ao,ab,aj);return Y}});var M=function(Z,X,ab,W,Y,aa){e.call(this,Z,X,ab,W,Y,aa);this.track_type="VcfTrack";this.painter=G.VariantPainter};extend(M.prototype,H.prototype,e.prototype);var P=function(Z,X,ab,W,Y,aa){e.call(this,Z,X,ab,W,Y,aa);this.track_config=new S({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:Y,onchange:function(){this.track.tile_cache.clear();this.track.draw()}});this.prefs=this.track_config.values;this.track_type="ReadTrack";this.painter=G.ReadPainter;this.make_name_popup_menu()};extend(P.prototype,H.prototype,e.prototype);var N=function(aa,Y,ac,W,Z,ab,X){e.call(this,aa,Y,ac,W,Z,ab,{},X);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};extend(N.prototype,H.prototype,e.prototype,{predraw_init:function(){var X=this;var W=function(){if(X.data_cache.size()===0){setTimeout(W,300)}else{X.data_url=default_data_url;X.data_query_wait=F;X.dataset_state_url=converted_datasets_state_url;$.getJSON(X.dataset_state_url,{dataset_id:X.dataset_id,hda_ldda:X.hda_ldda},function(Y){})}};W()}});Q.View=U;Q.LineTrack=l;Q.FeatureTrack=e;Q.ReadTrack=P};var slotting_module=function(c,b){var d=2,a=5;b.FeatureSlotter=function(h,g,e,f){this.slots={};this.start_end_dct={};this.w_scale=h;this.include_label=g;this.max_rows=e;this.measureText=f};extend(b.FeatureSlotter.prototype,{slot_features:function(l){var o=this.w_scale,r=this.slots,g=this.start_end_dct,x=[],z=[],m=0,y=this.max_rows;for(var v=0,w=l.length;v<w;v++){var k=l[v],n=k[0];if(r[n]!==undefined){m=Math.max(m,r[n]);z.push(r[n])}else{x.push(v)}}var p=function(F,G){for(var E=0;E<=y;E++){var C=false,H=g[E];if(H!==undefined){for(var B=0,D=H.length;B<D;B++){var A=H[B];if(G>A[0]&&F<A[1]){C=true;break}}}if(!C){return E}}return -1};for(var v=0,w=x.length;v<w;v++){var k=l[x[v]],n=k[0],t=k[1],e=k[2],q=k[3],f=Math.floor(t*o),j=Math.ceil(e*o),u=this.measureText(q).width,h;if(q!==undefined&&this.include_label){u+=(d+a);if(f-u>=0){f-=u;h="left"}else{j+=u;h="right"}}var s=p(f,j);if(s>=0){if(g[s]===undefined){g[s]=[]}g[s].push([f,j]);r[n]=s;m=Math.max(m,s)}else{}}return m+1}})};var painters_module=function(k,A){var q=function(L,D,J,C,I,G){if(G===undefined){G=4}var F=C-D;var E=I-J;var H=Math.floor(Math.sqrt(F*F+E*E)/G);var M=F/H;var K=E/H;var B;for(B=0;B<H;B++,D+=M,J+=K){if(B%2!==0){continue}L.fillRect(D,J,G,1)}};var r=function(D,C,B,G){var F=C-G/2,E=C+G/2,H=B-Math.sqrt(G*3/2);D.beginPath();D.moveTo(F,H);D.lineTo(E,H);D.lineTo(C,B);D.lineTo(F,H);D.strokeStyle=this.fillStyle;D.fill();D.stroke();D.closePath()};var v=function(E,G,C,F,B,D){this.data=E;this.delta=G;this.max=C;this.view_start=F;this.view_end=B;this.show_counts=D};v.prototype.draw=function(O,B,N){var G=this.view_start,Q=this.view_end-this.view_start,P=B/Q;var L=this.data,K=this.delta,I=this.max,D=N;delta_x_px=Math.ceil(K*P);O.save();for(var E=0,F=L.length;E<F;E++){var J=Math.floor((L[E][0]-G)*P);var H=L[E][1];if(!H){continue}var M=H/I*N;O.fillStyle="black";O.fillRect(J,D-M,delta_x_px,M);var C=4;if(this.show_counts&&(O.measureText(H).width+C)<delta_x_px){O.fillStyle="#666";O.textAlign="center";O.fillText(H,J+(delta_x_px/2),10)}}O.restore()};var c=function(E,H,B,C,G,D,F){this.data=E;this.view_start=H;this.view_end=B;this.min_value=C;this.max_value=G;this.color=D;this.mode=F;this.overflow_color="#F66"};c.prototype.draw=function(Q,P,N){var I=false,J=this.min_value,G=this.max_value,M=G-J,C=N,D=this.view_start,O=this.view_end-this.view_start,E=P/O,K=this.mode,U=this.data;Q.save();var V=Math.round(N+J/M*N);if(K!=="Intensity"){Q.fillStyle="#aaa";Q.fillRect(0,V,P,1)}Q.beginPath();Q.fillStyle=this.color;var T,H,F;if(U.length>1){F=Math.ceil((U[1][0]-U[0][0])*E)}else{F=10}for(var R=0,S=U.length;R<S;R++){T=Math.round((U[R][0]-D)*E);H=U[R][1];if(H===null){if(I&&K==="Filled"){Q.lineTo(T,C)}I=false;continue}if(H<J){H=J}else{if(H>G){H=G}}if(K==="Histogram"){H=Math.round(H/M*C);Q.fillRect(T,V,F,-H)}else{if(K==="Intensity"){H=255-Math.floor((H-J)/M*255);Q.fillStyle="rgb("+H+","+H+","+H+")";Q.fillRect(T,0,F,C)}else{H=Math.round(C-(H-J)/M*C);if(I){Q.lineTo(T,H)}else{I=true;if(K==="Filled"){Q.moveTo(T,C);Q.lineTo(T,H)}else{Q.moveTo(T,H)}}}}}if(K==="Filled"){if(I){Q.lineTo(T,V);Q.lineTo(0,V)}Q.fill()}else{Q.stroke()}var B=-1,L=-1;Q.fillStyle=this.overflow_color;for(var R=0,S=U.length;R<S;R++){H=U[R][1];T=Math.round((U[R][0]-D)*E);x_minus_scaled=Math.round((U[R][0]-1-D)*E);if(L>=0&&(H===null||H<G)){Q.fillRect(L,0,x_minus_scaled-L+1,2);L=-1}else{if(B>=0&&(H===null||H>J)){Q.fillRect(B,N-2,x_minus_scaled-B+1,2);B=-1}}if(H!==null&&H>G&&L<0){L=T}else{if(H!==null&&H<J&&B<0){B=T}}}Q.restore()};var p=function(D,F,B,C,E){this.data=D;this.view_start=F;this.view_end=B;this.prefs=C;this.mode=E};extend(p.prototype,{get_required_height:function(C){var B=y_scale=this.get_row_height(),D=this.mode;if(D==="no_detail"||D==="Squish"||D==="Pack"){B=C*y_scale}return B+Math.max(Math.round(y_scale/2),5)},draw:function(N,E,M,J){var H=this.data,K=this.view_start,O=this.view_end;N.save();N.fillStyle=this.prefs.block_color;N.textAlign="right";var R=this.view_end-this.view_start,Q=E/R,D=this.get_row_height();for(var G=0,I=H.length;G<I;G++){var P=H[G],F=P[0],B=P[1],C=P[2],L=(J&&J[F]!==undefined?J[F]:null);if((B<O&&C>K)&&(this.mode=="Dense"||L!==null)){this.draw_element(N,this.mode,P,L,K,O,Q,D,E)}}N.restore()}});var d=10,j=3,n=5,z=10,g=1,t=3,f=3,a=9,o=2,h="#ccc";var s=function(D,F,B,C,E){p.call(this,D,F,B,C,E)};extend(s.prototype,p.prototype,{get_row_height:function(){var C=this.mode,B;if(C==="Dense"){B=d}else{if(C==="no_detail"){B=j}else{if(C==="Squish"){B=n}else{B=z}}}return B},draw_element:function(N,G,V,I,P,af,aj,ak,B){var S=V[0],ah=V[1],Z=V[2]-1,Q=V[3],aa=Math.floor(Math.max(0,(ah-P)*aj)),O=Math.ceil(Math.min(B,Math.max(0,(Z-P)*aj))),Y=(G==="Dense"?0:(0+I))*ak,M,ad,R=null,al=null,E=this.prefs.block_color,ac=this.prefs.label_color;if(G=="Dense"){I=1}if(G==="no_detail"){N.fillStyle=E;N.fillRect(aa,Y+5,O-aa,g)}else{var L=V[4],X=V[5],ab=V[6],F=V[7];if(X&&ab){R=Math.floor(Math.max(0,(X-P)*aj));al=Math.ceil(Math.min(B,Math.max(0,(ab-P)*aj)))}var ai,T;if(G==="Squish"||G==="Dense"){ai=1;T=f}else{ai=5;T=a}if(!F){if(V.strand){if(V.strand==="+"){N.fillStyle=N.canvas.manager.get_pattern("right_strand_inv")}else{if(V.strand==="-"){N.fillStyle=N.canvas.manager.get_pattern("left_strand_inv")}}}else{N.fillStyle=E}N.fillRect(aa,Y,O-aa,T)}else{var K,U;if(G==="Squish"||G==="Dense"){N.fillStyle=h;K=Y+Math.floor(f/2)+1;U=1}else{if(L){var K=Y;var U=T;if(L==="+"){N.fillStyle=N.canvas.manager.get_pattern("right_strand")}else{if(L==="-"){N.fillStyle=N.canvas.manager.get_pattern("left_strand")}}}else{N.fillStyle=h;K+=(f/2)+1;U=1}}N.fillRect(aa,K,O-aa,U);for(var ag=0,D=F.length;ag<D;ag++){var H=F[ag],C=Math.floor(Math.max(0,(H[0]-P)*aj)),W=Math.ceil(Math.min(B,Math.max((H[1]-1-P)*aj)));if(C>W){continue}N.fillStyle=E;N.fillRect(C,Y+(T-ai)/2+1,W-C,ai);if(R!==undefined&&ab>X&&!(C>al||W<R)){var ae=Math.max(C,R),J=Math.min(W,al);N.fillRect(ae,Y+1,J-ae,T);if(F.length==1&&G=="Pack"){if(L==="+"){N.fillStyle=N.canvas.manager.get_pattern("right_strand_inv")}else{if(L==="-"){N.fillStyle=N.canvas.manager.get_pattern("left_strand_inv")}}if(ae+14<J){ae+=2;J-=2}N.fillRect(ae,Y+1,J-ae,T)}}}}if(G==="Pack"&&ah>P){N.fillStyle=ac;if(P===0&&aa-N.measureText(Q).width<0){N.textAlign="left";N.fillText(Q,O+o,Y+8)}else{N.textAlign="right";N.fillText(Q,aa-o,Y+8)}N.fillStyle=E}}}});var b=function(D,F,B,C,E){p.call(this,D,F,B,C,E)};extend(b.prototype,p.prototype,{draw_element:function(U,P,J,F,X,D,M,V,S){var J=data[i],L=J[0],T=J[1],E=J[2]-1,O=J[3],H=Math.floor(Math.max(0,(T-X)*M)),K=Math.ceil(Math.min(S,Math.max(0,(E-X)*M))),G=(P==="Dense"?0:(0+F))*V,B,Y,C=null,N=null;if(no_label){U.fillStyle=block_color;U.fillRect(H+left_offset,G+5,K-H,1)}else{var W=J[4],R=J[5],I=J[6];B=9;Y=1;U.fillRect(H+left_offset,G,K-H,B);if(P!=="Dense"&&O!==undefined&&T>X){U.fillStyle=label_color;if(X===0&&H-U.measureText(O).width<0){U.textAlign="left";U.fillText(O,K+2+left_offset,G+8)}else{U.textAlign="right";U.fillText(O,H-2+left_offset,G+8)}U.fillStyle=block_color}var Q=W+" / "+R;if(T>X&&U.measureText(Q).width<(K-H)){U.fillStyle="white";U.textAlign="center";U.fillText(Q,left_offset+H+(K-H)/2,G+8);U.fillStyle=block_color}}}});var y=1001,m=1002,e=1003,x=1004,l=1005;var w=function(F,C){var H=F[0],G=F[1],E=C[0],D=C[1],B;if(H<E){if(G<E){B=y}else{if(G<=D){B=e}else{B=m}}}else{if(H>D){B=y}else{if(G<=D){B=l}else{B=x}}}return B};var u=function(E,G,B,D,F,C){p.call(this,E,G,B,D,F);this.ref_seq=C};extend(u.prototype,p.prototype,{get_row_height:function(){var B,C=this.mode;if(C==="Dense"){B=d}else{if(C==="Squish"){B=n}else{B=z;if(this.prefs.show_insertions){B*=2}}}return B},draw_read:function(Y,T,O,ad,D,X,L,I,H){Y.textAlign="center";var W=this,C=[ad,D],R=0,Z=0,V=0;ref_seq=this.ref_seq,char_width_px=Y.canvas.manager.char_width_px;var ai=[];if((T==="Pack"||this.mode==="Auto")&&I!==undefined&&O>char_width_px){V=Math.round(O/2)}if(!L){L=[[0,I.length]]}for(var P=0,ab=L.length;P<ab;P++){var M=L[P],E="MIDNSHP=X"[M[0]],Q=M[1];if(E==="H"||E==="S"){R-=Q}var J=X+R,ah=Math.floor(Math.max(0,(J-ad)*O)),K=Math.floor(Math.max(0,(J+Q-ad)*O));switch(E){case"H":break;case"S":case"M":case"=":var S=w([J,J+Q],C);if(S!==y){var U=I.slice(Z,Z+Q);if(V>0){Y.fillStyle=this.prefs.block_color;Y.fillRect(ah-V,H+1,K-ah,9);Y.fillStyle=h;for(var af=0,B=U.length;af<B;af++){if(this.prefs.show_differences&&ref_seq){var N=ref_seq[J-ad+af];if(!N||N.toLowerCase()===U[af].toLowerCase()){continue}}if(J+af>=ad&&J+af<=D){var ag=Math.floor(Math.max(0,(J+af-ad)*O));Y.fillText(U[af],ag,H+9)}}}else{Y.fillStyle=this.prefs.block_color;Y.fillRect(ah,H+4,K-ah,f)}}Z+=Q;R+=Q;break;case"N":Y.fillStyle=h;Y.fillRect(ah-V,H+5,K-ah,1);R+=Q;break;case"D":Y.fillStyle="red";Y.fillRect(ah-V,H+4,K-ah,3);R+=Q;break;case"P":break;case"I":var S=w([J,J+Q],C),ac=ah-V;if(S!==y){var U=I.slice(Z,Z+Q);if(this.prefs.show_insertions){var G=ah-(K-ah)/2;if((T==="Pack"||this.mode==="Auto")&&I!==undefined&&O>char_width_px){Y.fillStyle="yellow";Y.fillRect(G-V,H-9,K-ah,9);ai[ai.length]={type:"triangle",data:[ac,H+4,5]};Y.fillStyle=h;switch(S){case (e):U=U.slice(ad-J);break;case (x):U=U.slice(0,J-D);break;case (l):break;case (m):U=U.slice(ad-J,J-D);break}for(var af=0,B=U.length;af<B;af++){var ag=Math.floor(Math.max(0,(J+af-ad)*O));Y.fillText(U[af],ag-(K-ah)/2,H)}}else{Y.fillStyle="yellow";Y.fillRect(G,H+(this.mode!=="Dense"?2:5),K-ah,(T!=="Dense"?f:t))}}else{if((T==="Pack"||this.mode==="Auto")&&I!==undefined&&O>char_width_px){ai[ai.length]={type:"text",data:[U.length,ac,H+9]}}else{}}}Z+=Q;break;case"X":Z+=Q;break}}Y.fillStyle="yellow";var ae,F,aj;for(var aa=0;aa<ai.length;aa++){ae=ai[aa];F=ae.type;aj=ae.data;if(F==="text"){Y.save();Y.font="bold "+Y.font;Y.fillText(aj[0],aj[1],aj[2]);Y.restore()}else{if(F=="triangle"){r(Y,aj[0],aj[1],aj[2])}}}},draw_element:function(U,P,H,E,X,C,L,V,S){var K=H[0],T=H[1],D=H[2],M=H[3],G=Math.floor(Math.max(0,(T-X)*L)),I=Math.ceil(Math.min(S,Math.max(0,(D-X)*L))),F=(P==="Dense"?0:(0+E))*V,Y=this.prefs.block_color,J=this.prefs.label_color,R=0;if((P==="Pack"||this.mode==="Auto")&&L>U.canvas.manager.char_width_px){var R=Math.round(L/2)}U.fillStyle=Y;if(H[5] instanceof Array){var Q=Math.floor(Math.max(0,(H[4][0]-X)*L)),O=Math.ceil(Math.min(S,Math.max(0,(H[4][1]-X)*L))),N=Math.floor(Math.max(0,(H[5][0]-X)*L)),B=Math.ceil(Math.min(S,Math.max(0,(H[5][1]-X)*L)));if(H[4][1]>=X&&H[4][0]<=C&&H[4][2]){this.draw_read(U,P,L,X,C,H[4][0],H[4][2],H[4][3],F)}if(H[5][1]>=X&&H[5][0]<=C&&H[5][2]){this.draw_read(U,P,L,X,C,H[5][0],H[5][2],H[5][3],F)}if(N>O){U.fillStyle=h;q(U,O-R,F+5,N-R,F+5)}}else{U.fillStyle=Y;this.draw_read(U,P,L,X,C,T,H[4],H[5],F)}if(P==="Pack"&&T>X){U.fillStyle=this.prefs.label_color;var W=1;if(W===0&&G-U.measureText(M).width<0){U.textAlign="left";U.fillText(M,I+o-R,F+8)}else{U.textAlign="right";U.fillText(M,G-o-R,F+8)}U.fillStyle=Y}}});A.SummaryTreePainter=v;A.LinePainter=c;A.LinkedFeaturePainter=s;A.ReadPainter=u;A.VariantPainter=b};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window);
\ No newline at end of file
+var extend=function(){var c=arguments[0];for(var b=1;b<arguments.length;b++){var a=arguments[b];for(key in a){c[key]=a[key]}}return c};var trackster_module=function(f,Q){var o=f("slotting"),G=f("painters");var V=function(W,X){this.document=W;this.default_font=X!==undefined?X:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};extend(V.prototype,{load_pattern:function(W,aa){var X=this.patterns,Y=this.dummy_context,Z=new Image();Z.src=image_path+aa;Z.onload=function(){X[W]=Y.createPattern(Z,"repeat")}},get_pattern:function(W){return this.patterns[W]},new_canvas:function(){var W=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(W)}W.manager=this;return W}});var B=function(W,X){W.bind("drag",{handle:X,relative:true},function(ab,ac){var aa=$(this).parent();var Z=aa.children();var Y;for(Y=0;Y<Z.length;Y++){if(ac.offsetY<$(Z.get(Y)).position().top){break}}if(Y===Z.length){if(this!==Z.get(Y-1)){aa.append(this)}}else{if(this!==Z.get(Y)){$(this).insertBefore(Z.get(Y))}}})};var h=function(Y,W){var X=W-Y;return(X<=2?0.01:(X<=100?1:(X<=1000?5:10)))};var C=9,z=10,L=C+2,w=100,D=12000,J=200,r=10,F=5000,s=100,m="There was an error in indexing this dataset. ",E="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",A="No data for this chrom/contig.",p="Currently indexing... please wait",u="Tool cannot be rerun: ",a="Loading data...",R="Ready for display",d=10,q=5,y=5;function t(W){return Math.round(W*1000)/1000}var c=function(W){this.num_elements=W;this.clear()};extend(c.prototype,{get:function(X){var W=this.key_ary.indexOf(X);if(W!==-1){this.move_key_to_end(X,W)}return this.obj_cache[X]},set:function(X,Y){if(!this.obj_cache[X]){if(this.key_ary.length>=this.num_elements){var W=this.key_ary.shift();delete this.obj_cache[W]}this.key_ary.push(X)}this.obj_cache[X]=Y;return Y},move_key_to_end:function(X,W){this.key_ary.splice(W,1);this.key_ary.push(X)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var K=function(X,W,Y){c.call(this,X);this.track=W;this.subset=(Y!==undefined?Y:true)};extend(K.prototype,c.prototype,{load_data:function(ad,ae,Z,ac,W,ab){var Y={chrom:ad,low:ae,high:Z,mode:ac,resolution:W,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(Y,ab);var af=[];for(var aa=0;aa<this.track.filters.length;aa++){af[af.length]=this.track.filters[aa].name}Y.filter_cols=JSON.stringify(af);var X=this;return $.getJSON(this.track.data_url,Y,function(ag){X.set_data(ae,Z,ac,ag)})},get_data:function(Y,W,ab,ac,X,aa){var Z=this.get(this.gen_key(W,ab,ac));if(Z){return Z}Z=this.load_data(Y,W,ab,ac,X,aa);this.set_data(W,ab,ac,Z);return Z},set_data:function(X,Y,Z,W){return this.set(this.gen_key(X,Y,Z),W)},gen_key:function(W,Y,Z){var X=W+"_"+Y+"_"+Z;return X},split_key:function(W){return W.split("_")}});var U=function(W,Z,Y,X,aa){this.container=W;this.chrom=null;this.vis_id=Y;this.dbkey=X;this.title=Z;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(aa);this.canvas_manager=new V(W.get(0).ownerDocument);this.reset()};extend(U.prototype,{init:function(Z){var Y=this.container,W=this;this.top_container=$("<div/>").addClass("top-container").appendTo(Y);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(Y);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(Y);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var X=function(aa){if(aa.type==="focusout"||(aa.keyCode||aa.which)===13||(aa.keyCode||aa.which)===27){if((aa.keyCode||aa.which)!==27){W.go_to($(this).val())}$(this).hide();$(this).val("");W.location_span.show();W.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",X).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").appendTo(this.nav_controls);this.location_span.bind("click",function(){W.location_span.hide();W.chrom_select.hide();W.nav_input.val(W.chrom+":"+W.low+"-"+W.high);W.nav_input.css("display","inline-block");W.nav_input.select();W.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a id='zoom-out' />").click(function(){W.zoom_out();W.redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){W.zoom_in();W.redraw()}).appendTo(this.nav_controls);this.load_chroms({low:0},Z);this.chrom_select.bind("change",function(){W.change_chrom(W.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(aa){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(aa){W.zoom_in(aa.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(aa,ab){this.current_x=ab.offsetX}).bind("drag",function(aa,ac){var ad=ac.offsetX-this.current_x;this.current_x=ac.offsetX;var ab=Math.round(ad/W.viewport_container.width()*(W.max_high-W.max_low));W.move_delta(-ab)});this.overview_close.bind("click",function(){for(var ab=0,aa=W.tracks.length;ab<aa;ab++){W.tracks[ab].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",W.overview_box.height());W.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(aa,ab){if(aa.clientX>W.viewport_container.width()-16){return false}}).bind("dragstart",function(aa,ab){ab.original_low=W.low;ab.current_height=aa.clientY;ab.current_x=ab.offsetX}).bind("drag",function(ac,ae){var aa=$(this);var af=ae.offsetX-ae.current_x;var ab=aa.scrollTop()-(ac.clientY-ae.current_height);aa.scrollTop(ab);ae.current_height=ac.clientY;ae.current_x=ae.offsetX;var ad=Math.round(af/W.viewport_container.width()*(W.high-W.low));W.move_delta(ad)}).bind("mousewheel",function(ac,ae,ab,aa){if(ab){var ad=Math.round(-ab/W.viewport_container.width()*(W.high-W.low));W.move_delta(ad)}});this.top_labeltrack.bind("dragstart",function(aa,ab){return $("<div />").css({height:W.content_div.height()+W.top_labeltrack.height()+W.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ae,af){$(af.proxy).css({left:Math.min(ae.pageX,af.startX),width:Math.abs(ae.pageX-af.startX)});var ab=Math.min(ae.pageX,af.startX)-W.container.offset().left,aa=Math.max(ae.pageX,af.startX)-W.container.offset().left,ad=(W.high-W.low),ac=W.viewport_container.width();W.update_location(Math.round(ab/ac*ad)+W.low,Math.round(aa/ac*ad)+W.low)}).bind("dragend",function(af,ag){var ab=Math.min(af.pageX,ag.startX),aa=Math.max(af.pageX,ag.startX),ad=(W.high-W.low),ac=W.viewport_container.width(),ae=W.low;W.low=Math.round(ab/ac*ad)+ae;W.high=Math.round(aa/ac*ad)+ae;$(ag.proxy).remove();W.redraw()});this.add_label_track(new T(this,this.top_labeltrack));this.add_label_track(new T(this,this.nav_labeltrack));$(window).bind("resize",function(){W.resize_window()});$(document).bind("redraw",function(){W.redraw()});this.reset();$(window).trigger("resize")},update_location:function(W,X){this.location_span.text(commatize(W)+" - "+commatize(X));this.nav_input.val(this.chrom+":"+commatize(W)+"-"+commatize(X))},load_chroms:function(X,Y){X.num=s;$.extend(X,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var W=this;$.ajax({url:chrom_url,data:X,dataType:"json",success:function(aa){if(aa.chrom_info.length===0){alert("Invalid chromosome: "+X.chrom);return}if(aa.reference){W.add_label_track(new x(W))}W.chrom_data=aa.chrom_info;var ad='<option value="">Select Chrom/Contig</option>';for(var ac=0,Z=W.chrom_data.length;ac<Z;ac++){var ab=W.chrom_data[ac].chrom;ad+='<option value="'+ab+'">'+ab+"</option>"}if(aa.prev_chroms){ad+='<option value="previous">Previous '+s+"</option>"}if(aa.next_chroms){ad+='<option value="next">Next '+s+"</option>"}W.chrom_select.html(ad);if(Y){Y()}W.chrom_start_index=aa.start_index},error:function(){alert("Could not load chroms for this dbkey:",W.dbkey)}})},change_chrom:function(aa,X,ac){if(!aa||aa==="None"){return}var Z=this;if(aa==="previous"){Z.load_chroms({low:this.chrom_start_index-s});return}if(aa==="next"){Z.load_chroms({low:this.chrom_start_index+s});return}var ab=$.grep(Z.chrom_data,function(ae,af){return ae.chrom===aa})[0];if(ab===undefined){Z.load_chroms({chrom:aa},function(){Z.change_chrom(aa,X,ac)});return}else{if(aa!==Z.chrom){Z.chrom=aa;if(!Z.chrom){Z.intro_div.show()}else{Z.intro_div.hide()}Z.chrom_select.val(Z.chrom);Z.max_high=ab.len-1;Z.reset();Z.redraw(true);for(var ad=0,W=Z.tracks.length;ad<W;ad++){var Y=Z.tracks[ad];if(Y.init){Y.init()}}}if(X!==undefined&&ac!==undefined){Z.low=Math.max(X,0);Z.high=Math.min(ac,Z.max_high)}Z.reset_overview();Z.redraw()}},go_to:function(aa){var ae=this,W,Z,X=aa.split(":"),ac=X[0],ad=X[1];if(ad!==undefined){try{var ab=ad.split("-");W=parseInt(ab[0].replace(/,/g,""),10);Z=parseInt(ab[1].replace(/,/g,""),10)}catch(Y){return false}}ae.change_chrom(ac,W,Z)},move_fraction:function(Y){var W=this;var X=W.high-W.low;this.move_delta(Y*X)},move_delta:function(Y){var W=this;var X=W.high-W.low;if(W.low-Y<W.max_low){W.low=W.max_low;W.high=W.max_low+X}else{if(W.high-Y>W.max_high){W.high=W.max_high;W.low=W.max_high-X}else{W.high-=Y;W.low-=Y}}W.redraw()},add_track:function(W){W.view=this;W.track_id=this.track_id_counter;this.tracks.push(W);if(W.init){W.init()}W.container_div.attr("id","track_"+W.track_id);B(W.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(W){W.view=this;this.label_tracks.push(W)},remove_track:function(W){this.has_changes=true;W.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(W)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(ad){var ac=this.high-this.low,ab=this.low,X=this.high;if(ab<this.max_low){ab=this.max_low}if(X>this.max_high){X=this.max_high}if(this.high!==0&&ac<this.min_separation){X=ab+this.min_separation}this.low=Math.floor(ab);this.high=Math.ceil(X);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(r,Math.max(0,Math.ceil(Math.log(this.resolution,r)/Math.log(r))));var W=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var aa=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ae=13;this.overview_box.css({left:W,width:Math.max(ae,aa)}).show();if(aa<ae){this.overview_box.css("left",W-(ae-aa)/2)}if(this.overview_highlight){this.overview_highlight.css({left:W,width:aa})}this.update_location(this.low,this.high);if(!ad){for(var Y=0,Z=this.tracks.length;Y<Z;Y++){if(this.tracks[Y]&&this.tracks[Y].enabled){this.tracks[Y].draw()}}for(Y=0,Z=this.label_tracks.length;Y<Z;Y++){this.label_tracks[Y].draw()}}},zoom_in:function(X,Y){if(this.max_high===0||this.high-this.low<this.min_separation){return}var Z=this.high-this.low,aa=Z/2+this.low,W=(Z/this.zoom_factor)/2;if(X){aa=X/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(aa-W);this.high=Math.round(aa+W);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var X=this.high-this.low,Y=X/2+this.low,W=(X*this.zoom_factor)/2;this.low=Math.round(Y-W);this.high=Math.round(Y+W);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var n=function(X,aa){this.track=X;this.name=aa.name;this.params=[];var ai=aa.params;for(var Y=0;Y<ai.length;Y++){var ad=ai[Y],W=ad.name,ah=ad.label,Z=unescape(ad.html),af=ad.type;if(af==="number"){this.params[this.params.length]=new g(W,ah,Z,ad.min,ad.max)}else{if(af=="select"){this.params[this.params.length]=new I(W,ah,Z)}else{console.log("WARNING: unrecognized tool parameter type:",W,af)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ak){ak.stopPropagation()}).bind("click",function(ak){ak.stopPropagation()}).bind("dblclick",function(ak){ak.stopPropagation()});var ag=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ae=this.params;var ab=this;$.each(this.params,function(al,ao){var an=$("<div>").addClass("param-row").appendTo(ab.parent_div);var ak=$("<div>").addClass("param-label").text(ao.label).appendTo(an);var am=$("<div/>").addClass("slider").html(ao.html).appendTo(an);$("<div style='clear: both;'/>").appendTo(an)});this.parent_div.find("input").click(function(){$(this).select()});var aj=$("<div>").addClass("slider-row").appendTo(this.parent_div);var ac=$("<input type='submit'>").attr("value","Run").appendTo(aj);var ab=this;ac.click(function(){ab.run()})};extend(n.prototype,{get_param_values_dict:function(){var W={};this.parent_div.find(":input").each(function(){var X=$(this).attr("name"),Y=$(this).val();W[X]=JSON.stringify(Y)});return W},get_param_values:function(){var X=[];var W={};this.parent_div.find(":input").each(function(){var Y=$(this).attr("name"),Z=$(this).val();if(Y){X[X.length]=Z}});return X},run:function(){var X={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name};$.extend(X,this.get_param_values_dict());var Z=this.track,Y=X.tool_id+Z.tool_region_and_parameters_str(X.chrom,X.low,X.high),aa;if(Z.track_type==="FeatureTrack"){aa=new N(Y,view,Z.hda_ldda,undefined,{},{},Z)}this.track.add_track(aa);aa.content_div.text("Starting job.");var W=function(){$.getJSON(run_tool_url,X,function(ab){if(ab==="no converter"){aa.container_div.addClass("error");aa.content_div.text(E)}else{if(ab.error){aa.container_div.addClass("error");aa.content_div.text(u+ab.message)}else{if(ab==="pending"){aa.container_div.addClass("pending");aa.content_div.text("Converting input data so that it can be easily reused.");setTimeout(W,2000)}else{aa.dataset_id=ab.dataset_id;aa.content_div.text("Running job.");aa.init()}}}})};W()}});var I=function(X,W,Y){this.name=X;this.label=W;this.html=Y};var g=function(Y,X,aa,Z,W){I.call(this,Y,X,aa);this.min=Z;this.max=W};var j=function(X,W,Y){this.name=X;this.index=W;this.value=Y};var O=function(X,W){this.name=X;this.index=W;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};extend(O.prototype,{applies_to:function(W){if(W.length>this.index){return true}return false},keep:function(W){if(!this.applies_to(W)){return true}return(W[this.index]>=this.low&&W[this.index]<=this.high)},update_attrs:function(X){var W=false;if(!this.applies_to(X)){return W}if(X[this.index]<this.min){this.min=Math.floor(X[this.index]);W=true}if(X[this.index]>this.max){this.max=Math.ceil(X[this.index]);W=true}return W},update_ui_elt:function(){var X=this.slider.slider("option","min"),W=this.slider.slider("option","max");if(this.min<X||this.max>W){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",h(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var v=function(W){var ac=[];for(var Z=0;Z<W.length;Z++){var ab=W[Z];var Y=ab.name,aa=ab.type,X=ab.index;if(aa==="int"||aa==="float"){ac[Z]=new O(Y,X)}else{ac[Z]=new j(Y,X,aa)}}return ac};var S=function(W){this.track=W.track;this.params=W.params;this.values={};if(W.saved_values){this.restore_values(W.saved_values)}this.onchange=W.onchange};extend(S.prototype,{restore_values:function(W){var X=this;$.each(this.params,function(Y,Z){if(W[Z.key]!==undefined){X.values[Z.key]=W[Z.key]}else{X.values[Z.key]=Z.default_value}})},build_form:function(){var X=this;var W=$("<div />");$.each(this.params,function(ab,Z){if(!Z.hidden){var Y="param_"+ab;var ag=$("<div class='form-row' />").appendTo(W);ag.append($("<label />").attr("for",Y).text(Z.label+":"));if(Z.type==="bool"){ag.append($('<input type="checkbox" />').attr("id",Y).attr("name",Y).attr("checked",X.values[Z.key]))}else{if(Z.type==="color"){var ad=X.values[Z.key];var ac=$("<input />").attr("id",Y).attr("name",Y).val(ad);var ae=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var aa=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(ae);var af=$("<div/>").appendTo(aa).farbtastic({width:100,height:100,callback:ac,color:ad});$("<div />").append(ac).append(ae).appendTo(ag).bind("click",function(ah){ae.css({left:$(this).position().left+($(ac).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){ae.hide();$(document).unbind("click.color-picker")});ah.stopPropagation()})}else{ag.append($("<input />").attr("id",Y).attr("name",Y).val(X.values[Z.key]))}}}});return W},update_from_form:function(W){var Y=this;var X=false;$.each(this.params,function(Z,ab){if(!ab.hidden){var ac="param_"+Z;var aa=W.find("#"+ac).val();if(ab.type==="float"){aa=parseFloat(aa)}else{if(ab.type==="int"){aa=parseInt(aa)}else{if(ab.type==="bool"){aa=W.find("#"+ac).is(":checked")}}}if(aa!==Y.values[ab.key]){Y.values[ab.key]=aa;X=true}}});if(X){this.onchange()}}});var b=function(W,X){this.track=W;this.canvas=X};var k=function(X,W,aa,Y,Z){this.name=X;this.view=W;this.parent_element=aa;this.data_url=(Y?Y:default_data_url);this.data_url_extra_params={};this.data_query_wait=(Z?Z:F);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};extend(k.prototype,{init:function(){var W=this;W.enabled=false;W.tile_cache.clear();W.data_cache.clear();W.initial_canvas=undefined;W.content_div.css("height","auto");W.container_div.removeClass("nodata error pending");if(!W.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:W.hda_ldda,dataset_id:W.dataset_id,chrom:W.view.chrom},function(X){if(!X||X==="error"||X.kind==="error"){W.container_div.addClass("error");W.content_div.text(m);if(X.message){var Z=W.view.tracks.indexOf(W);var Y=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+X.message+"</pre>",{Close:hide_modal})});W.content_div.append(Y)}}else{if(X==="no converter"){W.container_div.addClass("error");W.content_div.text(E)}else{if(X==="no data"||(X.data!==undefined&&(X.data===null||X.data.length===0))){W.container_div.addClass("nodata");W.content_div.text(A)}else{if(X==="pending"){W.container_div.addClass("pending");W.content_div.text(p);setTimeout(function(){W.init()},W.data_query_wait)}else{if(X.status==="data"){if(X.valid_chroms){W.valid_chroms=X.valid_chroms;W.make_name_popup_menu()}W.content_div.text(R);if(W.view.chrom){W.content_div.text("");W.content_div.css("height",W.height_px+"px");W.enabled=true;$.when(W.predraw_init()).done(function(){W.container_div.removeClass("nodata error pending");W.draw()})}}}}}}})},predraw_init:function(){},update_name:function(W){this.old_name=this.name;this.name=W;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var H=function(X,ad,ag){var Y=this,ah=Y.view;this.filters=(X!==undefined?v(X):[]);this.filters_available=false;this.filters_visible=false;this.tool=(ad!==undefined&&obj_length(ad)>0?new n(this,ad):undefined);this.parent_track=ag;this.child_tracks=[];if(Y.hidden){return}var af=function(ai,aj,ak){ai.click(function(){var al=aj.text();max=parseFloat(ak.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(ak.slider("option","values")){input_size=2*input_size+1;multi_value=true}aj.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",al).appendTo(aj).focus().select().click(function(am){am.stopPropagation()}).blur(function(){$(this).remove();aj.text(al)}).keyup(function(aq){if(aq.keyCode===27){$(this).trigger("blur")}else{if(aq.keyCode===13){var ao=ak.slider("option","min"),am=ak.slider("option","max"),ap=function(ar){return(isNaN(ar)||ar>am||ar<ao)},an=$(this).val();if(!multi_value){an=parseFloat(an);if(ap(an)){alert("Parameter value must be in the range ["+ao+"-"+am+"]");return $(this)}}else{an=an.split("-");an=[parseFloat(an[0]),parseFloat(an[1])];if(ap(an[0])||ap(an[1])){alert("Parameter value must be in the range ["+ao+"-"+am+"]");return $(this)}}ak.slider((multi_value?"values":"value"),an)}}})})};if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filters_div=$("<div/>").addClass("filters").hide();this.header_div.after(this.filters_div);this.filters_div.bind("drag",function(ai){ai.stopPropagation()}).bind("click",function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()});$.each(this.filters,function(ao,aj){var al=$("<div/>").addClass("slider-row").appendTo(Y.filters_div);var ai=$("<div/>").addClass("slider-label").appendTo(al);var aq=$("<span/>").addClass("slider-name").text(aj.name+" ").appendTo(ai);var ak=$("<span/>");var am=$("<span/>").addClass("slider-value").appendTo(ai).append("[").append(ak).append("]");var ap=$("<div/>").addClass("slider").appendTo(al);aj.control_element=$("<div/>").attr("id",aj.name+"-filter-control").appendTo(ap);var an=[0,0];aj.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(ar,at){an=at.values;ak.text(at.values[0]+"-"+at.values[1]);setTimeout(function(){if(at.values[0]==an[0]&&at.values[1]==an[1]){var au=at.values;ak.text(au[0]+"-"+au[1]);aj.low=au[0];aj.high=au[1];Y.draw(true,true)}},50)},change:function(ar,at){aj.control_element.slider("option","slide").call(aj.control_element,ar,at)}});aj.slider=aj.control_element;aj.slider_label=ak;af(am,ak,aj.control_element);$("<div style='clear: both;'/>").appendTo(al)});if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}Y.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();Y.container_div.append(Y.child_tracks_container);if(Y.display_modes!==undefined){if(Y.mode_div===undefined){Y.mode_div=$("<div class='right-float menubutton popup' />").appendTo(Y.header_div);var aa=(Y.track_config&&Y.track_config.values.mode?Y.track_config.values.mode:Y.display_modes[0]);Y.mode=aa;Y.mode_div.text(aa);var Z=function(ai){Y.mode_div.text(ai);Y.mode=ai;Y.track_config.values.mode=ai;Y.tile_cache.clear();Y.draw()};var W={};for(var ab=0,ae=Y.display_modes.length;ab<ae;ab++){var ac=Y.display_modes[ab];W[ac]=function(ai){return function(){Z(ai)}}(ac)}make_popupmenu(Y.mode_div,W)}else{Y.mode_div.hide()}}this.make_name_popup_menu()};extend(H.prototype,k.prototype,{make_name_popup_menu:function(){var X=this;var W={};W["Edit configuration"]=function(){var ad=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ab=function(){X.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ac=function(ae){if((ae.keyCode||ae.which)===27){ad()}else{if((ae.keyCode||ae.which)===13){ab()}}};$(window).bind("keypress.check_enter_esc",ac);show_modal("Configure Track",X.track_config.build_form(),{Cancel:ad,OK:ab})};if(X.filters_available>0){var aa=(X.filters_div.is(":visible")?"Hide filters":"Show filters");W[aa]=function(){X.filters_visible=(X.filters_div.is(":visible"));X.filters_div.toggle();X.make_name_popup_menu()}}if(X.tool){var aa=(X.dynamic_tool_div.is(":visible")?"Hide tool":"Show tool");W[aa]=function(){if(!X.dynamic_tool_div.is(":visible")){X.update_name(X.name+X.tool_region_and_parameters_str())}else{menu_option_text="Show dynamic tool";X.revert_name()}X.dynamic_tool_div.toggle();X.make_name_popup_menu()}}if(X.valid_chroms){W["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+X.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}var Y=view;var Z=function(){$("#no-tracks").show()};if(this.parent_track){Y=this.parent_track;Z=function(){}}W.Remove=function(){Y.remove_track(X);if(Y.num_tracks===0){Z()}};make_popupmenu(X.name_div,W)},draw:function(W,Z){var an=this.view.low,ac=this.view.high,ae=ac-an,ag=this.view.container.width(),ab=ag/ae,ah=this.view.resolution,aa=$("<div style='position: relative;'></div>");if(!Z){this.content_div.children().remove()}this.content_div.append(aa);this.max_height=0;var aj=Math.floor(an/ah/J);var Y={};while((aj*J*ah)<ac){var am=ag+"_"+ab+"_"+aj;var ad=this.tile_cache.get(am);var ak=aj*J*this.view.resolution;var X=ak+J*this.view.resolution;if(!W&&ad){this.show_tile(ad,aa,ak,ab)}else{this.delayed_draw(W,am,ak,X,aj,ah,aa,ab,Y)}aj+=1}var af=this;var al=setInterval(function(){if(obj_length(Y)===0){clearInterval(al);if(Z){var aq=af.content_div.children();var ap=false;for(var ar=aq.length-1,ao=0;ar>=ao;ar--){var av=$(aq[ar]);if(ap){av.remove()}else{if(av.children().length!==0){ap=true}}}}for(var au=0;au<af.filters.length;au++){af.filters[au].update_ui_elt()}var at=false;if(af.example_feature){for(var au=0;au<af.filters.length;au++){if(af.filters[au].applies_to(af.example_feature)){at=true;break}}}if(af.filters_available!==at){af.filters_available=at;if(!af.filters_available){af.filters_div.hide()}af.make_name_popup_menu()}}},50);for(var ai=0;ai<this.child_tracks.length;ai++){this.child_tracks[ai].draw(W,Z)}},delayed_draw:function(X,ae,ac,ag,Y,aa,af,ah,ab){var Z=this;var ad=function(ap,ai,ak,aj,an,ao,al){returned_tile=Z.draw_tile(ai,ak,aj,an,ao,al);var am=$("<div class='track-tile'>").prepend(returned_tile);tile_element=am;Z.tile_cache.set(ae,tile_element);Z.show_tile(tile_element,an,ac,ao);delete ab[ap]};var W=setTimeout(function(){if(ac<=Z.view.high&&ag>=Z.view.low){var ai=(X?undefined:Z.tile_cache.get(ae));if(ai){Z.show_tile(ai,af,ac,ah);delete ab[W]}else{$.when(Z.data_cache.get_data(view.chrom,ac,ag,Z.mode,aa,Z.data_url_extra_params)).then(function(aj){if(view.reference_track&&ah>view.canvas_manager.char_width_px){$.when(view.reference_track.data_cache.get_data(view.chrom,ac,ag,Z.mode,aa,view.reference_track.data_url_extra_params)).then(function(ak){ad(W,aj,aa,Y,af,ah,ak)})}else{ad(W,aj,aa,Y,af,ah)}})}}},50);ab[W]=true},show_tile:function(W,ab,Z,ac){var X=this;var Y=this.view.high-this.view.low,aa=(Z-this.view.low)*ac;if(this.left_offset){aa-=this.left_offset}W.css({position:"absolute",top:0,left:aa,height:""});ab.append(W);X.max_height=Math.max(X.max_height,W.height());X.content_div.css("height",X.max_height+"px");ab.children().css("height",X.max_height+"px")},set_overview:function(){var W=this.view;if(this.initial_canvas&&this.is_overview){W.overview_close.show();W.overview_viewport.append(this.initial_canvas);W.overview_highlight.show().height(this.initial_canvas.height());W.overview_viewport.height(this.initial_canvas.height()+W.overview_box.height())}$(window).trigger("resize")},tool_region_and_parameters_str:function(Y,W,Z){var X=this,aa=(Y!==undefined&&W!==undefined&&Z!==undefined?Y+":"+W+"-"+Z:"all");return" - region=["+aa+"], parameters=["+X.tool.get_param_values().join(", ")+"]"},add_track:function(W){W.track_id=this.track_id+"_"+this.child_tracks.length;W.container_div.attr("id","track_"+W.track_id);this.child_tracks_container.append(W.container_div);B(W.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(W);this.view.has_changes=true},remove_track:function(W){W.container_div.fadeOut("slow",function(){$(this).remove()})}});var T=function(W,X){this.track_type="LabelTrack";this.hidden=true;k.call(this,null,W,X);this.container_div.addClass("label-track")};extend(T.prototype,k.prototype,{draw:function(){var Y=this.view,Z=Y.high-Y.low,ac=Math.floor(Math.pow(10,Math.floor(Math.log(Z)/Math.log(10)))),W=Math.floor(Y.low/ac)*ac,aa=this.view.container.width(),X=$("<div style='position: relative; height: 1.3em;'></div>");while(W<Y.high){var ab=(W-Y.low)/Z*aa;X.append($("<div class='label'>"+commatize(W)+"</div>").css({position:"absolute",left:ab-1}));W+=ac}this.content_div.children(":first").remove();this.content_div.append(X)}});var x=function(W){this.track_type="ReferenceTrack";this.hidden=true;k.call(this,null,W,W.top_labeltrack);H.call(this);W.reference_track=this;this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:W.dbkey};this.data_cache=new K(y,this,false);this.tile_cache=new c(q)};extend(x.prototype,H.prototype,{draw_tile:function(ag,ab,X,ad,ah){var aa=this,Y=J*ab;if(ah>this.view.canvas_manager.char_width_px){if(ag===null){aa.content_div.css("height","0px");return}var Z=this.view.canvas_manager.new_canvas();var af=Z.getContext("2d");Z.width=Math.ceil(Y*ah+aa.left_offset);Z.height=aa.height_px;af.font=af.canvas.manager.default_font;af.textAlign="center";for(var ac=0,ae=ag.length;ac<ae;ac++){var W=Math.round(ac*ah);af.fillText(ag[ac],W+aa.left_offset,10)}return Z}this.content_div.css("height","0px")}});var l=function(aa,Y,ab,W,Z){var X=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";k.call(this,aa,Y,Y.viewport_container);H.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=ab;this.dataset_id=W;this.original_dataset_id=W;this.data_cache=new K(y,this);this.tile_cache=new c(q);this.track_config=new S({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:Z,onchange:function(){X.vertical_range=X.prefs.max_value-X.prefs.min_value;$("#linetrack_"+X.track_id+"_minval").text(X.prefs.min_value);$("#linetrack_"+X.track_id+"_maxval").text(X.prefs.max_value);X.tile_cache.clear();X.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;this.add_resize_handle()};extend(l.prototype,H.prototype,{add_resize_handle:function(){var W=this;var Z=false;var Y=false;var X=$("<div class='track-resize'>");$(W.container_div).hover(function(){Z=true;X.show()},function(){Z=false;if(!Y){X.hide()}});X.hide().bind("dragstart",function(aa,ab){Y=true;ab.original_height=$(W.content_div).height()}).bind("drag",function(ab,ac){var aa=Math.min(Math.max(ac.original_height+ac.deltaY,W.min_height_px),W.max_height_px);$(W.content_div).css("height",aa);W.height_px=aa;W.draw(true)}).bind("dragend",function(aa,ab){W.tile_cache.clear();Y=false;if(!Z){X.hide()}W.track_config.values.height=W.height_px}).appendTo(W.container_div)},predraw_init:function(){var W=this,X=W.view.tracks.indexOf(W);W.vertical_range=undefined;return $.getJSON(W.data_url,{stats:true,chrom:W.view.chrom,low:null,high:null,hda_ldda:W.hda_ldda,dataset_id:W.dataset_id},function(Y){W.container_div.addClass("line-track");var aa=Y.data;if(isNaN(parseFloat(W.prefs.min_value))||isNaN(parseFloat(W.prefs.max_value))){W.prefs.min_value=aa.min;W.prefs.max_value=aa.max;$("#track_"+X+"_minval").val(W.prefs.min_value);$("#track_"+X+"_maxval").val(W.prefs.max_value)}W.vertical_range=W.prefs.max_value-W.prefs.min_value;W.total_frequency=aa.total_frequency;W.container_div.find(".yaxislabel").remove();var ab=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+X+"_minval").text(t(W.prefs.min_value));var Z=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+X+"_maxval").text(t(W.prefs.max_value));Z.css({position:"absolute",top:"24px",left:"10px"});Z.prependTo(W.container_div);ab.css({position:"absolute",bottom:"2px",left:"10px"});ab.prependTo(W.container_div)})},draw_tile:function(ah,aa,X,ae,ag){if(this.vertical_range===undefined){return}var ab=X*J*aa,Z=J*aa,W=Math.ceil(Z*ag),ad=this.height_px;var Y=this.view.canvas_manager.new_canvas();Y.width=W,Y.height=ad;var af=Y.getContext("2d");var ac=new G.LinePainter(ah.data,ab,ab+Z,this.prefs,this.mode);ac.draw(af,W,ad);return Y}});var e=function(W,ab,aa,ae,ad,Y,Z,ac){var X=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];this.track_config=new S({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ad,onchange:function(){X.tile_cache.clear();X.draw()}});this.prefs=this.track_config.values;k.call(this,W,ab,ab.viewport_container);H.call(this,Y,Z,ac);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=aa;this.dataset_id=ae;this.original_dataset_id=ae;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_cache=new K(20,this);this.left_offset=200;this.painter=G.LinkedFeaturePainter};extend(e.prototype,H.prototype,{update_auto_mode:function(W){if(this.mode=="Auto"){if(W=="no_detail"){W="feature spans"}else{if(W=="summary_tree"){W="coverage histogram"}}this.mode_div.text("Auto ("+W+")")}},incremental_slots:function(aa,X,Z){var Y=this.view.canvas_manager.dummy_context,W=this.inc_slots[aa];if(!W||(W.mode!==Z)){W=new (o.FeatureSlotter)(aa,Z==="Pack",w,function(ab){return Y.measureText(ab)});W.mode=Z;this.inc_slots[aa]=W}return W.slot_features(X)},draw_tile:function(ai,aq,av,ae,ag,Z){var an=this,ax=av*J*aq,X=(av+1)*J*aq,ak=X-ax,ao=Math.ceil(ak*ag),am=this.mode,aB=25,aa=this.left_offset,aj,ab;if(am==="Auto"){if(ai.dataset_type==="summary_tree"){am=ai.dataset_type}else{if(ai.extra_info==="no_detail"){am="no_detail"}else{var aA=ai.data;if(this.view.high-this.view.low>D){am="Squish"}else{am="Pack"}}}this.update_auto_mode(am)}if(am==="summary_tree"){ab=this.summary_draw_height;ae.parent().css("height",Math.max(this.height_px,ab)+"px");this.container_div.find(".yaxislabel").remove();var W=$("<div />").addClass("yaxislabel");W.text(ai.max);W.css({position:"absolute",top:"22px",left:"10px"});W.prependTo(this.container_div);var Y=this.view.canvas_manager.new_canvas();Y.width=ao+aa;Y.height=ab+L;var ay=new G.SummaryTreePainter(ai,ax,X,this.prefs);var ap=Y.getContext("2d");ap.translate(aa,L);ay.draw(ap,ao,ab);return Y}var aj,ad=1;if(am==="no_detail"||am==="Squish"||am==="Pack"){ad=this.incremental_slots(ag,ai.data,am);aj=this.inc_slots[ag].slots}var af=[];if(ai.data){for(var ar=0,au=ai.data.length;ar<au;ar++){var ac=ai.data[ar];var at=false;var ah;for(var aw=0,az=this.filters.length;aw<az;aw++){ah=this.filters[aw];ah.update_attrs(ac);if(!ah.keep(ac)){at=true;break}}if(!at){af.push(ac)}}}var ay=new (this.painter)(af,ax,X,this.prefs,am,Z);var ab=ay.get_required_height(ad)+z;var Y=this.view.canvas_manager.new_canvas();Y.width=ao+aa;Y.height=ab;ae.parent().css("height",Math.max(this.height_px,ab)+"px");var ap=Y.getContext("2d");ap.fillStyle=this.prefs.block_color;ap.font=ap.canvas.manager.default_font;ap.textAlign="right";this.container_div.find(".yaxislabel").remove();if(ai.message){$(Y).css({"border-top":"1px solid red"});ap.fillStyle="red";ap.textAlign="left";var al=ap.textBaseline;ap.textBaseline="top";ap.fillText(ai.message,aa,0);ap.textBaseline=al;if(!ai.data){return Y}}this.example_feature=(ai.data.length?ai.data[0]:undefined);ap.translate(aa,z);ay.draw(ap,ao,ab,aj);return Y}});var M=function(Z,X,ab,W,Y,aa){e.call(this,Z,X,ab,W,Y,aa);this.track_type="VcfTrack";this.painter=G.VariantPainter};extend(M.prototype,H.prototype,e.prototype);var P=function(Z,X,ab,W,Y,aa){e.call(this,Z,X,ab,W,Y,aa);this.track_config=new S({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:Y,onchange:function(){this.track.tile_cache.clear();this.track.draw()}});this.prefs=this.track_config.values;this.track_type="ReadTrack";this.painter=G.ReadPainter;this.make_name_popup_menu()};extend(P.prototype,H.prototype,e.prototype);var N=function(aa,Y,ac,W,Z,ab,X){e.call(this,aa,Y,ac,W,Z,ab,{},X);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};extend(N.prototype,H.prototype,e.prototype,{predraw_init:function(){var X=this;var W=function(){if(X.data_cache.size()===0){setTimeout(W,300)}else{X.data_url=default_data_url;X.data_query_wait=F;X.dataset_state_url=converted_datasets_state_url;$.getJSON(X.dataset_state_url,{dataset_id:X.dataset_id,hda_ldda:X.hda_ldda},function(Y){})}};W()}});Q.View=U;Q.LineTrack=l;Q.FeatureTrack=e;Q.ReadTrack=P};var slotting_module=function(c,b){var d=2,a=5;b.FeatureSlotter=function(h,g,e,f){this.slots={};this.start_end_dct={};this.w_scale=h;this.include_label=g;this.max_rows=e;this.measureText=f};extend(b.FeatureSlotter.prototype,{slot_features:function(l){var o=this.w_scale,r=this.slots,g=this.start_end_dct,x=[],z=[],m=0,y=this.max_rows;for(var v=0,w=l.length;v<w;v++){var k=l[v],n=k[0];if(r[n]!==undefined){m=Math.max(m,r[n]);z.push(r[n])}else{x.push(v)}}var p=function(F,G){for(var E=0;E<=y;E++){var C=false,H=g[E];if(H!==undefined){for(var B=0,D=H.length;B<D;B++){var A=H[B];if(G>A[0]&&F<A[1]){C=true;break}}}if(!C){return E}}return -1};for(var v=0,w=x.length;v<w;v++){var k=l[x[v]],n=k[0],t=k[1],e=k[2],q=k[3],f=Math.floor(t*o),j=Math.ceil(e*o),u=this.measureText(q).width,h;if(q!==undefined&&this.include_label){u+=(d+a);if(f-u>=0){f-=u;h="left"}else{j+=u;h="right"}}var s=p(f,j);if(s>=0){if(g[s]===undefined){g[s]=[]}g[s].push([f,j]);r[n]=s;m=Math.max(m,s)}else{}}return m+1}})};var painters_module=function(k,B){var r=function(M,E,K,D,J,H){if(H===undefined){H=4}var G=D-E;var F=J-K;var I=Math.floor(Math.sqrt(G*G+F*F)/H);var N=G/I;var L=F/I;var C;for(C=0;C<I;C++,E+=N,K+=L){if(C%2!==0){continue}M.fillRect(E,K,H,1)}};var s=function(E,D,C,H){var G=D-H/2,F=D+H/2,I=C-Math.sqrt(H*3/2);E.beginPath();E.moveTo(G,I);E.lineTo(F,I);E.lineTo(D,C);E.lineTo(G,I);E.strokeStyle=this.fillStyle;E.fill();E.stroke();E.closePath()};var o=function(E,G,C,D,F){this.data=E;this.view_start=G;this.view_end=C;this.prefs=extend({},this.default_prefs,D);this.mode=F};o.prototype.default_prefs={};var w=function(E,G,C,D,F){o.call(this,E,G,C,D,F)};w.prototype.default_prefis={show_counts:false};w.prototype.draw=function(P,C,O){var H=this.view_start,R=this.view_end-this.view_start,Q=C/R;var M=this.data.data,L=this.data.delta,J=this.data.max,E=O;delta_x_px=Math.ceil(L*Q);P.save();for(var F=0,G=M.length;F<G;F++){var K=Math.floor((M[F][0]-H)*Q);var I=M[F][1];if(!I){continue}var N=I/J*O;P.fillStyle="black";P.fillRect(K,E-N,delta_x_px,N);var D=4;if(this.prefs.show_counts&&(P.measureText(I).width+D)<delta_x_px){P.fillStyle="#666";P.textAlign="center";P.fillText(I,K+(delta_x_px/2),10)}}P.restore()};var c=function(E,G,C,D,F){o.call(this,E,G,C,D,F)};c.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};c.prototype.draw=function(R,Q,O){var J=false,K=this.prefs.min_value,H=this.prefs.max_value,N=H-K,D=O,E=this.view_start,P=this.view_end-this.view_start,F=Q/P,L=this.mode,V=this.data;R.save();var W=Math.round(O+K/N*O);if(L!=="Intensity"){R.fillStyle="#aaa";R.fillRect(0,W,Q,1)}R.beginPath();R.fillStyle=this.prefs.color;var U,I,G;if(V.length>1){G=Math.ceil((V[1][0]-V[0][0])*F)}else{G=10}for(var S=0,T=V.length;S<T;S++){U=Math.round((V[S][0]-E)*F);I=V[S][1];if(I===null){if(J&&L==="Filled"){R.lineTo(U,D)}J=false;continue}if(I<K){I=K}else{if(I>H){I=H}}if(L==="Histogram"){I=Math.round(I/N*D);R.fillRect(U,W,G,-I)}else{if(L==="Intensity"){I=255-Math.floor((I-K)/N*255);R.fillStyle="rgb("+I+","+I+","+I+")";R.fillRect(U,0,G,D)}else{I=Math.round(D-(I-K)/N*D);if(J){R.lineTo(U,I)}else{J=true;if(L==="Filled"){R.moveTo(U,D);R.lineTo(U,I)}else{R.moveTo(U,I)}}}}}if(L==="Filled"){if(J){R.lineTo(U,W);R.lineTo(0,W)}R.fill()}else{R.stroke()}var C=-1,M=-1;R.fillStyle=this.prefs.overflow_color;for(var S=0,T=V.length;S<T;S++){I=V[S][1];U=Math.round((V[S][0]-E)*F);x_minus_scaled=Math.round((V[S][0]-1-E)*F);if(M>=0&&(I===null||I<H)){R.fillRect(M,0,x_minus_scaled-M+1,2);M=-1}else{if(C>=0&&(I===null||I>K)){R.fillRect(C,O-2,x_minus_scaled-C+1,2);C=-1}}if(I!==null&&I>H&&M<0){M=U}else{if(I!==null&&I<K&&C<0){C=U}}}R.restore()};var q=function(E,G,C,D,F){o.call(this,E,G,C,D,F)};q.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};extend(q.prototype,{get_required_height:function(D){var C=y_scale=this.get_row_height(),E=this.mode;if(E==="no_detail"||E==="Squish"||E==="Pack"){C=D*y_scale}return C+Math.max(Math.round(y_scale/2),5)},draw:function(O,F,N,K){var I=this.data,L=this.view_start,P=this.view_end;O.save();O.fillStyle=this.prefs.block_color;O.textAlign="right";var S=this.view_end-this.view_start,R=F/S,E=this.get_row_height();for(var H=0,J=I.length;H<J;H++){var Q=I[H],G=Q[0],C=Q[1],D=Q[2],M=(K&&K[G]!==undefined?K[G]:null);if((C<P&&D>L)&&(this.mode=="Dense"||M!==null)){this.draw_element(O,this.mode,Q,M,L,P,R,E,F)}}O.restore()}});var d=10,j=3,n=5,A=10,g=1,u=3,f=3,a=9,p=2,h="#ccc";var t=function(E,G,C,D,F){q.call(this,E,G,C,D,F)};extend(t.prototype,q.prototype,{get_row_height:function(){var D=this.mode,C;if(D==="Dense"){C=d}else{if(D==="no_detail"){C=j}else{if(D==="Squish"){C=n}else{C=A}}}return C},draw_element:function(O,H,W,J,Q,ag,ak,al,C){var T=W[0],ai=W[1],aa=W[2]-1,R=W[3],ab=Math.floor(Math.max(0,(ai-Q)*ak)),P=Math.ceil(Math.min(C,Math.max(0,(aa-Q)*ak))),Z=(H==="Dense"?0:(0+J))*al,N,ae,S=null,am=null,F=this.prefs.block_color,ad=this.prefs.label_color;if(H=="Dense"){J=1}if(H==="no_detail"){O.fillStyle=F;O.fillRect(ab,Z+5,P-ab,g)}else{var M=W[4],Y=W[5],ac=W[6],G=W[7];if(Y&&ac){S=Math.floor(Math.max(0,(Y-Q)*ak));am=Math.ceil(Math.min(C,Math.max(0,(ac-Q)*ak)))}var aj,U;if(H==="Squish"||H==="Dense"){aj=1;U=f}else{aj=5;U=a}if(!G){if(W.strand){if(W.strand==="+"){O.fillStyle=O.canvas.manager.get_pattern("right_strand_inv")}else{if(W.strand==="-"){O.fillStyle=O.canvas.manager.get_pattern("left_strand_inv")}}}else{O.fillStyle=F}O.fillRect(ab,Z,P-ab,U)}else{var L,V;if(H==="Squish"||H==="Dense"){O.fillStyle=h;L=Z+Math.floor(f/2)+1;V=1}else{if(M){var L=Z;var V=U;if(M==="+"){O.fillStyle=O.canvas.manager.get_pattern("right_strand")}else{if(M==="-"){O.fillStyle=O.canvas.manager.get_pattern("left_strand")}}}else{O.fillStyle=h;L+=(f/2)+1;V=1}}O.fillRect(ab,L,P-ab,V);for(var ah=0,E=G.length;ah<E;ah++){var I=G[ah],D=Math.floor(Math.max(0,(I[0]-Q)*ak)),X=Math.ceil(Math.min(C,Math.max((I[1]-1-Q)*ak)));if(D>X){continue}O.fillStyle=F;O.fillRect(D,Z+(U-aj)/2+1,X-D,aj);if(S!==undefined&&ac>Y&&!(D>am||X<S)){var af=Math.max(D,S),K=Math.min(X,am);O.fillRect(af,Z+1,K-af,U);if(G.length==1&&H=="Pack"){if(M==="+"){O.fillStyle=O.canvas.manager.get_pattern("right_strand_inv")}else{if(M==="-"){O.fillStyle=O.canvas.manager.get_pattern("left_strand_inv")}}if(af+14<K){af+=2;K-=2}O.fillRect(af,Z+1,K-af,U)}}}}if(H==="Pack"&&ai>Q){O.fillStyle=ad;if(Q===0&&ab-O.measureText(R).width<0){O.textAlign="left";O.fillText(R,P+p,Z+8)}else{O.textAlign="right";O.fillText(R,ab-p,Z+8)}O.fillStyle=F}}}});var b=function(E,G,C,D,F){q.call(this,E,G,C,D,F)};extend(b.prototype,q.prototype,{draw_element:function(V,Q,K,G,Y,E,N,W,T){var K=data[i],M=K[0],U=K[1],F=K[2]-1,P=K[3],I=Math.floor(Math.max(0,(U-Y)*N)),L=Math.ceil(Math.min(T,Math.max(0,(F-Y)*N))),H=(Q==="Dense"?0:(0+G))*W,C,Z,D=null,O=null;if(no_label){V.fillStyle=block_color;V.fillRect(I+left_offset,H+5,L-I,1)}else{var X=K[4],S=K[5],J=K[6];C=9;Z=1;V.fillRect(I+left_offset,H,L-I,C);if(Q!=="Dense"&&P!==undefined&&U>Y){V.fillStyle=label_color;if(Y===0&&I-V.measureText(P).width<0){V.textAlign="left";V.fillText(P,L+2+left_offset,H+8)}else{V.textAlign="right";V.fillText(P,I-2+left_offset,H+8)}V.fillStyle=block_color}var R=X+" / "+S;if(U>Y&&V.measureText(R).width<(L-I)){V.fillStyle="white";V.textAlign="center";V.fillText(R,left_offset+I+(L-I)/2,H+8);V.fillStyle=block_color}}}});var z=1001,m=1002,e=1003,y=1004,l=1005;var x=function(G,D){var I=G[0],H=G[1],F=D[0],E=D[1],C;if(I<F){if(H<F){C=z}else{if(H<=E){C=e}else{C=m}}}else{if(I>E){C=z}else{if(H<=E){C=l}else{C=y}}}return C};var v=function(F,H,C,E,G,D){q.call(this,F,H,C,E,G);this.ref_seq=D};v.prototype.default_prefs=extend({},q.prototype.default_prefs,{show_insertions:false});extend(v.prototype,q.prototype,{get_row_height:function(){var C,D=this.mode;if(D==="Dense"){C=d}else{if(D==="Squish"){C=n}else{C=A;if(this.prefs.show_insertions){C*=2}}}return C},draw_read:function(Z,U,P,ae,E,Y,M,J,I){Z.textAlign="center";var X=this,D=[ae,E],S=0,aa=0,W=0;ref_seq=this.ref_seq,char_width_px=Z.canvas.manager.char_width_px;var aj=[];if((U==="Pack"||this.mode==="Auto")&&J!==undefined&&P>char_width_px){W=Math.round(P/2)}if(!M){M=[[0,J.length]]}for(var Q=0,ac=M.length;Q<ac;Q++){var N=M[Q],F="MIDNSHP=X"[N[0]],R=N[1];if(F==="H"||F==="S"){S-=R}var K=Y+S,ai=Math.floor(Math.max(0,(K-ae)*P)),L=Math.floor(Math.max(0,(K+R-ae)*P));if(ai===L){L+=1}switch(F){case"H":break;case"S":case"M":case"=":var T=x([K,K+R],D);if(T!==z){var V=J.slice(aa,aa+R);if(W>0){Z.fillStyle=this.prefs.block_color;Z.fillRect(ai-W,I+1,L-ai,9);Z.fillStyle=h;for(var ag=0,C=V.length;ag<C;ag++){if(this.prefs.show_differences&&ref_seq){var O=ref_seq[K-ae+ag];if(!O||O.toLowerCase()===V[ag].toLowerCase()){continue}}if(K+ag>=ae&&K+ag<=E){var ah=Math.floor(Math.max(0,(K+ag-ae)*P));Z.fillText(V[ag],ah,I+9)}}}else{Z.fillStyle=this.prefs.block_color;Z.fillRect(ai,I+4,L-ai,f)}}aa+=R;S+=R;break;case"N":Z.fillStyle=h;Z.fillRect(ai-W,I+5,L-ai,1);S+=R;break;case"D":Z.fillStyle="red";Z.fillRect(ai-W,I+4,L-ai,3);S+=R;break;case"P":break;case"I":var T=x([K,K+R],D),ad=ai-W;if(T!==z){var V=J.slice(aa,aa+R);if(this.prefs.show_insertions){var H=ai-(L-ai)/2;if((U==="Pack"||this.mode==="Auto")&&J!==undefined&&P>char_width_px){Z.fillStyle="yellow";Z.fillRect(H-W,I-9,L-ai,9);aj[aj.length]={type:"triangle",data:[ad,I+4,5]};Z.fillStyle=h;switch(T){case (e):V=V.slice(ae-K);break;case (y):V=V.slice(0,K-E);break;case (l):break;case (m):V=V.slice(ae-K,K-E);break}for(var ag=0,C=V.length;ag<C;ag++){var ah=Math.floor(Math.max(0,(K+ag-ae)*P));Z.fillText(V[ag],ah-(L-ai)/2,I)}}else{Z.fillStyle="yellow";Z.fillRect(H,I+(this.mode!=="Dense"?2:5),L-ai,(U!=="Dense"?f:u))}}else{if((U==="Pack"||this.mode==="Auto")&&J!==undefined&&P>char_width_px){aj[aj.length]={type:"text",data:[V.length,ad,I+9]}}else{}}}aa+=R;break;case"X":aa+=R;break}}Z.fillStyle="yellow";var af,G,ak;for(var ab=0;ab<aj.length;ab++){af=aj[ab];G=af.type;ak=af.data;if(G==="text"){Z.save();Z.font="bold "+Z.font;Z.fillText(ak[0],ak[1],ak[2]);Z.restore()}else{if(G=="triangle"){s(Z,ak[0],ak[1],ak[2])}}}},draw_element:function(V,Q,I,F,Y,D,M,W,T){var L=I[0],U=I[1],E=I[2],N=I[3],H=Math.floor(Math.max(0,(U-Y)*M)),J=Math.ceil(Math.min(T,Math.max(0,(E-Y)*M))),G=(Q==="Dense"?0:(0+F))*W,Z=this.prefs.block_color,K=this.prefs.label_color,S=0;if((Q==="Pack"||this.mode==="Auto")&&M>V.canvas.manager.char_width_px){var S=Math.round(M/2)}V.fillStyle=Z;if(I[5] instanceof Array){var R=Math.floor(Math.max(0,(I[4][0]-Y)*M)),P=Math.ceil(Math.min(T,Math.max(0,(I[4][1]-Y)*M))),O=Math.floor(Math.max(0,(I[5][0]-Y)*M)),C=Math.ceil(Math.min(T,Math.max(0,(I[5][1]-Y)*M)));if(I[4][1]>=Y&&I[4][0]<=D&&I[4][2]){this.draw_read(V,Q,M,Y,D,I[4][0],I[4][2],I[4][3],G)}if(I[5][1]>=Y&&I[5][0]<=D&&I[5][2]){this.draw_read(V,Q,M,Y,D,I[5][0],I[5][2],I[5][3],G)}if(O>P){V.fillStyle=h;r(V,P-S,G+5,O-S,G+5)}}else{V.fillStyle=Z;this.draw_read(V,Q,M,Y,D,U,I[4],I[5],G)}if(Q==="Pack"&&U>Y){V.fillStyle=this.prefs.label_color;var X=1;if(X===0&&H-V.measureText(N).width<0){V.textAlign="left";V.fillText(N,J+p-S,G+8)}else{V.textAlign="right";V.fillText(N,H-p-S,G+8)}V.fillStyle=Z}}});B.SummaryTreePainter=w;B.LinePainter=c;B.LinkedFeaturePainter=t;B.ReadPainter=v;B.VariantPainter=b};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window);
\ No newline at end of file
--- a/static/scripts/trackster.js Fri Apr 08 16:43:45 2011 -0400
+++ b/static/scripts/trackster.js Fri Apr 08 17:07:08 2011 -0400
@@ -1235,7 +1235,10 @@
track.content_div.css( "height", track.height_px + "px" );
track.enabled = true;
// predraw_init may be asynchronous, wait for it and then draw
- $.when( track.predraw_init() ).done( function() { track.draw() } );
+ $.when(track.predraw_init()).done(function() {
+ track.container_div.removeClass("nodata error pending");
+ track.draw()
+ });
}
}
});
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: james_taylor: trackster: remove condition that sets mode to squish when less than four features in tile. mode selection must not change across tiles at the same level.
by Bitbucket 08 Apr '11
by Bitbucket 08 Apr '11
08 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a77c1ea48451/
changeset: r5361:a77c1ea48451
user: james_taylor
date: 2011-04-08 22:43:45
summary: trackster: remove condition that sets mode to squish when less than four features in tile. mode selection must not change across tiles at the same level.
affected #: 1 file (72 bytes)
--- a/static/scripts/trackster.js Fri Apr 08 14:14:58 2011 -0400
+++ b/static/scripts/trackster.js Fri Apr 08 16:43:45 2011 -0400
@@ -2153,8 +2153,9 @@
//if ( (result.message && result.message.match(/^Only the first [\d]+/)) ||
// (result.data && result.data.length > 2000) ||
var data = result.data;
- if ( (data.length && data.length < 4) ||
- (this.view.high - this.view.low > MIN_SQUISH_VIEW_WIDTH) ) {
+ // if ( (data.length && data.length < 4) ||
+ // (this.view.high - this.view.low > MIN_SQUISH_VIEW_WIDTH) ) {
+ if ( this.view.high - this.view.low > MIN_SQUISH_VIEW_WIDTH ) {
mode = "Squish";
} else {
mode = "Pack";
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: james_taylor: trackster: Painter class defining common interface for all painters
by Bitbucket 08 Apr '11
by Bitbucket 08 Apr '11
08 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/6389fb7faf5b/
changeset: r5360:6389fb7faf5b
user: james_taylor
date: 2011-04-08 20:14:58
summary: trackster: Painter class defining common interface for all painters
affected #: 1 file (329 bytes)
--- a/static/scripts/trackster.js Fri Apr 08 12:06:28 2011 -0400
+++ b/static/scripts/trackster.js Fri Apr 08 14:14:58 2011 -0400
@@ -11,6 +11,7 @@
target[key] = other[key];
}
}
+ return target;
};
// Encapsulate -- anything to be availabe outside this block is added to exports
@@ -2032,7 +2033,7 @@
// Paint line onto full canvas
var ctx = canvas.getContext("2d");
var painter = new painters.LinePainter( result.data, tile_low, tile_low + tile_length,
- this.prefs.min_value, this.prefs.max_value, this.prefs.color, this.mode );
+ this.prefs, this.mode );
painter.draw( ctx, width, height );
return canvas;
@@ -2180,7 +2181,7 @@
// Extra padding at top of summary tree
canvas.height = required_height + SUMMARY_TREE_TOP_PADDING;
// Paint summary tree into canvas
- var painter = new painters.SummaryTreePainter( result.data, result.delta, result.max, tile_low, tile_high, this.prefs.show_counts );
+ var painter = new painters.SummaryTreePainter( result, tile_low, tile_high, this.prefs );
var ctx = canvas.getContext("2d");
// Deal with left_offset by translating
ctx.translate( left_offset, SUMMARY_TREE_TOP_PADDING );
@@ -2572,27 +2573,39 @@
};
/**
- * SummaryTreePainter, a histogram showing number of intervals in a region
+ * Base class for painters
+ *
+ * -- Mode and prefs are both optional
*/
-var SummaryTreePainter = function( data, delta, max, view_start, view_end, show_counts ) {
+var Painter = function( data, view_start, view_end, prefs, mode ) {
// Data and data properties
this.data = data;
- this.delta = delta;
- this.max = max;
// View
this.view_start = view_start;
this.view_end = view_end;
// Drawing prefs
- this.show_counts = show_counts;
+ this.prefs = extend( {}, this.default_prefs, prefs );
+ this.mode = mode;
}
+Painter.prototype.default_prefs = {};
+
+/**
+ * SummaryTreePainter, a histogram showing number of intervals in a region
+ */
+var SummaryTreePainter = function( data, view_start, view_end, prefs, mode ) {
+ Painter.call( this, data, view_start, view_end, prefs, mode );
+}
+
+SummaryTreePainter.prototype.default_prefis = { show_counts: false };
+
SummaryTreePainter.prototype.draw = function( ctx, width, height ) {
var view_start = this.view_start,
view_range = this.view_end - this.view_start,
w_scale = width / view_range;
- var points = this.data, delta = this.delta, max = this.max,
+ var points = this.data.data, delta = this.data.delta, max = this.data.max,
// Set base Y so that max label and data do not overlap. Base Y is where rectangle bases
// start. However, height of each rectangle is relative to required_height; hence, the
// max rectangle is required_height.
@@ -2614,7 +2627,7 @@
// Draw number count if it can fit the number with some padding, otherwise things clump up
var text_padding_req_x = 4;
- if (this.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
+ if (this.prefs.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
ctx.fillStyle = "#666";
ctx.textAlign = "center";
ctx.fillText(y, x + (delta_x_px/2), 10);
@@ -2624,25 +2637,17 @@
ctx.restore();
}
-var LinePainter = function( data, view_start, view_end, min_value, max_value, color, mode ) {
- // Data and data properties
- this.data = data;
- // View
- this.view_start = view_start;
- this.view_end = view_end;
- // Drawing prefs
- this.min_value = min_value;
- this.max_value = max_value;
- this.color = color;
- this.mode = mode;
- this.overflow_color = "#F66";
-}
+var LinePainter = function( data, view_start, view_end, prefs, mode ) {
+ Painter.call( this, data, view_start, view_end, prefs, mode );
+};
+
+LinePainter.prototype.default_prefs = { min_value: undefined, max_value: undefined, mode: "Histogram", color: "#000", overflow_color: "#F66" };
LinePainter.prototype.draw = function( ctx, width, height ) {
var
in_path = false,
- min_value = this.min_value,
- max_value = this.max_value,
+ min_value = this.prefs.min_value,
+ max_value = this.prefs.max_value,
vertical_range = max_value - min_value,
height_px = height,
view_start = this.view_start,
@@ -2663,7 +2668,7 @@
}
ctx.beginPath();
- ctx.fillStyle = this.color;
+ ctx.fillStyle = this.prefs.color;
var x_scaled, y, delta_x_px;
if (data.length > 1) {
delta_x_px = Math.ceil((data[1][0] - data[0][0]) * w_scale);
@@ -2724,7 +2729,7 @@
// Draw lines at bounderies if overflowing min or max
var overflow_min_start = -1,
overflow_max_start = -1;
- ctx.fillStyle = this.overflow_color;
+ ctx.fillStyle = this.prefs.overflow_color;
for (var i = 0, len = data.length; i < len; i++) {
y = data[i][1];
x_scaled = Math.round((data[i][0] - view_start) * w_scale);
@@ -2756,13 +2761,11 @@
}
var FeaturePainter = function( data, view_start, view_end, prefs, mode ) {
- this.data = data;
- this.view_start = view_start;
- this.view_end = view_end;
- this.prefs = prefs;
- this.mode = mode;
+ Painter.call( this, data, view_start, view_end, prefs, mode );
}
+FeaturePainter.prototype.default_prefs = { block_color: "#FFF", connector_color: "#FFF" };
+
extend( FeaturePainter.prototype, {
get_required_height: function( rows_required ) {
@@ -3104,7 +3107,9 @@
var ReadPainter = function( data, view_start, view_end, prefs, mode, ref_seq ) {
FeaturePainter.call( this, data, view_start, view_end, prefs, mode );
this.ref_seq = ref_seq;
-}
+};
+
+ReadPainter.prototype.default_prefs = extend( {}, FeaturePainter.prototype.default_prefs, { show_insertions: false } );
extend( ReadPainter.prototype, FeaturePainter.prototype, {
/**
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: kellyv: Removed unnecessary size check on BAM file produce in view step of sam-to-bam
by Bitbucket 08 Apr '11
by Bitbucket 08 Apr '11
08 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/61b493011087/
changeset: r5359:61b493011087
user: kellyv
date: 2011-04-08 18:06:28
summary: Removed unnecessary size check on BAM file produce in view step of sam-to-bam
affected #: 1 file (560 bytes)
--- a/tools/samtools/sam_to_bam.py Fri Apr 08 09:45:38 2011 -0400
+++ b/tools/samtools/sam_to_bam.py Fri Apr 08 12:06:28 2011 -0400
@@ -125,8 +125,6 @@
tmp_aligns_file = tempfile.NamedTemporaryFile( dir=tmp_dir )
tmp_aligns_file_name = tmp_aligns_file.name
tmp_aligns_file.close()
- # IMPORTANT NOTE: for some reason the samtools view command gzips the resulting bam file without warning,
- # and the docs do not currently state that this occurs ( very bad ).
command = 'samtools view -bt %s -o %s %s' % ( fai_index_file_path, tmp_aligns_file_name, options.input1 )
tmp = tempfile.NamedTemporaryFile( dir=tmp_dir ).name
tmp_stderr = open( tmp, 'wb' )
@@ -147,8 +145,6 @@
tmp_stderr.close()
if returncode != 0:
raise Exception, stderr
- if len( open( tmp_aligns_file_name ).read() ) == 0:
- raise Exception, 'Initial BAM file empty'
except Exception, e:
#clean up temp files
if os.path.exists( tmp_dir ):
@@ -188,11 +184,6 @@
stop_err( 'Error sorting alignments from (%s), %s' % ( tmp_aligns_file_name, str( e ) ) )
# Move tmp_aligns_file_name to our output dataset location
sorted_bam_file = '%s.bam' % tmp_sorted_aligns_file_name
- if os.path.getsize( sorted_bam_file ) == 0:
- #clean up temp files
- if os.path.exists( tmp_dir ):
- shutil.rmtree( tmp_dir )
- stop_err( 'Error creating sorted version of BAM file' )
shutil.move( sorted_bam_file, options.output1 )
#clean up temp files
if os.path.exists( tmp_dir ):
@@ -201,6 +192,6 @@
if os.path.getsize( options.output1 ) > 0:
sys.stdout.write( 'SAM file converted to BAM' )
else:
- stop_err( 'The output file is empty, there may be an error with your input file or settings.' )
+ stop_err( 'Error creating sorted version of BAM file.' )
if __name__=="__main__": __main__()
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new changesets in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/db23b5ef6969/
changeset: r5357:db23b5ef6969
user: natefoo
date: 2011-04-08 15:37:33
summary: Use JobWrapper.get_job() since it's there.
affected #: 1 file (429 bytes)
--- a/lib/galaxy/jobs/__init__.py Thu Apr 07 16:28:56 2011 -0400
+++ b/lib/galaxy/jobs/__init__.py Fri Apr 08 09:37:33 2011 -0400
@@ -306,7 +306,7 @@
"""
Restore the dictionary of parameters from the database.
"""
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
param_dict = dict( [ ( p.name, p.value ) for p in job.parameters ] )
param_dict = self.tool.params_from_strings( param_dict, self.app )
return param_dict
@@ -320,7 +320,7 @@
if not os.path.exists( self.working_directory ):
os.mkdir( self.working_directory )
# Restore parameters from the database
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
if job.user is None and job.galaxy_session is None:
raise Exception( 'Job %s has no user and no session.' % job.id )
incoming = dict( [ ( p.name, p.value ) for p in job.parameters ] )
@@ -395,7 +395,7 @@
Indicate job failure by setting state and message on all output
datasets.
"""
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
self.sa_session.refresh( job )
# if the job was deleted, don't fail it
if not job.state == model.Job.states.DELETED:
@@ -439,7 +439,7 @@
self.cleanup()
def change_state( self, state, info = False ):
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
self.sa_session.refresh( job )
for dataset_assoc in job.output_datasets + job.output_library_datasets:
dataset = dataset_assoc.dataset
@@ -456,12 +456,12 @@
self.sa_session.flush()
def get_state( self ):
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
self.sa_session.refresh( job )
return job.state
def set_runner( self, runner_url, external_id ):
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
self.sa_session.refresh( job )
job.job_runner_name = runner_url
job.job_runner_external_id = external_id
@@ -476,7 +476,7 @@
"""
# default post job setup
self.sa_session.expunge_all()
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
# if the job was deleted, don't finish it
if job.state == job.states.DELETED:
self.cleanup()
@@ -658,7 +658,7 @@
return self.session_id
def get_input_fnames( self ):
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
filenames = []
for da in job.input_datasets: #da is JobToInputDatasetAssociation object
if da.dataset:
@@ -685,7 +685,7 @@
else:
return self.false_path
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
# Job output datasets are combination of output datasets, library datasets, and jeha datasets.
jeha = self.sa_session.query( model.JobExportHistoryArchive ).filter_by( job=job ).first()
if self.app.config.outputs_to_working_directory:
@@ -757,7 +757,7 @@
def setup_external_metadata( self, exec_dir = None, tmp_dir = None, dataset_files_path = None, config_root = None, datatypes_config = None, set_extension = True, **kwds ):
# extension could still be 'auto' if this is the upload tool.
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
if set_extension:
for output_dataset_assoc in job.output_datasets:
if output_dataset_assoc.dataset.ext == 'auto':
@@ -785,7 +785,7 @@
@property
def user( self ):
- job = self.sa_session.query( model.Job ).get( self.job_id )
+ job = self.get_job()
if job.user is not None:
return job.user.email
elif job.galaxy_session is not None and job.galaxy_session.user is not None:
http://bitbucket.org/galaxy/galaxy-central/changeset/defd1d9ab96b/
changeset: r5358:defd1d9ab96b
user: natefoo
date: 2011-04-08 15:45:38
summary: Use cluster_files_directory for SGE/DRMAA instead of the hardcoded database/pbs/. Fixes issue #512 (thanks, Anonymous).
affected #: 2 files (48 bytes)
--- a/lib/galaxy/jobs/runners/drmaa.py Fri Apr 08 09:37:33 2011 -0400
+++ b/lib/galaxy/jobs/runners/drmaa.py Fri Apr 08 09:45:38 2011 -0400
@@ -145,8 +145,8 @@
job_wrapper.change_state( model.Job.states.QUEUED )
# define job attributes
- ofile = "%s/database/pbs/%s.o" % (os.getcwd(), job_wrapper.get_id_tag())
- efile = "%s/database/pbs/%s.e" % (os.getcwd(), job_wrapper.get_id_tag())
+ ofile = "%s/%s.o" % (self.app.config.cluster_files_directory, job_wrapper.job_id)
+ efile = "%s/%s.e" % (self.app.config.cluster_files_directory, job_wrapper.job_id)
jt = self.ds.createJobTemplate()
jt.remoteCommand = "%s/database/pbs/galaxy_%s.sh" % (os.getcwd(), job_wrapper.get_id_tag())
jt.outputPath = ":%s" % ofile
--- a/lib/galaxy/jobs/runners/sge.py Fri Apr 08 09:37:33 2011 -0400
+++ b/lib/galaxy/jobs/runners/sge.py Fri Apr 08 09:45:38 2011 -0400
@@ -188,8 +188,8 @@
sge_extra_params = self.determine_sge_tool_parameters ( runner_url )
# define job attributes
- ofile = "%s/database/pbs/%s.o" % (os.getcwd(), job_wrapper.job_id)
- efile = "%s/database/pbs/%s.e" % (os.getcwd(), job_wrapper.job_id)
+ ofile = "%s/%s.o" % (self.app.config.cluster_files_directory, job_wrapper.job_id)
+ efile = "%s/%s.e" % (self.app.config.cluster_files_directory, job_wrapper.job_id)
jt = self.ds.createJobTemplate()
jt.remoteCommand = "%s/database/pbs/galaxy_%s.sh" % (os.getcwd(), job_wrapper.job_id)
jt.outputPath = ":%s" % ofile
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Fix hyperlinks in Cuffcompare and Cuffdiff documentation.
by Bitbucket 07 Apr '11
by Bitbucket 07 Apr '11
07 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/8a43c7a39dd1/
changeset: r5356:8a43c7a39dd1
user: jgoecks
date: 2011-04-07 22:28:56
summary: Fix hyperlinks in Cuffcompare and Cuffdiff documentation.
affected #: 2 files (36 bytes)
--- a/tools/ngs_rna/cuffcompare_wrapper.xml Thu Apr 07 08:39:07 2011 -0400
+++ b/tools/ngs_rna/cuffcompare_wrapper.xml Thu Apr 07 16:28:56 2011 -0400
@@ -130,9 +130,9 @@
**Input format**
-Cuffcompare takes Cufflinks' GTF output as input, and optionally can take a "reference" annotation (such as from Ensembl___)
+Cuffcompare takes Cufflinks' GTF output as input, and optionally can take a "reference" annotation (such as from Ensembl_)
-.. ___: http://www.todo.org
+.. _Ensembl: http://www.ensembl.org
------
--- a/tools/ngs_rna/cuffdiff_wrapper.xml Thu Apr 07 08:39:07 2011 -0400
+++ b/tools/ngs_rna/cuffdiff_wrapper.xml Thu Apr 07 16:28:56 2011 -0400
@@ -198,8 +198,6 @@
Cuffdiff takes Cufflinks or Cuffcompare GTF files as input along with two SAM files containing the fragment alignments for two or more samples.
-.. ___: http://www.todo.org
-
------
**Outputs**
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dan: Additional fix for typo propagated from manual_builds, which was updated in 5350:cd2aff5b117c.
by Bitbucket 07 Apr '11
by Bitbucket 07 Apr '11
07 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/50e249442c5a/
changeset: r5355:50e249442c5a
user: dan
date: 2011-04-07 14:39:07
summary: Additional fix for typo propagated from manual_builds, which was updated in 5350:cd2aff5b117c.
affected #: 1 file (0 bytes)
--- a/tool-data/shared/gbrowse/gbrowse_build_sites.txt Wed Apr 06 16:28:33 2011 -0400
+++ b/tool-data/shared/gbrowse/gbrowse_build_sites.txt Thu Apr 07 08:39:07 2011 -0400
@@ -10,5 +10,5 @@
modencode_fly http://modencode.oicr.on.ca/fgb2/gbrowse/fly dm2
#SGD
-sgd_yeast http://browse.yeastgenome.org/fgb2/gbrowse/scgenome Saccharomcyes_cerevisiae_S288C_SGD2010
+sgd_yeast http://browse.yeastgenome.org/fgb2/gbrowse/scgenome Saccharomyces_cerevisiae_S288C_SGD2010
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
06 Apr '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/b1657489f16c/
changeset: r5354:b1657489f16c
user: kellyv
date: 2011-04-06 22:28:33
summary: Added BWA for SOLiD to tool_conf.xml.main
affected #: 1 file (53 bytes)
--- a/tool_conf.xml.main Wed Apr 06 12:44:58 2011 -0400
+++ b/tool_conf.xml.main Wed Apr 06 16:28:33 2011 -0400
@@ -358,6 +358,7 @@
<tool file="metag_tools/megablast_xml_parser.xml" /><label text="AB-SOLiD" id="ab_solid"/><tool file="sr_mapping/bowtie_color_wrapper.xml" />
+ <tool file="sr_mapping/bwa_color_wrapper.xml" /></section><section name="NGS: SAM Tools" id="samtools"><tool file="samtools/sam_bitwise_flag_filter.xml" />
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0