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

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/0c2b174f18e9
changeset: 3780:0c2b174f18e9
user: Dannon Baker <dannon.baker(a)emory.edu>
date: Thu May 13 12:03:17 2010 -0400
description:
Fix for issue where connecting to a Workflow Step that had been changed wasn't being saved
diffstat:
static/scripts/galaxy.workflow_editor.canvas.js | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diffs (11 lines):
diff -r 6dab2b0a9801 -r 0c2b174f18e9 static/scripts/galaxy.workflow_editor.canvas.js
--- a/static/scripts/galaxy.workflow_editor.canvas.js Thu May 13 09:35:57 2010 -0400
+++ b/static/scripts/galaxy.workflow_editor.canvas.js Thu May 13 12:03:17 2010 -0400
@@ -473,6 +473,7 @@
this.has_changes = true;
if ( this.active_node == node ) {
// Reactive with new form_html
+ this.check_changes_in_active_form(); //Force changes to be saved even on new connection (previously dumped)
parent.show_form_for_tool( node.form_html + node.tooltip, node );
}
},
1
0

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/6dab2b0a9801
changeset: 3779:6dab2b0a9801
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Thu May 13 09:35:57 2010 -0400
description:
Fix for changing a library dataset's data type ( resolves ticket # 333 ), add the library dataset's data type to the library dataset info page, and add <pre> tags to the tool description on the tool information page in the community space.
diffstat:
templates/library/common/ldda_edit_info.mako | 1 +
templates/library/common/ldda_info.mako | 5 +++++
templates/webapps/community/tool/edit_tool.mako | 2 +-
templates/webapps/community/tool/view_tool.mako | 2 +-
4 files changed, 8 insertions(+), 2 deletions(-)
diffs (50 lines):
diff -r eb91e90d3405 -r 6dab2b0a9801 templates/library/common/ldda_edit_info.mako
--- a/templates/library/common/ldda_edit_info.mako Wed May 12 17:43:29 2010 -0400
+++ b/templates/library/common/ldda_edit_info.mako Thu May 13 09:35:57 2010 -0400
@@ -101,6 +101,7 @@
%if ldda.datatype.allow_datatype_change:
<form name="change_datatype" action="${h.url_for( controller='library_common', action='ldda_edit_info', cntrller=cntrller, library_id=library_id, folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), use_panels=use_panels, show_deleted=show_deleted, )}" method="post">
<div class="form-row">
+ <input type="hidden" name="id" value="${trans.security.encode_id( ldda.id )}"/>
<label>New Type:</label>
${datatype( ldda, file_formats )}
<div class="toolParamHelp" style="clear: both;">
diff -r eb91e90d3405 -r 6dab2b0a9801 templates/library/common/ldda_info.mako
--- a/templates/library/common/ldda_info.mako Wed May 12 17:43:29 2010 -0400
+++ b/templates/library/common/ldda_info.mako Thu May 13 09:35:57 2010 -0400
@@ -80,6 +80,11 @@
<div style="clear: both"></div>
</div>
<div class="form-row">
+ <label>Data type:</label>
+ ${ldda.ext}
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
<label>Build:</label>
${ldda.dbkey}
<div style="clear: both"></div>
diff -r eb91e90d3405 -r 6dab2b0a9801 templates/webapps/community/tool/edit_tool.mako
--- a/templates/webapps/community/tool/edit_tool.mako Wed May 12 17:43:29 2010 -0400
+++ b/templates/webapps/community/tool/edit_tool.mako Thu May 13 09:35:57 2010 -0400
@@ -83,7 +83,7 @@
<div class="form-row">
<label>Description:</label>
%if tool.user_description:
- <div class="form-row-input"><textarea name="user_description" rows="5" cols="35">${tool.user_description}</textarea></div>
+ <div class="form-row-input"><pre><textarea name="user_description" rows="5" cols="35">${tool.user_description}</textarea></pre></div>
%else:
<div class="form-row-input"><textarea name="user_description" rows="5" cols="35"></textarea></div>
%endif
diff -r eb91e90d3405 -r 6dab2b0a9801 templates/webapps/community/tool/view_tool.mako
--- a/templates/webapps/community/tool/view_tool.mako Wed May 12 17:43:29 2010 -0400
+++ b/templates/webapps/community/tool/view_tool.mako Thu May 13 09:35:57 2010 -0400
@@ -119,7 +119,7 @@
<div class="form-row">
<label>Description:</label>
%if tool.user_description:
- ${tool.user_description}
+ <pre>${tool.user_description}</pre>
%endif
<div style="clear: both"></div>
</div>
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/eb91e90d3405
changeset: 3778:eb91e90d3405
user: Kanwei Li <kanwei(a)gmail.com>
date: Wed May 12 17:43:29 2010 -0400
description:
trackster:
- Prompt when leaving a viz with unsaved changes
- Can only add datatypes of the same dbkey
diffstat:
lib/galaxy/web/controllers/tracks.py | 8 ++++++++
static/scripts/packed/trackster.js | 2 +-
static/scripts/trackster.js | 28 ++++++++++++++++------------
templates/tracks/browser.mako | 20 ++++++++++++++------
4 files changed, 39 insertions(+), 19 deletions(-)
diffs (191 lines):
diff -r b762ea8e5508 -r eb91e90d3405 lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py Wed May 12 15:57:05 2010 -0400
+++ b/lib/galaxy/web/controllers/tracks.py Wed May 12 17:43:29 2010 -0400
@@ -48,6 +48,13 @@
}
class DatasetSelectionGrid( grids.Grid ):
+ class DbKeyColumn( grids.GridColumn ):
+ def filter( self, trans, user, query, dbkey ):
+ """ Filter by dbkey. """
+ # use raw SQL b/c metadata is a BLOB
+ dbkey = dbkey.replace("'", "\\'")
+ return query.filter( "metadata like '%%\"dbkey\": [\"%s\"]%%' OR metadata like '%%\"dbkey\": \"%s\"%%'" % (dbkey, dbkey) )
+
# Grid definition.
available_tracks = None
title = "Add Tracks"
@@ -61,6 +68,7 @@
columns = [
grids.TextColumn( "Name", key="name", model_class=model.HistoryDatasetAssociation ),
grids.GridColumn( "Filetype", key="extension" ),
+ DbKeyColumn( "Dbkey", key="dbkey", model_class=model.HistoryDatasetAssociation, visible=False )
]
def build_initial_query( self, session ):
diff -r b762ea8e5508 -r eb91e90d3405 static/scripts/packed/trackster.js
--- a/static/scripts/packed/trackster.js Wed May 12 15:57:05 2010 -0400
+++ b/static/scripts/packed/trackster.js Wed May 12 17:43:29 2010 -0400
@@ -1,1 +1,1 @@
-var DEBUG=false;var DENSITY=200,FEATURE_LEVELS=10,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...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="/static/images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="/static/images/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src="/static/images/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="/static/images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}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 Drawer=function(){};$.extend(Drawer.prototype,{intensity:function(b,a,c){},});drawer=new Drawer();var View=function(b,d,c,a){this.vis_id=c;this.dbkey=a;this.title=d;this.chrom=b;this.tracks=[];this.label_tracks=[];this.!
max_low=0;this.max_high=0;this.center=(this.max_high-this.max_low)/2;t
his.zoom_factor=3;this.zoom_level=0;this.track_id_counter=0};$.extend(View.prototype,{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},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)]},update_options:function(){var b=$("ul#sortable-ul").sortable("toArray");for(var c in b){var e=b[c].split("_li")[0].split("track_")[1];$("#viewport").append($("#track_"+e))}for(var d in view.tracks){var a=view.tracks[d];if(a&&a.update_options){a.update_options(d)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.center=this.center=(this.max_high-this.max_low)/2;this.zoom_level=0;$(".yaxislabel").remove()},redraw:function(f){this.span=this.max_high-this.max_low;var d=this.span/Math.pow(this.zoom_factor!
,this.zoom_level),b=this.center-(d/2),e=b+d;if(b<0){b=0;e=b+d}else{if(e>this.max_high){e=this.max_high;b=e-d}}this.low=Math.floor(b);this.high=Math.ceil(e);this.center=Math.round(this.low+(this.high-this.low)/2);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))));$("#overview-box").css({left:(this.low/this.span)*$("#overview-viewport").width(),width:Math.max(12,((this.high-this.low)/this.span)*$("#overview-viewport").width())}).show();$("#low").val(commatize(this.low));$("#high").val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(a,b){if(this.max_high===0||this.high-this.low<30){return}if(a){this.center=a/b.width()*(this.high-this.lo!
w)+this.low}this.zoom_level+=1;this.redraw()},zoom_out:function(){if(t
his.max_high===0){return}if(this.zoom_level<=0){this.zoom_level=0;return}this.zoom_level-=1;this.redraw()}});var Track=function(a,b){this.name=a;this.parent_element=b;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div></div>").addClass("track").append(this.header_div).append(this.content_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.content_div.css("height","30px");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(){};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var i=this.view.low,e=this.view.high,f=e-i,d=this.view.resolution;if(DEBUG){$("#debug").text(d+" "+this.view.zoom_res)}var k=$("<div style='position:!
relative;'></div>"),l=this.content_div.width()/f,h;this.content_div.c
hildren(":first").remove();this.content_div.append(k),this.max_height=0;var a=Math.floor(i/d/DENSITY);while((a*DENSITY*d)<e){var j=this.content_div.width()+"_"+this.view.zoom_level+"_"+a;var c=this.tile_cache.get(j);if(c){var g=a*DENSITY*d;var b=(g-i)*l;if(this.left_offset){b-=this.left_offset}c.css({left:b});k.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,j,i,e,a,d,k,l)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a){Track.call(this,null,a);this.track_type="LabelTrack";this.hidden=true;this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.vi!
ew,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 LineTrack=function(c,a,b){this.track_type="LineTrack";Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.height_px=100;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode:"Line"};if(b.min_value!==undefined){this.prefs.min_value=b.min_value}if(b.max_value!==undefined){this.prefs.max_value=b.max_value}if(b.mode!==undefined){this.prefs.mode=b.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertica!
l_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:nu
ll,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div></div>").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);var d=$("<div></div>").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px",left:"10px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.da!
ta_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){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 o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.prefs.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;!
h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}els
e{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(n){var a=$("<div></div>").addClass("form-row");var h="track_"+n+"_minval",k="track_"+n+"_maxval",e="track_"+n+"_mode",l=$("<label></label>").attr("for",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),m=$("<input></input>").attr("id",h).val(b),g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j),d=$("<label></label>").attr("for",e).text("Display mode:"),i=(this.prefs.mode===undefined?"Line":t!
his.prefs.mode),c=$('<select id="'+e+'"><option value="Line" id="mode_Line">Line</option><option value="Filled" id="mode_Filled">Filled</option><option value="Intensity" id="mode_Intensity">Intensity</option></select>');c.children("#mode_"+i).attr("selected","selected");return a.append(l).append(m).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!=this.prefs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=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_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(c,a,b){this.track_type="FeatureTrack";Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.h!
eight_px=100;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.default_font="9px Monaco, Lucida Console, monospace";this.left_offset=200;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.prefs={block_color:"black",label_color:"black",show_counts:false};if(b.block_color!==undefined){this.prefs.block_color=b.block_color}if(b.label_color!==undefined){this.prefs.label_color=b.label_color}if(b.show_counts!==undefined){this.prefs.show_counts=b.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;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},function(c){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},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,c){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,v=[],h=0,b=$("<canvas></canvas>").get(0).getContext("2d"),n=this.view.max_low;var d,f,x=[];for(var s=0,t=g.length;s<t;s++){var e=g[s],l=e[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);x.push(this.inc_slots[a][l])}else{v.push(s)}}for(var s=0,t=v.length;s<t;s++){var e=g[v[s]];l=e[0],feature_start=e[1],feature_end=e[2],feature_name=e[3];d=Math.floor((feature_start-n)*m);f=Math.ceil((feature_end-n)*m);if(!c){var p=b.measureText(feature_name).width;if(d-p<0){f+=p}else{d-=p}}var r=0;while(true){var o=true;if(this.s_e_by_tile[a][r]!==undefined){for(var q=0,w=this.s_e_by_tile[a][r].length;q<w;q++){var u!
=this.s_e_by_tile[a][r][q];if(f>u[0]&&d<u[1]){o=false;break}}}if(o){if
(this.s_e_by_tile[a][r]===undefined){this.s_e_by_tile[a][r]=[]}this.s_e_by_tile[a][r].push([d,f]);this.inc_slots[a][l]=r;h=Math.max(h,r);break}r++}}return h},rect_or_text:function(n,o,g,f,m,b,d,k,e,i){n.textAlign="center";var j=Math.round(o/2);if(d!==undefined&&o>g){n.fillStyle="#555";n.fillRect(k,i+1,e,9);n.fillStyle="#eee";for(var h=0,l=d.length;h<l;h++){if(b+h>=f&&b+h<=m){var a=Math.floor(Math.max(0,(b+h-f)*o));n.fillText(d[h],a+this.left_offset+j,i+9)}}}else{n.fillStyle="#555";n.fillRect(k,i+4,e,3)}},draw_tile:function(W,h,m,ak){var D=h*DENSITY*W,ac=(h+1)*DENSITY*W,C=DENSITY*W;var aj,r;var ad=D+"_"+ac;var w=this.data_cache.get(ad);if(w===undefined){this.data_queue[[D,ac]]=true;this.get_data(D,ac);return}if(w.dataset_type==="summary_tree"){r=30}else{var U=(w.extra_info==="no_detail");var al=(U?this.vertical_nodetail_px:this.vertical_detail_px);r=this.incremental_slots(this.view.zoom_res,w.data,U)*al+15;m.parent().css("height",Math.max(this.height_px,r)+"px");aj=this.inc_s!
lots[this.view.zoom_res]}var a=Math.ceil(C*ak),K=$("<canvas class='tile'></canvas>"),Y=this.prefs.label_color,f=this.prefs.block_color,O=this.left_offset;K.css({position:"absolute",top:0,left:(D-this.view.low)*ak-O});K.get(0).width=a+O;K.get(0).height=r;var z=K.get(0).getContext("2d"),ah=z.measureText("A").width;z.fillStyle=this.prefs.block_color;z.font=this.default_font;z.textAlign="right";if(w.dataset_type=="summary_tree"){var J,G=55,ab=255-G,g=ab*2/3,Q=w.data,B=w.max,l=w.avg;if(Q.length>2){var b=Math.ceil((Q[1][0]-Q[0][0])*ak)}else{var b=50}for(var af=0,v=Q.length;af<v;af++){var S=Math.ceil((Q[af][0]-D)*ak);var R=Q[af][1];if(!R){continue}J=Math.floor(ab-(R/B)*ab);z.fillStyle="rgb("+J+","+J+","+J+")";z.fillRect(S+O,0,b,20);if(this.prefs.show_counts){if(J>g){z.fillStyle="black"}else{z.fillStyle="#ddd"}z.textAlign="center";z.fillText(Q[af][1],S+O+(b/2),12)}}m.append(K);return K}var ai=w.data;var ae=0;for(var af=0,v=ai.length;af<v;af++){var L=ai[af],I=L[0],ag=L[1],T=L[2],E=L!
[3];if(ag<=ac&&T>=D){var V=Math.floor(Math.max(0,(ag-D)*ak)),A=Math.ce
il(Math.min(a,Math.max(0,(T-D)*ak))),P=aj[I]*al;if(w.dataset_type==="bai"){z.fillStyle="#555";if(L[4] instanceof Array){var s=Math.floor(Math.max(0,(L[4][0]-D)*ak)),H=Math.ceil(Math.min(a,Math.max(0,(L[4][1]-D)*ak))),q=Math.floor(Math.max(0,(L[5][0]-D)*ak)),o=Math.ceil(Math.min(a,Math.max(0,(L[5][1]-D)*ak)));if(L[4][1]>=D&&L[4][0]<=ac){this.rect_or_text(z,ak,ah,D,ac,L[4][0],L[4][2],s+O,H-s,P)}if(L[5][1]>=D&&L[5][0]<=ac){this.rect_or_text(z,ak,ah,D,ac,L[5][0],L[5][2],q+O,o-q,P)}if(q>H){z.fillStyle="#999";z.fillRect(H+O,P+5,q-H,1)}}else{z.fillStyle="#555";this.rect_or_text(z,ak,ah,D,ac,ag,E,V+O,A-V,P)}if(!U&&ag>D){z.fillStyle=this.prefs.label_color;if(h===0&&V-z.measureText(E).width<0){z.textAlign="left";z.fillText(I,A+2+O,P+8)}else{z.textAlign="right";z.fillText(I,V-2+O,P+8)}z.fillStyle="#555"}}else{if(w.dataset_type==="interval_index"){if(U){z.fillRect(V+O,P+5,A-V,1)}else{var u=L[4],N=L[5],X=L[6],e=L[7];var t,Z,F=null,am=null;if(N&&X){F=Math.floor(Math.max(0,(N-D)*ak));am=Ma!
th.ceil(Math.min(a,Math.max(0,(X-D)*ak)))}if(E!==undefined&&ag>D){z.fillStyle=Y;if(h===0&&V-z.measureText(E).width<0){z.textAlign="left";z.fillText(E,A+2+O,P+8)}else{z.textAlign="right";z.fillText(E,V-2+O,P+8)}z.fillStyle=f}if(e){if(u){if(u=="+"){z.fillStyle=RIGHT_STRAND}else{if(u=="-"){z.fillStyle=LEFT_STRAND}}z.fillRect(V+O,P,A-V,10);z.fillStyle=f}for(var ad=0,d=e.length;ad<d;ad++){var n=e[ad],c=Math.floor(Math.max(0,(n[0]-D)*ak)),M=Math.ceil(Math.min(a,Math.max((n[1]-D)*ak)));if(c>M){continue}t=5;Z=3;z.fillRect(c+O,P+Z,M-c,t);if(F!==undefined&&!(c>am||M<F)){t=9;Z=1;var aa=Math.max(c,F),p=Math.min(M,am);z.fillRect(aa+O,P+Z,p-aa,t)}}}else{t=9;Z=1;z.fillRect(V+O,P+Z,A-V,t);if(L.strand){if(L.strand=="+"){z.fillStyle=RIGHT_STRAND_INV}else{if(L.strand=="-"){z.fillStyle=LEFT_STRAND_INV}}z.fillRect(V+O,P,A-V,10);z.fillStyle=prefs.block_color}}}}}ae++}}m.append(K);return K},gen_options:function(i){var a=$("<div></div>").addClass("form-row");var e="track_"+i+"_block_color",k=$("<l!
abel></label>").attr("for",e).text("Block color:"),l=$("<input></input
>").attr("id",e).attr("name",e).val(this.prefs.block_color),j="track_"+i+"_label_color",g=$("<label></label>").attr("for",j).text("Text color:"),h=$("<input></input>").attr("id",j).attr("name",j).val(this.prefs.label_color),f="track_"+i+"_show_count",c=$("<label></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></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(c,a,b){FeatureTrack.call(this,c,a,b);this.track_type="ReadTrack";this.!
vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
\ No newline at end of file
+var DEBUG=false;var DENSITY=200,FEATURE_LEVELS=10,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...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="/static/images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="/static/images/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src="/static/images/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="/static/images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}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 Drawer=function(){};$.extend(Drawer.prototype,{intensity:function(b,a,c){},});drawer=new Drawer();var View=function(b,d,c,a){this.vis_id=c;this.dbkey=a;this.title=d;this.chrom=b;this.tracks=[];this.label_tracks=[];this.!
max_low=0;this.max_high=0;this.center=(this.max_high-this.max_low)/2;t
his.zoom_factor=3;this.zoom_level=0;this.track_id_counter=0;this.has_changes=false};$.extend(View.prototype,{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},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)]},update_options:function(){this.has_changes=true;var b=$("ul#sortable-ul").sortable("toArray");for(var c in b){var e=b[c].split("_li")[0].split("track_")[1];$("#viewport").append($("#track_"+e))}for(var d in view.tracks){var a=view.tracks[d];if(a&&a.update_options){a.update_options(d)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.center=this.center=(this.max_high-this.max_low)/2;this.zoom_level=0;$(".yaxislabel").remove()},redraw:function(f){this.span=t!
his.max_high-this.max_low;var d=this.span/Math.pow(this.zoom_factor,this.zoom_level),b=this.center-(d/2),e=b+d;if(b<0){b=0;e=b+d}else{if(e>this.max_high){e=this.max_high;b=e-d}}this.low=Math.floor(b);this.high=Math.ceil(e);this.center=Math.round(this.low+(this.high-this.low)/2);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))));$("#overview-box").css({left:(this.low/this.span)*$("#overview-viewport").width(),width:Math.max(12,((this.high-this.low)/this.span)*$("#overview-viewport").width())}).show();$("#low").val(commatize(this.low));$("#high").val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(a,b){if(this.max_high===0||this.high-t!
his.low<30){return}if(a){this.center=a/b.width()*(this.high-this.low)+
this.low}this.zoom_level+=1;this.redraw()},zoom_out:function(){if(this.max_high===0){return}if(this.zoom_level<=0){this.zoom_level=0;return}this.zoom_level-=1;this.redraw()}});var Track=function(a,b){this.name=a;this.parent_element=b;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div />").addClass("track").append(this.header_div).append(this.content_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.content_div.css("height","30px");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(){};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var i=this.view.low,e=this.view.high,f=e-i,d=this.view.resolution;if(DEBUG){$("#debug"!
).text(d+" "+this.view.zoom_res)}var k=$("<div style='position: relati
ve;'></div>"),l=this.content_div.width()/f,h;this.content_div.children(":first").remove();this.content_div.append(k),this.max_height=0;var a=Math.floor(i/d/DENSITY);while((a*DENSITY*d)<e){var j=this.content_div.width()+"_"+this.view.zoom_level+"_"+a;var c=this.tile_cache.get(j);if(c){var g=a*DENSITY*d;var b=(g-i)*l;if(this.left_offset){b-=this.left_offset}c.css({left:b});k.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,j,i,e,a,d,k,l)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a){Track.call(this,null,a);this.track_type="LabelTrack";this.hidden=true;this.container_div.addClass("label-track")};$.extend(Labe!
lTrack.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 LineTrack=function(c,a,b){this.track_type="LineTrack";Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.height_px=100;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode:"Line"};if(b.min_value!==undefined){this.prefs.min_value=b.min_value}if(b.max_value!==undefined){this.prefs.max_value=b.max_value}if(b.mode!==undefined){this.prefs.mode=b.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");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px",left:"10px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*!
d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){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 o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.prefs.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var!
u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if
(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(n){var a=$("<div />").addClass("form-row");var h="track_"+n+"_minval",k="track_"+n+"_maxval",e="track_"+n+"_mode",l=$("<label></label>").attr("for",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),m=$("<input></input>").attr("id",h).val(b),g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j),d=$("<label></label>").attr("for",e).text("Disp!
lay mode:"),i=(this.prefs.mode===undefined?"Line":this.prefs.mode),c=$('<select id="'+e+'"><option value="Line" id="mode_Line">Line</option><option value="Filled" id="mode_Filled">Filled</option><option value="Intensity" id="mode_Intensity">Intensity</option></select>');c.children("#mode_"+i).attr("selected","selected");return a.append(l).append(m).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!=this.prefs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=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_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(c,a,b){this.track_type="FeatureTrack";Track.call(!
this,c,$("#viewport"));TiledTrack.call(this);this.height_px=100;this.c
ontainer_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.default_font="9px Monaco, Lucida Console, monospace";this.left_offset=200;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.prefs={block_color:"black",label_color:"black",show_counts:false};if(b.block_color!==undefined){this.prefs.block_color=b.block_color}if(b.label_color!==undefined){this.prefs.label_color=b.label_color}if(b.show_counts!==undefined){this.prefs.show_counts=b.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;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},function(c){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},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,c){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,v=[],h=0,b=$("<canvas></canvas>").get(0).getContext("2d"),n=this.view.max_low;var d,f,x=[];for(var s=0,t=g.length;s<t;s++){var e=g[s],l=e[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);x.push(this.inc_slots[a][l])}else{v.push(s)}}for(var s=0,t=v.length;s<t;s++){var e=g[v[s]];l=e[0],feature_start=e[1],feature_end=e[2],feature_name=e[3];d=Math.floor((feature_start-n)*m);f=Math.ceil((feature_end-n)*m);if(!c){var p=b.measureText(feature_name).width;if(d-p<0){f+=p}else{d-=p}}var r=0;while(true){var o=true;if(this.s_e_by_tile[a][r]!==undefined){for(var!
q=0,w=this.s_e_by_tile[a][r].length;q<w;q++){var u=this.s_e_by_tile[a
][r][q];if(f>u[0]&&d<u[1]){o=false;break}}}if(o){if(this.s_e_by_tile[a][r]===undefined){this.s_e_by_tile[a][r]=[]}this.s_e_by_tile[a][r].push([d,f]);this.inc_slots[a][l]=r;h=Math.max(h,r);break}r++}}return h},rect_or_text:function(n,o,g,f,m,b,d,k,e,i){n.textAlign="center";var j=Math.round(o/2);if(d!==undefined&&o>g){n.fillStyle="#555";n.fillRect(k,i+1,e,9);n.fillStyle="#eee";for(var h=0,l=d.length;h<l;h++){if(b+h>=f&&b+h<=m){var a=Math.floor(Math.max(0,(b+h-f)*o));n.fillText(d[h],a+this.left_offset+j,i+9)}}}else{n.fillStyle="#555";n.fillRect(k,i+4,e,3)}},draw_tile:function(W,h,m,ak){var D=h*DENSITY*W,ac=(h+1)*DENSITY*W,C=DENSITY*W;var aj,r;var ad=D+"_"+ac;var w=this.data_cache.get(ad);if(w===undefined){this.data_queue[[D,ac]]=true;this.get_data(D,ac);return}if(w.dataset_type==="summary_tree"){r=30}else{var U=(w.extra_info==="no_detail");var al=(U?this.vertical_nodetail_px:this.vertical_detail_px);r=this.incremental_slots(this.view.zoom_res,w.data,U)*al+15;m.parent().css("hei!
ght",Math.max(this.height_px,r)+"px");aj=this.inc_slots[this.view.zoom_res]}var a=Math.ceil(C*ak),K=$("<canvas class='tile'></canvas>"),Y=this.prefs.label_color,f=this.prefs.block_color,O=this.left_offset;K.css({position:"absolute",top:0,left:(D-this.view.low)*ak-O});K.get(0).width=a+O;K.get(0).height=r;var z=K.get(0).getContext("2d"),ah=z.measureText("A").width;z.fillStyle=this.prefs.block_color;z.font=this.default_font;z.textAlign="right";if(w.dataset_type=="summary_tree"){var J,G=55,ab=255-G,g=ab*2/3,Q=w.data,B=w.max,l=w.avg;if(Q.length>2){var b=Math.ceil((Q[1][0]-Q[0][0])*ak)}else{var b=50}for(var af=0,v=Q.length;af<v;af++){var S=Math.ceil((Q[af][0]-D)*ak);var R=Q[af][1];if(!R){continue}J=Math.floor(ab-(R/B)*ab);z.fillStyle="rgb("+J+","+J+","+J+")";z.fillRect(S+O,0,b,20);if(this.prefs.show_counts){if(J>g){z.fillStyle="black"}else{z.fillStyle="#ddd"}z.textAlign="center";z.fillText(Q[af][1],S+O+(b/2),12)}}m.append(K);return K}var ai=w.data;var ae=0;for(var af=0,v=ai.lengt!
h;af<v;af++){var L=ai[af],I=L[0],ag=L[1],T=L[2],E=L[3];if(ag<=ac&&T>=D
){var V=Math.floor(Math.max(0,(ag-D)*ak)),A=Math.ceil(Math.min(a,Math.max(0,(T-D)*ak))),P=aj[I]*al;if(w.dataset_type==="bai"){z.fillStyle="#555";if(L[4] instanceof Array){var s=Math.floor(Math.max(0,(L[4][0]-D)*ak)),H=Math.ceil(Math.min(a,Math.max(0,(L[4][1]-D)*ak))),q=Math.floor(Math.max(0,(L[5][0]-D)*ak)),o=Math.ceil(Math.min(a,Math.max(0,(L[5][1]-D)*ak)));if(L[4][1]>=D&&L[4][0]<=ac){this.rect_or_text(z,ak,ah,D,ac,L[4][0],L[4][2],s+O,H-s,P)}if(L[5][1]>=D&&L[5][0]<=ac){this.rect_or_text(z,ak,ah,D,ac,L[5][0],L[5][2],q+O,o-q,P)}if(q>H){z.fillStyle="#999";z.fillRect(H+O,P+5,q-H,1)}}else{z.fillStyle="#555";this.rect_or_text(z,ak,ah,D,ac,ag,E,V+O,A-V,P)}if(!U&&ag>D){z.fillStyle=this.prefs.label_color;if(h===0&&V-z.measureText(E).width<0){z.textAlign="left";z.fillText(I,A+2+O,P+8)}else{z.textAlign="right";z.fillText(I,V-2+O,P+8)}z.fillStyle="#555"}}else{if(w.dataset_type==="interval_index"){if(U){z.fillRect(V+O,P+5,A-V,1)}else{var u=L[4],N=L[5],X=L[6],e=L[7];var t,Z,F=null,am=nul!
l;if(N&&X){F=Math.floor(Math.max(0,(N-D)*ak));am=Math.ceil(Math.min(a,Math.max(0,(X-D)*ak)))}if(E!==undefined&&ag>D){z.fillStyle=Y;if(h===0&&V-z.measureText(E).width<0){z.textAlign="left";z.fillText(E,A+2+O,P+8)}else{z.textAlign="right";z.fillText(E,V-2+O,P+8)}z.fillStyle=f}if(e){if(u){if(u=="+"){z.fillStyle=RIGHT_STRAND}else{if(u=="-"){z.fillStyle=LEFT_STRAND}}z.fillRect(V+O,P,A-V,10);z.fillStyle=f}for(var ad=0,d=e.length;ad<d;ad++){var n=e[ad],c=Math.floor(Math.max(0,(n[0]-D)*ak)),M=Math.ceil(Math.min(a,Math.max((n[1]-D)*ak)));if(c>M){continue}t=5;Z=3;z.fillRect(c+O,P+Z,M-c,t);if(F!==undefined&&!(c>am||M<F)){t=9;Z=1;var aa=Math.max(c,F),p=Math.min(M,am);z.fillRect(aa+O,P+Z,p-aa,t)}}}else{t=9;Z=1;z.fillRect(V+O,P+Z,A-V,t);if(L.strand){if(L.strand=="+"){z.fillStyle=RIGHT_STRAND_INV}else{if(L.strand=="-"){z.fillStyle=LEFT_STRAND_INV}}z.fillRect(V+O,P,A-V,10);z.fillStyle=prefs.block_color}}}}}ae++}}m.append(K);return K},gen_options:function(i){var a=$("<div />").addClass("for!
m-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(c,a,b){FeatureTrack.call(this,c,a,b);this.track_type="Rea!
dTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
\ No newline at end of file
diff -r b762ea8e5508 -r eb91e90d3405 static/scripts/trackster.js
--- a/static/scripts/trackster.js Wed May 12 15:57:05 2010 -0400
+++ b/static/scripts/trackster.js Wed May 12 17:43:29 2010 -0400
@@ -102,6 +102,7 @@
this.zoom_factor = 3;
this.zoom_level = 0;
this.track_id_counter = 0;
+ this.has_changes = false;
};
$.extend( View.prototype, {
add_track: function ( track ) {
@@ -117,10 +118,12 @@
this.label_tracks.push( label_track );
},
remove_track: function( track ) {
+ this.has_changes = true;
track.container_div.fadeOut('slow', function() { $(this).remove(); });
delete this.tracks[this.tracks.indexOf(track)];
},
update_options: function() {
+ this.has_changes = true;
var sorted = $("ul#sortable-ul").sortable('toArray');
for (var id_i in sorted) {
var id = sorted[id_i].split("_li")[0].split("track_")[1];
@@ -215,7 +218,7 @@
init_global: function () {
this.header_div = $("<div class='track-header'>").text( this.name );
this.content_div = $("<div class='track-content'>");
- this.container_div = $("<div></div>").addClass('track').append( this.header_div ).append( this.content_div );
+ this.container_div = $("<div />").addClass('track').append( this.header_div ).append( this.content_div );
this.parent_element.append( this.container_div );
},
init_each: function(params, success_fn) {
@@ -392,8 +395,8 @@
$('#linetrack_' + track_id + '_minval').remove();
$('#linetrack_' + track_id + '_maxval').remove();
- var min_label = $("<div></div>").addClass('yaxislabel').attr("id", 'linetrack_' + track_id + '_minval').text(track.prefs.min_value);
- var max_label = $("<div></div>").addClass('yaxislabel').attr("id", 'linetrack_' + track_id + '_maxval').text(track.prefs.max_value);
+ var min_label = $("<div />").addClass('yaxislabel').attr("id", 'linetrack_' + track_id + '_minval').text(track.prefs.min_value);
+ var max_label = $("<div />").addClass('yaxislabel').attr("id", 'linetrack_' + track_id + '_maxval').text(track.prefs.max_value);
max_label.css({ position: "relative", top: "25px", left: "10px" });
max_label.prependTo(track.container_div);
@@ -537,7 +540,7 @@
parent_element.append( canvas );
return canvas;
}, gen_options: function(track_id) {
- var container = $("<div></div>").addClass("form-row");
+ var container = $("<div />").addClass("form-row");
var minval = 'track_' + track_id + '_minval',
maxval = 'track_' + track_id + '_maxval',
@@ -604,7 +607,8 @@
init: function() {
var track = this,
key = track.view.max_low + '_' + track.view.max_high;
- this.init_each({ low: track.view.max_low,
+
+ this.init_each({ low: track.view.max_low,
high: track.view.max_high, dataset_id: track.dataset_id,
chrom: track.view.chrom, resolution: this.view.resolution }, function (result) {
track.data_cache.set(key, result);
@@ -948,18 +952,18 @@
parent_element.append( new_canvas );
return new_canvas;
}, gen_options: function(track_id) {
- var container = $("<div></div>").addClass("form-row");
+ var container = $("<div />").addClass("form-row");
var block_color = 'track_' + track_id + '_block_color',
- block_color_label = $('<label></label>').attr("for", block_color).text("Block color:"),
- block_color_input = $('<input></input>').attr("id", block_color).attr("name", block_color).val(this.prefs.block_color),
+ block_color_label = $('<label />').attr("for", block_color).text("Block color:"),
+ block_color_input = $('<input />').attr("id", block_color).attr("name", block_color).val(this.prefs.block_color),
label_color = 'track_' + track_id + '_label_color',
- label_color_label = $('<label></label>').attr("for", label_color).text("Text color:"),
- label_color_input = $('<input></input>').attr("id", label_color).attr("name", label_color).val(this.prefs.label_color),
+ label_color_label = $('<label />').attr("for", label_color).text("Text color:"),
+ label_color_input = $('<input />').attr("id", label_color).attr("name", label_color).val(this.prefs.label_color),
show_count = 'track_' + track_id + '_show_count',
- show_count_label = $('<label></label>').attr("for", show_count).text("Show summary counts"),
+ show_count_label = $('<label />').attr("for", show_count).text("Show summary counts"),
show_count_input = $('<input type="checkbox" style="float:left;"></input>').attr("id", show_count).attr("name", show_count).attr("checked", this.prefs.show_counts),
- show_count_div = $('<div></div>').append(show_count_input).append(show_count_label);
+ show_count_div = $('<div />').append(show_count_input).append(show_count_label);
return container.append(block_color_label).append(block_color_input).append(label_color_label).append(label_color_input).append(show_count_div);
}, update_options: function(track_id) {
diff -r b762ea8e5508 -r eb91e90d3405 templates/tracks/browser.mako
--- a/templates/tracks/browser.mako Wed May 12 15:57:05 2010 -0400
+++ b/templates/tracks/browser.mako Wed May 12 17:43:29 2010 -0400
@@ -110,7 +110,7 @@
error: function() { alert( "Couldn't create new browser" ) },
success: function(form_html) {
show_modal("New Track Browser", form_html, {
- "Cancel": function() { window.location = "/"; },
+ "Cancel": function() { window.location = "${h.url_for( controller='visualization', action='list' )}"; },
"Continue": function() { $(document).trigger("convert_dbkeys"); continue_fn(); }
});
$("#new-title").focus();
@@ -119,6 +119,12 @@
});
%endif
+ window.onbeforeunload = function() {
+ if ( view.has_changes ) {
+ return "There are unsaved changes to your visualization which will be lost.";
+ }
+ };
+
// Execute this when everything is ready
function init() {
$("ul#sortable-ul").sortable({
@@ -192,7 +198,7 @@
$("#add-track").bind( "click", function(e) {
$.ajax({
url: "${h.url_for( action='list_datasets' )}",
- data: {},
+ data: { "f-dbkey": view.dbkey },
error: function() { alert( "Grid refresh failed" ); },
success: function(table_html) {
show_modal("Add Track — Select Dataset(s)", table_html, {
@@ -219,6 +225,7 @@
break;
}
view.add_track(new_track);
+ view.has_changes = true;
sidebar_box(new_track);
}
});
@@ -262,13 +269,15 @@
},
success: function(vis_id) {
view.vis_id = vis_id;
+ view.has_changes = false;
hide_modal();
- }
+ },
+ error: function() { alert("Could not save visualization"); }
});
});
- view.add_label_track( new LabelTrack( $("#top-labeltrack" ) ) );
- view.add_label_track( new LabelTrack( $("#nav-labeltrack" ) ) );
+ view.add_label_track( new LabelTrack( $("#top-labeltrack") ) );
+ view.add_label_track( new LabelTrack( $("#nav-labeltrack") ) );
$.ajax({
url: "${h.url_for( action='chroms' )}",
@@ -328,7 +337,6 @@
del_icon.bind("click", function() {
$("#track_" + track_id + "_li").fadeOut('slow', function() { $("#track_" + track_id + "_li").remove(); });
view.remove_track(track);
- view.update_options();
});
icon_div.append(edit_icon).append(del_icon);
title.append(label).prepend(icon_div);
1
0

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/b762ea8e5508
changeset: 3777:b762ea8e5508
user: Dan Blankenberg <dan(a)bx.psu.edu>
date: Wed May 12 15:57:05 2010 -0400
description:
Several Fixes for Uploading Composite datatypes. Revert changeset 3769:69e70e588a8e.
diffstat:
lib/galaxy/tools/actions/upload_common.py | 3 +--
lib/galaxy/tools/parameters/grouping.py | 23 +++++++++++++++--------
lib/galaxy/web/controllers/tool_runner.py | 2 +-
tools/data_source/upload.py | 2 +-
4 files changed, 18 insertions(+), 12 deletions(-)
diffs (101 lines):
diff -r 997d55c65f49 -r b762ea8e5508 lib/galaxy/tools/actions/upload_common.py
--- a/lib/galaxy/tools/actions/upload_common.py Wed May 12 15:18:40 2010 -0400
+++ b/lib/galaxy/tools/actions/upload_common.py Wed May 12 15:57:05 2010 -0400
@@ -102,8 +102,7 @@
for data in precreated_datasets:
log.info( 'Cleaned up unclaimed precreated dataset (%s).' % ( data.id ) )
data.state = data.states.ERROR
- data.info = 'Unused precreated dataset to be deleted.'
- data.deleted = True
+ data.info = 'No file contents were available.'
def new_history_upload( trans, uploaded_dataset, state=None ):
hda = trans.app.model.HistoryDatasetAssociation( name = uploaded_dataset.name,
diff -r 997d55c65f49 -r b762ea8e5508 lib/galaxy/tools/parameters/grouping.py
--- a/lib/galaxy/tools/parameters/grouping.py Wed May 12 15:18:40 2010 -0400
+++ b/lib/galaxy/tools/parameters/grouping.py Wed May 12 15:57:05 2010 -0400
@@ -99,6 +99,17 @@
self.default_file_type = 'txt'
self.file_type_to_ext = { 'auto':self.default_file_type }
self.metadata_ref = 'files_metadata'
+ def get_composite_dataset_name( self, context ):
+ #FIXME: HACK
+ #Special case of using 'base_name' metadata for use as Dataset name needs to be done in a General Fashion, as defined within a particular Datatype.
+
+ #We get two different types of contexts here, one straight from submitted parameters, the other after being parsed into tool inputs
+ dataset_name = context.get('files_metadata|base_name', None )
+ if dataset_name is None:
+ dataset_name = context.get('files_metadata', {} ).get( 'base_name', None )
+ if dataset_name is None:
+ dataset_name = 'Uploaded Composite Dataset (%s)' % self.get_file_type( context )
+ return dataset_name
def get_file_base_name( self, context ):
fd = context.get('files_metadata|base_name','Galaxy_Composite_file')
return fd
@@ -241,6 +252,7 @@
for file_bunch in get_url_paste_urls_or_filename( context, override_name = name, override_info = info ):
if file_bunch.path:
break
+ file_bunch.space_to_tab = space_to_tab
return file_bunch, warnings
def get_filenames( context ):
rval = []
@@ -287,24 +299,18 @@
if meta_spec.set_in_upload:
if meta_name in files_metadata:
dataset.metadata[ meta_name ] = files_metadata[ meta_name ]
- dataset_name = None
- dataset_info = None
+ dataset.precreated_name = dataset.name = self.get_composite_dataset_name( context )
if dataset.datatype.composite_type == 'auto_primary_file':
#replace sniff here with just creating an empty file
temp_name, is_multi_byte = sniff.stream_to_file( StringIO.StringIO( d_type.generate_primary_file( dataset ) ), prefix='upload_auto_primary_file' )
dataset.primary_file = temp_name
dataset.space_to_tab = False
- dsn = dataset.metadata.get('base_name','Uploaded Composite Dataset (%s)' % file_type)
- dataset.precreated_name = dataset.name = dsn
else:
file_bunch, warnings = get_one_filename( groups_incoming[ 0 ] )
writable_files_offset = 1
dataset.primary_file = file_bunch.path
dataset.space_to_tab = file_bunch.space_to_tab
- dsn = dataset.metadata.get('base_name',file_bunch.precreated_name)
- dataset.precreated_name = dsn
- dataset.name = dsn
- dataset.warnings.extend( file_bunch.warnings )
+ dataset.warnings.extend( warnings )
if dataset.primary_file is None:#remove this before finish, this should create an empty dataset
raise Exception( 'No primary dataset file was available for composite upload' )
keys = [ value.name for value in writable_files.values() ]
@@ -315,6 +321,7 @@
dataset.composite_files[ key ] = None
else:
file_bunch, warnings = get_one_filename( group_incoming )
+ dataset.warnings.extend( warnings )
if file_bunch.path:
dataset.composite_files[ key ] = file_bunch.__dict__
else:
diff -r 997d55c65f49 -r b762ea8e5508 lib/galaxy/web/controllers/tool_runner.py
--- a/lib/galaxy/web/controllers/tool_runner.py Wed May 12 15:18:40 2010 -0400
+++ b/lib/galaxy/web/controllers/tool_runner.py Wed May 12 15:57:05 2010 -0400
@@ -203,7 +203,7 @@
d_type = dataset_upload_input.get_datatype( trans, kwd )
if d_type.composite_type is not None:
- datasets.append( create_dataset( 'Uploaded Composite Dataset (%s)' % dataset_upload_input.get_datatype_ext( trans, kwd ) ) )
+ datasets.append( create_dataset( dataset_upload_input.get_composite_dataset_name( kwd ) ) )
else:
params = Bunch( ** tool_state.inputs[dataset_upload_input.name][0] )
if params.file_data not in [ None, "" ]:
diff -r 997d55c65f49 -r b762ea8e5508 tools/data_source/upload.py
--- a/tools/data_source/upload.py Wed May 12 15:18:40 2010 -0400
+++ b/tools/data_source/upload.py Wed May 12 15:57:05 2010 -0400
@@ -299,7 +299,7 @@
break
elif dataset.composite_file_paths[value.name] is not None:
if not value.is_binary:
- if uploaded_dataset.composite_files[ value.name ].space_to_tab:
+ if value.space_to_tab:
sniff.convert_newlines_sep2tabs( dataset.composite_file_paths[ value.name ][ 'path' ] )
else:
sniff.convert_newlines( dataset.composite_file_paths[ value.name ][ 'path' ] )
1
0

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/997d55c65f49
changeset: 3776:997d55c65f49
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Wed May 12 15:18:40 2010 -0400
description:
Remove the hack I just committed for changing modENCODE fly and worm dbkeys, and translate the values in the tool configs.
diffstat:
lib/galaxy/tools/__init__.py | 6 ------
tools/data_source/fly_modencode.xml | 5 +++++
tools/data_source/worm_modencode.xml | 5 +++++
3 files changed, 10 insertions(+), 6 deletions(-)
diffs (46 lines):
diff -r 70747a610c28 -r 997d55c65f49 lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py Wed May 12 14:50:25 2010 -0400
+++ b/lib/galaxy/tools/__init__.py Wed May 12 15:18:40 2010 -0400
@@ -1646,12 +1646,6 @@
data.name = param_dict.get( 'name', data.name )
data.info = param_dict.get( 'info', data.name )
data.dbkey = param_dict.get( 'dbkey', data.dbkey )
- # HACK to map modENCODEfly dbkey, which is always "fly" to be dm2
- # and modENCODEworm dbkey, which is always "worm" to be ce6
- if data.dbkey == 'fly':
- data.dbkey = 'dm2'
- elif data.dbkey == 'worm':
- data.dbkey = 'ce6'
data.extension = param_dict.get( 'data_type', data.extension )
#TODO: these should be possible as part of data_source.py and external set_meta, see the upload tool:
if data.extension in [ 'txt', 'tabular' ]:
diff -r 70747a610c28 -r 997d55c65f49 tools/data_source/fly_modencode.xml
--- a/tools/data_source/fly_modencode.xml Wed May 12 14:50:25 2010 -0400
+++ b/tools/data_source/fly_modencode.xml Wed May 12 15:18:40 2010 -0400
@@ -7,6 +7,11 @@
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=modENCODEfly" />
</inputs>
<request_param_translation>
+ <request_param galaxy_name="dbkey" remote_name="dbkey" missing="dm2" >
+ <value_translation>
+ <value galaxy_value="dm2" remote_value="fly" />
+ </value_translation>
+ </request_param>
<request_param galaxy_name="URL" remote_name="URL" missing="">
<append_param separator="&" first_separator="?" join="=">
<value name="d" missing="" />
diff -r 70747a610c28 -r 997d55c65f49 tools/data_source/worm_modencode.xml
--- a/tools/data_source/worm_modencode.xml Wed May 12 14:50:25 2010 -0400
+++ b/tools/data_source/worm_modencode.xml Wed May 12 15:18:40 2010 -0400
@@ -7,6 +7,11 @@
<param name="GALAXY_URL" type="baseurl" value="/tool_runner?tool_id=modENCODEworm" />
</inputs>
<request_param_translation>
+ <request_param galaxy_name="dbkey" remote_name="dbkey" missing="ce6" >
+ <value_translation>
+ <value galaxy_value="ce6" remote_value="worm" />
+ </value_translation>
+ </request_param>
<request_param galaxy_name="URL" remote_name="URL" missing="">
<append_param separator="&" first_separator="?" join="=">
<value name="d" missing="" />
1
0

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/70747a610c28
changeset: 3775:70747a610c28
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Wed May 12 14:50:25 2010 -0400
description:
Force modENCODE worm dbkey to be ce6 and modENCODE fly dbkey to be dm2.
diffstat:
lib/galaxy/tools/__init__.py | 6 ++++++
tools/data_source/fly_modencode.xml | 2 +-
tools/data_source/worm_modencode.xml | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diffs (40 lines):
diff -r 58500dfab084 -r 70747a610c28 lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py Wed May 12 14:37:00 2010 -0400
+++ b/lib/galaxy/tools/__init__.py Wed May 12 14:50:25 2010 -0400
@@ -1646,6 +1646,12 @@
data.name = param_dict.get( 'name', data.name )
data.info = param_dict.get( 'info', data.name )
data.dbkey = param_dict.get( 'dbkey', data.dbkey )
+ # HACK to map modENCODEfly dbkey, which is always "fly" to be dm2
+ # and modENCODEworm dbkey, which is always "worm" to be ce6
+ if data.dbkey == 'fly':
+ data.dbkey = 'dm2'
+ elif data.dbkey == 'worm':
+ data.dbkey = 'ce6'
data.extension = param_dict.get( 'data_type', data.extension )
#TODO: these should be possible as part of data_source.py and external set_meta, see the upload tool:
if data.extension in [ 'txt', 'tabular' ]:
diff -r 58500dfab084 -r 70747a610c28 tools/data_source/fly_modencode.xml
--- a/tools/data_source/fly_modencode.xml Wed May 12 14:37:00 2010 -0400
+++ b/tools/data_source/fly_modencode.xml Wed May 12 14:50:25 2010 -0400
@@ -10,7 +10,7 @@
<request_param galaxy_name="URL" remote_name="URL" missing="">
<append_param separator="&" first_separator="?" join="=">
<value name="d" missing="" />
- <value name="dbkey" missing="" />
+ <value name="dbkey" missing="dm2" />
<value name="q" missing="" />
<value name="s" missing="" />
<value name="t" missing="" />
diff -r 58500dfab084 -r 70747a610c28 tools/data_source/worm_modencode.xml
--- a/tools/data_source/worm_modencode.xml Wed May 12 14:37:00 2010 -0400
+++ b/tools/data_source/worm_modencode.xml Wed May 12 14:50:25 2010 -0400
@@ -10,7 +10,7 @@
<request_param galaxy_name="URL" remote_name="URL" missing="">
<append_param separator="&" first_separator="?" join="=">
<value name="d" missing="" />
- <value name="dbkey" missing="" />
+ <value name="dbkey" missing="ce6" />
<value name="q" missing="" />
<value name="s" missing="" />
<value name="t" missing="" />
1
0

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/58500dfab084
changeset: 3774:58500dfab084
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Wed May 12 14:37:00 2010 -0400
description:
Fixes for displaying appropriate datasets in GBrowse wormbase, modENCODE worm, and modENCODE fly.
diffstat:
lib/galaxy/config.py | 2 +-
lib/galaxy/datatypes/interval.py | 32 ++++++++++++++++++------
tool-data/shared/gbrowse/gbrowse_build_sites.txt | 11 ++++++-
tool_conf.xml.sample | 2 +
universe_wsgi.ini.sample | 2 +-
5 files changed, 37 insertions(+), 12 deletions(-)
diffs (120 lines):
diff -r f5f6b6e0a784 -r 58500dfab084 lib/galaxy/config.py
--- a/lib/galaxy/config.py Wed May 12 11:43:57 2010 -0400
+++ b/lib/galaxy/config.py Wed May 12 14:37:00 2010 -0400
@@ -84,7 +84,7 @@
self.log_events = string_as_bool( kwargs.get( 'log_events', 'False' ) )
self.bx_display_sites = kwargs.get( 'bx_display_sites', "main" ).lower().split(",")
self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",")
- self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "main,test,tair" ).lower().split(",")
+ self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "wormbase,tair,modencode_worm,modencode_fly" ).lower().split(",")
self.genetrack_display_sites = kwargs.get( 'genetrack_display_sites', "main,test" ).lower().split(",")
self.brand = kwargs.get( 'brand', None )
self.wiki_url = kwargs.get( 'wiki_url', 'http://g2.trac.bx.psu.edu/' )
diff -r f5f6b6e0a784 -r 58500dfab084 lib/galaxy/datatypes/interval.py
--- a/lib/galaxy/datatypes/interval.py Wed May 12 11:43:57 2010 -0400
+++ b/lib/galaxy/datatypes/interval.py Wed May 12 14:37:00 2010 -0400
@@ -582,7 +582,7 @@
"""Initialize datatype, by adding GBrowse display app"""
Tabular.__init__(self, **kwd)
self.add_display_app( 'ucsc', 'display at UCSC', 'as_ucsc_display_file', 'ucsc_links' )
- self.add_display_app( 'c_elegans', 'display in Wormbase', 'as_gbrowse_display_file', 'gbrowse_links' )
+ self.add_display_app( 'gbrowse', 'display in Gbrowse', 'as_gbrowse_display_file', 'gbrowse_links' )
def set_meta( self, dataset, overwrite = True, **kwd ):
i = 0
for i, line in enumerate( file ( dataset.file_name ) ):
@@ -628,10 +628,24 @@
continue
if line.startswith( '##sequence-region' ): # ##sequence-region IV 6000000 6030000
elems = line.split()
- seqid = elems[1] # IV
- start = elems[2] # 6000000
- stop = elems[3] # 6030000
- break
+ if len( elems ) > 3:
+ # line looks like:
+ # ##sequence-region ctg123 1 1497228
+ seqid = elems[1] # IV
+ start = elems[2] # 6000000
+ stop = elems[3] # 6030000
+ break
+ elif len( elems ) == 2 and elems[1].find( '..' ) > 0:
+ # line looks like this:
+ # ##sequence-region X:120000..140000
+ elems = elems[1].split( ':' )
+ seqid = elems[0]
+ start = elems[1].split( '..' )[0]
+ stop = elems[1].split( '..' )[1]
+ break
+ else:
+ log.exception( "line (%s) uses an unsupported ##sequence-region definition." % str( line ) )
+ break
# Allow UCSC style browser and track info in the GFF file
if line.startswith("browser position"):
pos_info = line.split()[-1]
@@ -652,7 +666,8 @@
break
if i > 10:
break
- except:
+ except Exception, e:
+ log.exception( str( e ) )
seqid, start, stop = ( '', '', '' )
return ( seqid, str( start ), str( stop ) )
else:
@@ -681,8 +696,9 @@
if seqid and start and stop:
for site_name, site_url in util.get_gbrowse_sites_by_build( dataset.dbkey ):
if site_name in app.config.gbrowse_display_sites:
- redirect_url = urllib.quote_plus( "%s%s/?ref=%s&start=%s&stop=%s&eurl=%%s" %
- ( site_url, dataset.dbkey, seqid, start, stop ) )
+ # Old method, the one uncommented below now seems to be the way GBrowse wants the request
+ # redirect_url = urllib.quote_plus( "%s%s/?ref=%s&start=%s&stop=%s&eurl=%%s" % ( site_url, dataset.dbkey, seqid, start, stop ) )
+ redirect_url = urllib.quote_plus( "%s/?q=%s:%s..%s" % ( site_url, seqid, start, stop ) )
link = self._get_remote_call_url( redirect_url, site_name, dataset, type, app, base_url )
ret_val.append( ( site_name, link ) )
return ret_val
diff -r f5f6b6e0a784 -r 58500dfab084 tool-data/shared/gbrowse/gbrowse_build_sites.txt
--- a/tool-data/shared/gbrowse/gbrowse_build_sites.txt Wed May 12 11:43:57 2010 -0400
+++ b/tool-data/shared/gbrowse/gbrowse_build_sites.txt Wed May 12 14:37:00 2010 -0400
@@ -1,4 +1,11 @@
# wormbase sites / supported genomes
-main http://www.wormbase.org/db/seq/gbgff/c_elegans/ c_elegans,c_briggsae,c_remanei,c_brenneri,c_japonica,p_pristionchus,b_malayi
-test http://dev.wormbase.org/db/seq/gbrowse/c_elegans/ c_elegans,c_briggsae,c_remanei,c_brenneri,c_japonica,p_pristionchus,b_malayi
+wormbase http://www.wormbase.org/db/gb2/gbrowse/c_elegans ce8,ce7,ce6,ce5,ce4,ce3,ce2,cb3,cb2,cb1,caeRem3,caeRem2,caeRem1,caePb2,caePb1,caeJap2,caeJap1
+#test http://dev.wormbase.org/db/seq/gbrowse/c_elegans/ ce8,ce7,ce6,ce5,ce4,ce3,ce2,cb3,cb2,cb1,caeRem3,caeRem2,caeRem1,caePb2,caePb1,caeJap2,caeJap1
+
+# UCSC mirror that includes arabidopsis
tair http://arabidopsis.org/cgi-bin/gbrowse/ arabidopsis_tair8,arabidopsis
+
+# modENCODE worm and fly
+modencode_worm http://modencode.oicr.on.ca/fgb2/gbrowse/worm ce6
+modencode_fly http://modencode.oicr.on.ca/fgb2/gbrowse/fly dm2
+
diff -r f5f6b6e0a784 -r 58500dfab084 tool_conf.xml.sample
--- a/tool_conf.xml.sample Wed May 12 11:43:57 2010 -0400
+++ b/tool_conf.xml.sample Wed May 12 14:37:00 2010 -0400
@@ -10,10 +10,12 @@
<tool file="data_source/biomart.xml" />
<tool file="data_source/biomart_test.xml" />
<tool file="data_source/gramene_mart.xml" />
+ <tool file="data_source/fly_modencode.xml" />
<tool file="data_source/flymine.xml" />
<tool file="data_source/flymine_test.xml" />
<tool file="data_source/modmine.xml" />
<tool file="data_source/ratmine.xml" />
+ <tool file="data_source/worm_modencode.xml" />
<tool file="data_source/wormbase.xml" />
<tool file="data_source/wormbase_test.xml" />
<tool file="data_source/eupathdb.xml" />
diff -r f5f6b6e0a784 -r 58500dfab084 universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample Wed May 12 11:43:57 2010 -0400
+++ b/universe_wsgi.ini.sample Wed May 12 14:37:00 2010 -0400
@@ -108,7 +108,7 @@
# Comma separated list of bx / UCSC / gbrowse / GeneTrack browsers to use for viewing
bx_display_sites = main
ucsc_display_sites = main,test,archaea,ucla
-gbrowse_display_sites = main,test,tair
+gbrowse_display_sites = wormbase,tair,modencode_worm,modencode_fly
# Define your GeneTrack servers in tool-data/shared/genetrack/genetrack_sites.txt
#genetrack_display_sites =
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/f5f6b6e0a784
changeset: 3773:f5f6b6e0a784
user: Nate Coraor <nate(a)bx.psu.edu>
date: Wed May 12 11:43:57 2010 -0400
description:
Fix buildbot's builds.txt
diffstat:
buildbot_setup.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diffs (11 lines):
diff -r ef70e978e3fe -r f5f6b6e0a784 buildbot_setup.sh
--- a/buildbot_setup.sh Wed May 12 09:51:31 2010 -0400
+++ b/buildbot_setup.sh Wed May 12 11:43:57 2010 -0400
@@ -55,6 +55,7 @@
SAMPLES="
datatypes_conf.xml.sample
universe_wsgi.ini.sample
+tool-data/shared/ucsc/builds.txt.sample
"
DIRS="
1
0

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/ef70e978e3fe
changeset: 3772:ef70e978e3fe
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Wed May 12 09:51:31 2010 -0400
description:
Enable viewing of datasets via history/view when user is not logged in and/or when user does not have public username.
diffstat:
templates/root/history_common.mako | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (22 lines):
diff -r dea0ad16553e -r ef70e978e3fe templates/root/history_common.mako
--- a/templates/root/history_common.mako Wed May 12 09:18:05 2010 -0400
+++ b/templates/root/history_common.mako Wed May 12 09:51:31 2010 -0400
@@ -38,8 +38,16 @@
if for_editing:
display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
else:
- display_url = h.url_for( controller='dataset', action='display_by_username_and_slug',
- username=data.history.user.username, slug=dataset_id )
+ # Get URL for display only.
+ if data.history.user and data.history.user.username:
+ display_url = h.url_for( controller='dataset', action='display_by_username_and_slug',
+ username=data.history.user.username, slug=dataset_id )
+ else:
+ # HACK: revert to for_editing display URL when there is no user/username. This should only happen when
+ # there's no user/username because dataset is being displayed by history/view after error reported.
+ # There are no security concerns here because both dataset/display and dataset/display_by_username_and_slug
+ # check user permissions (to the same degree) before displaying.
+ display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
%>
<a class="icon-button display tooltip" title="Display data in browser" href="${display_url}"
%if for_editing:
1
0

20 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/dea0ad16553e
changeset: 3771:dea0ad16553e
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Wed May 12 09:18:05 2010 -0400
description:
Fixes for uploading a tool to the community space, and keep None from being displayed if there is no user_description.
diffstat:
lib/galaxy/webapps/community/controllers/common.py | 12 +-
lib/galaxy/webapps/community/controllers/upload.py | 199 ++++++++++----------
lib/galaxy/webapps/community/datatypes/__init__.py | 10 +-
templates/webapps/community/tool/edit_tool.mako | 6 +-
templates/webapps/community/tool/view_tool.mako | 10 +-
5 files changed, 131 insertions(+), 106 deletions(-)
diffs (321 lines):
diff -r 7232b61da6d3 -r dea0ad16553e lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py Tue May 11 18:02:39 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Wed May 12 09:18:05 2010 -0400
@@ -28,8 +28,11 @@
else:
# There must not be any categories associated with the tool
trans.app.security_agent.set_entity_category_associations( tools=[ tool ], categories=[] )
- if params.get( 'description', False ):
- tool.user_description = util.restore_text( params.get( 'description', '' ) )
+ user_description = util.restore_text( params.get( 'user_description', '' ) )
+ if user_description:
+ tool.user_description = user_description
+ else:
+ tool.user_description = ''
trans.sa_session.add( tool )
trans.sa_session.flush()
message="Tool '%s' description and category associations have been saved" % tool.name
@@ -236,7 +239,10 @@
def get_tool( trans, id ):
return trans.sa_session.query( trans.model.Tool ).get( trans.app.security.decode_id( id ) )
def get_tools( trans ):
- return trans.sa_session.query( trans.model.Tool ).order_by( trans.model.Tool.name )
+ # Return only the latest version of each tool
+ return trans.sa_session.query( trans.model.Tool ) \
+ .filter( trans.model.Tool.newer_version_id == None ) \
+ .order_by( trans.model.Tool.name )
def get_approved_tools( trans, category=None ):
# TODO: write this as a query using eagerload - will be much faster.
ids = []
diff -r 7232b61da6d3 -r dea0ad16553e lib/galaxy/webapps/community/controllers/upload.py
--- a/lib/galaxy/webapps/community/controllers/upload.py Tue May 11 18:02:39 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Wed May 12 09:18:05 2010 -0400
@@ -26,112 +26,119 @@
replace_version = None
uploaded_file = None
categories = get_categories( trans )
- if not get_categories( trans ):
+ if not categories:
return trans.response.send_redirect( web.url_for( controller='tool',
action='browse_tools',
cntrller='tool',
message='No categories have been configured in this instance of the Galaxy Community. An administrator needs to create some via the Administrator control panel before anything can be uploaded',
status='error' ) )
- elif params.file_data == '' and params.url.strip() == '':
- message = 'No files were entered on the upload form.'
- status = 'error'
- elif params.file_data == '':
- try:
- uploaded_file = urllib2.urlopen( params.url.strip() )
- except ( ValueError, urllib2.HTTPError ), e:
- message = 'An error occurred trying to retrieve the URL entered on the upload form: %s' % e
+ if params.get( 'upload_button', False ):
+
+ url_paste = params.get( 'url', '' ).strip()
+ file_data = params.get( 'file_data', '' )
+ if file_data == '' and url_paste == '':
+ message = 'No files were entered on the upload form.'
status = 'error'
- except urllib2.URLError, e:
- message = 'An error occurred trying to retrieve the URL entered on the upload form: %s' % e.reason
- status = 'error'
- elif params.file_data not in ( '', None ):
- uploaded_file = params.file_data.file
- if params.upload_button and uploaded_file:
- datatype = trans.app.datatypes_registry.get_datatype_by_extension( params.upload_type )
- if datatype is None:
- message = 'An unknown file type was selected. This should not be possible, please report the error.'
- status = 'error'
- else:
+ elif file_data == '':
try:
- # Initialize the tool object
- meta = datatype.verify( uploaded_file )
- meta.user = trans.user
- meta.guid = trans.app.security.get_new_guid()
- obj = datatype.create_model_object( meta )
- trans.sa_session.add( obj )
- if isinstance( obj, trans.app.model.Tool ):
- existing = trans.sa_session.query( trans.app.model.Tool ).filter_by( tool_id = meta.id ).first()
- if existing and replace_id is None:
- raise UploadError( 'A tool with the same ID already exists. If you are trying to update this tool to a new version, please use the upload form on the "Edit Tool" page. Otherwise, please choose a new ID.' )
- elif existing:
- replace_version = trans.sa_session.query( trans.app.model.Tool ).get( trans.security.decode_id( replace_id ) )
- if replace_version.newer_version:
- # If the user has picked an old version, switch to the newest version
- replace_version = get_versions( trans, replace_version )[0]
- if replace_version.tool_id != meta.id:
- raise UploadError( 'The new tool id (%s) does not match the old tool id (%s). Check the tool XML file' % ( meta.id, replace_version.tool_id ) )
- for old_version in get_versions( trans, replace_version ):
- if old_version.version == meta.version:
- raise UploadError( 'The new version (%s) matches an old version. Check your version in the tool XML file' % meta.version )
- if old_version.is_new():
- raise UploadError( 'There is an existing version of this tool which has not yet been submitted for approval, so either <a href="%s">submit or delete it</a> before uploading a new version.' % url_for( controller='common',
- action='view_tool',
- cntrller='tool',
- id=trans.security.encode_id( old_version.id ) ) )
- if old_version.is_waiting():
- raise UploadError( 'There is an existing version of this tool which is waiting for administrative approval, so contact an administrator for help.' )
- # Defer setting the id since the newer version id doesn't exist until the new Tool object is flushed
- if category_ids:
- for category_id in category_ids:
- category = trans.app.model.Category.get( trans.security.decode_id( category_id ) )
- # Initialize the tool category
- tca = trans.app.model.ToolCategoryAssociation( obj, category )
- trans.sa_session.add( tca )
- # Initialize the tool event
- event = trans.app.model.Event( state=trans.app.model.Tool.states.NEW )
- # Flush to get an event id
- trans.sa_session.add( event )
+ uploaded_file = urllib2.urlopen( url_paste )
+ except ( ValueError, urllib2.HTTPError ), e:
+ message = 'An error occurred trying to retrieve the URL entered on the upload form: %s' % e
+ status = 'error'
+ except urllib2.URLError, e:
+ message = 'An error occurred trying to retrieve the URL entered on the upload form: %s' % e.reason
+ status = 'error'
+ elif file_data not in ( '', None ):
+ uploaded_file = file_data.file
+ if uploaded_file:
+ # TODO: tool should no longer be the default when we upload histories and workflows
+ upload_type = params.get( 'upload_type', 'tool' )
+ datatype = trans.app.datatypes_registry.get_datatype_by_extension( upload_type )
+ if datatype is None:
+ message = 'An unknown file type was selected. This should not be possible, please report the error.'
+ status = 'error'
+ else:
+ try:
+ # Initialize the tool object
+ meta = datatype.verify( uploaded_file )
+ meta.user = trans.user
+ meta.guid = trans.app.security.get_new_guid()
+ obj = datatype.create_model_object( meta )
+ trans.sa_session.add( obj )
+ if isinstance( obj, trans.app.model.Tool ):
+ existing = trans.sa_session.query( trans.app.model.Tool ).filter_by( tool_id = meta.id ).first()
+ if existing and replace_id is None:
+ raise UploadError( 'A tool with the same ID already exists. If you are trying to update this tool to a new version, please use the upload form on the "Edit Tool" page. Otherwise, please choose a new ID.' )
+ elif existing:
+ replace_version = trans.sa_session.query( trans.app.model.Tool ).get( trans.security.decode_id( replace_id ) )
+ if replace_version.newer_version:
+ # If the user has picked an old version, switch to the newest version
+ replace_version = get_versions( trans, replace_version )[0]
+ if replace_version.tool_id != meta.id:
+ raise UploadError( 'The new tool id (%s) does not match the old tool id (%s). Check the tool XML file' % ( meta.id, replace_version.tool_id ) )
+ for old_version in get_versions( trans, replace_version ):
+ if old_version.version == meta.version:
+ raise UploadError( 'The new version (%s) matches an old version. Check your version in the tool XML file' % meta.version )
+ if old_version.is_new():
+ raise UploadError( 'There is an existing version of this tool which has not yet been submitted for approval, so either <a href="%s">submit or delete it</a> before uploading a new version.' % url_for( controller='common',
+ action='view_tool',
+ cntrller='tool',
+ id=trans.security.encode_id( old_version.id ) ) )
+ if old_version.is_waiting():
+ raise UploadError( 'There is an existing version of this tool which is waiting for administrative approval, so contact an administrator for help.' )
+ # Defer setting the id since the newer version id doesn't exist until the new Tool object is flushed
+ if category_ids:
+ for category_id in category_ids:
+ category = trans.app.model.Category.get( trans.security.decode_id( category_id ) )
+ # Initialize the tool category
+ tca = trans.app.model.ToolCategoryAssociation( obj, category )
+ trans.sa_session.add( tca )
+ # Initialize the tool event
+ event = trans.app.model.Event( state=trans.app.model.Tool.states.NEW )
+ # Flush to get an event id
+ trans.sa_session.add( event )
+ trans.sa_session.flush()
+ tea = trans.app.model.ToolEventAssociation( obj, event )
+ trans.sa_session.add( tea )
+ if replace_version and replace_id:
+ replace_version.newer_version_id = obj.id
+ trans.sa_session.add( replace_version )
trans.sa_session.flush()
- tea = trans.app.model.ToolEventAssociation( obj, event )
- trans.sa_session.add( tea )
- if replace_version and replace_id:
- replace_version.newer_version_id = obj.id
- trans.sa_session.add( replace_version )
- trans.sa_session.flush()
- try:
- os.link( uploaded_file.name, obj.file_name )
- except OSError:
- shutil.copy( uploaded_file.name, obj.file_name )
- # We're setting cntrller to 'tool' since that is the only controller from which we can upload
+ try:
+ os.link( uploaded_file.name, obj.file_name )
+ except OSError:
+ shutil.copy( uploaded_file.name, obj.file_name )
+ # We're setting cntrller to 'tool' since that is the only controller from which we can upload
+ # TODO: this will need tweaking when we can upload histories or workflows
+ return trans.response.send_redirect( web.url_for( controller='common',
+ action='edit_tool',
+ cntrller='tool',
+ id=trans.app.security.encode_id( obj.id ),
+ message='Uploaded %s' % meta.message,
+ status='done' ) )
+ except ( datatypes.DatatypeVerificationError, UploadError ), e:
+ message = str( e )
+ status = 'error'
+ uploaded_file.close()
+ elif replace_id is not None:
+ replace_version = trans.sa_session.query( trans.app.model.Tool ).get( int( trans.app.security.decode_id( replace_id ) ) )
+ old_version = None
+ for old_version in get_versions( trans, replace_version ):
+ if old_version.is_new():
+ message = 'There is an existing version of this tool which has not been submitted for approval, so either submit or delete it before uploading a new version.'
+ break
+ if old_version.is_waiting():
+ message = 'There is an existing version of this tool which is waiting for administrative approval, so contact an administrator for help.'
+ break
+ else:
+ old_version = None
+ if old_version is not None:
return trans.response.send_redirect( web.url_for( controller='common',
- action='edit_tool',
+ action='view_tool',
cntrller='tool',
- id=trans.app.security.encode_id( obj.id ),
- message='Uploaded %s' % meta.message,
- status='done' ) )
- except ( datatypes.DatatypeVerificationError, UploadError ), e:
- message = str( e )
- status = 'error'
- uploaded_file.close()
- elif replace_id is not None:
- replace_version = trans.sa_session.query( trans.app.model.Tool ).get( int( trans.app.security.decode_id( replace_id ) ) )
- old_version = None
- for old_version in get_versions( trans, replace_version ):
- if old_version.is_new():
- message = 'There is an existing version of this tool which has not been submitted for approval, so either submit or delete it before uploading a new version.'
- break
- if old_version.is_waiting():
- message = 'There is an existing version of this tool which is waiting for administrative approval, so contact an administrator for help.'
- break
- else:
- old_version = None
- if old_version is not None:
- return trans.response.send_redirect( web.url_for( controller='common',
- action='view_tool',
- cntrller='tool',
- id=trans.app.security.encode_id( old_version.id ),
- message=message,
- status='error' ) )
+ id=trans.app.security.encode_id( old_version.id ),
+ message=message,
+ status='error' ) )
selected_upload_type = params.get( 'type', 'tool' )
selected_categories = [ trans.security.decode_id( id ) for id in category_ids ]
return trans.fill_template( '/webapps/community/upload/upload.mako',
diff -r 7232b61da6d3 -r dea0ad16553e lib/galaxy/webapps/community/datatypes/__init__.py
--- a/lib/galaxy/webapps/community/datatypes/__init__.py Tue May 11 18:02:39 2010 -0400
+++ b/lib/galaxy/webapps/community/datatypes/__init__.py Wed May 12 09:18:05 2010 -0400
@@ -120,11 +120,13 @@
rval.version = root.attrib['version']
except KeyError, e:
raise DatatypeVerificationError( 'Tool XML file does not conform to the specification. Missing required <tool> tag attribute: %s' % e )
- rval.description = None
+ rval.description = ''
desc_tag = root.find( 'description' )
- if desc_tag is not None:
- rval.description = desc_tag.text.strip()
- rval.message = 'Tool: %s %s, Version: %s, ID: %s' % ( rval.name, rval.description or '', rval.version, rval.id )
+ if desc_tag:
+ description = desc_tag.text
+ if description:
+ rval.description = description.strip()
+ rval.message = 'Tool: %s %s, Version: %s, ID: %s' % ( str( rval.name ), str( rval.description ), str( rval.version ), str( rval.id ) )
return rval
else:
raise DatatypeVerificationError( 'Unable to find a properly formatted tool XML file' )
diff -r 7232b61da6d3 -r dea0ad16553e templates/webapps/community/tool/edit_tool.mako
--- a/templates/webapps/community/tool/edit_tool.mako Tue May 11 18:02:39 2010 -0400
+++ b/templates/webapps/community/tool/edit_tool.mako Wed May 12 09:18:05 2010 -0400
@@ -82,7 +82,11 @@
</div>
<div class="form-row">
<label>Description:</label>
- <div class="form-row-input"><textarea name="description" rows="5" cols="35">${tool.user_description}</textarea></div>
+ %if tool.user_description:
+ <div class="form-row-input"><textarea name="user_description" rows="5" cols="35">${tool.user_description}</textarea></div>
+ %else:
+ <div class="form-row-input"><textarea name="user_description" rows="5" cols="35"></textarea></div>
+ %endif
<div style="clear: both"></div>
</div>
<div class="form-row">
diff -r 7232b61da6d3 -r dea0ad16553e templates/webapps/community/tool/view_tool.mako
--- a/templates/webapps/community/tool/view_tool.mako Tue May 11 18:02:39 2010 -0400
+++ b/templates/webapps/community/tool/view_tool.mako Wed May 12 09:18:05 2010 -0400
@@ -4,8 +4,12 @@
from galaxy.web.framework.helpers import time_ago
from urllib import quote_plus
+ menu_label = 'Edit information'
+
if cntrller in [ 'tool' ]:
can_edit = trans.app.security_agent.can_edit_item( trans.user, tool )
+ if can_edit:
+ menu_label = 'Edit information or submit for approval'
can_upload_new_version = trans.app.security_agent.can_upload_new_version( trans.user, tool, versions )
visible_versions = []
@@ -89,7 +93,7 @@
<a id="tool-${tool.id}-popup" class="popup-arrow" style="display: none;">▼</a>
<div popupmenu="tool-${tool.id}-popup">
%if cntrller=='admin' or can_edit:
- <a class="action-button" href="${h.url_for( controller='common', action='edit_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Edit information</a>
+ <a class="action-button" href="${h.url_for( controller='common', action='edit_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">${menu_label}</a>
%endif
<a class="action-button" href="${h.url_for( controller='tool', action='download_tool', id=trans.app.security.encode_id( tool.id ) )}">Download tool</a>
%if cntrller=='admin' or trans.user==tool.user:
@@ -114,7 +118,9 @@
</div>
<div class="form-row">
<label>Description:</label>
- ${tool.user_description}
+ %if tool.user_description:
+ ${tool.user_description}
+ %endif
<div style="clear: both"></div>
</div>
<div class="form-row">
1
0