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
- 15302 discussions
galaxy-dist commit 3868982a4eff: trackster: Fix error on saving when no chrom is currently viewed due to new saving of current viewport. Remove debug statements
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289849956 18000
# Node ID 3868982a4eff5036f13650ab303e0b9a4fb30da8
# Parent 2bfb046649f059734e2709643785a95af3b85e81
trackster: Fix error on saving when no chrom is currently viewed due to new saving of current viewport. Remove debug statements
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -83,6 +83,7 @@ var Cache = function( num_elements ) {
var View = function( container, title, vis_id, dbkey, callback ) {
this.container = container;
+ this.chrom = null;
this.vis_id = vis_id;
this.dbkey = dbkey;
this.title = title;
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -201,8 +201,7 @@
});
}
- var payload = { 'tracks': tracks, 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high } }
- console.log( payload );
+ var payload = { 'tracks': tracks, 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high } };
$.ajax({
url: "${h.url_for( action='save' )}",
--- a/templates/tracks/new_browser.mako
+++ b/templates/tracks/new_browser.mako
@@ -18,12 +18,11 @@
<div style="clear: both;"></div></div><div class="form-row">
- Is your build not listed here?
+ Is the build not listed here?
<a href="${h.url_for( controller='user', action='dbkeys', panels=True )}">Add a Custom Build</a></div>
%if default_dbkey is not None:
<script type="text/javascript">
- console.log("${default_dbkey}");
$("#new-dbkey option[value='${default_dbkey}']").attr("selected", true);
</script>
%endif
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=50,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPa
ttern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,d,c,b,e){this.container=a;this.vis_id=c;this.dbkey=b;this.
title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);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_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-a
utocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).append
To(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(f){if(f.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=f.chrom_info;var j='<option value="">Select Chrom/Contig</option>';for(var h=0,e=a.chrom_data.length;h<e;h++){var g=a.chrom_data[h].chrom;j+='<option value="'+g+'">'+g+"</option>"}a.chrom_select.html(j);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});if(d){d()}},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f){this.current_x=f.offsetX}).bind("drag",function(f){var h=f.offsetX-this.current_x;this.current_x=f.offsetX;var g=Math.round(h/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for
(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(f){this.original_low=a.low;this.current_height=f.clientY;this.current_x=f.offsetX;this.enable_pan=(f.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(h){if(!this.enable_pan||this.in_reordering){return}var f=$(this);var j=h.offsetX-this.current_x;var g=f.scrollTop()-(h.clientY-this.current_height);f.scrollTop(g);this.current_height=h.clientY;this.current_x=h.offsetX;var i=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)});this.top_labeltrack.bind("dragstart",function(f){this.drag_origin_x=f.clientX;this.drag_origin_pos=f.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav
_labeltrack.height(),top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var g=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,f=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low);this.drag_div.css({left:g+"px",width:(f-g)+"px"})}).bind("dragend",function(k){var g=Math.min(k.clientX,this.drag_origin_x),f=Math.max(k.clientX,this.drag_origin_x),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},upd
ate_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(e,b,g){var d=this;var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){return}if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<
a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(
Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+th
is.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},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 Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null}
;$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=function(b,a,d,c
){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.filtering_div.hide();this.filtering_div.bind("drag",function(i){i.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);var g=$("<th cla
ss='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(k,l){var i=l.values;d.text("["+i[0]+"-"+i[1]+"]");a.low=i[0];a.high=i[1];c.draw(true)},change:function(i,k){a.control_element.slider("option","slide").call(a.control_element,i,k)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.r
emoveClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.conte
nt_div.text(DATA_NONE)}}});var TiledTrack=function(){var b=this,j=b.view;if(b.hidden){return}if(b.display_modes!==undefined){if(b.mode_div===undefined){b.mode_div=$("<div class='right-float menubutton popup' />").appendTo(b.header_div);var e=b.display_modes[0];b.mode=e;b.mode_div.text(e);var c=function(i){b.mode_div.text(i);b.mode=i;b.tile_cache.clear();b.draw()};var a={};for(var f=0,h=b.display_modes.length;f<h;f++){var g=b.display_modes[f];a[g]=function(i){return function(){c(i)}}(g)}make_popupmenu(b.mode_div,a)}else{b.mode_div.hide()}}var d={};d["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();b.is_overview=true;b.set_overview();for(var i in j.tracks){if(j.tracks[i]!==b){j.tracks[i].is_overview=false}}};d["Edit configuration"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){b.update_options(b.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.keyCode||m.which
)===27){l()}else{if((m.keyCode||m.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",b.gen_options(b.track_id),{Cancel:l,OK:i})};if(b.filters.length>0){d["Show filters"]=function(){var i;if(!b.filtering_div.is(":visible")){i="Hide filters";b.filters_visible=true}else{i="Show filters";b.filters_visible=false}$("#"+b.name_div.attr("id")+"-menu").find("li").eq(2).text(i);b.filtering_div.toggle()}}d.Remove=function(){j.remove_track(b);if(j.num_tracks===0){$("#no-tracks").show()}};b.popup_menu=make_popupmenu(b.name_div,d);show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var k=this.view.low,g=this.view.high,h=g-k,f=this.view.resolution;var n=$("<div style='position: relative;'></div>"),o=this.content_div.width()/h;this.content_div.append(n);this.max_height=0;var b=Math.floor(k/f/DENSITY);var j={};while((b*DENSITY*f)<g){var l=this.content_div.width()+"_"+
o+"_"+b;var e=this.tile_cache.get(l);if(!a&&e){var i=b*DENSITY*f;var d=(i-k)*o;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,n)}else{this.delayed_draw(this,l,k,g,b,f,n,o,j)}b+=1}var c=this;var m=setInterval(function(){if(obj_length(j)===0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var p=0;p<c.filters.length;p++){c.filters[p].update_ui_elt()}clearInterval(m)}},50)},delayed_draw:function(c,h,g,e,b,d,i,j,f){var a=setTimeout(function(){if(g<=c.view.high&&e>=c.view.low){var k=c.draw_tile(d,b,i,j);if(k){if(!c.initial_canvas&&!window.G_vmlCanvasManager){c.initial_canvas=$(k).clone();var n=k.get(0).getContext("2d");var l=c.initial_canvas.get(0).getContext("2d");var m=n.getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,k);c.show_tile(k,i)}}delete f[a]},50);f[a]=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_height,a.height())
;b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div styl
e='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})
}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o-this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DA
TA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.pref
s.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",top:a.height_px+12+"px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,w=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(w)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(w);if(!v){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=Mat
h.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(d-(h-k)/m*d);n.fillRect(u,h,f,d-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,d)}n.fill()}else{n.stroke()}c.append(b);return b},gen_options:function(m){var a=$("<div />").addClass("form-row");var e="track_"+m+"_color",b=$("<label />").attr("for
",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+m+"_minval",l=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),k=$("<input></input>").attr("id",h).val(d),j="track_"+m+"_maxval",g=$("<label></label>").attr("for",j).text("Max value:"),i=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",j).val(i);return a.append(l).append(k).append(g).append(f).append(b).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_color").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.color=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_valu
e);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"#444",label_color:"black",show_counts:true}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},fun
ction(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,b,q){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=q;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,y=[],h=0,n=this.view.max_low;var A=[];if(this.inc_slots[a].mode!==q){delete this.inc_slots[a];this.inc_slots[a]={mode:q,w_scale:m};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var v=0,w=g.length;v<w;v++){var f=g[v],l=f[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);A.push(this.inc_slots[a][l])}else{y.push(v)}}for(var v=0,w=y.length;v<w;v++){var f=g[y[v]],l=f[0],r=f[1],c=f[2],p=f[3],d=Math.floor((r-n)*m),e=Math.ceil((c-n
)*m);if(p!==undefined&&!b){var s=CONTEXT.measureText(p).width;if(d-s<0){e+=s}else{d-=s}}var u=0;while(u<=MAX_FEATURE_DEPTH){var o=true;if(this.s_e_by_tile[a][u]!==undefined){for(var t=0,z=this.s_e_by_tile[a][u].length;t<z;t++){var x=this.s_e_by_tile[a][u][t];if(e>x[0]&&d<x[1]){o=false;break}}}if(o){if(this.s_e_by_tile[a][u]===undefined){this.s_e_by_tile[a][u]=[]}this.s_e_by_tile[a][u].push([d,e]);this.inc_slots[a][l]=u;h=Math.max(h,u);break}u++}}return h},rect_or_text:function(r,l,t,b,q,f,i,e){r.textAlign="center";var k=0,p=Math.round(l/2);for(var m=0,s=i.length;m<s;m++){var j=i[m],d="MIDNSHP"[j[0]],n=j[1];if(d==="H"||d==="S"){k-=n}var g=q+k,w=Math.floor(Math.max(0,(g-t)*l)),h=Math.floor(Math.max(0,(g+n-t)*l));switch(d){case"S":case"H":case"M":var o=f.slice(k,n);if((this.mode==="Pack"||this.mode==="Auto")&&f!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+1,h-w,9);r.fillStyle=CONNECTOR_COLOR;for(var u=0,a=o.length;u<a;u++){if(g+
u>=t&&g+u<=b){var v=Math.floor(Math.max(0,(g+u-t)*l));r.fillText(o[u],v+this.left_offset+p,e+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+4,h-w,3)}break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(w+this.left_offset,e+5,h-w,1);break;case"D":r.fillStyle="red";r.fillRect(w+this.left_offset,e+4,h-w,3);break;case"P":case"I":break}k+=n}},draw_tile:function(ag,o,s,av){var N=o*DENSITY*ag,al=(o+1)*DENSITY*ag,M=al-N;var an=(!this.initial_canvas?"initial":N+"_"+al);var I=this.data_cache.get(an);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,al]]=true;this.get_data(N,al);return}var a=Math.ceil(M*av),ai=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,ae=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_info==="no_detail")),W=this.left_offset,au,D,aw;var q=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(q)}q=$(q);if(I.datase
t_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;aw=10}else{aw=(ae?this.vertical_nodetail_px:this.vertical_detail_px);var A=(av<0.0001?1/this.view.zoom_res:av);D=this.incremental_slots(A,I.data,ae,r)*aw+z;au=this.inc_slots[A]}}q.css({position:"absolute",top:0,left:(N-this.view.low)*av-W});q.get(0).width=a+W;q.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=q.get(0).getContext("2d");J.fillStyle=l;J.font=this.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Y=I.data,L=I.max,b=Math.ceil(I.delta*av);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var ap=0,H=Y.length;ap<H;ap++){var aa=Math.floor((Y[ap][0]-N)*av);var Z=Y[ap][1];if(!Z){continue}var am=Z/L*this.summary_draw_height;J.fillStyle="black";J.fillRect(aa+W,this.summary_draw_height-am,b,am);if(this.prefs.sho
w_counts&&J.measureText(Z).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(Z,aa+W+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(q);return q}if(I.message){q.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+W,aw)}var ad=false;if(I.data){ad=true;for(var ar=0;ar<this.filters.length;ar++){if(!this.filters[ar].applies_to(I.data[0])){ad=false}}}if(ad){q.addClass(FILTERABLE_CLASS)}var at=I.data;var ao=0;for(var ap=0,H=at.length;ap<H;ap++){var S=at[ap],R=S[0],aq=S[1],ac=S[2],O=S[3];if(au[R]===undefined){continue}var ab=false;var U;for(var ar=0;ar<this.filters.length;ar++){U=this.filters[ar];U.update_attrs(S);if(!U.keep(S)){ab=true;break}}if(ab){continue}if(aq<=al&&ac>=N){var af=Math.floor(Math.max(0,(aq-N)*av)),K=Math.ceil(Math.min(a,Math.max(0,(ac-N)*av))),X=(r==="Dense"?1:(1+au[R]))*aw;var G,aj,P=null,ax=null;if(I.dataset_type==="bai"){var v=S[4];J.fillStyle=l;if(S[5] instanceof Array){var
E=Math.floor(Math.max(0,(S[5][0]-N)*av)),Q=Math.ceil(Math.min(a,Math.max(0,(S[5][1]-N)*av))),C=Math.floor(Math.max(0,(S[6][0]-N)*av)),w=Math.ceil(Math.min(a,Math.max(0,(S[6][1]-N)*av)));if(S[5][1]>=N&&S[5][0]<=al){this.rect_or_text(J,av,N,al,S[5][0],S[5][2],v,X)}if(S[6][1]>=N&&S[6][0]<=al){this.rect_or_text(J,av,N,al,S[6][0],S[6][2],v,X)}if(C>Q){J.fillStyle=CONNECTOR_COLOR;J.fillRect(Q+W,X+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,av,N,al,aq,O,v,X)}if(r!=="Dense"&&!ae&&aq>N){J.fillStyle=this.prefs.label_color;if(o===0&&af-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+W,X+8)}else{J.textAlign="right";J.fillText(R,af-2+W,X+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var F=S[4],V=S[5],ah=S[6],h=S[7];if(V&&ah){P=Math.floor(Math.max(0,(V-N)*av));ax=Math.ceil(Math.min(a,Math.max(0,(ah-N)*av)))}if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O).width<0){J.tex
tAlign="left";J.fillText(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}if(h){if(F){if(F=="+"){J.fillStyle=RIGHT_STRAND}else{if(F=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}for(var an=0,g=h.length;an<g;an++){var u=h[an],d=Math.floor(Math.max(0,(u[0]-N)*av)),T=Math.ceil(Math.min(a,Math.max((u[1]-N)*av)));if(d>T){continue}G=5;aj=3;J.fillRect(d+W,X+aj,T-d,G);if(P!==undefined&&!(d>ax||T<P)){G=9;aj=1;var ak=Math.max(d,P),B=Math.min(T,ax);J.fillRect(ak+W,X+aj,B-ak,G)}}}else{G=9;aj=1;J.fillRect(af+W,X+aj,K-af,G);if(S.strand){if(S.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(S.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var t=S[4],n=S[5],c=S[6];G=9;aj=1;J.fillRect(af+W,X,K-af,G);if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O).width<0){J.textAlign="left";J.fillT
ext(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}var m=t+" / "+n;if(aq>N&&J.measureText(m).width<(K-af)){J.fillStyle="white";J.textAlign="center";J.fillText(m,W+af+(K-af)/2,X+8);J.fillStyle=l}}}}}ao++}}return q},gen_options:function(i){var a=$("<div />").addClass("form-row");var e="track_"+i+"_block_color",k=$("<label />").attr("for",e).text("Block color:"),l=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),j="track_"+i+"_label_color",g=$("<label />").attr("for",j).text("Text color:"),h=$("<input />").attr("id",j).attr("name",j).val(this.prefs.label_color),f="track_"+i+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(k).append(l).append(g).append(h).append(d)},update_options:function(d){var b=$("#track_"+d+"_block_color").va
l(),c=$("#track_"+d+"_label_color").val(),a=$("#track_"+d+"_show_count").attr("checked");if(b!==this.prefs.block_color||c!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=c;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=50,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPa
ttern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;th
is.dbkey=b;this.title=d;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(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);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").pr
ependTo(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_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em"
).addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.r
edraw()}).appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(f){if(f.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=f.chrom_info;var j='<option value="">Select Chrom/Contig</option>';for(var h=0,e=a.chrom_data.length;h<e;h++){var g=a.chrom_data[h].chrom;j+='<option value="'+g+'">'+g+"</option>"}a.chrom_select.html(j);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});if(d){d()}},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f){this.current_x=f.offsetX}).bind("drag",function(f){var h=f.offsetX-this.current_x;this.current_x=f.offsetX;var g=Math.round(h/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click
",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(f){this.original_low=a.low;this.current_height=f.clientY;this.current_x=f.offsetX;this.enable_pan=(f.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(h){if(!this.enable_pan||this.in_reordering){return}var f=$(this);var j=h.offsetX-this.current_x;var g=f.scrollTop()-(h.clientY-this.current_height);f.scrollTop(g);this.current_height=h.clientY;this.current_x=h.offsetX;var i=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)});this.top_labeltrack.bind("dragstart",function(f){this.drag_origin_x=f.clientX;this.drag_origin_pos=f.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+a.top_labeltrac
k.height()+a.nav_labeltrack.height(),top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var g=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,f=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low);this.drag_div.css({left:g+"px",width:(f-g)+"px"})}).bind("dragend",function(k){var g=Math.min(k.clientX,this.drag_origin_x),f=Math.max(k.clientX,this.drag_origin_x),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigge
r("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(e,b,g){var d=this;var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){return}if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a
.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.p
ow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.h
igh-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},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 Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.sl
ider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=
function(b,a,d,c){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.filtering_div.hide();this.filtering_div.bind("drag",function(i){i.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);
var g=$("<th class='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(k,l){var i=l.values;d.text("["+i[0]+"-"+i[1]+"]");a.low=i[0];a.high=i[1];c.draw(true)},change:function(i,k){a.control_element.slider("option","slide").call(a.control_element,i,k)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a
.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("
nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var b=this,j=b.view;if(b.hidden){return}if(b.display_modes!==undefined){if(b.mode_div===undefined){b.mode_div=$("<div class='right-float menubutton popup' />").appendTo(b.header_div);var e=b.display_modes[0];b.mode=e;b.mode_div.text(e);var c=function(i){b.mode_div.text(i);b.mode=i;b.tile_cache.clear();b.draw()};var a={};for(var f=0,h=b.display_modes.length;f<h;f++){var g=b.display_modes[f];a[g]=function(i){return function(){c(i)}}(g)}make_popupmenu(b.mode_div,a)}else{b.mode_div.hide()}}var d={};d["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();b.is_overview=true;b.set_overview();for(var i in j.tracks){if(j.tracks[i]!==b){j.tracks[i].is_overview=false}}};d["Edit configuration"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){b.update_options(b.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.
keyCode||m.which)===27){l()}else{if((m.keyCode||m.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",b.gen_options(b.track_id),{Cancel:l,OK:i})};if(b.filters.length>0){d["Show filters"]=function(){var i;if(!b.filtering_div.is(":visible")){i="Hide filters";b.filters_visible=true}else{i="Show filters";b.filters_visible=false}$("#"+b.name_div.attr("id")+"-menu").find("li").eq(2).text(i);b.filtering_div.toggle()}}d.Remove=function(){j.remove_track(b);if(j.num_tracks===0){$("#no-tracks").show()}};b.popup_menu=make_popupmenu(b.name_div,d);show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var k=this.view.low,g=this.view.high,h=g-k,f=this.view.resolution;var n=$("<div style='position: relative;'></div>"),o=this.content_div.width()/h;this.content_div.append(n);this.max_height=0;var b=Math.floor(k/f/DENSITY);var j={};while((b*DENSITY*f)<g){var l=this.content_
div.width()+"_"+o+"_"+b;var e=this.tile_cache.get(l);if(!a&&e){var i=b*DENSITY*f;var d=(i-k)*o;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,n)}else{this.delayed_draw(this,l,k,g,b,f,n,o,j)}b+=1}var c=this;var m=setInterval(function(){if(obj_length(j)===0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var p=0;p<c.filters.length;p++){c.filters[p].update_ui_elt()}clearInterval(m)}},50)},delayed_draw:function(c,h,g,e,b,d,i,j,f){var a=setTimeout(function(){if(g<=c.view.high&&e>=c.view.low){var k=c.draw_tile(d,b,i,j);if(k){if(!c.initial_canvas&&!window.G_vmlCanvasManager){c.initial_canvas=$(k).clone();var n=k.get(0).getContext("2d");var l=c.initial_canvas.get(0).getContext("2d");var m=n.getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,k);c.show_tile(k,i)}}delete f[a]},50);f[a]=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_he
ight,a.height());b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(
),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){conso
le.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o-this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new
Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(r
ound_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",top:a.height_px+12+"px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,w=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(w)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(w);if(!v){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.
get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(d-(h-k)/m*d);n.fillRect(u,h,f,d-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,d)}n.fill()}else{n.stroke()}c.append(b);return b},gen_options:function(m){var a=$("<div />").addClass("form-row");var e="track_"+m+"_color",b=$("<labe
l />").attr("for",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+m+"_minval",l=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),k=$("<input></input>").attr("id",h).val(d),j="track_"+m+"_maxval",g=$("<label></label>").attr("for",j).text("Max value:"),i=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",j).val(i);return a.append(l).append(k).append(g).append(f).append(b).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_color").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.color=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(thi
s.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"#444",label_color:"black",show_counts:true}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,
mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,b,q){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=q;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,y=[],h=0,n=this.view.max_low;var A=[];if(this.inc_slots[a].mode!==q){delete this.inc_slots[a];this.inc_slots[a]={mode:q,w_scale:m};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var v=0,w=g.length;v<w;v++){var f=g[v],l=f[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);A.push(this.inc_slots[a][l])}else{y.push(v)}}for(var v=0,w=y.length;v<w;v++){var f=g[y[v]],l=f[0],r=f[1],c=f[2],p=f[3],d=Math.floor((r-n)*m),
e=Math.ceil((c-n)*m);if(p!==undefined&&!b){var s=CONTEXT.measureText(p).width;if(d-s<0){e+=s}else{d-=s}}var u=0;while(u<=MAX_FEATURE_DEPTH){var o=true;if(this.s_e_by_tile[a][u]!==undefined){for(var t=0,z=this.s_e_by_tile[a][u].length;t<z;t++){var x=this.s_e_by_tile[a][u][t];if(e>x[0]&&d<x[1]){o=false;break}}}if(o){if(this.s_e_by_tile[a][u]===undefined){this.s_e_by_tile[a][u]=[]}this.s_e_by_tile[a][u].push([d,e]);this.inc_slots[a][l]=u;h=Math.max(h,u);break}u++}}return h},rect_or_text:function(r,l,t,b,q,f,i,e){r.textAlign="center";var k=0,p=Math.round(l/2);for(var m=0,s=i.length;m<s;m++){var j=i[m],d="MIDNSHP"[j[0]],n=j[1];if(d==="H"||d==="S"){k-=n}var g=q+k,w=Math.floor(Math.max(0,(g-t)*l)),h=Math.floor(Math.max(0,(g+n-t)*l));switch(d){case"S":case"H":case"M":var o=f.slice(k,n);if((this.mode==="Pack"||this.mode==="Auto")&&f!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+1,h-w,9);r.fillStyle=CONNECTOR_COLOR;for(var u=0,a=o.lengt
h;u<a;u++){if(g+u>=t&&g+u<=b){var v=Math.floor(Math.max(0,(g+u-t)*l));r.fillText(o[u],v+this.left_offset+p,e+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+4,h-w,3)}break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(w+this.left_offset,e+5,h-w,1);break;case"D":r.fillStyle="red";r.fillRect(w+this.left_offset,e+4,h-w,3);break;case"P":case"I":break}k+=n}},draw_tile:function(ag,o,s,av){var N=o*DENSITY*ag,al=(o+1)*DENSITY*ag,M=al-N;var an=(!this.initial_canvas?"initial":N+"_"+al);var I=this.data_cache.get(an);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,al]]=true;this.get_data(N,al);return}var a=Math.ceil(M*av),ai=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,ae=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_info==="no_detail")),W=this.left_offset,au,D,aw;var q=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(q)}q=
$(q);if(I.dataset_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;aw=10}else{aw=(ae?this.vertical_nodetail_px:this.vertical_detail_px);var A=(av<0.0001?1/this.view.zoom_res:av);D=this.incremental_slots(A,I.data,ae,r)*aw+z;au=this.inc_slots[A]}}q.css({position:"absolute",top:0,left:(N-this.view.low)*av-W});q.get(0).width=a+W;q.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=q.get(0).getContext("2d");J.fillStyle=l;J.font=this.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Y=I.data,L=I.max,b=Math.ceil(I.delta*av);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var ap=0,H=Y.length;ap<H;ap++){var aa=Math.floor((Y[ap][0]-N)*av);var Z=Y[ap][1];if(!Z){continue}var am=Z/L*this.summary_draw_height;J.fillStyle="black";J.fillRect(aa+W,this.summary_draw_height-am,b,am);i
f(this.prefs.show_counts&&J.measureText(Z).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(Z,aa+W+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(q);return q}if(I.message){q.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+W,aw)}var ad=false;if(I.data){ad=true;for(var ar=0;ar<this.filters.length;ar++){if(!this.filters[ar].applies_to(I.data[0])){ad=false}}}if(ad){q.addClass(FILTERABLE_CLASS)}var at=I.data;var ao=0;for(var ap=0,H=at.length;ap<H;ap++){var S=at[ap],R=S[0],aq=S[1],ac=S[2],O=S[3];if(au[R]===undefined){continue}var ab=false;var U;for(var ar=0;ar<this.filters.length;ar++){U=this.filters[ar];U.update_attrs(S);if(!U.keep(S)){ab=true;break}}if(ab){continue}if(aq<=al&&ac>=N){var af=Math.floor(Math.max(0,(aq-N)*av)),K=Math.ceil(Math.min(a,Math.max(0,(ac-N)*av))),X=(r==="Dense"?1:(1+au[R]))*aw;var G,aj,P=null,ax=null;if(I.dataset_type==="bai"){var v=S[4];J.fillStyle=l;if(S[5] insta
nceof Array){var E=Math.floor(Math.max(0,(S[5][0]-N)*av)),Q=Math.ceil(Math.min(a,Math.max(0,(S[5][1]-N)*av))),C=Math.floor(Math.max(0,(S[6][0]-N)*av)),w=Math.ceil(Math.min(a,Math.max(0,(S[6][1]-N)*av)));if(S[5][1]>=N&&S[5][0]<=al){this.rect_or_text(J,av,N,al,S[5][0],S[5][2],v,X)}if(S[6][1]>=N&&S[6][0]<=al){this.rect_or_text(J,av,N,al,S[6][0],S[6][2],v,X)}if(C>Q){J.fillStyle=CONNECTOR_COLOR;J.fillRect(Q+W,X+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,av,N,al,aq,O,v,X)}if(r!=="Dense"&&!ae&&aq>N){J.fillStyle=this.prefs.label_color;if(o===0&&af-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+W,X+8)}else{J.textAlign="right";J.fillText(R,af-2+W,X+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var F=S[4],V=S[5],ah=S[6],h=S[7];if(V&&ah){P=Math.floor(Math.max(0,(V-N)*av));ax=Math.ceil(Math.min(a,Math.max(0,(ah-N)*av)))}if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O
).width<0){J.textAlign="left";J.fillText(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}if(h){if(F){if(F=="+"){J.fillStyle=RIGHT_STRAND}else{if(F=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}for(var an=0,g=h.length;an<g;an++){var u=h[an],d=Math.floor(Math.max(0,(u[0]-N)*av)),T=Math.ceil(Math.min(a,Math.max((u[1]-N)*av)));if(d>T){continue}G=5;aj=3;J.fillRect(d+W,X+aj,T-d,G);if(P!==undefined&&!(d>ax||T<P)){G=9;aj=1;var ak=Math.max(d,P),B=Math.min(T,ax);J.fillRect(ak+W,X+aj,B-ak,G)}}}else{G=9;aj=1;J.fillRect(af+W,X+aj,K-af,G);if(S.strand){if(S.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(S.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var t=S[4],n=S[5],c=S[6];G=9;aj=1;J.fillRect(af+W,X,K-af,G);if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O).width<0){J.textAlig
n="left";J.fillText(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}var m=t+" / "+n;if(aq>N&&J.measureText(m).width<(K-af)){J.fillStyle="white";J.textAlign="center";J.fillText(m,W+af+(K-af)/2,X+8);J.fillStyle=l}}}}}ao++}}return q},gen_options:function(i){var a=$("<div />").addClass("form-row");var e="track_"+i+"_block_color",k=$("<label />").attr("for",e).text("Block color:"),l=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),j="track_"+i+"_label_color",g=$("<label />").attr("for",j).text("Text color:"),h=$("<input />").attr("id",j).attr("name",j).val(this.prefs.label_color),f="track_"+i+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(k).append(l).append(g).append(h).append(d)},update_options:function(d){var b=$("#track_"+d+"_
block_color").val(),c=$("#track_"+d+"_label_color").val(),a=$("#track_"+d+"_show_count").attr("checked");if(b!==this.prefs.block_color||c!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=c;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0
galaxy-dist commit def13f052a4a: Restored the function to stop the edit samples form from getting submitted when return key is pressed. This is needed in this form as the barcode scanner (when in keyboard emulation mode) may send a return key appended to the scanned barcode string.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289853524 18000
# Node ID def13f052a4a22c46ec5be6481ad874ceb734799
# Parent 02f6c9dae26e9aef40a44bc151ed07b457715839
Restored the function to stop the edit samples form from getting submitted when return key is pressed. This is needed in this form as the barcode scanner (when in keyboard emulation mode) may send a return key appended to the scanned barcode string.
--- a/scripts/galaxy_messaging/server/amqp_consumer.py
+++ b/scripts/galaxy_messaging/server/amqp_consumer.py
@@ -68,7 +68,7 @@ def update_sample_state( message ):
api_key = get_value(dom, 'api_key')
log.debug('Barcode: ' + barcode)
log.debug('State: ' + state)
- log.debug('api_key: ' + api_key)
+ log.debug('API Key: ' + api_key)
# validate
if not barcode or not state or not api_key:
log.debug( 'Incomplete sample_state_update message received. Sample barcode, desired state and user API key is required.' )
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -14,6 +14,18 @@
${common_javascripts()}
</%def>
+<script type="text/javascript">
+ // This function stops the form from getting submitted when return key is pressed
+ // This is needed in this form as the barcode scanner (when in keyboard emulation mode)
+ // may send a return key appended to the scanned barcode string.
+ function stopRKey(evt) {
+ var evt = (evt) ? evt : ((event) ? event : null);
+ var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
+ if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
+ }
+ document.onkeypress = stopRKey
+</script>
+
<%
from galaxy.web.framework.helpers import time_ago
1
0
galaxy-dist commit 33dacaafc62e: Change in output redirect. Should fix drawing phylogeny bug. Thanks Nate for pointing this out.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User anton(a)grusha.bx.psu.edu
# Date 1289920626 18000
# Node ID 33dacaafc62eac4a8940c4bc978da1d1a6c68af9
# Parent 94c2040e58255136741d776de8401cfb4128133b
Change in output redirect. Should fix drawing phylogeny bug. Thanks Nate for pointing this out.
--- a/tools/taxonomy/t2ps_wrapper.py
+++ b/tools/taxonomy/t2ps_wrapper.py
@@ -38,7 +38,7 @@ ps_file = tempfile.NamedTemporaryFile('w
# Execute taxonomy2tree
try:
- t2t_cmd = 'taxonomy2tree %s %s %s /dev/null 1 &> /dev/null' % ( tree_file, max_tree_level, newick_file.name )
+ t2t_cmd = 'taxonomy2tree %s %s %s /dev/null 1 > /dev/null 2>&1' % ( tree_file, max_tree_level, newick_file.name )
retcode = subprocess.call( t2t_cmd, shell=True )
if retcode < 0:
print >>sys.stderr, "Execution of taxonomy2tree terminated by signal", -retcode
1
0
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Anton Nekrutenko <anton(a)bx.psu.edu>
# Date 1289851601 18000
# Node ID 0505090dbbe610741cacd7a9a1c2e79b8cc9ea5c
# Parent 9a7482206be274678079271331171600a2023b03
Changing back
--- a/tools/taxonomy/t2ps_wrapper.py
+++ b/tools/taxonomy/t2ps_wrapper.py
@@ -59,7 +59,7 @@ except OSError, e:
# Convert PS to PDF
try:
- ps2pdf_cmd = 'pstopdf %s -o %s' % ( ps_file.name, pdf_file )
+ ps2pdf_cmd = 'ps2pdf %s %s' % ( ps_file.name, pdf_file )
retcode = subprocess.call( ps2pdf_cmd, shell=True )
if retcode < 0:
print >>sys.stderr, "Execution of ps2pdf terminated by signal", -retcode
1
0
galaxy-dist commit 9a7482206be2: Tweaks to taxonomy tools
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Anton Nekrutenko <anton(a)bx.psu.edu>
# Date 1289851499 18000
# Node ID 9a7482206be274678079271331171600a2023b03
# Parent 3868982a4eff5036f13650ab303e0b9a4fb30da8
Tweaks to taxonomy tools
--- a/tools/taxonomy/t2ps_wrapper.py
+++ b/tools/taxonomy/t2ps_wrapper.py
@@ -59,7 +59,7 @@ except OSError, e:
# Convert PS to PDF
try:
- ps2pdf_cmd = 'ps2pdf %s %s' % ( ps_file.name, pdf_file )
+ ps2pdf_cmd = 'pstopdf %s -o %s' % ( ps_file.name, pdf_file )
retcode = subprocess.call( ps2pdf_cmd, shell=True )
if retcode < 0:
print >>sys.stderr, "Execution of ps2pdf terminated by signal", -retcode
--- a/scripts/taxonomy/processTaxonomy.sh
+++ b/scripts/taxonomy/processTaxonomy.sh
@@ -11,7 +11,7 @@ echo "Sorting gi2tax files..."
sort -n -k 1 gi_taxid_all.dmp > gi_taxid_sorted.txt
rm gi_taxid_nucl.dmp gi_taxid_prot.dmp gi_taxid_all.dmp
echo "Removing parenthesis from names.dmp"
-cat names.dmp | sed s/\(/_/g | sed s/\)/_/g > names.temporary
+cat names.dmp | sed s/[\(\)\'\"]/_/g > names.temporary
mv names.dmp names.dmp.orig
mv names.temporary names.dmp
1
0
galaxy-dist commit 2bfb046649f0: Cleaned up the remote file size method so that only the file size is stored.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289848701 18000
# Node ID 2bfb046649f059734e2709643785a95af3b85e81
# Parent 796201bc8dbc531ddaec5d75fadb88e858adfbc4
Cleaned up the remote file size method so that only the file size is stored.
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1864,20 +1864,21 @@ class Sample( object ):
untransferred_datasets.append( dataset )
return untransferred_datasets
def get_untransferred_dataset_size( self, filepath ):
- # TODO: RC: If rsh keys are not set, this method will return something like the following:
- # greg(a)scofield.bx.psu.edu's password: 46M /afs/bx.psu.edu/home/greg/chr22/chr21.fa
- # This method should return the number of bytes in the file. I believe du
- # displays the file system block usage which may not be the number of bytes in the file.
- # Would ls -l be better?
def print_ticks( d ):
pass
datatx_info = self.request.type.datatx_info
- cmd = 'ssh %s@%s "du -sh \'%s\'"' % ( datatx_info['username'], datatx_info['host'], filepath )
+ login_str = '%s@%s' % ( datatx_info['username'], datatx_info['host'] )
+ cmd = 'ssh %s "du -sh \'%s\'"' % ( login_str, filepath )
output = pexpect.run( cmd,
events={ '.ssword:*': datatx_info['password']+'\r\n',
pexpect.TIMEOUT:print_ticks},
timeout=10 )
- return output.replace( filepath, '' ).strip()
+ # cleanup the output to get just the file size
+ return output.replace( filepath, '' )\
+ .replace( 'Password:', '' )\
+ .replace( "'s password:", '' )\
+ .replace( login_str, '' )\
+ .strip()
def get_api_value( self, view='collection' ):
rval = {}
try:
1
0
galaxy-dist commit efc0b15af402: More tests added to sample tracking functional tests
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289841695 18000
# Node ID efc0b15af4026aa039945c799354e8cac5975528
# Parent bde1ca8b6134079a9323d76bcaf057b3cc4166c1
More tests added to sample tracking functional tests
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -360,10 +360,13 @@ class TestFormsAndRequests( TwillTestCas
strings_displayed=[ 'Edit sequencing request "%s"' % request1.name ],
strings_displayed_after_submit=[ new_name, new_desc ] )
refresh( request1 )
- # now check email notification settings
- check_sample_states = [ ( request1.type.states[0].name, request1.type.states[0].id, True ),
- ( request1.type.states[2].name, request1.type.states[2].id, True ),
- ( request1.type.states[4].name, request1.type.states[4].id, True ) ]#[ ( state.id, True ) for state in request1.type.states ]
+ # define the sample states when we want an email notification
+ global email_notification_sample_states
+ email_notification_sample_states = [ request1.type.states[2], request1.type.states[4] ]
+ # check email notification settings
+ check_sample_states = []
+ for state in email_notification_sample_states:
+ check_sample_states.append( ( state.name, state.id, True ) )
strings_displayed = [ 'Edit sequencing request "%s"' % request1.name,
'Email notification settings' ]
additional_emails = [ 'test@.bx.psu.edu', 'test2@.bx.psu.edu' ]
@@ -496,7 +499,9 @@ class TestFormsAndRequests( TwillTestCas
#
def test_050_receive_request_as_admin( self ):
"""Testing receiving a sequencing request and assigning it barcodes"""
+ # logged in as regular_user1
self.logout()
+ # login as a admin_user to assign bar codes to samples
self.login( email=admin_user.email )
self.check_request_grid( cntrller='requests_admin',
state=request1.states.SUBMITTED,
@@ -540,49 +545,48 @@ class TestFormsAndRequests( TwillTestCas
sample_id=self.security.encode_id( sample.id ),
strings_displayed=strings_displayed,
strings_not_displayed=strings_not_displayed )
-# def test_040_request_lifecycle( self ):
-# """Testing request life-cycle as it goes through all the states"""
-# # logged in as regular_user1
-# self.logout()
-# self.login( email=admin_user.email )
-# self.check_request_grid( cntrller='requests_admin',
-# state=request1.states.SUBMITTED,
-# strings_displayed=[ request1.name ] )
-# self.visit_url( "%s/requests_common/view_request?cntrller=requests&id=%s" % ( self.url, self.security.encode_id( request1.id ) ) )
-# # TODO: add some string for checking on the page above...
-# # Set bar codes for the samples
-# bar_codes = [ '1234567890', '0987654321' ]
-# strings_displayed_after_submit=[ 'Changes made to the samples have been saved.' ]
-# for bar_code in bar_codes:
-# strings_displayed_after_submit.append( bar_code )
-# self.add_bar_codes( request_id=self.security.encode_id( request1.id ),
-# request_name=request1.name,
-# bar_codes=bar_codes,
-# samples=request1.samples,
-# strings_displayed_after_submit=strings_displayed_after_submit )
-# # Change the states of all the samples of this request to ultimately be COMPLETE
-# self.change_sample_state( request_id=self.security.encode_id( request1.id ),
-# request_name=request1.name,
-# sample_names=[ sample.name for sample in request1.samples ],
-# sample_ids=[ sample.id for sample in request1.samples ],
-# new_sample_state_id=request_type1.states[1].id,
-# new_state_name=request_type1.states[1].name )
-# self.change_sample_state( request_id=self.security.encode_id( request1.id ),
-# request_name=request1.name,
-# sample_names=[ sample.name for sample in request1.samples ],
-# sample_ids=[ sample.id for sample in request1.samples ],
-# new_sample_state_id=request_type1.states[2].id,
-# new_state_name=request_type1.states[2].name )
-# refresh( request1 )
-# self.logout()
-# self.login( email=regular_user1.email )
-# # check if the request's state is now set to 'complete'
-# self.check_request_grid( cntrller='requests',
-# state='Complete',
-# strings_displayed=[ request1.name ] )
-# assert request1.state is not request1.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
-# % ( request1.name, request1.states.COMPLETE )
-#
+ def test_055_request_lifecycle( self ):
+ """Testing request life-cycle as it goes through all the states"""
+ # logged in as admin_user
+ self.check_request_grid( cntrller='requests_admin',
+ state=request1.states.SUBMITTED,
+ strings_displayed=[ request1.name ] )
+ strings_displayed=[ 'History of sequencing request "%s"' % request1.name ]
+ # Change the states of all the samples of this request to ultimately be COMPLETE
+ for index, state in enumerate( request_type1.states ):
+ # start from the second state onwards
+ if index > 1:
+ # status message
+ if index == len( request_type1.states ) - 1:
+ status_msg = 'All samples of this request are in the final sample state (%s).' % state.name
+ else:
+ status_msg = 'All samples of this request are in the (%s) sample state. ' % state.name
+ # check email notification message
+ email_msg = ''
+ if state.id in [ email_state.id for email_state in email_notification_sample_states ]:
+ email_msg = 'Email notification failed as SMTP server not set in config file'
+ self.change_sample_state( request_id=self.security.encode_id( request1.id ),
+ sample_ids=[ sample.id for sample in request1.samples ],
+ new_sample_state_id=self.security.encode_id( state.id ),
+ strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name ],
+ strings_displayed_after_submit = [ status_msg, email_msg ] )
+ # check request history page
+ if index == len( request_type1.states ) - 1:
+ strings_displayed.append( status_msg )
+ else:
+ strings_displayed.append( status_msg )
+ self.view_request_history( cntrller='requests_admin',
+ request_id=self.security.encode_id( request1.id ),
+ strings_displayed=strings_displayed,
+ strings_not_displayed=[ request1.states.REJECTED ] )
+ refresh( request1 )
+ # check if the request's state is now set to 'complete'
+ self.check_request_grid( cntrller='requests_admin',
+ state='Complete',
+ strings_displayed=[ request1.name ] )
+ assert request1.state is not request1.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
+ % ( request1.name, request1.states.COMPLETE )
+
# def test_045_admin_create_request_on_behalf_of_regular_user( self ):
# """Testing creating and submitting a request as an admin on behalf of a regular user"""
# # Logged in as regular_user1
@@ -660,7 +664,7 @@ class TestFormsAndRequests( TwillTestCas
# # Make sure the request's state is now set to REJECTED
# assert request2.state is not request2.states.REJECTED, "The state of the request '%s' should be set to '%s'" \
# % ( request2.name, request2.states.REJECTED )
- def test_055_reset_data_for_later_test_runs( self ):
+ def __test_055_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
# Logged in as admin_user
self.logout()
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1434,9 +1434,9 @@ class TwillTestCase( unittest.TestCase )
'''View form details'''
self.home()
self.visit_url( "%s/forms/manage?operation=view&id=%s" % ( self.url, id ) )
- self.check_page_for_string( form_type )
+ #self.check_page_for_string( form_type )
self.check_page_for_string( form_name )
- self.check_page_for_string( form_desc )
+ #self.check_page_for_string( form_desc )
self.check_page_for_string( form_layout_name )
for i, field_dict in enumerate( field_dicts ):
self.check_page_for_string( field_dict[ 'name' ] )
@@ -1495,8 +1495,7 @@ class TwillTestCase( unittest.TestCase )
'''View request_type details'''
self.home()
self.visit_url( "%s/requests_admin/view_request_type?id=%s" % ( self.url, request_type_id ) )
- self.check_page_for_string( 'Sequencer configuration information' )
- self.check_page_for_string( request_type_name )
+ self.check_page_for_string( '"%s" sequencer configuration' % request_type_name )
for name, desc in sample_states:
self.check_page_for_string( name )
self.check_page_for_string( desc )
@@ -1624,23 +1623,21 @@ class TwillTestCase( unittest.TestCase )
tc.submit( "reject_button" )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
- def change_sample_state( self, request_id, request_name, sample_names, sample_ids, new_sample_state_id, new_state_name, comment='',
- strings_displayed=[], strings_displayed_after_submit=[] ):
- # We have to simulate the form submission here since twill barfs on the page
- # gvk - 9/22/10 - TODO: make sure the mako template produces valid html
- url = "%s/requests_common/edit_samples?cntrller=requests_admin&id=%s" % ( self.url, request_id )
- url += "&comment=%s&sample_state_id=%s" % ( comment, self.security.encode_id( new_sample_state_id ) )
- # select_sample_%i=true must be included twice for each sample to simulate a CheckboxField checked setting.
+ def change_sample_state( self, request_id, sample_ids, new_sample_state_id, comment='', strings_displayed=[], strings_displayed_after_submit=[] ):
+ url = "%s/requests_common/edit_samples?cntrller=requests_admin&id=%s&editing_samples=True" % ( self.url, request_id )
+ self.visit_url( url )
+ for check_str in strings_displayed:
+ self.check_page_for_string( check_str )
for sample_id in sample_ids:
- url += "&select_sample_%i=true&select_sample_%i=true" % ( sample_id, sample_id )
- url += "&sample_operation=Change%20state&refresh=true"
- url += "&save_changes_button=Save&editing_samples=True"
- self.visit_url( url )
- self.check_page_for_string( 'Edit Current Samples of Request "%s"' % request_name )
- for sample_id, sample_name in zip( sample_ids, sample_names ):
- self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%s" % ( self.url, self.security.encode_id( sample_id ) ) )
- self.check_page_for_string( 'Events for Sample "%s"' % sample_name )
- self.check_page_for_string( new_state_name )
+ tc.fv( "1", "select_sample_%i" % sample_id, True )
+ tc.fv( "1", "sample_operation", 'Change state' )
+ self.refresh_form( "sample_operation", 'Change state' )
+ self.check_page_for_string( "Change current state" )
+ tc.fv( "1", "sample_state_id", new_sample_state_id )
+ tc.fv( "1", "sample_event_comment", comment )
+ tc.submit( "save_samples_button" )
+ for check_str in strings_displayed_after_submit:
+ self.check_page_for_string( check_str )
def add_user_address( self, user_id, address_dict ):
self.home()
self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) )
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -137,7 +137,8 @@
<p/><div class="form-row">
## hidden element to make twill work.
- <input type="hidden" name="hidden_input" value=""/>
+ ## Greg will fix this
+ <input type="hidden" name="twill" value=""/>
%if ( request.samples or displayable_sample_widgets ) and ( editing_samples or len( displayable_sample_widgets ) > len( request.samples ) ):
<input type="submit" name="add_sample_button" value="Add sample" /><input type="submit" name="save_samples_button" value="Save"/>
@@ -156,7 +157,8 @@
<p/><div class="form-row">
## hidden element to make twill work.
- <input type="hidden" name="hidden_input" value=""/>
+ ## Greg will fix this
+ <input type="hidden" name="twill" value=""/><input type="submit" name="save_samples_button" value="Save"/><input type="submit" name="cancel_changes_button" value="Cancel"/><div class="toolParamHelp" style="clear: both;">
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -420,7 +420,7 @@ class Forms( BaseController ):
'visible': True,
'required': required,
'type': field_type,
- 'selectlist': selectlist,
+ 'selectlist': options,
'layout': layout,
'default': default }
return { 'label': name,
1
0
galaxy-dist commit bde1ca8b6134: First pass at cleaning up the Galaxy Form Definition UI ( forms controller still needs a re-write ).
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289839599 18000
# Node ID bde1ca8b6134079a9323d76bcaf057b3cc4166c1
# Parent 095dc06e0728556426a9288e6448fd1114e24063
First pass at cleaning up the Galaxy Form Definition UI ( forms controller still needs a re-write ).
--- a/lib/galaxy/webapps/community/controllers/__init__.py
+++ b/lib/galaxy/webapps/community/controllers/__init__.py
@@ -1,1 +1,1 @@
-"""Galaxy community space controllers."""
+"""Galaxy tool shed controllers."""
--- a/templates/admin/forms/edit_form.mako
+++ /dev/null
@@ -1,137 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$(document).ready(function(){
- //hide the all of the element with class msg_body
- $(".msg_body").hide();
- //toggle the componenet with class msg_body
- $(".msg_head").click(function(){
- $(this).next(".msg_body").slideToggle(450);
- });
-});
-</script>
-<style type="text/css">
-.msg_head {
- padding: 0px 0px;
- cursor: pointer;
-}
-
-}
-</style>
-
-<%def name="render_selectbox_options( index, field_attr )">
- %if field_attr[0] == 'Type':
- %if field_attr[1].get_selected( return_label=True ) == 'SelectField':
- <% options = field_attr[2] %>
- <div class="repeat-group-item">
- <div class="form-row">
- <label> Options</label>
- %for i, option in enumerate(options):
- <div class="form-row">
- <b> ${i+1}</b>
- ${option[1].get_html()}
- <input type="submit" name="removeoption_${index}_${i}" value="Remove"/>
- </div>
- %endfor
- </div>
- </div>
- <div class="form-row">
- <input type="submit" name="addoption_${index}" value="Add"/>
- </div>
- %endif
- %endif
-</%def>
-
-<%def name="render_field( index, field, saved )">
- %if saved:
- <h4 class="msg_head">
- <div class="form-row">${index+1}. ${field[0][1].value} (${field[2][1].get_selected( return_value=True )})</div>
- </h4>
- <div class="msg_body">
- %else:
- <div class="msg_body2">
- %endif
- <div class="repeat-group-item">
- %for field_attr in field:
- <div class="form-row">
- <label>${field_attr[0]}</label>
- ${field_attr[1].get_html()}
- ${render_selectbox_options( index, field_attr )}
- </div>
- %endfor
- <div class="form-row">
- <input type="submit" name="remove_button" value="Remove field ${index+1}"/>
- </div>
- </div>
- </div>
-</%def>
-
-<%def name="render_layout( index, widget )">
- <div class="repeat-group-item">
- <div class="form-row">
- <b> ${index+1}</b>
- ${widget.get_html()}
- <input type="submit" name="remove_layout_grid_button" value="Remove grid ${index+1}"/>
- </div>
- </div>
-</%def>
-
-<div class="toolForm">
- <div class="toolFormTitle">Edit form definition "${form.name}"</div>
- <form id="edit_form" name="edit_form" action="${h.url_for( controller='forms', action='edit', id=trans.security.encode_id(form.current.id) )}" method="post" >
- %if response_redirect:
- <input type="hidden" name="response_redirect" value="${response_redirect}" size="40" />
- %endif
- %for label, input in form_details:
- <div class="form-row">
- ## TODO: RC, this will keep the form type select list label
- ## from being displayed here. At this point, the select list is a hidden field.
- ## Make sure this is the best solution to this problem.
- %if label != 'Type':
- <label>${label}</label>
- %endif
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${input.get_html()}
- </div>
- <div style="clear: both"></div>
- </div>
- %endfor
- %if current_form_type == trans.app.model.FormDefinition.types.SAMPLE:
- <div class="toolFormTitle">Form Layout</div>
- <div class="form-row">
- <label>Layout grid names</label>
- </div>
- %for index, lg in enumerate(layout_grids):
- ${render_layout( index, lg )}
- %endfor
- <div class="form-row">
- <input type="submit" name="add_layout_grid" value="Add layout grid"/>
- </div>
- %endif
- <div class="toolFormTitle">Fields (${len(form.fields)})</div>
- %for ctr, field in enumerate(field_details):
- %if ctr < len(form.fields):
- ${render_field( ctr, field, True )}
- %else:
- ${render_field( ctr, field, False )}
- %endif
- %endfor
- <div class="form-row">
- <input type="submit" name="add_field_button" value="Add field"/>
- </div>
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="save_changes_button" value="Save"/>
- </div>
- </form>
-</div>
--- a/lib/galaxy/security/__init__.py
+++ b/lib/galaxy/security/__init__.py
@@ -19,14 +19,14 @@ class Action( object ):
class RBACAgent:
"""Class that handles galaxy security"""
permitted_actions = Bunch(
- DATASET_MANAGE_PERMISSIONS = Action( "manage permissions", "Role members can manage the roles associated with permissions on this dataset", "grant" ),
- DATASET_ACCESS = Action( "access", "Role members can import this dataset into their history for analysis", "restrict" ),
- LIBRARY_ACCESS = Action( "access library", "Restrict access to this library to only role members", "restrict" ),
- LIBRARY_ADD = Action( "add library item", "Role members can add library items to this library item", "grant" ),
- LIBRARY_MODIFY = Action( "modify library item", "Role members can modify this library item", "grant" ),
- LIBRARY_MANAGE = Action( "manage library permissions", "Role members can manage roles associated with permissions on this library item", "grant" ),
+ DATASET_MANAGE_PERMISSIONS = Action( "manage permissions", "Users having associated role can manage the roles associated with permissions on this dataset", "grant" ),
+ DATASET_ACCESS = Action( "access", "Users having associated role can import this dataset into their history for analysis", "restrict" ),
+ LIBRARY_ACCESS = Action( "access library", "Restrict access to this library to only users having assocaited role", "restrict" ),
+ LIBRARY_ADD = Action( "add library item", "Users having associated role can add library items to this library item", "grant" ),
+ LIBRARY_MODIFY = Action( "modify library item", "Users having associated role can modify this library item", "grant" ),
+ LIBRARY_MANAGE = Action( "manage library permissions", "Users having associated role can manage roles associated with permissions on this library item", "grant" ),
# Request type permissions
- REQUEST_TYPE_ACCESS = Action( "access request_type", "Restrict access to this request_type to only role members", "restrict" )
+ REQUEST_TYPE_ACCESS = Action( "access request_type", "Restrict access to only users having associated role", "restrict" )
)
def get_action( self, name, default=None ):
@@ -912,9 +912,6 @@ class GalaxyRBACAgent( RBACAgent ):
else:
hidden_folder_ids = '%d' % sub_folder.id
return False, hidden_folder_ids
- #
- # RequestType Permissions
- #
def can_access_request_type( self, roles, request_type ):
action = self.permitted_actions.REQUEST_TYPE_ACCESS
request_type_actions = []
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -312,6 +312,9 @@ use_interactive = True
# -- Beta features
+# Enable Galaxy to communicate directly with a sequencer
+#enable_sequencer_communication = False
+
# Enable Galaxy's built-in visualization module, Trackster.
#enable_tracks = False
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1494,6 +1494,9 @@ class MetadataFile( object ):
return os.path.abspath( os.path.join( path, "metadata_%d.dat" % self.id ) )
class FormDefinition( object ):
+ # The following form_builder classes are supported by the FormDefinition class.
+ # AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField
+ supported_field_types = [ AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField ]
types = Bunch( REQUEST = 'Sequencing Request Form',
SAMPLE = 'Sequencing Sample Form',
LIBRARY_INFO_TEMPLATE = 'Library information template',
@@ -1587,6 +1590,19 @@ class FormDefinition( object ):
widget=field_widget,
helptext=helptext ) )
return widgets
+ def field_as_html( self, field ):
+ """Generates disabled html for a field"""
+ type = field[ 'type' ]
+ form_field = None
+ for field_type in self.supported_field_types:
+ if type == field_type.__name__:
+ # Name it AddressField, CheckboxField, etc.
+ form_field = field_type( type )
+ break
+ if form_field:
+ return form_field.get_html( disabled=True )
+ # Return None if unsupported field type
+ return None
class FormDefinitionCurrent( object ):
def __init__(self, form_definition=None):
--- a/templates/webapps/galaxy/admin/index.mako
+++ b/templates/webapps/galaxy/admin/index.mako
@@ -101,11 +101,11 @@
</div><div class="toolSectionPad"></div><div class="toolSectionTitle">
- <span>Forms</span>
+ <span>Form Definitions</span></div><div class="toolSectionBody"><div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='forms', action='manage' )}" target="galaxy_main">Manage forms</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='forms', action='manage' )}" target="galaxy_main">Manage form definitions</a></div></div></div><div class="toolSectionPad"></div>
@@ -114,7 +114,7 @@
</div><div class="toolSectionBody"><div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_request_types' )}" target="galaxy_main">Sequencer configurations</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_request_types' )}" target="galaxy_main">Manage sequencers</a></div><div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_requests' )}" target="galaxy_main">Sequencing requests</a></div><div class="toolTitle"><a href="${h.url_for( controller='requests_common', action='find_samples', cntrller='requests_admin' )}" target="galaxy_main">Find samples</a></div></div>
--- a/templates/admin/requests/view_request_type.mako
+++ b/templates/admin/requests/view_request_type.mako
@@ -1,78 +1,102 @@
<%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" />
+<%
+ states_list = request_type.states
+ can_edit_permissions = not request_type.deleted
+ can_delete = not request_type.deleted
+ can_undelete = request_type.deleted
+%>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ %if can_edit_permissions:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='request_type_permissions', id=trans.security.encode_id( request_type.id ) )}">Edit permissions</a></li>
+ %endif
+ %if can_delete:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='delete_request_type', id=trans.security.encode_id( request_type.id ) )}">Delete</a></li>
+ %endif
+ %if can_undelete:
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='undelete_request_type', id=trans.security.encode_id( request_type.id ) )}">Undelete</a></li>
+ %endif
+</ul>
+
%if message:
${render_msg( message, status )}
%endif
-<% states_list = request_type.states %>
-
-<h2>Sequencer Configuration "${request_type.name}"</h2>
-
<div class="toolForm">
- <div class="toolFormTitle">Sequencer configuration information</div>
+ <div class="toolFormTitle">"${request_type.name}" sequencer configuration</div>
+ <div class="form-row">
+ <label>Name</label>
+ ${request_type.name}
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Description</label>
+ ${request_type.desc}
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Request form definition</label>
+ ${request_type.request_form.name}
+ </div>
+ <div class="form-row">
+ <label>Sample form definition</label>
+ ${request_type.sample_form.name}
+ </div>
+</div>
+<p/>
+<div class="toolForm">
+ <div class="toolFormTitle">Sample states defined for this sequencer configuration</div>
+ %for state in states_list:
+ <div class="form-row">
+ <label>${state.name}</label>
+ ${state.desc}
+ </div>
+ <div style="clear: both"></div>
+ %endfor
+</div>
+<p/>
+<div class="toolForm">
+ <div class="toolFormTitle">Sequencer login information</div><form name="view_request_type" action="${h.url_for( controller='requests_admin', action='create_request_type', rt_id=trans.security.encode_id( request_type.id ))}" method="post" ><div class="form-row">
- <label>Name</label>
- ${request_type.name}
- <div style="clear: both"></div>
+ This information is needed only if you will transfer datasets from the sequencer to a target Galaxy data library
</div>
- <div class="form-row">
- <label>Description</label>
- ${request_type.desc}
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>
- Request Form definition
- </label>
- ${request_type.request_form.name}
- </div>
- <div class="form-row">
- <label>
- Sample Form definition
- </label>
- ${request_type.sample_form.name}
- </div>
- <div class="toolFormTitle">Possible sample states</div>
- %for element_count, state in enumerate(states_list):
- <div class="form-row">
- <label>${1+element_count}. ${state.name}</label>
- ${state.desc}
- </div>
- <div style="clear: both"></div>
- %endfor
- <div class="toolFormTitle">Sequencer information</div>
- <div class="form-row">
- This information is only needed for transferring data from sequencer to Galaxy
- </div>
+ <div style="clear: both"></div><div class="form-row"><label>Hostname or IP Address:</label><input type="text" name="host" value="${request_type.datatx_info['host']}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row"><label>Username:</label><input type="text" name="username" value="${request_type.datatx_info['username']}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row"><label>Password:</label><input type="password" name="password" value="${request_type.datatx_info['password']}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row"><label>Data directory:</label><input type="text" name="data_dir" value="${request_type.datatx_info.get('data_dir', '')}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row">
- <label>Add experiment name and the sample name to the dataset name?</label>
+ <label>Prepend the experiment name and sample name to the dataset name?</label>
${rename_dataset_select_field.get_html()}
<div class="toolParamHelp" style="clear: both;">
- The datasets are renamed by prepending the experiment name and the sample name to the dataset name. <br/>This
- makes sure that dataset names remain unique in Galaxy even when they have the
- same name in the sequencer.
+ Galaxy datasets are renamed by prepending the experiment name and sample name to the dataset name, ensuring<br/>
+ dataset names remain unique in Galaxy even when multiple datasets have the same name on the sequencer.
</div></div>
+ <div style="clear: both"></div><div class="form-row">
- <input type="submit" name="save_changes" value="Save changes"/>
+ <input type="submit" name="save_changes" value="Save changes"/></div>
+ <div style="clear: both"></div></form></div>
--- a/templates/library/common/ldda_permissions.mako
+++ b/templates/library/common/ldda_permissions.mako
@@ -12,9 +12,7 @@
<br/><br/><ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, use_panels=use_panels, show_deleted=show_deleted )}"><span>Browse this data library</span></a>
- </li>
+ <li><a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, use_panels=use_panels, show_deleted=show_deleted )}"><span>Browse this data library</span></a></li></ul>
%if message:
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -105,7 +105,7 @@ class Forms( BaseController ):
action='manage',
message='Invalid form',
status='error' ) )
- return trans.fill_template( '/admin/forms/show_form_read_only.mako',
+ return trans.fill_template( '/admin/forms/view_form_definition.mako',
form_definition=fdc.latest_form )
def __form_types_widget(self, trans, selected='none'):
form_type_selectbox = SelectField( 'form_type_selectbox' )
@@ -223,8 +223,13 @@ class Forms( BaseController ):
# unsaved form, with the error message
if not fd_new:
current_form = self.__get_form( trans, **kwd )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status='error', response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status='error',
+ response_redirect=response_redirect,
+ **kwd )
# everything went fine. form saved successfully. Show the saved form or redirect
# to response_redirect if appropriate.
if response_redirect:
@@ -232,8 +237,13 @@ class Forms( BaseController ):
fd = fd_new
current_form = self.__get_saved_form( fd )
message = "The form '%s' has been updated with the changes." % fd.name
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Add a layout grid
#
@@ -241,8 +251,13 @@ class Forms( BaseController ):
current_form = self.__get_form( trans, **kwd )
current_form['layout'].append('')
# show the form again
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Delete a layout grid
#
@@ -250,8 +265,13 @@ class Forms( BaseController ):
current_form = self.__get_form( trans, **kwd )
index = int( kwd[ 'remove_layout_grid_button' ].split( ' ' )[2] ) - 1
del current_form['layout'][index]
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Add a field
#
@@ -259,8 +279,13 @@ class Forms( BaseController ):
current_form = self.__get_form( trans, **kwd )
current_form['fields'].append( self.empty_field )
# show the form again with one empty field
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Delete a field
#
@@ -269,8 +294,13 @@ class Forms( BaseController ):
# find the index of the field to be removed from the remove button label
index = int( kwd[ 'remove_button' ].split( ' ' )[2] ) - 1
del current_form['fields'][index]
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Add SelectField option
#
@@ -286,15 +316,25 @@ class Forms( BaseController ):
#
elif params.get( 'refresh', False ):
current_form = self.__get_form( trans, **kwd )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Show the form for editing
#
else:
current_form = self.__get_saved_form( fd )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
def __add_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
@@ -311,13 +351,22 @@ class Forms( BaseController ):
break
if index == -1:
# something wrong happened
- return self.__show( trans=trans, form=fd, current_form=current_form,
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
message='Error in adding selectfield option',
- status='error', response_redirect=response_redirect, **kwd )
+ status='error',
+ response_redirect=response_redirect,
+ **kwd )
# add an empty option
current_form[ 'fields' ][ index ][ 'selectlist' ].append( '' )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
def __remove_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
This method removes a selectbox option. The kwd dict searched for
@@ -334,13 +383,22 @@ class Forms( BaseController ):
break
if option == -1:
# something wrong happened
- return self.__show( trans=trans, form=fd, current_form=current_form,
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
message='Error in removing selectfield option',
- status='error', response_redirect=response_redirect, **kwd )
+ status='error',
+ response_redirect=response_redirect,
+ **kwd )
# remove the option
del current_form[ 'fields' ][ index ][ 'selectlist' ][ option ]
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
def __get_field(self, index, **kwd):
@@ -356,22 +414,22 @@ class Forms( BaseController ):
layout = params.get( 'field_layout_%i' % index, '' )
default = params.get( 'field_default_%i' % index, '' )
if field_type == 'SelectField':
- selectlist = self.__get_selectbox_options(index, **kwd)
- return {'label': name,
- 'helptext': helptext,
- 'visible': True,
- 'required': required,
- 'type': field_type,
- 'selectlist': selectlist,
- 'layout': layout,
- 'default': default }
- return {'label': name,
- 'helptext': helptext,
- 'visible': True,
- 'required': required,
- 'type': field_type,
- 'layout': layout,
- 'default': default}
+ options = self.__get_selectbox_options(index, **kwd)
+ return { 'label': name,
+ 'helptext': helptext,
+ 'visible': True,
+ 'required': required,
+ 'type': field_type,
+ 'selectlist': selectlist,
+ 'layout': layout,
+ 'default': default }
+ return { 'label': name,
+ 'helptext': helptext,
+ 'visible': True,
+ 'required': required,
+ 'type': field_type,
+ 'layout': layout,
+ 'default': default }
def __get_selectbox_options(self, index, **kwd):
'''
This method gets all the options entered by the user for field when
@@ -452,23 +510,23 @@ class Forms( BaseController ):
continue
options = row[5].split(',')
if len(row) >= 8:
- fields.append({'label': row[0],
- 'helptext': row[1],
- 'visible': row[2],
- 'required': row[3],
- 'type': row[4],
- 'selectlist': options,
- 'layout':row[6],
- 'default': row[7]})
+ fields.append( { 'label': row[0],
+ 'helptext': row[1],
+ 'visible': row[2],
+ 'required': row[3],
+ 'type': row[4],
+ 'selectlist': options,
+ 'layout':row[6],
+ 'default': row[7] } )
layouts.add(row[6])
else:
- fields.append({'label': row[0],
- 'helptext': row[1],
- 'visible': row[2],
- 'required': row[3],
- 'type': row[4],
- 'selectlist': options,
- 'default': row[6]})
+ fields.append( { 'label': row[0],
+ 'helptext': row[1],
+ 'visible': row[2],
+ 'required': row[3],
+ 'type': row[4],
+ 'selectlist': options,
+ 'default': row[6] } )
except:
return trans.response.send_redirect( web.url_for( controller='forms',
action='create_form',
@@ -570,8 +628,8 @@ class Forms( BaseController ):
refresh_on_change_values=['SelectField'])
if field_type:
field['type'] = unicode(field_type)
- if field_type == 'SelectField' and not field['selectlist']:
- field['selectlist'] = ['', '']
+ if field_type == 'SelectField' and not field[ 'selectlist' ]:
+ field[ 'selectlist' ] = ['', '']
# if the form is for defining samples, then use the sample field types
# which does not include TextArea & AddressField
if form_type == trans.app.model.FormDefinition.types.SAMPLE:
@@ -605,8 +663,8 @@ class Forms( BaseController ):
self.layout_selectbox.add_option("%i. %s" %(i+1, grid_name), i)
def selectbox_ui(self, field):
self.selectbox_options = []
- if field['selectlist']:
- for ctr, option in enumerate(field['selectlist']):
+ if field[ 'selectlist' ]:
+ for ctr, option in enumerate(field[ 'selectlist' ]):
self.selectbox_options.append(('Option '+str(ctr+1),
TextField('field_'+str(self.index)+'_option_'+str(ctr),
40, option)))
@@ -628,17 +686,14 @@ class Forms( BaseController ):
def label(self):
return str(self.index)+'.'+self.label
- def __show( self, trans, form, current_form, message='', status='done', response_redirect=None, **kwd ):
- '''
- This method displays the form and any of the changes made to it,
- The empty_form param allows for this method to simulate clicking
- the "add_field_button" on the edit_form.mako page so that the page
- is displayed with the first field to be added, saving a mouse click.
- '''
+ def __show( self, trans, form_definition, current_form, message='', status='done', response_redirect=None, **kwd ):
+ """
+ Displays the form and any of the changes made to it, The empty_form param allows for this method to
+ simulate clicking the "add_field_button" on the edit_form_definition.mako page so that the page is
+ displayed with the first field to be added, saving a mouse click.
+ """
params = util.Params( kwd )
# name & description
- # TODO: RC, I've changed Type to be a hidden field since it should not be displayed on the edit_form.mako
- # template. Make sure this is the optimal solution for this problem. See my additional TODO in edit_form.mako.
form_details = [ ( 'Name', TextField( 'name', 40, current_form[ 'name' ] ) ),
( 'Description', TextField( 'description', 40, current_form[ 'desc' ] ) ),
( 'Type', HiddenField( 'form_type_selectbox', current_form['type']) ) ]
@@ -654,10 +709,10 @@ class Forms( BaseController ):
else:
field_ui = self.FieldUI( trans, None, index, field, form_type=current_form['type'] )
field_details.append( field_ui.get() )
- return trans.fill_template( '/admin/forms/edit_form.mako',
+ return trans.fill_template( '/admin/forms/edit_form_definition.mako',
form_details=form_details,
field_details=field_details,
- form=form,
+ form_definition=form_definition,
field_types=BaseField.form_field_types(),
message=message,
status=status,
--- a/templates/admin/requests/create_request_type.mako
+++ b/templates/admin/requests/create_request_type.mako
@@ -69,12 +69,11 @@
<input type="text" name="data_dir" value="" size="40"/></div><div class="form-row">
- <label>Add experiment name and the sample name to the dataset name?</label>
+ <label>Prepend the experiment name and sample name to the dataset name?</label>
${rename_dataset_select_field.get_html()}
<div class="toolParamHelp" style="clear: both;">
- The datasets are renamed by prepending the experiment name and the sample name to the dataset name. <br/>This
- makes sure that dataset names remain unique in Galaxy even when they have the
- same name in the sequencer.
+ Galaxy datasets are renamed by prepending the experiment name and sample name to the dataset name, ensuring<br/>
+ dataset names remain unique in Galaxy even when multiple datasets have the same name on the sequencer.
</div></div><div class="form-row">
--- a/test/functional/test_library_security.py
+++ b/test/functional/test_library_security.py
@@ -393,8 +393,8 @@ class TestLibrarySecurity( TwillTestCase
# admin_user is associated with role1, so should have all permissions on imported datasets
check_edit_page( latest_3_lddas,
strings_displayed=[ 'Manage dataset permissions on',
- 'Role members can manage the roles associated with permissions on this dataset',
- 'Role members can import this dataset into their history for analysis' ] )
+ 'can manage the roles associated with permissions on this dataset',
+ 'can import this dataset into their history for analysis' ] )
self.logout()
# regular_user1 is associated with role1, so should have all permissions on imported datasets
self.login( email=regular_user1.email )
@@ -423,8 +423,8 @@ class TestLibrarySecurity( TwillTestCase
check_edit_page( latest_3_lddas,
strings_displayed=[ 'View Permissions' ],
strings_not_displayed=[ 'Manage dataset permissions on',
- 'Role members can manage roles associated with permissions on this library item',
- 'Role members can import this dataset into their history for analysis' ] )
+ 'can manage roles associated with permissions on this library item',
+ 'can import this dataset into their history for analysis' ] )
def test_060_restrict_access_to_library2( self ):
"""Testing restricting access to library2"""
# Logged in as admin_user
--- a/templates/admin/forms/show_form_read_only.mako
+++ /dev/null
@@ -1,115 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<%def name="render_grid( grid_index, grid_name, fields_dict )">
- %if grid_name:
- <div class="form-row">
- <h4>${grid_name}</h4>
- </div>
- %endif
- <div style="clear: both"></div>
- <table class="grid">
- <thead>
- <tr>
- %for index, field in fields_dict.items():
- <th>
- ${field['label']}
- <div class="toolParamHelp" style="clear: both;">
- <i>${field['helptext']}</i>
- </div>
- </th>
- %endfor
- <th></th>
- </tr>
- <thead>
- <tbody>
- <tr>
- %for index, field in fields_dict.items():
- <td>
- <div>${field['required']}</div>
-## <div>${field['type']}</div>
- </td>
- %endfor
- <th></th>
- </tr>
- %for index, field in fields_dict.items():
- <td>
-## <div>${field['required']}</div>
- <div><i>Type:</i></div>
- <div>${field['type']}</div>
- </td>
- %endfor
- <th></th>
- </tr>
- <tr>
- %for index, field in fields_dict.items():
- <td>
- %if field['type'] == 'SelectField':
- <div><i>Options:</i></div>
- %for option in field['selectlist']:
- <div>${option}</div>
- %endfor
- %endif
- </td>
- %endfor
- <th></th>
- </tr>
- <tbody>
- </table>
-</%def>
-
-<div class="toolForm">
- %if form_definition.desc:
- <div class="toolFormTitle">${form_definition.name} - <i> ${form_definition.desc}</i> (${form_definition.type})
- <a id="form_definition-${form_definition.id}-popup" class="popup-arrow" style="display: none;">▼</a>
- <div popupmenu="form_definition-${form_definition.id}-popup">
- <a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id(form_definition.current.id) )}">Edit</a>
- </div>
- </div>
- %else:
- <div class="toolFormTitle">${form_definition.name} (${form_definition.type})
- <a id="form_definition-${form_definition.id}-popup" class="popup-arrow" style="display: none;">▼</a>
- <div popupmenu="form_definition-${form_definition.id}-popup">
- <a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id(form_definition.current.id) )}">Edit</a>
- </div>
- </div>
- %endif
- <form name="library" action="${h.url_for( controller='forms', action='manage' )}" method="post" >
- %if form_definition.type == trans.app.model.FormDefinition.types.SAMPLE:
- %if not len(form_definition.layout):
- ${render_grid( 0, '', form_definition.grid_fields( None ) )}
- %else:
- %for grid_index, grid_name in enumerate(form_definition.layout):
- ${render_grid( grid_index, grid_name, form_definition.grid_fields( grid_index ) )}
- %endfor
- %endif
- %else:
- %for index, field in enumerate(form_definition.fields):
- <div class="form-row">
- <label>${field['label']}</label>
- %if field['helptext']:
- <div class="toolParamHelp" style="clear: both;">
- <i>${field['helptext']}</i>
- </div>
- %endif
- <div>${field['required']}</div>
- <i>Type: </i> ${field['type']}
- %if field['type'] == 'SelectField':
- <div>
- <div><i>Options:</i></div>
- %for option in field['selectlist']:
- <div>${option}</div>
- %endfor
- </div>
- %endif
- </div>
- <div style="clear: both"></div>
- %endfor
- %endif
- </form>
- </div>
-</div>
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -57,7 +57,7 @@ class RequestTypeGrid( grids.Grid ):
columns = [
NameColumn( "Name",
key="name",
- link=( lambda item: iff( item.deleted, None, dict( operation="view", id=item.id ) ) ),
+ link=( lambda item: iff( item.deleted, None, dict( operation="view_request_type", id=item.id ) ) ),
attach_popup=True,
filterable="advanced" ),
DescriptionColumn( "Description",
@@ -78,12 +78,12 @@ class RequestTypeGrid( grids.Grid ):
visible=False,
filterable="standard" ) )
operations = [
- grids.GridOperation( "Permissions", allow_multiple=False, condition=( lambda item: not item.deleted ) ),
+ grids.GridOperation( "Edit permissions", allow_multiple=False, condition=( lambda item: not item.deleted ) ),
grids.GridOperation( "Delete", allow_multiple=True, condition=( lambda item: not item.deleted ) ),
grids.GridOperation( "Undelete", condition=( lambda item: item.deleted ) ),
]
global_actions = [
- grids.GridAction( "Create new sequencer configuration", dict( controller='requests_admin', action='create_request_type' ) )
+ grids.GridAction( "Create new configuration", dict( controller='requests_admin', action='create_request_type' ) )
]
class DataTransferGrid( grids.Grid ):
@@ -638,23 +638,21 @@ class RequestsAdmin( BaseController, Use
err_msg += "Set your API Key in your User Preferences to transfer datasets."
# check if library_import_dir is set
if not trans.app.config.library_import_dir:
- err_msg = "'The library_import_dir' setting is not set in the Galaxy config file."
+ err_msg = "'The library_import_dir' setting is not correctly set in the Galaxy config file."
# check the RabbitMQ server settings in the config file
for k, v in trans.app.config.amqp.items():
if not v:
- err_msg += 'Set RabbitMQ server settings in the "galaxy_amqp" section of the Galaxy config file. %s is not set.' % k
+ err_msg += 'Set RabbitMQ server settings in the "galaxy_amqp" section of the Galaxy config file, specifically "%s" is not set.' % k
break
return err_msg
@web.expose
@web.require_admin
def initiate_data_transfer( self, trans, sample_id, sample_datasets=[], sample_dataset_id='' ):
'''
- This method initiates the transfer of the datasets from the sequencer. It
- happens in the following steps:
- - The current admin user needs to have LIBRARY_ADD permission for the
- target library and folder
- - Create an XML message encapsulating all the data transfer info and send it
- to the message queue (RabbitMQ broker)
+ Initiate the transfer of the datasets from the sequencer to the target Galaxy data library:
+ - The admin user must have LIBRARY_ADD permission for the target library and folder
+ - Create an XML message encapsulating all the data transfer information and send it
+ to the message queue (RabbitMQ broker).
'''
try:
sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) )
@@ -735,13 +733,13 @@ class RequestsAdmin( BaseController, Use
obj_id = kwd.get( 'id', None )
if operation == "view_form_definition":
return self.view_form_definition( trans, **kwd )
- elif operation == "view":
+ elif operation == "view_request_type":
return self.view_request_type( trans, **kwd )
elif operation == "delete":
return self.delete_request_type( trans, **kwd )
elif operation == "undelete":
return self.undelete_request_type( trans, **kwd )
- elif operation == "permissions":
+ elif operation == "edit permissions":
return self.request_type_permissions( trans, **kwd )
# Render the grid view
return self.requesttype_grid( trans, **kwd )
@@ -888,11 +886,9 @@ class RequestsAdmin( BaseController, Use
request_type = trans.sa_session.query( trans.model.RequestType ).get( trans.security.decode_id( request_type_id ) )
except:
return invalid_id_redirect( trans, 'requests_admin', request_type_id, action='browse_request_types' )
- forms = self.get_all_forms( trans )
rename_dataset_select_field = self.__build_rename_dataset_select_field( trans, request_type )
return trans.fill_template( '/admin/requests/view_request_type.mako',
request_type=request_type,
- forms=forms,
rename_dataset_select_field=rename_dataset_select_field )
@web.expose
@web.require_admin
@@ -902,7 +898,7 @@ class RequestsAdmin( BaseController, Use
form_definition = trans.sa_session.query( trans.model.FormDefinition ).get( trans.security.decode_id( form_definition_id ) )
except:
return invalid_id_redirect( trans, 'requests_admin', form_definition_id, action='browse_request_types' )
- return trans.fill_template( '/admin/forms/show_form_read_only.mako',
+ return trans.fill_template( '/admin/forms/view_form_definition.mako',
form_definition=form_definition )
@web.expose
@web.require_admin
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1494,7 +1494,7 @@ class TwillTestCase( unittest.TestCase )
def view_request_type( self, request_type_id, request_type_name, sample_states, strings_displayed=[] ):
'''View request_type details'''
self.home()
- self.visit_url( "%s/requests_admin/browse_request_types?operation=view&id=%s" % ( self.url, request_type_id ) )
+ self.visit_url( "%s/requests_admin/view_request_type?id=%s" % ( self.url, request_type_id ) )
self.check_page_for_string( 'Sequencer configuration information' )
self.check_page_for_string( request_type_name )
for name, desc in sample_states:
--- /dev/null
+++ b/templates/admin/forms/edit_form_definition.mako
@@ -0,0 +1,140 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+<script type="text/javascript">
+$(document).ready(function(){
+ //hide the all of the element with class msg_body
+ $(".msg_body").hide();
+ //toggle the componenet with class msg_body
+ $(".msg_head").click(function(){
+ $(this).next(".msg_body").slideToggle(450);
+ });
+});
+</script>
+<style type="text/css">
+.msg_head {
+ padding: 0px 0px;
+ cursor: pointer;
+}
+
+}
+</style>
+
+<%def name="render_selectbox_options( index, field_attr )">
+ %if field_attr[0] == 'Type':
+ %if field_attr[1].get_selected( return_label=True ) == 'SelectField':
+ <% options = field_attr[2] %>
+ <div class="repeat-group-item">
+ <div class="form-row">
+ <label> Options</label>
+ %for i, option in enumerate(options):
+ <div class="form-row">
+ <b> ${i+1}</b>
+ ${option[1].get_html()}
+ <input type="submit" name="removeoption_${index}_${i}" value="Remove"/>
+ </div>
+ %endfor
+ </div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="addoption_${index}" value="Add"/>
+ </div>
+ %endif
+ %endif
+</%def>
+
+<%def name="render_field( index, field, saved )">
+ %if saved:
+ <h4 class="msg_head">
+ <div class="form-row">${index+1}. ${field[0][1].value} (${field[2][1].get_selected( return_value=True )})</div>
+ </h4>
+ <div class="msg_body">
+ %else:
+ <div class="msg_body2">
+ %endif
+ <div class="repeat-group-item">
+ %for field_attr in field:
+ <div class="form-row">
+ <label>${field_attr[0]}</label>
+ ${field_attr[1].get_html()}
+ ${render_selectbox_options( index, field_attr )}
+ </div>
+ %endfor
+ <div class="form-row">
+ <input type="submit" name="remove_button" value="Remove field ${index+1}"/>
+ </div>
+ </div>
+ </div>
+</%def>
+
+<%def name="render_layout( index, widget )">
+ <div class="repeat-group-item">
+ <div class="form-row">
+ <b> ${index+1}</b>
+ ${widget.get_html()}
+ <input type="submit" name="remove_layout_grid_button" value="Remove grid ${index+1}"/>
+ </div>
+ </div>
+</%def>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='View', id=trans.security.encode_id( form_definition.current.id ) )}">View</a></li>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Edit form definition "${form_definition.name}"</div>
+ <form id="edit_form_definition" name="edit_form_definition" action="${h.url_for( controller='forms', action='edit', id=trans.security.encode_id( form_definition.current.id ) )}" method="post" >
+ %if response_redirect:
+ <input type="hidden" name="response_redirect" value="${response_redirect}" size="40" />
+ %endif
+ %for label, input in form_details:
+ <div class="form-row">
+ %if label != 'Type':
+ <label>${label}</label>
+ %endif
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ ${input.get_html()}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ %endfor
+ %if current_form_type == trans.app.model.FormDefinition.types.SAMPLE:
+ <div class="toolFormTitle">Form Layout</div>
+ <div class="form-row">
+ <label>Layout grid names</label>
+ </div>
+ %for index, lg in enumerate( layout_grids ):
+ ${render_layout( index, lg )}
+ %endfor
+ <div class="form-row">
+ <input type="submit" name="add_layout_grid" value="Add layout grid"/>
+ </div>
+ %endif
+ <div class="toolFormTitle">Form fields</div>
+ %for ctr, field in enumerate(field_details):
+ %if ctr < len( form_definition.fields ):
+ ${render_field( ctr, field, True )}
+ %else:
+ ${render_field( ctr, field, False )}
+ %endif
+ %endfor
+ <div class="form-row">
+ <input type="submit" name="add_field_button" value="Add field"/>
+ </div>
+ <div class="form-row">
+ ## TODO: Eliminate the need for this hidden refresh param
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ <input type="hidden" name="refresh" value="true" size="40"/>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="save_changes_button" value="Save"/>
+ </div>
+ </form>
+</div>
--- a/templates/webapps/galaxy/admin/center.mako
+++ b/templates/webapps/galaxy/admin/center.mako
@@ -51,9 +51,9 @@
be granted to users (a library item is one of: a data library, a library folder, a library dataset).
<p/><ul>
- <li><strong>add library item</strong> - Role members can add library items to this data library or folder</li>
- <li><strong>modify library item</strong> - Role members can modify this library item</li>
- <li><strong>manage library permissions</strong> - Role members can manage permissions applied to this library item</li>
+ <li><strong>add library item</strong> - Users that have the role can add library items to this data library or folder</li>
+ <li><strong>modify library item</strong> - Users that have the role can modify this library item</li>
+ <li><strong>manage library permissions</strong> - Users that have the role can manage permissions applied to this library item</li></ul><p/>
The default behavior is for no permissions to be applied to a data library item, but applied permissions are inherited downward (with the exception
--- a/templates/admin/requests/request_type_permissions.mako
+++ b/templates/admin/requests/request_type_permissions.mako
@@ -1,11 +1,6 @@
<%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
<script type="text/javascript">
$( document ).ready( function () {
$( '.role_add_button' ).click( function() {
@@ -28,19 +23,23 @@
});
</script>
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='view_request_type', id=trans.security.encode_id( request_type.id ) )}"><span>Browse this configuration</span></a></li>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
<div class="toolForm">
- <div class="toolFormTitle">Manage permissions on "${request_type.name}"</div>
+ <div class="toolFormTitle">Manage access permissions on sequencer interface "${request_type.name}"</div><div class="toolFormBody"><form name="request_type_permissions" id="request_type_permissions" action="${h.url_for( controller='requests_admin', action='request_type_permissions', id=trans.security.encode_id( request_type.id ) )}" method="post"><div class="form-row"><%
- obj_name = request_type.name
current_actions = request_type.actions
- permitted_actions = trans.app.model.RequestType.permitted_actions.items()
- action = trans.app.model.RequestType.permitted_actions.REQUEST_TYPE_ACCESS
- obj_str = 'request_type %s' % obj_name
- obj_type = 'request_type'
+ action = trans.app.security_agent.permitted_actions.REQUEST_TYPE_ACCESS
all_roles = roles
action_key = 'REQUEST_TYPE_ACCESS'
@@ -51,9 +50,7 @@
in_roles.add( a.role )
out_roles = filter( lambda x: x not in in_roles, all_roles )
%>
- <p>
- <b>access sequencer configuration:</b> Restrict access to this sequencer configuration to only role members
- </p>
+ ${action.description}<br/><br/><div style="width: 100%; white-space: nowrap;"><div style="float: left; width: 50%;">
Roles associated:<br/>
@@ -74,7 +71,6 @@
<input type="submit" id="${action_key}_add_button" class="role_add_button" value="<<"/></div></div>
-## </%def></div><div class="form-row"><input type="submit" name="update_roles_button" value="Save"/>
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -42,6 +42,8 @@ class Configuration( object ):
self.cookie_path = kwargs.get( "cookie_path", "/" )
# web API
self.enable_api = string_as_bool( kwargs.get( 'enable_api', False ) )
+ # Communication with a sequencer
+ self.enable_sequencer_communication = string_as_bool( kwargs.get( 'enable_sequencer_communication', False ) )
# dataset Track files
self.track_store_path = kwargs.get( "track_store_path", "${extra_files_path}/tracks")
self.tool_path = resolve_path( kwargs.get( "tool_path", "tools" ), self.root )
--- /dev/null
+++ b/templates/admin/forms/view_form_definition.mako
@@ -0,0 +1,85 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<%def name="render_grid( grid_index, grid_name, fields_dict )">
+ %if grid_name:
+ <div class="form-row">
+ <label>${grid_name}</label>
+ </div>
+ %endif
+ <div style="clear: both"></div>
+ <table class="grid">
+ <thead>
+ <tr>
+ %for index, field in fields_dict.items():
+ <th>${field[ 'label' ]}</th>
+ %endfor
+ </tr>
+ <thead>
+ <tbody>
+ <tr>
+ %for index, field in fields_dict.items():
+ <td>
+ ${field[ 'type' ]}: ${form_definition.field_as_html( field )}<br/>
+ <div class="toolParamHelp" style="clear: both;">
+ <i>${field[ 'helptext' ]}</i> - (${field[ 'required' ]})
+ </div>
+ %if field[ 'type' ] == 'SelectField':
+ <div class="toolParamHelp" style="clear: both;">
+ <label>Options:</label>
+ %for option in field[ 'selectlist' ]:
+ ${option}
+ %endfor
+ </div>
+ %endif
+ </td>
+ %endfor
+ </tr>
+ <tbody>
+ </table>
+</%def>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id( form_definition.current.id ) )}">Edit</a></li>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Form definition "${form_definition.name}"</div>
+ %if form_definition.type == trans.app.model.FormDefinition.types.SAMPLE:
+ %if form_definition.layout:
+ %for grid_index, grid_name in enumerate( form_definition.layout ):
+ ${render_grid( grid_index, grid_name, form_definition.grid_fields( grid_index ) )}
+ %endfor
+ %else:
+ ${render_grid( 0, '', form_definition.grid_fields( None ) )}
+ %endif
+ %else:
+ %for index, field in enumerate( form_definition.fields ):
+ <div class="form-row">
+ <label>${field[ 'label' ]}</label>
+ ${field[ 'type' ]}: ${form_definition.field_as_html( field )}
+ <div class="toolParamHelp" style="clear: both;">
+ <i>${field[ 'helptext' ]}</i> - (${field[ 'required' ]})
+ </div>
+ %if field[ 'type' ] == 'SelectField':
+ <div class="toolParamHelp" style="clear: both;">
+ <label>Options:</label>
+ %for option in field[ 'selectlist' ]:
+ ${option}
+ %endfor
+ </div>
+ %endif
+ </div>
+ <div style="clear: both"></div>
+ %endfor
+ %endif
+</div>
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -430,7 +430,7 @@
<input type="text" name="sample_${index}_field_${field_index}" value="${sample_values[field_index]}" size="7"/>
%elif field_type == 'SelectField':
<select name="sample_${index}_field_${field_index}" last_selected_value="2">
- %for option_index, option in enumerate(field['selectlist']):
+ %for option_index, option in enumerate(field[ 'selectlist' ]):
%if option == sample_values[field_index]:
<option value="${option}" selected>${option}</option>
%else:
1
0
galaxy-dist commit 796201bc8dbc: Enabled the cleanup method which was disabled by mistake in the previous commit.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289841891 18000
# Node ID 796201bc8dbc531ddaec5d75fadb88e858adfbc4
# Parent efc0b15af4026aa039945c799354e8cac5975528
Enabled the cleanup method which was disabled by mistake in the previous commit.
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -664,7 +664,7 @@ class TestFormsAndRequests( TwillTestCas
# # Make sure the request's state is now set to REJECTED
# assert request2.state is not request2.states.REJECTED, "The state of the request '%s' should be set to '%s'" \
# % ( request2.name, request2.states.REJECTED )
- def __test_055_reset_data_for_later_test_runs( self ):
+ def test_055_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
# Logged in as admin_user
self.logout()
1
0
galaxy-dist commit 095dc06e0728: Python 2.4 Compatibility Fix. ( with open():)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dannon Baker <dannonbaker(a)me.com>
# Date 1289832899 18000
# Node ID 095dc06e0728556426a9288e6448fd1114e24063
# Parent 47d6c393f4cf9562e4e3e10211389f84bf0a2f24
Python 2.4 Compatibility Fix. ( with open():)
--- a/lib/galaxy/jobs/splitters/basic.py
+++ b/lib/galaxy/jobs/splitters/basic.py
@@ -3,17 +3,19 @@ log = logging.getLogger( __name__ )
def _file_len(fname):
i = 0
- with open(fname) as f:
- for i, l in enumerate(f):
- pass
+ f = open(fname)
+ for i, l in enumerate(f):
+ pass
+ f.close()
return i + 1
def _fq_seq_count(fname):
count = 0
- with open(fname) as f:
- for i, l in enumerate(f):
- if l.startswith('@'):
- count += 1
+ f = open(fname)
+ for i, l in enumerate(f):
+ if l.startswith('@'):
+ count += 1
+ f.close()
return count
def split_fq(input_file, working_directory, parts):
@@ -25,25 +27,27 @@ def split_fq(input_file, working_directo
if length < parts:
parts = length
len_each, remainder = divmod(length, parts)
- with open(input_file, 'rt') as f:
- for p in range(0, parts):
- part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
- if not os.path.exists( part_dir ):
- os.mkdir( part_dir )
- part_path = os.path.join(part_dir, os.path.basename(input_file))
- with open(part_path, 'w') as part_file:
- for l in range(0, len_each):
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- if remainder > 0:
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- remainder -= 1
- outputs.append(part_path)
+ f = open(input_file, 'rt')
+ for p in range(0, parts):
+ part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
+ if not os.path.exists( part_dir ):
+ os.mkdir( part_dir )
+ part_path = os.path.join(part_dir, os.path.basename(input_file))
+ part_file = open(part_path, 'w')
+ for l in range(0, len_each):
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ if remainder > 0:
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ remainder -= 1
+ outputs.append(part_path)
+ part_file.close()
+ f.close()
return outputs
def split_txt(input_file, working_directory, parts):
@@ -52,19 +56,21 @@ def split_txt(input_file, working_direct
if length < parts:
parts = length
len_each, remainder = divmod(length, parts)
- with open(input_file, 'rt') as f:
- for p in range(0, parts):
- part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
- if not os.path.exists( part_dir ):
- os.mkdir( part_dir )
- part_path = os.path.join(part_dir, os.path.basename(input_file))
- with open(part_path, 'w') as part_file:
- for l in range(0, len_each):
- part_file.write(f.readline())
- if remainder > 0:
- part_file.write(f.readline())
- remainder -= 1
- outputs.append(part_path)
+ f = open(input_file, 'rt')
+ for p in range(0, parts):
+ part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
+ if not os.path.exists( part_dir ):
+ os.mkdir( part_dir )
+ part_path = os.path.join(part_dir, os.path.basename(input_file))
+ part_file = open(part_path, 'w')
+ for l in range(0, len_each):
+ part_file.write(f.readline())
+ if remainder > 0:
+ part_file.write(f.readline())
+ remainder -= 1
+ outputs.append(part_path)
+ part_file.close()
+ f.close()
return outputs
def split( input_file, working_directory, parts, file_type = None):
1
0