galaxy-dev
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
October 2009
- 18 participants
- 172 discussions
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/7fd7bbe91838
changeset: 2874:7fd7bbe91838
user: Kelly Vincent <kpvincent(a)bx.psu.edu>
date: Mon Oct 12 14:40:01 2009 -0400
description:
Corrected Bowtie wrapper's output type (to SAM) for one missed condition, and also corrected problem with handling of full parameter list
1 file(s) affected in this change:
tools/sr_mapping/bowtie_wrapper.py
diffs (21 lines):
diff -r 4a3e48e1e8e1 -r 7fd7bbe91838 tools/sr_mapping/bowtie_wrapper.py
--- a/tools/sr_mapping/bowtie_wrapper.py Mon Oct 12 14:04:28 2009 -0400
+++ b/tools/sr_mapping/bowtie_wrapper.py Mon Oct 12 14:40:01 2009 -0400
@@ -119,7 +119,7 @@
('','-I %s'%options.minInsert)[options.minInsert!='None'],
('','-X %s'%options.maxInsert)[options.maxInsert!='None'],
('','--%s'%options.mateOrient)[options.mateOrient!='None'],
- ('','--pairtries %s'%options.maxAlignAttempt)[int(options.maxAlignAttempt)>=0],
+ ('','--pairtries %s'%options.maxAlignAttempt)[options.maxAlignAttempt!='None' and int(options.maxAlignAttempt)>=0],
('','--nofw')[options.forwardAlign=='noForward'],
('','--norc')[options.reverseAlign=='noReverse'],
('','--maxbts %s'%options.maxBacktracks)[options.maxBacktracks!='None' and (options.mismatchSeed=='2' or options.mismatchSeed=='3')],
@@ -133,7 +133,7 @@
('','--seed %s'%options.seed)[int(options.seed)>=0],
options.threads)
except ValueError:
- aligning_cmds = '-p %s' % options.threads
+ aligning_cmds = '-p %s -S' % options.threads
# prepare actual aligning commands
if options.paired == 'paired':
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/ebc1c19fc2d5
changeset: 2875:ebc1c19fc2d5
user: Kelly Vincent <kpvincent(a)bx.psu.edu>
date: Mon Oct 12 16:14:54 2009 -0400
description:
Changed Bowtie so that if alignment parameters cannot be read, it errors out
1 file(s) affected in this change:
tools/sr_mapping/bowtie_wrapper.py
diffs (14 lines):
diff -r 7fd7bbe91838 -r ebc1c19fc2d5 tools/sr_mapping/bowtie_wrapper.py
--- a/tools/sr_mapping/bowtie_wrapper.py Mon Oct 12 14:40:01 2009 -0400
+++ b/tools/sr_mapping/bowtie_wrapper.py Mon Oct 12 16:14:54 2009 -0400
@@ -132,8 +132,8 @@
('','-o %s'%options.offrate)[int(options.offrate)>=0],
('','--seed %s'%options.seed)[int(options.seed)>=0],
options.threads)
- except ValueError:
- aligning_cmds = '-p %s -S' % options.threads
+ except ValueError, erf:
+ stop_err('Something is wrong with the alignment parameters and the alignment could not be run\n' + str(erf))
# prepare actual aligning commands
if options.paired == 'paired':
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/e11e89fd2c82
changeset: 2876:e11e89fd2c82
user: Kanwei Li <kanwei(a)gmail.com>
date: Mon Oct 12 19:00:39 2009 -0400
description:
trackster: caching works, faster loops, displays exon blocks, passes JSLint
4 file(s) affected in this change:
static/scripts/packed/autocomplete_tagging.js
static/scripts/packed/trackster.js
static/scripts/trackster.js
static/trackster.css
diffs (513 lines):
diff -r ebc1c19fc2d5 -r e11e89fd2c82 static/scripts/packed/autocomplete_tagging.js
--- a/static/scripts/packed/autocomplete_tagging.js Mon Oct 12 16:14:54 2009 -0400
+++ b/static/scripts/packed/autocomplete_tagging.js Mon Oct 12 19:00:39 2009 -0400
@@ -1,1 +1,1 @@
-var ac_tag_area_id_gen=1;jQuery.fn.autocomplete_tagging=function(c){var e={get_toggle_link_text_fn:function(u){var w="";var v=o(u);if(v!=0){w=v+(v!=0?" Tags":" Tag")}else{w="Add tags"}return w},tag_click_fn:function(u,v){},input_size:20,in_form:false,tags:{},use_toggle_link:true,item_id:"",add_tag_img:"",add_tag_img_rollover:"",delete_tag_img:"",ajax_autocomplete_tag_url:"",ajax_retag_url:"",ajax_delete_tag_url:"",ajax_add_tag_url:""};var p=jQuery.extend(e,c);var k="tag-area-"+(ac_tag_area_id_gen)++;var m=$("<div>").attr("id",k).addClass("tag-area");this.append(m);var o=function(u){if(u.length){return u.length}var v=0;for(element in u){v++}return v};var b=function(){var u=p.get_toggle_link_text_fn(p.tags);var v=$("<a href='/history/tags'>").text(u).addClass("toggle-link");v.click(function(){var w=(m.css("display")=="none");var x;if(w){x=function(){var y=o(p.tags);if(y==0){m.click()}}}else{x=function(){m.blur()}}m.slideToggle("fast",x);return false});return v};var s=b();if(p.
use_toggle_link){this.prepend(s)}var t=function(u){var v=new Array();for(key in u){v[v.length]=key+"-->"+u[key]}return"{"+v.join(",")+"}"};var a=function(v,u){return v+((u!=""&&u)?":"+u:"")};var h=function(u){return u.split(":")};var i=function(u){var v=$("<img src='"+p.add_tag_img+"' rollover='"+p.add_tag_img_rollover+"'/>").addClass("add-tag-button");v.click(function(){$(this).hide();m.click();return false});return v};var j=function(u){var v=$("<img src='"+p.delete_tag_img+"'/>").addClass("delete-tag-img");v.mouseenter(function(){$(this).attr("src",p.delete_tag_img_rollover)});v.mouseleave(function(){$(this).attr("src",p.delete_tag_img)});v.click(function(){var D=$(this).parent();var C=D.find(".tag-name").eq(0);var B=C.text();var z=h(B);var F=z[0];var y=z[1];var E=D.prev();D.remove();delete p.tags[F];var A=p.get_toggle_link_text_fn(p.tags);s.text(A);$.ajax({url:p.ajax_delete_tag_url,data:{tag_name:F},error:function(){p.tags[F]=y;if(E.hasClass("tag-button")){E.after(D)}else
{m.prepend(D)}var G=p.get_toggle_link_text_fn(p.tags);alert("Remove tag failed");s.text(G);v.mouseenter(function(){$(this).attr("src",p.delete_tag_img_rollover)});v.mouseleave(function(){$(this).attr("src",p.delete_tag_img)})},success:function(){}});return true});var w=$("<span>").text(u).addClass("tag-name");w.click(function(){tag_name_and_value=u.split(":");p.tag_click_fn(tag_name_and_value[0],tag_name_and_value[1]);return true});var x=$("<span></span>").addClass("tag-button");x.append(w);x.append(v);return x};var d=function(v){var u;if(p.in_form){u=$("<textarea id='history-tag-input' rows='1' cols='"+p.input_size+"' value='"+escape(v)+"'></textarea>")}else{u=$("<input id='history-tag-input' type='text' size='"+p.input_size+"' value='"+escape(v)+"'></input>")}u.keyup(function(D){if(D.keyCode==27){$(this).trigger("blur")}else{if((D.keyCode==13)||(D.keyCode==188)||(D.keyCode==32)){new_value=this.value;if(return_key_pressed_for_autocomplete==true){return_key_pressed_for_autoc
omplete=false;return false}if(new_value.indexOf(": ",new_value.length-2)!=-1){this.value=new_value.substring(0,new_value.length-1);return false}if((D.keyCode==188)||(D.keyCode==32)){new_value=new_value.substring(0,new_value.length-1)}new_value=new_value.replace(/^\s+|\s+$/g,"");if(new_value.length<3){return false}this.value="";var A=j(new_value);var z=m.children(".tag-button");if(z.length!=0){var E=z.slice(z.length-1);E.after(A)}else{m.prepend(A)}var y=new_value.split(":");p.tags[y[0]]=y[1];var B=p.get_toggle_link_text_fn(p.tags);s.text(B);var C=$(this);$.ajax({url:p.ajax_add_tag_url,data:{new_tag:new_value},error:function(){A.remove();delete p.tags[y[0]];var F=p.get_toggle_link_text_fn(p.tags);s.text(F);alert("Add tag failed")},success:function(){C.flushCache()}});return false}}});var w=function(A,z,y,C,B){tag_name_and_value=C.split(":");return(tag_name_and_value.length==1?tag_name_and_value[0]:tag_name_and_value[1])};var x={selectFirst:false,formatItem:w,autoFill:false,hig
hlight:false};u.autocomplete(p.ajax_autocomplete_tag_url,x);u.addClass("tag-input");return u};for(tag_name in p.tags){var q=p.tags[tag_name];var l=a(tag_name,q);var g=j(l,s,p.tags);m.append(g)}var n=d("");var f=i(n);m.blur(function(u){r=o(p.tags);if(r!=0){f.show();n.hide();m.removeClass("active-tag-area")}else{}});m.append(f);m.append(n);n.hide();m.click(function(w){var v=$(this).hasClass("active-tag-area");if($(w.target).hasClass("delete-tag-img")&&!v){return false}if($(w.target).hasClass("tag-name")&&!v){return false}$(this).addClass("active-tag-area");f.hide();n.show();n.focus();var u=function(y){var x=m.attr("id");if(($(y.target).attr("id")!=x)&&($(y.target).parents().filter(x).length==0)){m.blur();$(document).unbind("click",u)}};$(window).click(u);return false});if(p.use_toggle_link){m.hide()}else{var r=o(p.tags);if(r==0){f.hide();n.show()}}return this.addClass("tag-element")};
\ No newline at end of file
+var ac_tag_area_id_gen=1;jQuery.fn.autocomplete_tagging=function(c){var e={get_toggle_link_text_fn:function(u){var w="";var v=o(u);if(v!=0){w=v+(v!=0?" Tags":" Tag")}else{w="Add tags"}return w},tag_click_fn:function(u,v){},editable:true,input_size:20,in_form:false,tags:{},use_toggle_link:true,item_id:"",add_tag_img:"",add_tag_img_rollover:"",delete_tag_img:"",ajax_autocomplete_tag_url:"",ajax_retag_url:"",ajax_delete_tag_url:"",ajax_add_tag_url:""};var p=jQuery.extend(e,c);var k="tag-area-"+(ac_tag_area_id_gen)++;var m=$("<div>").attr("id",k).addClass("tag-area");this.append(m);var o=function(u){if(u.length){return u.length}var v=0;for(element in u){v++}return v};var b=function(){var u=p.get_toggle_link_text_fn(p.tags);var v=$("<a href='/history/tags'>").text(u).addClass("toggle-link");v.click(function(){var w=(m.css("display")=="none");var x;if(w){x=function(){var y=o(p.tags);if(y==0){m.click()}}}else{x=function(){m.blur()}}m.slideToggle("fast",x);return false});return v};v
ar s=b();if(p.use_toggle_link){this.prepend(s)}var t=function(u){var v=new Array();for(key in u){v[v.length]=key+"-->"+u[key]}return"{"+v.join(",")+"}"};var a=function(v,u){return v+((u!=""&&u)?":"+u:"")};var h=function(u){return u.split(":")};var i=function(u){var v=$("<img src='"+p.add_tag_img+"' rollover='"+p.add_tag_img_rollover+"'/>").addClass("add-tag-button");v.click(function(){$(this).hide();m.click();return false});return v};var j=function(u){var v=$("<img src='"+p.delete_tag_img+"'/>").addClass("delete-tag-img");v.mouseenter(function(){$(this).attr("src",p.delete_tag_img_rollover)});v.mouseleave(function(){$(this).attr("src",p.delete_tag_img)});v.click(function(){var D=$(this).parent();var C=D.find(".tag-name").eq(0);var B=C.text();var z=h(B);var F=z[0];var y=z[1];var E=D.prev();D.remove();delete p.tags[F];var A=p.get_toggle_link_text_fn(p.tags);s.text(A);$.ajax({url:p.ajax_delete_tag_url,data:{tag_name:F},error:function(){p.tags[F]=y;if(E.hasClass("tag-button")){E
.after(D)}else{m.prepend(D)}var G=p.get_toggle_link_text_fn(p.tags);alert("Remove tag failed");s.text(G);v.mouseenter(function(){$(this).attr("src",p.delete_tag_img_rollover)});v.mouseleave(function(){$(this).attr("src",p.delete_tag_img)})},success:function(){}});return true});var w=$("<span>").text(u).addClass("tag-name");w.click(function(){tag_name_and_value=u.split(":");p.tag_click_fn(tag_name_and_value[0],tag_name_and_value[1]);return true});var x=$("<span></span>").addClass("tag-button");x.append(w);if(p.editable){x.append(v)}return x};var d=function(v){var u;if(p.in_form){u=$("<textarea id='history-tag-input' rows='1' cols='"+p.input_size+"' value='"+escape(v)+"'></textarea>")}else{u=$("<input id='history-tag-input' type='text' size='"+p.input_size+"' value='"+escape(v)+"'></input>")}u.keyup(function(D){if(D.keyCode==27){$(this).trigger("blur")}else{if((D.keyCode==13)||(D.keyCode==188)||(D.keyCode==32)){new_value=this.value;if(return_key_pressed_for_autocomplete==true)
{return_key_pressed_for_autocomplete=false;return false}if(new_value.indexOf(": ",new_value.length-2)!=-1){this.value=new_value.substring(0,new_value.length-1);return false}if((D.keyCode==188)||(D.keyCode==32)){new_value=new_value.substring(0,new_value.length-1)}new_value=new_value.replace(/^\s+|\s+$/g,"");if(new_value.length<3){return false}this.value="";var A=j(new_value);var z=m.children(".tag-button");if(z.length!=0){var E=z.slice(z.length-1);E.after(A)}else{m.prepend(A)}var y=new_value.split(":");p.tags[y[0]]=y[1];var B=p.get_toggle_link_text_fn(p.tags);s.text(B);var C=$(this);$.ajax({url:p.ajax_add_tag_url,data:{new_tag:new_value},error:function(){A.remove();delete p.tags[y[0]];var F=p.get_toggle_link_text_fn(p.tags);s.text(F);alert("Add tag failed")},success:function(){C.flushCache()}});return false}}});var w=function(A,z,y,C,B){tag_name_and_value=C.split(":");return(tag_name_and_value.length==1?tag_name_and_value[0]:tag_name_and_value[1])};var x={selectFirst:false,fo
rmatItem:w,autoFill:false,highlight:false};u.autocomplete(p.ajax_autocomplete_tag_url,x);u.addClass("tag-input");return u};for(tag_name in p.tags){var q=p.tags[tag_name];var l=a(tag_name,q);var g=j(l,s,p.tags);m.append(g)}var n=d("");var f=i(n);m.blur(function(u){r=o(p.tags);if(r!=0){f.show();n.hide();m.removeClass("active-tag-area")}else{}});if(p.editable){m.append(f);m.append(n);n.hide();m.click(function(w){var v=$(this).hasClass("active-tag-area");if($(w.target).hasClass("delete-tag-img")&&!v){return false}if($(w.target).hasClass("tag-name")&&!v){return false}$(this).addClass("active-tag-area");f.hide();n.show();n.focus();var u=function(y){var x=m.attr("id");if(($(y.target).attr("id")!=x)&&($(y.target).parents().filter(x).length==0)){m.blur();$(document).unbind("click",u)}};$(window).click(u);return false})}if(p.use_toggle_link){m.hide()}else{var r=o(p.tags);if(r==0){f.hide();n.show()}}return this.addClass("tag-element")};
\ No newline at end of file
diff -r ebc1c19fc2d5 -r e11e89fd2c82 static/scripts/packed/trackster.js
--- a/static/scripts/packed/trackster.js Mon Oct 12 16:14:54 2009 -0400
+++ b/static/scripts/packed/trackster.js Mon Oct 12 19:00:39 2009 -0400
@@ -1,1 +1,1 @@
-var DENSITY=1000,DATA_ERROR="There was an error in indexing this dataset.",DATA_NONE="No data for this chrom/contig.";var DataCache=function(b,a){this.type=b;this.track=a;this.cache=Object()};$.extend(DataCache.prototype,{get:function(d,b){var c=this.cache;if(!(c[d]&&c[d][b])){if(!c[d]){c[d]=Object()}var a=b*DENSITY*d;var e=(b+1)*DENSITY*d;c[d][b]={state:"loading"};$.getJSON(data_url,{track_type:this.track.track_type,chrom:this.track.view.chrom,low:a,high:e,dataset_id:this.track.dataset_id},function(f){if(f=="pending"){setTimeout(fetcher,5000)}else{c[d][b]={state:"loaded",values:f}}$(document).trigger("redraw")})}return c[d][b]}});var View=function(a,b){this.chrom=a;this.tracks=[];this.max_low=0;this.max_high=b;this.low=this.max_low;this.high=this.max_high;this.length=this.max_high-this.max_low};$.extend(View.prototype,{add_track:function(a){a.view=this;this.tracks.push(a);if(a.init){a.init()}},redraw:function(){$("#overview-box").css({left:(this.low/this.length)*$("#overvie
w-viewport").width(),width:Math.max(4,((this.high-this.low)/this.length)*$("#overview-viewport").width())}).show();$("#low").text(this.low);$("#high").text(this.high);for(var a in this.tracks){this.tracks[a].draw()}$("#bottom-spacer").remove();$("#viewport").append('<div id="bottom-spacer" style="height: 200px;"></div>')},move:function(b,a){this.low=Math.max(this.max_low,Math.floor(b));this.high=Math.min(this.length,Math.ceil(a))},zoom_in:function(d,b){if(this.max_high==0){return}var c=this.high-this.low;var e=c/d/2;if(b==undefined){var a=(this.low+this.high)/2}else{var a=this.low+c*b/$(document).width()}this.low=Math.floor(a-e);this.high=Math.ceil(a+e);if(this.low<this.max_low){this.low=this.max_low;this.high=c/d}else{if(this.high>this.max_high){this.high=this.max_high;this.low=this.max_high-c/d}}if(this.high-this.low<1){this.high=this.low+1}},zoom_out:function(c){if(this.max_high==0){return}var a=(this.low+this.high)/2;var b=this.high-this.low;var d=b*c/2;this.low=Math.flo
or(Math.max(0,a-d));this.high=Math.ceil(Math.min(this.length,a+d))},left:function(b){var a=this.high-this.low;var c=Math.floor(a/b);if(this.low-c<0){this.low=0;this.high=this.low+a}else{this.low-=c;this.high-=c}},right:function(b){var a=this.high-this.low;var c=Math.floor(a/b);if(this.high+c>this.length){this.high=this.length;this.low=this.high-a}else{this.low+=c;this.high+=c}}});var Track=function(a,b){this.name=a;this.parent_element=b;this.make_container()};$.extend(Track.prototype,{make_container:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div class='track'></div>").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)}});var TiledTrack=function(){this.last_resolution=null;this.last_w_scale=null;this.tile_cache={}};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var i=this.view.low,c=this.view.high,e=c-i;var b=Mat
h.pow(10,Math.ceil(Math.log(e/DENSITY)/Math.log(10)));b=Math.max(b,1);b=Math.min(b,100000);var m=$("<div style='position: relative;'></div>");this.content_div.children(":first").remove();this.content_div.append(m);var k=this.content_div.width(),d=this.content_div.height(),n=k/e,j={},l={};if(this.last_resolution==b&&this.last_w_scale==n){j=this.tile_cache}var g;var a=Math.floor(i/b/DENSITY);while((a*1000*b)<c){if(a in j){g=j[a];var f=a*DENSITY*b;g.css({left:(f-this.view.low)*n});m.append(g)}else{g=this.draw_tile(b,a,m,n,d)}if(g){l[a]=g}a+=1}this.last_resolution=b;this.last_w_scale=n;this.tile_cache=l}});var LabelTrack=function(a){Track.call(this,null,a);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.hig
h){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+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,b,a){Track.call(this,c,$("#viewport"));this.track_type="line";this.height_px=(a?a:100);this.container_div.addClass("line-track");this.content_div.css("height",this.height_px+"px");this.dataset_id=b;this.cache=new DataCache("",this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this;$.getJSON(data_url,{stats:true,track_type:a.track_type,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(b){if(!b||b=="error"){a.content_div.addClass("error").text(DATA_ERROR)}else{if(b=="no data"){a.content_div.addClass("nodata").text(DATA_NONE)}else{a.min_value=b.min;a.max_value=b.max;a.vertical_range=a.max_value-a.min_value;a.view.redraw()}}})},draw_tile:function(d,a,n,r,o){if(!this.vertical_range){return}var j=a*DENSITY*d,q=(a+1)*DENSITY*
d,c=DENSITY*d;var m=this.cache.get(d,a);var h;if(m.state=="loading"){h=$("<div class='loading tile'></div>")}else{h=$("<canvas class='tile'></canvas>")}h.css({position:"absolute",top:0,left:(j-this.view.low)*r,});n.append(h);if(m.state=="loading"){e=false;return null}var b=h;b.get(0).width=Math.ceil(c*r);b.get(0).height=this.height_px;var p=b.get(0).getContext("2d");var e=false;p.beginPath();var g=m.values;if(!g){return}for(var f=0;f<g.length-1;f++){var l=g[f][0]-j;var k=g[f][1];if(isNaN(k)){e=false}else{l=l*r;y_above_min=k-this.min_value;k=y_above_min/this.vertical_range*this.height_px;if(e){p.lineTo(l,k)}else{p.moveTo(l,k);e=true}}}p.stroke();return h}});var FeatureTrack=function(c,b,a){Track.call(this,c,$("#viewport"));this.track_type="feature";this.height_px=(a?a:100);this.container_div.addClass("feature-track");this.content_div.css("height",this.height_px+"px");this.dataset_id=b;this.zo_slots={};this.show_labels_scale=0.01;this.showing_labels=false;this.vertical_gap=10}
;$.extend(FeatureTrack.prototype,TiledTrack.prototype,{calc_slots:function(h){var b=[];var a=this.container_div.width()/(this.view.high-this.view.low);if(h){this.zi_slots={}}var g=$("<canvas></canvas>").get(0).getContext("2d");for(var d in this.values){var k=this.values[d];var e=Math.floor(Math.max(this.view.max_low,(k.start-this.view.max_low)*a));if(h){e-=g.measureText(k.name).width;e-=10}var f=Math.ceil(Math.min(this.view.max_high,(k.end-this.view.max_low)*a));var c=0;while(true){if(b[c]==undefined||b[c]<e){b[c]=f;if(h){this.zi_slots[k.name]=c}else{this.zo_slots[k.name]=c}break}c++}}this.height_px=b.length*this.vertical_gap+15;this.content_div.css("height",this.height_px+"px")},init:function(){var a=this;$.getJSON(data_url,{track_type:a.track_type,low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom},function(b){if(b=="error"){a.content_div.addClass("error").text(DATA_ERROR)}else{if(b.length==0||b=="no data"){a.content_div.addClass("nodata").t
ext(DATA_NONE)}else{a.values=b;a.calc_slots();a.slots=a.zo_slots;a.draw()}}})},draw_tile:function(q,t,e,g,f){if(!this.values){return null}if(g>this.show_labels_scale&&!this.showing_labels){this.showing_labels=true;if(!this.zi_slots){this.calc_slots(true)}this.slots=this.zi_slots}else{if(g<=this.show_labels_scale&&this.showing_labels){this.showing_labels=false;this.slots=this.zo_slots}}var u=t*DENSITY*q,c=(t+1)*DENSITY*q,b=DENSITY*q;var k=this.view,m=k.high-k.low,o=Math.ceil(b*g),h=new Array(),n=this.height_px,l=$("<canvas class='tile'></canvas>");l.css({position:"absolute",top:0,left:(u-this.view.low)*g,});l.get(0).width=o;l.get(0).height=n;var p=l.get(0).getContext("2d");var r=0;for(var s in this.values){feature=this.values[s];if(feature.start<=c&&feature.end>=u){f_start=Math.floor(Math.max(0,(feature.start-u)*g));f_end=Math.ceil(Math.min(o,(feature.end-u)*g));p.fillStyle="#000";p.fillRect(f_start,this.slots[feature.name]*this.vertical_gap+5,f_end-f_start,1);if(this.showing
_labels&&p.fillText){p.font="10px monospace";p.textAlign="right";p.fillText(feature.name,f_start,this.slots[feature.name]*10+8)}if(feature.exon_start&&feature.exon_end){var d=Math.floor(Math.max(0,(feature.exon_start-u)*g));var w=Math.ceil(Math.min(o,(feature.exon_end-u)*g))}for(var s in feature.blocks){block=feature.blocks[s];block_start=Math.floor(Math.max(0,(block[0]-u)*g));block_end=Math.ceil(Math.min(o,(block[1]-u)*g));var a=3,v=4;if(d&&block_start>=d&&block_end<=w){a=5,v=3}p.fillRect(d,this.slots[feature.name]*this.vertical_gap+v,block_end-block_start,a)}r++}}e.append(l);return l},});
\ No newline at end of file
+var DENSITY=1000,DATA_ERROR="There was an error in indexing this dataset.",DATA_NONE="No data for this chrom/contig.",CACHED_TILES=200,CACHED_DATA=20;var View=function(a,b){this.chrom=a;this.tracks=[];this.max_low=0;this.max_high=b;this.low=this.max_low;this.high=this.max_high;this.length=this.max_high-this.max_low};$.extend(View.prototype,{add_track:function(a){a.view=this;this.tracks.push(a);if(a.init){a.init()}},redraw:function(){$("#overview-box").css({left:(this.low/this.length)*$("#overview-viewport").width(),width:Math.max(4,((this.high-this.low)/this.length)*$("#overview-viewport").width())}).show();$("#low").text(this.low);$("#high").text(this.high);for(var b=0,a=this.tracks.length;b<a;b++){this.tracks[b].draw()}$("#bottom-spacer").remove();$("#viewport").append('<div id="bottom-spacer" style="height: 200px;"></div>')},move:function(b,a){this.low=Math.max(this.max_low,Math.floor(b));this.high=Math.min(this.length,Math.ceil(a))},zoom_in:function(d,b){if(this.max_high
===0){return}var c=this.high-this.low;var e=c/d/2;var a;if(b===undefined){a=(this.low+this.high)/2}else{a=this.low+c*b/$(document).width()}this.low=Math.floor(a-e);this.high=Math.ceil(a+e);if(this.low<this.max_low){this.low=this.max_low;this.high=c/d}else{if(this.high>this.max_high){this.high=this.max_high;this.low=this.max_high-c/d}}if(this.high-this.low<1){this.high=this.low+1}},zoom_out:function(c){if(this.max_high===0){return}var a=(this.low+this.high)/2;var b=this.high-this.low;var d=b*c/2;this.low=Math.floor(Math.max(0,a-d));this.high=Math.ceil(Math.min(this.length,a+d))},left:function(b){var a=this.high-this.low;var c=Math.floor(a/b);if(this.low-c<0){this.low=0;this.high=this.low+a}else{this.low-=c;this.high-=c}},right:function(b){var a=this.high-this.low;var c=Math.floor(a/b);if(this.high+c>this.length){this.high=this.length;this.low=this.high-a}else{this.low+=c;this.high+=c}}});var Track=function(a,b){this.name=a;this.parent_element=b;this.make_container()};$.extend
(Track.prototype,{make_container:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div class='track'></div>").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)}});var TiledTrack=function(){this.tile_cache=new Cache(CACHED_TILES)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var i=this.view.low,c=this.view.high,e=c-i;var b=Math.pow(10,Math.ceil(Math.log(e/DENSITY)/Math.log(10)));b=Math.max(b,1);b=Math.min(b,100000);var l=$("<div style='position: relative;'></div>");this.content_div.children(":first").remove();this.content_div.append(l);var j=this.content_div.width(),d=this.content_div.height(),m=j/e;var g;var a=Math.floor(i/b/DENSITY);while((a*DENSITY*b)<c){var k=m+"_"+a;if(this.tile_cache[k]){g=this.tile_cache[k];var f=a*DENSITY*b;g.css({left:(f-this.view.low)*m});l.append(g)}else{g=this.draw_tile(b,a,l,m,d)}if(g){t
his.tile_cache[k]=g}a+=1}}});var LabelTrack=function(a){Track.call(this,null,a);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'>"+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,b,a){Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.track_type="line";this.height_px=(a?a:100);this.container_div.addClass("line-track");this.dataset_id=b;this.cache=new Cache(CACHED_DATA)};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this;$.getJSON(data_url,{stats:true,track_type:a.track_type,chrom:a.view.chrom,low:null,high:n
ull,dataset_id:a.dataset_id},function(b){if(!b||b=="error"){a.content_div.addClass("error").text(DATA_ERROR)}else{if(b=="no data"){a.content_div.addClass("nodata").text(DATA_NONE)}else{a.content_div.css("height",a.height_px+"px");a.min_value=b.min;a.max_value=b.max;a.vertical_range=a.max_value-a.min_value;a.view.redraw()}}})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;$.getJSON(data_url,{track_type:this.track_type,chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id},function(g){c.cache[e]=g;$(document).trigger("redraw")})},draw_tile:function(d,a,m,p,n){if(!this.vertical_range){return}var h=a*DENSITY*d,b=DENSITY*d,c=$("<canvas class='tile'></canvas>"),l=d+"_"+a;if(!this.cache[l]){this.get_data(d,a);return}var g=this.cache[l];c.css({position:"absolute",top:0,left:(h-this.view.low)*p});c.get(0).width=Math.ceil(b*p);c.get(0).height=this.height_px;var o=c.get(0).getContext("2d");var e=false;o.beginPath();for(var f=0;f<g.length-1;f++){var
k=g[f][0]-h;var j=g[f][1];if(isNaN(j)){e=false}else{k=k*p;j=(j-this.min_value)/this.vertical_range*this.height_px;if(e){o.lineTo(k,j)}else{o.moveTo(k,j);e=true}}}o.stroke();m.append(c);return c}});var FeatureTrack=function(c,b,a){Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.track_type="feature";this.height_px=(a?a:100);this.container_div.addClass("feature-track");this.dataset_id=b;this.zo_slots={};this.show_labels_scale=0.001;this.showing_labels=false;this.vertical_gap=10};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this;$.getJSON(data_url,{track_type:a.track_type,low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom},function(b){if(b=="error"){a.content_div.addClass("error").text(DATA_ERROR)}else{if(b.length===0||b=="no data"){a.content_div.addClass("nodata").text(DATA_NONE)}else{a.content_div.css("height",a.height_px+"px");a.values=b;a.calc_slots();a.slots=a.zo_slots;a.draw()}}})},calc_slots:func
tion(o){var c=[],b=this.container_div.width()/(this.view.high-this.view.low),g=this.show_labels_scale,a=this.view.max_high,e=this.view.max_low;if(o){this.zi_slots={}}var m=$("<canvas></canvas>").get(0).getContext("2d");for(var f=0,h=this.values.length;f<h;f++){var k,l,n=this.values[f];if(o){k=Math.floor(Math.max(e,(n.start-e)*g));k-=m.measureText(n.name).width;l=Math.ceil(Math.min(a,(n.end-e)*g))}else{k=Math.floor(Math.max(e,(n.start-e)*b));l=Math.ceil(Math.min(a,(n.end-e)*b))}var d=0;while(true){if(c[d]===undefined||c[d]<k){c[d]=l;if(o){this.zi_slots[n.name]=d}else{this.zo_slots[n.name]=d}break}d++}}this.height_px=c.length*this.vertical_gap+15;this.content_div.css("height",this.height_px+"px")},draw_tile:function(u,z,l,p,n){if(!this.values){return null}if(p>this.show_labels_scale&&!this.showing_labels){this.showing_labels=true;if(!this.zi_slots){this.calc_slots(true)}this.slots=this.zi_slots}else{if(p<=this.show_labels_scale&&this.showing_labels){this.showing_labels=false;t
his.slots=this.zo_slots}}var A=z*DENSITY*u,c=(z+1)*DENSITY*u,b=DENSITY*u;var s=Math.ceil(b*p),r=this.height_px,q=$("<canvas class='tile'></canvas>");q.css({position:"absolute",top:0,left:(A-this.view.low)*p});q.get(0).width=s;q.get(0).height=r;var t=q.get(0).getContext("2d");t.fillStyle="#000";t.font="10px monospace";t.textAlign="right";var w=0;for(var x=0,y=this.values.length;x<y;x++){var h=this.values[x];if(h.start<=c&&h.end>=A){var f=Math.floor(Math.max(0,(h.start-A)*p)),g=Math.ceil(Math.min(s,(h.end-A)*p)),e=this.slots[h.name]*this.vertical_gap;t.fillRect(f,e+5,g-f,1);if(this.showing_labels&&t.fillText){t.fillText(h.name,f,e+8)}var d,E;if(h.exon_start&&h.exon_end){d=Math.floor(Math.max(0,(h.exon_start-A)*p));E=Math.ceil(Math.min(s,(h.exon_end-A)*p));t.fillRect(d,e+4,E-d,3)}if(h.blocks){for(var v=0,C=h.blocks.length;v<C;v++){var o=h.blocks[v],m=Math.floor(Math.max(0,(o[0]-A)*p)),B=Math.ceil(Math.min(s,(o[1]-A)*p));var a=3,D=4;if(d&&m>=d&&B<=E){a=5;D=3}t.fillRect(m,e+D,B-m
,a)}}w++}}l.append(q);return q}});
\ No newline at end of file
diff -r ebc1c19fc2d5 -r e11e89fd2c82 static/scripts/trackster.js
--- a/static/scripts/trackster.js Mon Oct 12 16:14:54 2009 -0400
+++ b/static/scripts/trackster.js Mon Oct 12 19:00:39 2009 -0400
@@ -4,7 +4,9 @@
var DENSITY = 1000,
DATA_ERROR = "There was an error in indexing this dataset.",
- DATA_NONE = "No data for this chrom/contig.";
+ DATA_NONE = "No data for this chrom/contig.",
+ CACHED_TILES = 200,
+ CACHED_DATA = 20;
var View = function( chrom, max_length ) {
this.chrom = chrom;
@@ -29,7 +31,7 @@
}).show();
$("#low").text( this.low );
$("#high").text( this.high );
- for ( var i in this.tracks ) {
+ for ( var i = 0, len = this.tracks.length; i < len; i++ ) {
this.tracks[i].draw();
}
$("#bottom-spacer").remove();
@@ -40,18 +42,19 @@
this.high = Math.min( this.length, Math.ceil( new_high ) );
},
zoom_in: function ( factor, point ) {
- if (this.max_high == 0) return;
+ if (this.max_high === 0) {
+ return;
+ }
var range = this.high - this.low;
var diff = range / factor / 2;
+ var center;
- if (point == undefined) {
- var center = ( this.low + this.high ) / 2;
+ if (point === undefined) {
+ center = ( this.low + this.high ) / 2;
} else {
- // console.log(100*point/$(document).width());
- var center = this.low + range * point / $(document).width();
+ center = this.low + range * point / $(document).width();
}
- // console.log(center);
this.low = Math.floor( center - diff );
this.high = Math.ceil( center + diff );
if (this.low < this.max_low) {
@@ -67,7 +70,9 @@
}
},
zoom_out: function ( factor ) {
- if (this.max_high == 0) return;
+ if (this.max_high === 0) {
+ return;
+ }
var center = ( this.low + this.high ) / 2;
var range = this.high - this.low;
var diff = range * factor / 2;
@@ -105,7 +110,7 @@
};
$.extend( Track.prototype, {
make_container: function () {
- this.header_div = $("<div class='track-header'>").text( this.name );;
+ this.header_div = $("<div class='track-header'>").text( this.name );
this.content_div = $("<div class='track-content'>");
this.container_div = $("<div class='track'></div>").append( this.header_div ).append( this.content_div );
this.parent_element.append( this.container_div );
@@ -113,9 +118,7 @@
});
var TiledTrack = function() {
- this.last_resolution = null;
- this.last_w_scale = null;
- this.tile_cache = {};
+ this.tile_cache = new Cache(CACHED_TILES);
};
$.extend( TiledTrack.prototype, Track.prototype, {
draw: function() {
@@ -133,23 +136,17 @@
var w = this.content_div.width(),
h = this.content_div.height(),
- w_scale = w / range,
- old_tiles = {},
- new_tiles = {};
-
- // If resolution and scale are unchanged, try to reuse tiles
- if ( this.last_resolution == resolution && this.last_w_scale == w_scale ) {
- old_tiles = this.tile_cache;
- }
+ w_scale = w / range;
var tile_element;
// Index of first tile that overlaps visible region
var tile_index = Math.floor( low / resolution / DENSITY );
- while ( ( tile_index * 1000 * resolution ) < high ) {
+ while ( ( tile_index * DENSITY * resolution ) < high ) {
// Check in cache
- if ( tile_index in old_tiles ) {
- // console.log( "tile from cache" );
- tile_element = old_tiles[tile_index];
+ var key = w_scale + "_" + tile_index;
+ if ( this.tile_cache[key] ) {
+ // console.log("cached tile");
+ tile_element = this.tile_cache[key];
var tile_low = tile_index * DENSITY * resolution;
tile_element.css( {
left: ( tile_low - this.view.low ) * w_scale
@@ -160,14 +157,10 @@
tile_element = this.draw_tile( resolution, tile_index, parent_element, w_scale, h );
}
if ( tile_element ) {
- // console.log( typeof(tile_element) );
- new_tiles[tile_index] = tile_element;
+ this.tile_cache[key] = tile_element;
}
tile_index += 1;
}
- this.last_resolution = resolution;
- this.last_w_scale = w_scale;
- this.tile_cache = new_tiles;
}
});
@@ -199,70 +192,67 @@
var LineTrack = function ( name, dataset_id, height ) {
Track.call( this, name, $("#viewport") );
+ TiledTrack.call( this );
this.track_type = "line";
this.height_px = (height ? height : 100);
this.container_div.addClass( "line-track" );
- this.content_div.css( "height", this.height_px + "px" );
this.dataset_id = dataset_id;
- this.cache = new Cache(50);
+ this.cache = new Cache(CACHED_DATA); // We need to cache some data because of
+ // asynchronous calls
};
$.extend( LineTrack.prototype, TiledTrack.prototype, {
init: function() {
var track = this;
- $.getJSON( data_url, { stats: true, track_type: track.track_type, chrom: track.view.chrom,
- low: null, high: null, dataset_id: track.dataset_id }, function ( data ) {
+ $.getJSON( data_url, { stats: true, track_type: track.track_type,
+ chrom: track.view.chrom, low: null, high: null,
+ dataset_id: track.dataset_id }, function ( data ) {
if (!data || data == "error") {
track.content_div.addClass("error").text(DATA_ERROR);
} else if (data == "no data") {
- // console.log(track.content_div);
track.content_div.addClass("nodata").text(DATA_NONE);
} else {
- track.min_value = data['min'];
- track.max_value = data['max'];
+ track.content_div.css( "height", track.height_px + "px" );
+ track.min_value = data.min;
+ track.max_value = data.max;
track.vertical_range = track.max_value - track.min_value;
track.view.redraw();
}
});
},
get_data: function( resolution, position ) {
- var key = resolution + '-' + position,
- cache = this.cache;
-
- if ( !cache[key] ) {
- var low = position * DENSITY * resolution,
- high = ( position + 1 ) * DENSITY * resolution;
-
- $.getJSON( data_url, { track_type: this.track_type, chrom: this.view.chrom, low: low, high: high, dataset_id: this.dataset_id }, function ( data ) {
- cache[key] = data;
- $(document).trigger( "redraw" );
- });
- }
- return cache[key];
+ var track = this,
+ low = position * DENSITY * resolution,
+ high = ( position + 1 ) * DENSITY * resolution,
+ key = resolution + "_" + position;
+
+ $.getJSON( data_url, { track_type: this.track_type, chrom: this.view.chrom, low: low, high: high, dataset_id: this.dataset_id }, function ( data ) {
+ track.cache[key] = data;
+ $(document).trigger( "redraw" );
+ });
},
draw_tile: function( resolution, tile_index, parent_element, w_scale, h_scale ) {
- if (!this.vertical_range) // We don't have the necessary information yet
+ if (!this.vertical_range) { // We don't have the necessary information yet
return;
-
+ }
+
var tile_low = tile_index * DENSITY * resolution,
- tile_high = ( tile_index + 1 ) * DENSITY * resolution,
- tile_length = DENSITY * resolution;
- var data = this.get_data( resolution, tile_index );
- if ( !data ) {
- in_path = false;
- return null;
+ tile_length = DENSITY * resolution,
+ canvas = $("<canvas class='tile'></canvas>"),
+ key = resolution + "_" + tile_index;
+
+ if (!this.cache[key]) {
+ this.get_data( resolution, tile_index );
+ return;
}
- var element = $("<canvas class='tile'></canvas>");
-
- element.css( {
+
+ var data = this.cache[key];
+ canvas.css( {
position: "absolute",
top: 0,
- left: ( tile_low - this.view.low ) * w_scale,
+ left: ( tile_low - this.view.low ) * w_scale
});
- parent_element.append( element );
- // Chunk is still loading, do nothing
-
- var canvas = element;
+
canvas.get(0).width = Math.ceil( tile_length * w_scale );
canvas.get(0).height = this.height_px;
var ctx = canvas.get(0).getContext("2d");
@@ -277,8 +267,7 @@
} else {
// Translate
x = x * w_scale;
- y_above_min = y - this.min_value;
- y = y_above_min / this.vertical_range * this.height_px;
+ y = (y - this.min_value) / this.vertical_range * this.height_px;
if ( in_path ) {
ctx.lineTo( x, y );
} else {
@@ -288,44 +277,69 @@
}
}
ctx.stroke();
- return element;
+ parent_element.append( canvas );
+ return canvas;
}
});
var FeatureTrack = function ( name, dataset_id, height ) {
Track.call( this, name, $("#viewport") );
+ TiledTrack.call( this );
+
this.track_type = "feature";
this.height_px = (height ? height : 100);
this.container_div.addClass( "feature-track" );
- this.content_div.css( "height", this.height_px + "px" );
this.dataset_id = dataset_id;
this.zo_slots = {};
- this.show_labels_scale = 0.01;
+ this.show_labels_scale = 0.001;
this.showing_labels = false;
this.vertical_gap = 10;
};
$.extend( FeatureTrack.prototype, TiledTrack.prototype, {
+ init: function() {
+ var track = this;
+ $.getJSON( data_url, { track_type: track.track_type, low: track.view.max_low,
+ high: track.view.max_high, dataset_id: track.dataset_id,
+ chrom: track.view.chrom }, function ( data ) {
+ if (data == "error") {
+ track.content_div.addClass("error").text(DATA_ERROR);
+ } else if (data.length === 0 || data == "no data") {
+ track.content_div.addClass("nodata").text(DATA_NONE);
+ } else {
+ track.content_div.css( "height", track.height_px + "px" );
+ track.values = data;
+ track.calc_slots();
+ track.slots = track.zo_slots;
+ track.draw();
+ }
+ });
+ },
calc_slots: function( include_labels ) {
// console.log("num vals: " + this.values.length);
- var end_ary = [];
- var scale = this.container_div.width() / (this.view.high - this.view.low);
+ var end_ary = [],
+ scale = this.container_div.width() / (this.view.high - this.view.low),
+ labels_scale = this.show_labels_scale,
+ max_high = this.view.max_high,
+ max_low = this.view.max_low;
// console.log(scale, this.view.high, this.view.low);
- if (include_labels) this.zi_slots = {};
+ if (include_labels) {
+ this.zi_slots = {};
+ }
var dummy_canvas = $("<canvas></canvas>").get(0).getContext("2d");
- for (var i in this.values) {
-
- var feature = this.values[i];
- var f_start = Math.floor( Math.max(this.view.max_low, (feature.start - this.view.max_low) * scale) );
+ for (var i = 0, len = this.values.length; i < len; i++) {
+ var f_start, f_end, feature = this.values[i];
if (include_labels) {
+ f_start = Math.floor( Math.max(max_low, (feature.start - max_low) * labels_scale) );
f_start -= dummy_canvas.measureText(feature.name).width;
- f_start -= 10; // Spacing between text and line
+ f_end = Math.ceil( Math.min(max_high, (feature.end - max_low) * labels_scale) );
+ } else {
+ f_start = Math.floor( Math.max(max_low, (feature.start - max_low) * scale) );
+ f_end = Math.ceil( Math.min(max_high, (feature.end - max_low) * scale) );
}
-
- var f_end = Math.ceil( Math.min(this.view.max_high, (feature.end - this.view.max_low) * scale) );
// if (include_labels) { console.log(f_start, f_end); }
var j = 0;
while (true) {
- if (end_ary[j] == undefined || end_ary[j] < f_start) {
+ if (end_ary[j] === undefined || end_ary[j] < f_start) {
end_ary[j] = f_end;
if (include_labels) {
this.zi_slots[feature.name] = j;
@@ -340,33 +354,16 @@
this.height_px = end_ary.length * this.vertical_gap + 15;
this.content_div.css( "height", this.height_px + "px" );
},
-
- init: function() {
- var track = this;
- $.getJSON( data_url, { track_type: track.track_type, low: track.view.max_low, high: track.view.max_high,
- dataset_id: track.dataset_id, chrom: track.view.chrom }, function ( data ) {
- if (data == "error") {
- track.content_div.addClass("error").text(DATA_ERROR);
- } else if (data.length == 0 || data == "no data") {
- // console.log(track.content_div);
- track.content_div.addClass("nodata").text(DATA_NONE);
- } else {
- track.values = data;
- track.calc_slots();
- track.slots = track.zo_slots;
- // console.log(track.zo_slots);
- track.draw();
- }
- });
- },
-
draw_tile: function( resolution, tile_index, parent_element, w_scale, h_scale ) {
- if (!this.values) // Still loading
+ if (!this.values) { // Still loading
return null;
-
+ }
+ // Once we zoom in enough, show name labels
if (w_scale > this.show_labels_scale && !this.showing_labels) {
this.showing_labels = true;
- if (!this.zi_slots) this.calc_slots(true); // Once we zoom in enough, show name labels
+ if (!this.zi_slots) {
+ this.calc_slots(true);
+ }
this.slots = this.zi_slots;
} else if (w_scale <= this.show_labels_scale && this.showing_labels) {
this.showing_labels = false;
@@ -378,63 +375,64 @@
tile_high = ( tile_index + 1 ) * DENSITY * resolution,
tile_length = DENSITY * resolution;
// console.log(tile_low, tile_high, tile_length, w_scale);
- var view = this.view,
- range = view.high - view.low,
- width = Math.ceil( tile_length * w_scale ),
- slots = new Array(),
+ var width = Math.ceil( tile_length * w_scale ),
height = this.height_px,
new_canvas = $("<canvas class='tile'></canvas>");
new_canvas.css({
position: "absolute",
top: 0,
- left: ( tile_low - this.view.low ) * w_scale,
+ left: ( tile_low - this.view.low ) * w_scale
});
new_canvas.get(0).width = width;
new_canvas.get(0).height = height;
// console.log(( tile_low - this.view.low ) * w_scale, tile_index, w_scale);
var ctx = new_canvas.get(0).getContext("2d");
+ ctx.fillStyle = "#000";
+ ctx.font = "10px monospace";
+ ctx.textAlign = "right";
var j = 0;
- for (var i in this.values) {
- feature = this.values[i];
+ for (var i = 0, len = this.values.length; i < len; i++) {
+ var feature = this.values[i];
if (feature.start <= tile_high && feature.end >= tile_low) {
- f_start = Math.floor( Math.max(0, (feature.start - tile_low) * w_scale) );
- f_end = Math.ceil( Math.min(width, (feature.end - tile_low) * w_scale) );
+ var f_start = Math.floor( Math.max(0, (feature.start - tile_low) * w_scale) ),
+ f_end = Math.ceil( Math.min(width, (feature.end - tile_low) * w_scale) ),
+ y_center = this.slots[feature.name] * this.vertical_gap;
+
// console.log(feature.start, feature.end, f_start, f_end, j);
- ctx.fillStyle = "#000";
- ctx.fillRect(f_start, this.slots[feature.name] * this.vertical_gap + 5, f_end - f_start, 1);
+ ctx.fillRect(f_start, y_center + 5, f_end - f_start, 1);
if (this.showing_labels && ctx.fillText) {
- ctx.font = "10px monospace";
- ctx.textAlign = "right";
- ctx.fillText(feature.name, f_start, this.slots[feature.name] * 10 + 8);
+ ctx.fillText(feature.name, f_start, y_center + 8);
}
+ var exon_start, exon_end;
if (feature.exon_start && feature.exon_end) {
- var exon_start = Math.floor( Math.max(0, (feature.exon_start - tile_low) * w_scale) );
- var exon_end = Math.ceil( Math.min(width, (feature.exon_end - tile_low) * w_scale) );
- // ctx.fillRect(exon_start, j * 10 + 3, exon_end - exon_start, 5);
- // ctx.fillRect(exon_start, this.slots[feature.name] * 10 + 3, exon_end - exon_start, 3);
+ exon_start = Math.floor( Math.max(0, (feature.exon_start - tile_low) * w_scale) );
+ exon_end = Math.ceil( Math.min(width, (feature.exon_end - tile_low) * w_scale) );
+ ctx.fillRect(exon_start, y_center + 4, exon_end - exon_start, 3);
}
- for (var i in feature.blocks) {
- block = feature.blocks[i];
- block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) );
- block_end = Math.ceil( Math.min(width, (block[1] - tile_low) * w_scale) );
- var thickness = 3, y_start = 4;
- if (exon_start && block_start >= exon_start && block_end <= exon_end) {
- thickness = 5, y_start = 3;
- }
- ctx.fillRect(exon_start, this.slots[feature.name] * this.vertical_gap + y_start, block_end - block_start, thickness);
- // console.log(block_start, block_end);
+ if (feature.blocks) {
+ for (var k = 0, k_len = feature.blocks.length; k < k_len; k++) {
+ var block = feature.blocks[k],
+ block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ),
+ block_end = Math.ceil( Math.min(width, (block[1] - tile_low) * w_scale) );
+ var thickness = 3, y_start = 4;
+ if (exon_start && block_start >= exon_start && block_end <= exon_end) {
+ thickness = 5;
+ y_start = 3;
+ }
+ ctx.fillRect(block_start, y_center + y_start, block_end - block_start, thickness);
+ // console.log(block_start, block_end);
+ }
}
-
j++;
}
}
parent_element.append( new_canvas );
return new_canvas;
- },
+ }
});
diff -r ebc1c19fc2d5 -r e11e89fd2c82 static/trackster.css
--- a/static/trackster.css Mon Oct 12 16:14:54 2009 -0400
+++ b/static/trackster.css Mon Oct 12 19:00:39 2009 -0400
@@ -85,13 +85,15 @@
.track-content.error {
text-align: center;
- padding-top: 30px;
+ padding-top: 10px;
background-color: #ECB4AF;
+ height: 30px;
}
.track-content.nodata {
text-align: center;
- padding-top: 30px;
+ padding-top: 10px;
background-color: #ddd;
+ height: 30px;
}
.loading {
@@ -102,15 +104,3 @@
border-left: solid gray 1px;
padding-left: 2px;
}
-
-.feature-track .feature {
-
-}
-
-.feature-track .feature .forward {
-
-}
-
-.feature-track .feature .reverse {
-
-}
\ No newline at end of file
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/1a0bb7d6897c
changeset: 2870:1a0bb7d6897c
user: Ross Lazarus <ross.lazarus(a)gmail.com>
date: Sun Oct 11 15:07:11 2009 -0400
description:
symlinks are not very useful
6 file(s) affected in this change:
lib/galaxy/datatypes/converters/lped_to_fped_converter.py
lib/galaxy/datatypes/converters/lped_to_fped_converter.xml
lib/galaxy/datatypes/converters/lped_to_pbed_converter.py
lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml
lib/galaxy/datatypes/converters/pbed_to_lped_converter.py
lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml
diffs (383 lines):
diff -r 639c6b5e0073 -r 1a0bb7d6897c lib/galaxy/datatypes/converters/lped_to_fped_converter.py
--- a/lib/galaxy/datatypes/converters/lped_to_fped_converter.py Sun Oct 11 15:00:40 2009 -0400
+++ b/lib/galaxy/datatypes/converters/lped_to_fped_converter.py Sun Oct 11 15:07:11 2009 -0400
@@ -1,1 +1,110 @@
-/opt/galaxy/tools/rgenetics/converters/lped_to_fped_converter.py
\ No newline at end of file
+# for rgenetics - lped to fbat
+# recode to numeric fbat version
+# much slower so best to always
+# use numeric alleles internally
+
+import sys,os,time
+
+
+prog = os.path.split(sys.argv[0])[-1]
+myversion = 'Oct 10 2009'
+
+galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Galaxy %s tool output - see http://g2.trac.bx.psu.edu/" />
+<title></title>
+<link rel="stylesheet" href="/static/style/base.css" type="text/css" />
+</head>
+<body>
+<div class="document">
+"""
+
+def timenow():
+ """return current time as a string
+ """
+ return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time()))
+
+
+def rgConv(inpedfilepath,outhtmlname,outfilepath):
+ """convert linkage ped/map to fbat"""
+ recode={'A':'1','C':'2','G':'3','T':'4','N':'0','0':'0','1':'1','2':'2','3':'3','4':'4'}
+ basename = os.path.split(inpedfilepath)[-1] # get basename
+ inmap = '%s.map' % inpedfilepath
+ inped = '%s.ped' % inpedfilepath
+ outf = '%s.ped' % basename # note the fbat exe insists that this is the extension for the ped data
+ outfpath = os.path.join(outfilepath,outf) # where to write the fbat format file to
+ try:
+ mf = file(inmap,'r')
+ except:
+ sys.stderr.write('%s cannot open inmap file %s - do you have permission?\n' % (prog,inmap))
+ sys.exit(1)
+ try:
+ rsl = [x.split()[1] for x in mf]
+ except:
+ sys.stderr.write('## cannot parse %s' % inmap)
+ sys.exit(1)
+ try:
+ os.makedirs(outfilepath)
+ except:
+ pass # already exists
+ head = ' '.join(rsl) # list of rs numbers
+ # TODO add anno to rs but fbat will prolly barf?
+ pedf = file(inped,'r')
+ o = file(outfpath,'w',2**20)
+ o.write(head)
+ o.write('\n')
+ for i,row in enumerate(pedf):
+ if i == 0:
+ lrow = row.split()
+ try:
+ x = [int(x) for x in lrow[10:50]] # look for non numeric codes
+ except:
+ dorecode = 1
+ if dorecode:
+ lrow = row.strip().split()
+ p = lrow[:6]
+ g = lrow[6:]
+ gc = [recode.get(x,'0') for x in g]
+ lrow = p+gc
+ row = '%s\n' % ' '.join(lrow)
+ o.write(row)
+ o.close()
+
+
+def main():
+ """call fbater
+ need to work with rgenetics composite datatypes
+ so in and out are html files with data in extrafiles path
+ <command interpreter="python">rg_convert_lped_fped.py '$input1/$input1.metadata.base_name'
+ '$output1' '$output1.extra_files_path'
+ </command>
+ """
+ nparm = 3
+ if len(sys.argv) < nparm:
+ sys.stderr.write('## %s called with %s - needs %d parameters \n' % (prog,sys.argv,nparm))
+ sys.exit(1)
+ inpedfilepath = sys.argv[1]
+ outhtmlname = sys.argv[2]
+ outfilepath = sys.argv[3]
+ try:
+ os.makedirs(outfilepath)
+ except:
+ pass
+ rgConv(inpedfilepath,outhtmlname,outfilepath)
+ f = file(outhtmlname,'w')
+ f.write(galhtmlprefix % prog)
+ flist = os.listdir(outfilepath)
+ print '## Rgenetics: http://rgenetics.org Galaxy Tools %s %s' % (prog,timenow()) # becomes info
+ f.write('<div>## Rgenetics: http://rgenetics.org Galaxy Tools %s %s\n<ol>' % (prog,timenow()))
+ for i, data in enumerate( flist ):
+ f.write('<li><a href="%s">%s</a></li>\n' % (os.path.split(data)[-1],os.path.split(data)[-1]))
+ f.write("</div></body></html>")
+ f.close()
+
+
+
+if __name__ == "__main__":
+ main()
diff -r 639c6b5e0073 -r 1a0bb7d6897c lib/galaxy/datatypes/converters/lped_to_fped_converter.xml
--- a/lib/galaxy/datatypes/converters/lped_to_fped_converter.xml Sun Oct 11 15:00:40 2009 -0400
+++ b/lib/galaxy/datatypes/converters/lped_to_fped_converter.xml Sun Oct 11 15:07:11 2009 -0400
@@ -1,1 +1,15 @@
-/opt/galaxy/tools/rgenetics/converters/lped_to_fped_converter.xml
\ No newline at end of file
+<tool id="lped2fpedconvert" name="Convert lped to fped" version="0.01">
+ <!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> -->
+ <!-- Used on the metadata edit page. -->
+ <command interpreter="python">
+ lped_to_fped_converter.py '$input1.extra_files_path/$input1.metadata.base_name' '$output1' '$output1.extra_files_path'
+ </command>
+ <inputs>
+ <param format="lped" name="input1" type="data" label="Choose linkage pedigree file"/>
+ </inputs>
+ <outputs>
+ <data format="fped" name="output1" metadata_source="input1"/>
+ </outputs>
+ <help>
+ </help>
+</tool>
diff -r 639c6b5e0073 -r 1a0bb7d6897c lib/galaxy/datatypes/converters/lped_to_pbed_converter.py
--- a/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py Sun Oct 11 15:00:40 2009 -0400
+++ b/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py Sun Oct 11 15:07:11 2009 -0400
@@ -1,1 +1,110 @@
-/opt/galaxy/tools/rgenetics/converters/lped_to_pbed_converter.py
\ No newline at end of file
+# for rgenetics - lped to pbed
+# where to stop with converters
+# pbed might be central
+# eg lped/eigen/fbat/snpmatrix all to pbed
+# and pbed to lped/eigen/fbat/snpmatrix ?
+# that's a lot of converters
+import sys,os,time,subprocess
+
+
+prog = os.path.split(sys.argv[0])[-1]
+myversion = 'Oct 10 2009'
+
+galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Galaxy %s tool output - see http://g2.trac.bx.psu.edu/" />
+<title></title>
+<link rel="stylesheet" href="/static/style/base.css" type="text/css" />
+</head>
+<body>
+<div class="document">
+"""
+
+def timenow():
+ """return current time as a string
+ """
+ return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time()))
+
+def getMissval(inped=''):
+ """
+ read some lines...ugly hack - try to guess missing value
+ should be N or 0 but might be . or -
+ """
+ commonmissvals = {'N':'N','0':'0','n':'n','9':'9','-':'-','.':'.'}
+ try:
+ f = file(inped,'r')
+ except:
+ return None # signal no in file
+ missval = None
+ while missval == None: # doggedly continue until we solve the mystery
+ try:
+ l = f.readline()
+ except:
+ break
+ ll = l.split()[6:] # ignore pedigree stuff
+ for c in ll:
+ if commonmissvals.get(c,None):
+ missval = c
+ f.close()
+ return missval
+ if not missval:
+ missval = 'N' # punt
+ close(f)
+ return missval
+
+def rgConv(inpedfilepath,outhtmlname,outfilepath,plink):
+ """
+ """
+ pedf = '%s.ped' % inpedfilepath
+ basename = os.path.split(inpedfilepath)[-1] # get basename
+ outroot = os.path.join(outfilepath,basename)
+ missval = getMissval(inped = pedf)
+ if not missval:
+ print '### lped_to_pbed_converter.py cannot identify missing value in %s' % pedf
+ missval = '0'
+ cl = '%s --noweb --file %s --make-bed --out %s --missing-genotype %s' % (plink,inpedfilepath,outroot,missval)
+ p = subprocess.Popen(cl,shell=True,cwd=outfilepath)
+ retval = p.wait() # run plink
+
+
+
+
+def main():
+ """
+ need to work with rgenetics composite datatypes
+ so in and out are html files with data in extrafiles path
+ <command interpreter="python">lped_to_pbed_converter.py '$input1/$input1.metadata.base_name'
+ '$output1' '$output1.extra_files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+ </command>
+ """
+ nparm = 4
+ if len(sys.argv) < nparm:
+ sys.stderr.write('## %s called with %s - needs %d parameters \n' % (prog,sys.argv,nparm))
+ sys.exit(1)
+ inpedfilepath = sys.argv[1]
+ outhtmlname = sys.argv[2]
+ outfilepath = sys.argv[3]
+ try:
+ os.makedirs(outfilepath)
+ except:
+ pass
+ plink = sys.argv[4]
+ rgConv(inpedfilepath,outhtmlname,outfilepath,plink)
+ f = file(outhtmlname,'w')
+ f.write(galhtmlprefix % prog)
+ flist = os.listdir(outfilepath)
+ s = '## Rgenetics: http://rgenetics.org Galaxy Tools %s %s' % (prog,timenow()) # becomes info
+ print s
+ f.write('<div>%s\n<ol>' % (s))
+ for i, data in enumerate( flist ):
+ f.write('<li><a href="%s">%s</a></li>\n' % (os.path.split(data)[-1],os.path.split(data)[-1]))
+ f.write("</div></body></html>")
+ f.close()
+
+
+
+if __name__ == "__main__":
+ main()
diff -r 639c6b5e0073 -r 1a0bb7d6897c lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml
--- a/lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml Sun Oct 11 15:00:40 2009 -0400
+++ b/lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml Sun Oct 11 15:07:11 2009 -0400
@@ -1,1 +1,16 @@
-/opt/galaxy/tools/rgenetics/converters/lped_to_pbed_converter.xml
\ No newline at end of file
+<tool id="lped2pbedconvert" name="Convert lped to plink pbed" version="0.01">
+ <!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> -->
+ <!-- Used on the metadata edit page. -->
+ <command interpreter="python">
+ lped_to_pbed_converter.py '$input1.extra_files_path/$input1.metadata.base_name'
+ '$output1' '$output1.extra_files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+ </command>
+ <inputs>
+ <param format="lped" name="input1" type="data" label="Choose linkage pedigree file"/>
+ </inputs>
+ <outputs>
+ <data format="pbed" name="output1" metadata_source="input1"/>
+ </outputs>
+ <help>
+ </help>
+</tool>
diff -r 639c6b5e0073 -r 1a0bb7d6897c lib/galaxy/datatypes/converters/pbed_to_lped_converter.py
--- a/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py Sun Oct 11 15:00:40 2009 -0400
+++ b/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py Sun Oct 11 15:07:11 2009 -0400
@@ -1,1 +1,80 @@
-/opt/galaxy/tools/rgenetics/converters/pbed_to_lped_converter.py
\ No newline at end of file
+# for rgenetics - lped to pbed
+# where to stop with converters
+# pbed might be central
+# eg lped/eigen/fbat/snpmatrix all to pbed
+# and pbed to lped/eigen/fbat/snpmatrix ?
+# that's a lot of converters
+import sys,os,time,subprocess
+
+
+prog = os.path.split(sys.argv[0])[-1]
+myversion = 'Oct 10 2009'
+
+galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Galaxy %s tool output - see http://g2.trac.bx.psu.edu/" />
+<title></title>
+<link rel="stylesheet" href="/static/style/base.css" type="text/css" />
+</head>
+<body>
+<div class="document">
+"""
+
+def timenow():
+ """return current time as a string
+ """
+ return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time()))
+
+
+def rgConv(inpedfilepath,outhtmlname,outfilepath,plink):
+ """
+ """
+
+ basename = os.path.split(inpedfilepath)[-1] # get basename
+ outroot = os.path.join(outfilepath,basename)
+ cl = '%s --noweb --bfile %s --recode --out %s ' % (plink,inpedfilepath,outroot)
+ p = subprocess.Popen(cl,shell=True,cwd=outfilepath)
+ retval = p.wait() # run plink
+
+
+
+
+def main():
+ """
+ need to work with rgenetics composite datatypes
+ so in and out are html files with data in extrafiles path
+ <command interpreter="python">pbed_to_lped_converter.py '$input1/$input1.metadata.base_name'
+ '$output1' '$output1.extra_files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+ </command>
+ """
+ nparm = 4
+ if len(sys.argv) < nparm:
+ sys.stderr.write('## %s called with %s - needs %d parameters \n' % (myname,sys.argv,nparm))
+ sys.exit(1)
+ inpedfilepath = sys.argv[1]
+ outhtmlname = sys.argv[2]
+ outfilepath = sys.argv[3]
+ try:
+ os.makedirs(outfilepath)
+ except:
+ pass
+ plink = sys.argv[4]
+ rgConv(inpedfilepath,outhtmlname,outfilepath,plink)
+ f = file(outhtmlname,'w')
+ f.write(galhtmlprefix % prog)
+ flist = os.listdir(outfilepath)
+ s = '## Rgenetics: http://rgenetics.org Galaxy Tools %s %s' % (prog,timenow()) # becomes info
+ print s
+ f.write('<div>%s\n<ol>' % (s))
+ for i, data in enumerate( flist ):
+ f.write('<li><a href="%s">%s</a></li>\n' % (os.path.split(data)[-1],os.path.split(data)[-1]))
+ f.write("</div></body></html>")
+ f.close()
+
+
+
+if __name__ == "__main__":
+ main()
diff -r 639c6b5e0073 -r 1a0bb7d6897c lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml
--- a/lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml Sun Oct 11 15:00:40 2009 -0400
+++ b/lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml Sun Oct 11 15:07:11 2009 -0400
@@ -1,1 +1,16 @@
-/opt/galaxy/tools/rgenetics/converters/pbed_to_lped_converter.xml
\ No newline at end of file
+<tool id="pbed2lpedconvert" name="Convert plink pbed to linkage lped" version="0.01">
+ <!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> -->
+ <!-- Used on the metadata edit page. -->
+ <command interpreter="python">
+ pbed_to_lped_converter.py '$input1.extra_files_path/$input1.metadata.base_name'
+ '$output1' '$output1.extra_files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+ </command>
+ <inputs>
+ <param format="pbed" name="input1" type="data" label="Choose compressed Plink binary format genotype file"/>
+ </inputs>
+ <outputs>
+ <data format="lped" name="output1" metadata_source="input1"/>
+ </outputs>
+ <help>
+ </help>
+</tool>
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/75a488a0cbc9
changeset: 2871:75a488a0cbc9
user: Nate Coraor <nate(a)bx.psu.edu>
date: Mon Oct 12 12:48:37 2009 -0400
description:
Removing another not very useful symlink
1 file(s) affected in this change:
lib/galaxy/datatypes/genetics.py
diffs (6 lines):
diff -r 1a0bb7d6897c -r 75a488a0cbc9 lib/galaxy/datatypes/genetics.py
--- a/lib/galaxy/datatypes/genetics.py Sun Oct 11 15:07:11 2009 -0400
+++ b/lib/galaxy/datatypes/genetics.py Mon Oct 12 12:48:37 2009 -0400
@@ -1,1 +0,0 @@
-/opt/galaxy/tools/rgenetics/genetics.py
\ No newline at end of file
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/9d67ae5ecda7
changeset: 2872:9d67ae5ecda7
user: Ross Lazarus <ross.lazarus(a)gmail.com>
date: Mon Oct 12 13:19:31 2009 -0400
description:
real replacement for stoopid symlink
1 file(s) affected in this change:
lib/galaxy/datatypes/genetics.py
diffs (671 lines):
diff -r 75a488a0cbc9 -r 9d67ae5ecda7 lib/galaxy/datatypes/genetics.py
--- a/lib/galaxy/datatypes/genetics.py Mon Oct 12 12:48:37 2009 -0400
+++ b/lib/galaxy/datatypes/genetics.py Mon Oct 12 13:19:31 2009 -0400
@@ -0,0 +1,667 @@
+"""
+rgenetics datatypes
+Use at your peril
+Ross Lazarus
+for the rgenetics and galaxy projects
+
+genome graphs datatypes derived from Interval datatypes
+genome graphs datasets have a header row with appropriate columnames
+The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps
+subsequent row values are all numeric ! Will fail if any non numeric (eg '+' or 'NA') values
+ross lazarus for rgenetics
+august 20 2007
+"""
+
+import logging, os, sys, time, tempfile, shutil, string, glob
+import data
+from galaxy import util
+from cgi import escape
+import urllib
+from galaxy.web import url_for
+from galaxy.datatypes import metadata
+from galaxy.datatypes.metadata import MetadataElement
+from galaxy.datatypes.data import Text
+from galaxy.datatypes.tabular import Tabular
+from galaxy.datatypes.images import Html
+
+gal_Log = logging.getLogger(__name__)
+
+class GenomeGraphs( Tabular ):
+ """Tab delimited data containing a marker id and any number of numeric values"""
+
+ """Add metadata elements"""
+ MetadataElement( name="markerCol", default=1, desc="Marker ID column", param=metadata.ColumnParameter )
+ MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True )
+ MetadataElement( name="column_types", default=[], desc="Column types", readonly=True, visible=False )
+ file_ext = 'gg'
+
+ def __init__(self, **kwd):
+ """Initialize gg datatype, by adding UCSC display apps"""
+ Tabular.__init__(self, **kwd)
+ self.add_display_app ( 'ucsc', 'Genome Graph', 'as_ucsc_display_file', 'ucsc_links' )
+
+ def set_peek( self, dataset ):
+ """Set the peek and blurb text"""
+ if not dataset.dataset.purged:
+ dataset.peek = data.get_file_peek( dataset.file_name )
+ dataset.blurb = util.commaify( str( data.get_line_count( dataset.file_name ) ) ) + " rows"
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disk'
+
+ def get_mime(self):
+ """Returns the mime type of the datatype"""
+ return 'application/vnd.msexcel'
+
+ def get_estimated_display_viewport( self, dataset ):
+ """Return a chrom, start, stop tuple for viewing a file."""
+ raise notImplemented
+
+ def as_ucsc_display_file( self, dataset, **kwd ):
+ """Returns file"""
+ return file(dataset.file_name,'r')
+
+ def ucsc_links( self, dataset, type, app, base_url ):
+ """ from the ever-helpful angie hinrichs angie(a)soe.ucsc.edu
+ a genome graphs call looks like this
+ http://genome.ucsc.edu/cgi-bin/hgGenome?clade=mammal&org=Human&db=hg18&hgGe…
+ &hgGenome_dataSetDescription=test&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess
+ &hgGenome_columnLabels=best%20guess&hgGenome_maxVal=&hgGenome_labelVals=
+ &hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=http://galaxy.esphealth.org/datasets/333/display/index
+ &hgGenome_doSubmitUpload=submit
+ Galaxy gives this for an interval file
+ http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg18&position=chr1:1-1000&hgt.cu…
+ http%3A%2F%2Fgalaxy.esphealth.org%2Fdisplay_as%3Fid%3D339%26display_app%3Ducsc
+ """
+ ret_val = []
+ ggtail = '&hgGenome_doSubmitUpload=submit'
+ if not dataset.dbkey:
+ dataset.dbkey = 'hg18' # punt!
+ ret_val = []
+ ggtail = '&hgGenome_doSubmitUpload=submit'
+ if not dataset.dbkey:
+ dataset.dbkey = 'hg18' # punt!
+ if dataset.has_data:
+ for site_name, site_url in util.get_ucsc_by_build(dataset.dbkey):
+ if site_name in app.config.ucsc_display_sites:
+ site_url = site_url.replace('/hgTracks?','/hgGenome?') # for genome graphs
+ display_url = urllib.quote_plus( "%s/display_as?id=%i&display_app=%s" % (base_url, dataset.id, type) )
+ sl = ["%sdb=%s" % (site_url,dataset.dbkey ),]
+ sl.append("&hgGenome_dataSetName=%s&hgGenome_dataSetDescription=%s" % (dataset.name, 'GalaxyGG_data'))
+ sl.append("&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess")
+ sl.append("&hgGenome_columnLabels=first%20row&hgGenome_maxVal=&hgGenome_labelVals=")
+ sl.append("&hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=")
+ s = urllib.quote_plus( ''.join(sl) )
+ link = "%s%s%s" % (s, display_url, ggtail )
+ ret_val.append( (site_name, link) )
+ return ret_val
+
+
+ def validate( self, dataset ):
+ """Validate a gg file - all numeric after header row"""
+ errors = list()
+ infile = open(dataset.file_name, "r")
+ for i,row in enumerate(infile): #drop header
+ badvals = []
+ if i > 0:
+ ll = row.strip().split('\t')
+ for j,x in enumerate(ll):
+ try:
+ x = float(x)
+ except:
+ badval.append('col%d:%s' % (j+1,x))
+ if len(badvals) > 0:
+ errors.append('row %d, %s' % (' '.join(badvals)))
+ return errors
+
+ def repair_methods( self, dataset ):
+ """Return options for removing errors along with a description"""
+ return [("lines","Remove erroneous lines")]
+
+ def sniff(self,filename):
+ """
+ """
+ infile = open(dataset.file_name, "r")
+ header= infile.next() # header
+ badvals = []
+ for i,row in enumerate(infile[:10]): # sample first 10 rows
+ ll = row.strip().split('\t')
+ for j,x in enumerate(ll[1:]): # ignore first identifier col
+ try:
+ x = float(x)
+ except:
+ badval.append('col%d:%s' % (j+1,x))
+ if len(badvals) > 0:
+ return False
+ else:
+ return True
+
+class rgTabList(Tabular):
+ """ for sampleid and for featureid lists of exclusions or inclusions in the clean tool
+ featureid subsets on statistical criteria -> specialized display such as gg
+ """
+ file_ext = "rgTList"
+
+
+ def __init__(self, **kwd):
+ """Initialize featurelistt datatype"""
+ Tabular.__init__( self, **kwd )
+ self.column_names = []
+
+ def make_html_table( self, dataset, skipchars=[] ):
+ """Create HTML table, used for displaying peek"""
+ out = ['<table cellspacing="0" cellpadding="3">']
+ comments = []
+ try:
+ # Generate column header
+ out.append( '<tr>' )
+ for i, name in enumerate( self.column_names ):
+ out.append( '<th>%s.%s</th>' % ( str( i+1 ), name ) )
+ if dataset.metadata.columns - len( self.column_names ) > 0:
+ for i in range( len( self.column_names ), dataset.metadata.columns ):
+ out.append( '<th>%s</th>' % str( i+1 ) )
+ out.append( '</tr>' )
+ out.append( self.make_html_peek_rows( dataset, skipchars=skipchars ) )
+ out.append( '</table>' )
+ out = "".join( out )
+ except Exception, exc:
+ out = "Can't create peek %s" % exc
+ return out
+
+
+class rgSampleList(rgTabList):
+ """ for sampleid exclusions or inclusions in the clean tool
+ output from QC eg excess het, gender error, ibd pair member,eigen outlier,excess mendel errors,...
+ since they can be uploaded, should be flexible
+ but they are persistent at least
+ same infrastructure for expression?
+ """
+ file_ext = "rgSList"
+
+ def __init__(self, **kwd):
+ """Initialize samplelist datatype"""
+ rgTabList.__init__( self, **kwd )
+ self.column_names[0] = 'FID'
+ self.column_names[1] = 'IID'
+ # this is what Plink wants as at 2009
+
+ def sniff(self,filename):
+ """
+ """
+ infile = open(dataset.file_name, "r")
+ header= infile.next() # header
+ if header[0] == 'FID' and header[1] == 'IID':
+ return True
+ else:
+ return False
+
+class rgFeatureList( rgTabList ):
+ """ for featureid lists of exclusions or inclusions in the clean tool
+ output from QC eg low maf, high missingness, bad hwe in controls, excess mendel errors,...
+ featureid subsets on statistical criteria -> specialized display such as gg
+ same infrastructure for expression?
+ """
+ file_ext = "rgFList"
+
+ def __init__(self, **kwd):
+ """Initialize featurelist datatype"""
+ rgTabList.__init__( self, **kwd )
+ for i,s in enumerate(['#FeatureId', 'Chr', 'Genpos', 'Mappos']):
+ self.column_names[i] = s
+
+
+class Rgenetics(Html):
+ """class to use for rgenetics"""
+
+ MetadataElement( name="base_name", desc="base name for all transformed versions of this genetic dataset", default="rgenetics",
+ readonly=True, set_in_upload=True)
+
+ composite_type = 'auto_primary_file'
+ allow_datatype_change = False
+ file_ext = 'rgenetics'
+
+
+ def missing_meta( self, dataset=None, **kwargs):
+ """Checks for empty meta values"""
+ for key, value in dataset.metadata.items():
+ if not value:
+ return True
+ return False
+
+ def generate_primary_file( self, dataset = None ):
+ rval = ['<html><head><title>Rgenetics Galaxy Composite Dataset </title></head><p/>']
+ rval.append('<div>This composite dataset is composed of the following files:<p/><ul>')
+ for composite_name, composite_file in self.get_composite_files( dataset = dataset ).iteritems():
+ opt_text = ''
+ if composite_file.optional:
+ opt_text = ' (optional)'
+ rval.append( '<li><a href="%s" type="application/binary">%s</a>%s' % ( composite_name, composite_name, opt_text ) )
+ rval.append( '</ul></div></html>' )
+ return "\n".join( rval )
+
+class SNPMatrix(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="snpmatrix"
+
+ def set_peek( self, dataset ):
+ if not dataset.dataset.purged:
+ dataset.peek = "Binary RGenetics file"
+ dataset.blurb = data.nice_size( dataset.get_size() )
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disk'
+
+ def sniff(self,filename):
+ """ need to check the file header hex code
+ """
+ infile = open(dataset.file_name, "b")
+ head = infile.read(16)
+ head = [hex(x) for x in head]
+ if head <> '':
+ return False
+ else:
+ return True
+
+
+class Lped(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="lped"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.ped', description = 'Pedigree File', substitute_name_with_metadata = 'base_name', is_binary = True )
+ self.add_composite_file( '%s.map', description = 'Map File', substitute_name_with_metadata = 'base_name', is_binary = True )
+
+
+class Pphe(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="pphe"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.pphe', description = 'Plink Phenotype File', substitute_name_with_metadata = 'base_name' )
+
+
+class Lmap(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="lmap"
+
+class Fphe(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="fphe"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.fphe', description = 'FBAT Phenotype File', substitute_name_with_metadata = 'base_name' )
+
+class Phe(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="phe"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.phe', description = 'Phenotype File', substitute_name_with_metadata = 'base_name' )
+
+
+
+class Fped(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="fped"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.fped', description = 'FBAT format pedfile', substitute_name_with_metadata = 'base_name' )
+
+
+class Pbed(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="pbed"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.bim', substitute_name_with_metadata = 'base_name', is_binary = True )
+ self.add_composite_file( '%s.bed', substitute_name_with_metadata = 'base_name', is_binary = True )
+ self.add_composite_file( '%s.fam', substitute_name_with_metadata = 'base_name', is_binary = True )
+
+class Eigenstratgeno(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="eigenstratgeno"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.eigenstratgeno', substitute_name_with_metadata = 'base_name', is_binary = True )
+ self.add_composite_file( '%s.ind', substitute_name_with_metadata = 'base_name', is_binary = True )
+ self.add_composite_file( '%s.map', substitute_name_with_metadata = 'base_name', is_binary = True )
+
+
+
+class Eigenstratpca(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="eigenstratpca"
+
+ def __init__( self, **kwd ):
+ Rgenetics.__init__(self, **kwd)
+ self.add_composite_file( '%s.eigenstratpca', description = 'Eigenstrat PCA file', substitute_name_with_metadata = 'base_name' )
+
+
+class Snptest(Rgenetics):
+ """fake class to distinguish different species of Rgenetics data collections
+ """
+ file_ext="snptest"
+
+
+class Pheno(Tabular):
+ """
+ base class for pheno files
+ """
+ file_ext = 'pheno'
+
+
+class RexpBase( Html ):
+ """base class for BioC data structures in Galaxy
+ must be constructed with the pheno data in place since that
+ goes into the metadata for each instance
+ """
+ MetadataElement( name="columns", default=0, desc="Number of columns", visible=True )
+ MetadataElement( name="column_names", default=[], desc="Column names", visible=True )
+ MetadataElement(name="pheCols",default=[],desc="Select list for potentially interesting variables",visible=True)
+ MetadataElement( name="base_name",
+ desc="base name for all transformed versions of this expression dataset", default='rexpression', set_in_upload=True)
+ MetadataElement( name="pheno_path", desc="Path to phenotype data for this experiment", default="rexpression.pheno", visible=True)
+ file_ext = 'rexpbase'
+ html_table = None
+ is_binary = True
+ composite_type = 'auto_primary_file'
+ allow_datatype_change = False
+
+
+ def __init__( self, **kwd ):
+ Html.__init__(self,**kwd)
+ self.add_composite_file( '%s.pheno', description = 'Phenodata tab text file',
+ substitute_name_with_metadata = 'base_name', is_binary=True)
+
+ def generate_primary_file( self, dataset = None ):
+ """ This is called only at upload to write the html file
+ cannot rename the datasets here - they come with the default unfortunately
+ """
+ return '<html><head></head><body>AutoGenerated Primary File for Composite Dataset</body></html>'
+
+ def get_phecols(self, phenolist=[], maxConc=20):
+ """
+ sept 2009: cannot use whitespace to split - make a more complex structure here
+ and adjust the methods that rely on this structure
+ return interesting phenotype column names for an rexpression eset or affybatch
+ to use in array subsetting and so on. Returns a data structure for a
+ dynamic Galaxy select parameter.
+ A column with only 1 value doesn't change, so is not interesting for
+ analysis. A column with a different value in every row is equivalent to a unique
+ identifier so is also not interesting for anova or limma analysis - both these
+ are removed after the concordance (count of unique terms) is constructed for each
+ column. Then a complication - each remaining pair of columns is tested for
+ redundancy - if two columns are always paired, then only one is needed :)
+ """
+ for nrows,row in enumerate(phenolist): # construct concordance
+ if len(row.strip()) == 0:
+ break
+ row = row.strip().split('\t')
+ if nrows == 0: # set up from header
+ head = row
+ totcols = len(row)
+ concordance = [{} for x in head] # list of dicts
+ else:
+ for col,code in enumerate(row): # keep column order correct
+ if col >= totcols:
+ gal_Log.warning('### get_phecols error in pheno file - row %d col %d (%s) longer than header %s' % (nrows, col, row, head))
+ else:
+ concordance[col].setdefault(code,0) # first one is zero
+ concordance[col][code] += 1
+ useCols = []
+ useConc = [] # columns of interest to keep
+ nrows = len(phenolist)
+ nrows -= 1 # drop head from count
+ for c,conc in enumerate(concordance): # c is column number
+ if (len(conc) > 1) and (len(conc) < min(nrows,maxConc)): # not all same and not all different!!
+ useConc.append(conc) # keep concordance
+ useCols.append(c) # keep column
+ nuse = len(useCols)
+ # now to check for pairs of concordant columns - drop one of these.
+ delme = []
+ p = phenolist[1:] # drop header
+ plist = [x.strip().split('\t') for x in p] # list of lists
+ phe = [[x[i] for i in useCols] for x in plist if len(x) >= totcols] # strip unused data
+ for i in range(0,(nuse-1)): # for each interesting column
+ for j in range(i+1,nuse):
+ kdict = {}
+ for row in phe: # row is a list of lists
+ k = '%s%s' % (row[i],row[j]) # composite key
+ kdict[k] = k
+ if (len(kdict.keys()) == len(concordance[useCols[j]])): # i and j are always matched
+ delme.append(j)
+ delme = list(set(delme)) # remove dupes
+ listCol = []
+ delme.sort()
+ delme.reverse() # must delete from far end!
+ for i in delme:
+ del useConc[i] # get rid of concordance
+ del useCols[i] # and usecols entry
+ for i,conc in enumerate(useConc): # these are all unique columns for the design matrix
+ ccounts = [(conc.get(code,0),code) for code in conc.keys()] # decorate
+ ccounts.sort()
+ cc = [(x[1],x[0]) for x in ccounts] # list of code count tuples
+ codeDetails = (head[useCols[i]],cc) # ('foo',[('a',3),('b',11),..])
+ listCol.append(codeDetails)
+ if len(listCol) > 0:
+ res = listCol
+ # metadata.pheCols becomes [('bar;22,zot;113','foo'), ...]
+ else:
+ res = [('no usable phenotype columns found',[('?',0),]),]
+ return res
+
+
+
+ def get_pheno(self,dataset):
+ """expects a .pheno file in the extra_files_dir - ugh
+ note that R is wierd and adds the row.name in
+ the header so the columns are all wrong - unless you tell it not to.
+ A file can be written as
+ write.table(file='foo.pheno',pData(foo),sep='\t',quote=F,row.names=F)
+ """
+ p = file(dataset.metadata.pheno_path,'r').readlines()
+ if len(p) > 0: # should only need to fix an R pheno file once
+ head = p[0].strip().split('\t')
+ line1 = p[1].strip().split('\t')
+ if len(head) < len(line1):
+ head.insert(0,'ChipFileName') # fix R write.table b0rken-ness
+ p[0] = '\t'.join(head)
+ else:
+ p = []
+ return '\n'.join(p)
+
+ def set_peek( self, dataset ):
+ """expects a .pheno file in the extra_files_dir - ugh
+ note that R is wierd and does not include the row.name in
+ the header. why?"""
+ if not dataset.dataset.purged:
+ pp = os.path.join(dataset.extra_files_path,'%s.pheno' % dataset.metadata.base_name)
+ try:
+ p = file(pp,'r').readlines()
+ except:
+ p = ['##failed to find %s' % pp,]
+ gal_Log.debug('@@@rexpression set_peek, dataset.name=%s,\npp=%s,\np=%s' % (dataset.name,pp,p[:3]))
+ dataset.peek = ''.join(p[:5])
+ dataset.blurb = 'Galaxy Rexpression composite file'
+ else:
+ dataset.peek = 'file does not exist\n'
+ dataset.blurb = 'file purged from disk'
+
+ def get_peek( self, dataset ):
+ """expects a .pheno file in the extra_files_dir - ugh
+ """
+ pp = os.path.join(dataset.extra_files_path,'%s.pheno' % dataset.metadata.base_name)
+ try:
+ p = file(pp,'r').readlines()
+ except:
+ p = ['##failed to find %s' % pp]
+ gal_Log.debug('@@@rexpression get_peek, dataset.file_name=%s,\npp=%s,\np=%s' % (dataset.file_name,pp,p[:3]))
+ return ''.join(p[:5])
+
+ def get_file_peek(self,filename):
+ """
+ can't really peek at a filename - need the extra_files_path and such?
+ """
+ h = '## rexpression get_file_peek: no file found'
+ try:
+ h = file(filename,'r').readlines()
+ except:
+ pass
+ return ''.join(h[:5])
+
+ def regenerate_primary_file(self,dataset):
+ """cannot do this until we are setting metadata
+ """
+ bn = dataset.metadata.base_name
+ flist = os.listdir(dataset.extra_files_path)
+ rval = ['<html><head><title>Files for Composite Dataset %s</title></head><p/>Comprises the following files:<p/><ul>' % (bn)]
+ for i,fname in enumerate(flist):
+ sfname = os.path.split(fname)[-1]
+ rval.append( '<li><a href="%s">%s</a>' % ( sfname, sfname ) )
+ rval.append( '</ul></html>' )
+ gal_Log.debug('rexpression regenerate primary file, writing %s' % rval)
+ f = file(dataset.file_name,'w')
+ f.write("\n".join( rval ))
+ f.write('\n')
+ f.close()
+
+ """Add metadata elements"""
+ def init_meta( self, dataset, copy_from=None ):
+ if copy_from:
+ dataset.metadata = copy_from.metadata
+
+ def set_meta( self, dataset, **kwd ):
+
+ """
+ NOTE we apply the tabular machinary to the phenodata extracted
+ from a BioC eSet or affybatch.
+
+ """
+ try:
+ flist = os.listdir(dataset.extra_files_path)
+ except:
+ gal_Log.debug('@@@rexpression set_meta failed - no dataset?')
+ return
+ bn = None
+ for f in flist:
+ n = os.path.splitext(f)[0]
+ if not bn:
+ bn = n
+ dataset.metadata.base_name = bn
+ if not bn:
+ bn = '?'
+ pn = '%s.pheno' % (bn)
+ pp = os.path.join(dataset.extra_files_path,pn)
+ dataset.metadata.pheno_path=pp
+ try:
+ pf = file(pp,'r').readlines() # read the basename.phenodata in the extra_files_path
+ except:
+ pf = None
+ if pf:
+ h = pf[0].strip()
+ h = h.split('\t') # hope is header
+ h = [escape(x) for x in h]
+ dataset.metadata.column_names = h
+ dataset.metadata.columns = len(h)
+ dataset.peek = ''.join(pf[:5])
+ else:
+ dataset.metadata.column_names = []
+ dataset.metadata.columns = 0
+ dataset.peek = 'No pheno file found'
+ if len(pf) > 1:
+ dataset.metadata.pheCols = self.get_phecols(phenolist=pf)
+ else:
+ dataset.metadata.pheCols = [('','No useable phenotypes found',False),]
+ #self.regenerate_primary_file(dataset)
+ if not dataset.info:
+ dataset.info = 'Galaxy Expression datatype object'
+ if not dataset.blurb:
+ dataset.blurb = 'R loadable BioC expression object for the Rexpression Galaxy toolkit'
+ gal_Log.debug('@@@rexpression set_meta on dsn=%s, pf=%s, peek=%s' % (dataset.file_name,''.join(pf[:5]),dataset.peek))
+ return True
+
+ def make_html_table( self, pp='nothing supplied from peek\n'):
+ """Create HTML table, used for displaying peek"""
+ out = ['<table cellspacing="0" cellpadding="3">',]
+ p = pp.split('\n')
+ try:
+ # Generate column header
+ for i,row in enumerate(p):
+ lrow = row.strip().split('\t')
+ if i == 0:
+ orow = ['<th>%s</th>' % escape(x) for x in lrow]
+ orow.insert(0,'<tr>')
+ orow.append('</tr>')
+ else:
+ orow = ['<td>%s</td>' % escape(x) for x in lrow]
+ orow.insert(0,'<tr>')
+ orow.append('</tr>')
+ out.append(''.join(orow))
+ out.append( '</table>' )
+ out = "\n".join( out )
+ except Exception, exc:
+ out = "Can't create html table %s" % str( exc )
+ return out
+
+ def display_peek( self, dataset ):
+ """Returns formatted html of peek"""
+ out=self.make_html_table(dataset.peek)
+ return out
+
+ def get_mime(self):
+ """Returns the mime type of the datatype"""
+ return 'text/html'
+
+
+class Affybatch( RexpBase ):
+ """derived class for BioC data structures in Galaxy """
+
+ file_ext = "affybatch"
+
+ def __init__( self, **kwd ):
+ RexpBase.__init__(self, **kwd)
+ self.add_composite_file( '%s.affybatch', description = 'AffyBatch R object saved to file',
+ substitute_name_with_metadata = 'base_name', is_binary=True )
+
+class Eset( RexpBase ):
+ """derived class for BioC data structures in Galaxy """
+ file_ext = "eset"
+
+ def __init__( self, **kwd ):
+ RexpBase.__init__(self, **kwd)
+ self.add_composite_file( '%s.eset', description = 'ESet R object saved to file',
+ substitute_name_with_metadata = 'base_name', is_binary = True )
+
+
+class MAlist( RexpBase ):
+ """derived class for BioC data structures in Galaxy """
+ file_ext = "malist"
+
+ def __init__( self, **kwd ):
+ RexpBase.__init__(self, **kwd)
+ self.add_composite_file( '%s.malist', description = 'MAlist R object saved to file',
+ substitute_name_with_metadata = 'base_name', is_binary = True )
+
+
+if __name__ == '__main__':
+ import doctest, sys
+ doctest.testmod(sys.modules[__name__])
+
+
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/4a3e48e1e8e1
changeset: 2873:4a3e48e1e8e1
user: Kelly Vincent <kpvincent(a)bx.psu.edu>
date: Mon Oct 12 14:04:28 2009 -0400
description:
Changed FASTQ Groomer's handling of Sanger data to output all lines even if only first n are validated
3 file(s) affected in this change:
test-data/fastq_gen_conv_in2.fastq
test-data/fastq_gen_conv_out2.fastqsanger
tools/next_gen_conversion/fastq_gen_conv.py
diffs (74 lines):
diff -r 9d67ae5ecda7 -r 4a3e48e1e8e1 test-data/fastq_gen_conv_in2.fastq
--- a/test-data/fastq_gen_conv_in2.fastq Mon Oct 12 13:19:31 2009 -0400
+++ b/test-data/fastq_gen_conv_in2.fastq Mon Oct 12 14:04:28 2009 -0400
@@ -5,7 +5,7 @@
@seq2
GGGTCTCCCAGAATGATTAGAGCCGTATAGGA
+
-?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]
+?@ABCDEFGHIJK MNOPQRSTUVWXYZ[\\]
@seq3
GCGGTTCAATACGATTACCACCATGATAAATA
+
diff -r 9d67ae5ecda7 -r 4a3e48e1e8e1 test-data/fastq_gen_conv_out2.fastqsanger
--- a/test-data/fastq_gen_conv_out2.fastqsanger Mon Oct 12 13:19:31 2009 -0400
+++ b/test-data/fastq_gen_conv_out2.fastqsanger Mon Oct 12 14:04:28 2009 -0400
@@ -2,11 +2,19 @@
AAAGGTTTCTCTTTTGGAAATATCTAAATCCC
+
!"#$%&\'()*+,-./0123456789:;<=>.
-@seq2
-GGGTCTCCCAGAATGATTAGAGCCGTATAGGA
-+
-?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]
@seq3
GCGGTTCAATACGATTACCACCATGATAAATA
+
?Aa.1ghB2K!#lk(02GY[[II])Kwl+,5M
+@seq4
+AGTCTTTTCCTCTAAAATAACATAGGATACTA
++
+ghY)N375Nh.,Ol>==/<:2#i&d%#KdNII
+@seq5
+GAGGACTCATGGTAGGTATTTTACATGACATT
++
+IIgy%hf6#394bd&hNMWL$OPB63II*,+-
+@seq6
+GGCCTACATTCATTTACGAGACTAATTAGGGA
++
+IIIIIgd6#5%jKO&.,D+s3aW=cdGB#a1$
\ No newline at end of file
diff -r 9d67ae5ecda7 -r 4a3e48e1e8e1 tools/next_gen_conversion/fastq_gen_conv.py
--- a/tools/next_gen_conversion/fastq_gen_conv.py Mon Oct 12 13:19:31 2009 -0400
+++ b/tools/next_gen_conversion/fastq_gen_conv.py Mon Oct 12 14:04:28 2009 -0400
@@ -47,14 +47,15 @@
lines = []
line = fin.readline()
while line:
- if max_blocks >= 0 and block_num > 0 and orig_type == 'sanger' and max_blocks < block_num:
- print 'break'
- break
- if line.strip():
- # the line that starts of a block, with a name
+ if line.strip() and max_blocks >= 0 and block_num > 0 and orig_type == 'sanger' and block_num >= max_blocks:
+ fout.write(line)
+ if line_count % 4 == 0:
+ block_num += 1
+ line_count += 1
+ elif line.strip():
+ # the line that starts a block, with a name
if line_count % 4 == 0 and line.startswith('@'):
lines.append(line)
- block_num += 1
else:
# if we expect a sequence of bases
if line_count % 4 == 1 and all_bases_valid(line.strip()):
@@ -154,6 +155,8 @@
bad_blocks += 1
base_len = -1
lines = []
+ # mark the successful end of a block
+ block_num += 1
line_count += 1
line = fin.readline()
fout.close()
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/109e94372abb
changeset: 2868:109e94372abb
user: Ross Lazarus <ross.lazarus(a)gmail.com>
date: Sun Oct 11 09:45:38 2009 -0400
description:
added 2 valid chars ;| and patch for empty url_paste in composite upload
2 file(s) affected in this change:
lib/galaxy/tools/parameters/grouping.py
lib/galaxy/util/__init__.py
diffs (24 lines):
diff -r 5391edcf618d -r 109e94372abb lib/galaxy/tools/parameters/grouping.py
--- a/lib/galaxy/tools/parameters/grouping.py Sun Oct 11 09:37:43 2009 -0400
+++ b/lib/galaxy/tools/parameters/grouping.py Sun Oct 11 09:45:38 2009 -0400
@@ -226,7 +226,7 @@
if context.get( 'space_to_tab', None ) not in ["None", None]:
space_to_tab = True
file_bunch = get_data_file_filename( data_file, override_name = name, override_info = info )
- if file_bunch.path:
+ if file_bunch.path and url_paste:
if url_paste.strip():
warnings.append( "All file contents specified in the paste box were ignored." )
else: #we need to use url_paste
diff -r 5391edcf618d -r 109e94372abb lib/galaxy/util/__init__.py
--- a/lib/galaxy/util/__init__.py Sun Oct 11 09:37:43 2009 -0400
+++ b/lib/galaxy/util/__init__.py Sun Oct 11 09:45:38 2009 -0400
@@ -109,7 +109,7 @@
return text
# characters that are valid
-valid_chars = set(string.letters + string.digits + " -=_.()/+*^,:?!")
+valid_chars = set(string.letters + string.digits + " -=_.()/+*^,:?!;|")
# characters that are allowed but need to be escaped
mapped_chars = { '>' :'__gt__',
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/639c6b5e0073
changeset: 2869:639c6b5e0073
user: Ross Lazarus <ross.lazarus(a)gmail.com>
date: Sun Oct 11 15:00:40 2009 -0400
description:
adding rgenetics converters
6 file(s) affected in this change:
lib/galaxy/datatypes/converters/lped_to_fped_converter.py
lib/galaxy/datatypes/converters/lped_to_fped_converter.xml
lib/galaxy/datatypes/converters/lped_to_pbed_converter.py
lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml
lib/galaxy/datatypes/converters/pbed_to_lped_converter.py
lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml
diffs (36 lines):
diff -r 109e94372abb -r 639c6b5e0073 lib/galaxy/datatypes/converters/lped_to_fped_converter.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/lped_to_fped_converter.py Sun Oct 11 15:00:40 2009 -0400
@@ -0,0 +1,1 @@
+/opt/galaxy/tools/rgenetics/converters/lped_to_fped_converter.py
\ No newline at end of file
diff -r 109e94372abb -r 639c6b5e0073 lib/galaxy/datatypes/converters/lped_to_fped_converter.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/lped_to_fped_converter.xml Sun Oct 11 15:00:40 2009 -0400
@@ -0,0 +1,1 @@
+/opt/galaxy/tools/rgenetics/converters/lped_to_fped_converter.xml
\ No newline at end of file
diff -r 109e94372abb -r 639c6b5e0073 lib/galaxy/datatypes/converters/lped_to_pbed_converter.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py Sun Oct 11 15:00:40 2009 -0400
@@ -0,0 +1,1 @@
+/opt/galaxy/tools/rgenetics/converters/lped_to_pbed_converter.py
\ No newline at end of file
diff -r 109e94372abb -r 639c6b5e0073 lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/lped_to_pbed_converter.xml Sun Oct 11 15:00:40 2009 -0400
@@ -0,0 +1,1 @@
+/opt/galaxy/tools/rgenetics/converters/lped_to_pbed_converter.xml
\ No newline at end of file
diff -r 109e94372abb -r 639c6b5e0073 lib/galaxy/datatypes/converters/pbed_to_lped_converter.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py Sun Oct 11 15:00:40 2009 -0400
@@ -0,0 +1,1 @@
+/opt/galaxy/tools/rgenetics/converters/pbed_to_lped_converter.py
\ No newline at end of file
diff -r 109e94372abb -r 639c6b5e0073 lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/converters/pbed_to_lped_converter.xml Sun Oct 11 15:00:40 2009 -0400
@@ -0,0 +1,1 @@
+/opt/galaxy/tools/rgenetics/converters/pbed_to_lped_converter.xml
\ No newline at end of file
1
0
13 Oct '09
details: http://www.bx.psu.edu/hg/galaxy/rev/5391edcf618d
changeset: 2867:5391edcf618d
user: Ross Lazarus <ross.lazarus(a)gmail.com>
date: Sun Oct 11 09:37:43 2009 -0400
description:
rexpression datatypes and fixes for rgenetics datatypes
1 file(s) affected in this change:
lib/galaxy/datatypes/genetics.py
diffs (376 lines):
diff -r 080b3c44963e -r 5391edcf618d lib/galaxy/datatypes/genetics.py
--- a/lib/galaxy/datatypes/genetics.py Sat Oct 10 16:18:08 2009 -0400
+++ b/lib/galaxy/datatypes/genetics.py Sun Oct 11 09:37:43 2009 -0400
@@ -1,370 +1,1 @@
-"""
-rgenetics datatypes
-Use at your peril
-Ross Lazarus
-for the rgenetics and galaxy projects
-
-genome graphs datatypes derived from Interval datatypes
-genome graphs datasets have a header row with appropriate columnames
-The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps
-subsequent row values are all numeric ! Will fail if any non numeric (eg '+' or 'NA') values
-ross lazarus for rgenetics
-august 20 2007
-"""
-
-import logging, os, sys, time, tempfile, shutil
-import data
-from galaxy import util
-from cgi import escape
-import urllib
-from galaxy.web import url_for
-from galaxy.datatypes import metadata
-from galaxy.datatypes.metadata import MetadataElement
-#from galaxy.datatypes.data import Text
-from galaxy.datatypes.tabular import Tabular
-from galaxy.datatypes.images import Html
-
-log = logging.getLogger(__name__)
-
-
-
-class GenomeGraphs( Tabular ):
- """Tab delimited data containing a marker id and any number of numeric values"""
-
- """Add metadata elements"""
- MetadataElement( name="markerCol", default=1, desc="Marker ID column", param=metadata.ColumnParameter )
- MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True )
- MetadataElement( name="column_types", default=[], desc="Column types", readonly=True, visible=False )
- file_ext = 'gg'
-
- def __init__(self, **kwd):
- """Initialize gg datatype, by adding UCSC display apps"""
- Tabular.__init__(self, **kwd)
- self.add_display_app ( 'ucsc', 'Genome Graph', 'as_ucsc_display_file', 'ucsc_links' )
-
- def set_peek( self, dataset ):
- """Set the peek and blurb text"""
- if not dataset.dataset.purged:
- dataset.peek = data.get_file_peek( dataset.file_name )
- dataset.blurb = util.commaify( str( data.get_line_count( dataset.file_name ) ) ) + " rows"
- #i don't think set_meta should not be called here, it should be called separately
- self.set_meta( dataset )
- else:
- dataset.peek = 'file does not exist'
- dataset.blurb = 'file purged from disk'
-
- def get_estimated_display_viewport( self, dataset ):
- """Return a chrom, start, stop tuple for viewing a file."""
- raise notImplemented
-
- def ucsc_links( self, dataset, type, app, base_url ):
- """ from the ever-helpful angie hinrichs angie(a)soe.ucsc.edu
- a genome graphs call looks like this
- http://genome.ucsc.edu/cgi-bin/hgGenome?clade=mammal&org=Human&db=hg18&hgGe…
- &hgGenome_dataSetDescription=test&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess
- &hgGenome_columnLabels=best%20guess&hgGenome_maxVal=&hgGenome_labelVals=
- &hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=http://galaxy.esphealth.org/datasets/333/display/index
- &hgGenome_doSubmitUpload=submit
- Galaxy gives this for an interval file
- http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg18&position=chr1:1-1000&hgt.cu…
- http%3A%2F%2Fgalaxy.esphealth.org%2Fdisplay_as%3Fid%3D339%26display_app%3Ducsc
- """
- ret_val = []
- ggtail = '&hgGenome_doSubmitUpload=submit'
- if not dataset.dbkey:
- dataset.dbkey = 'hg18' # punt!
- if dataset.has_data:
- for site_name, site_url in util.get_ucsc_by_build(dataset.dbkey):
- if site_name in app.config.ucsc_display_sites:
- site_url = site_url.replace('/hgTracks?','/hgGenome?') # for genome graphs
- display_url = urllib.quote_plus( "%s%s/display_as?id=%i&display_app=%s" % (base_url, url_for( controller='root' ), dataset.id, type))
- sl = ["%sdb=%s" % (site_url,dataset.dbkey ),]
- sl.append("&hgGenome_dataSetName=%s&hgGenome_dataSetDescription=%s" % (dataset.name, 'GalaxyGG_data'))
- sl.append("&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess")
- sl.append("&hgGenome_columnLabels=first%20row&hgGenome_maxVal=&hgGenome_labelVals=")
- sl.append("&hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=%%s")
- sl.append(ggtail)
- s = urllib.quote_plus( ''.join(sl) )
- link = '%s?redirect_url=%s&display_url=%s' % ( internal_url, s, display_url )
- ret_val.append( (site_name, link) )
- return ret_val
-
- def validate( self, dataset ):
- """Validate a gg file - all numeric after header row"""
- errors = list()
- infile = open(dataset.file_name, "r")
- header= infile.next() # header
- for i,row in enumerate(infile):
- ll = row.strip().split('\t')
- badvals = []
- for j,x in enumerate(ll):
- try:
- x = float(x)
- except:
- badval.append('col%d:%s' % (j+1,x))
- if len(badvals) > 0:
- errors.append('row %d, %s' % (' '.join(badvals)))
- return errors
-
- def repair_methods( self, dataset ):
- """Return options for removing errors along with a description"""
- return [("lines","Remove erroneous lines")]
-
-
-class Rgenetics(Html):
- """class to use for rgenetics"""
- """Add metadata elements"""
- MetadataElement( name="base_name", desc="base name for all transformed versions of this genetic dataset", default="galaxy", readonly=True, set_in_upload=True)
-
- file_ext="html"
- composite_type = 'auto_primary_file'
- allow_datatype_change = False
-
- def missing_meta( self, dataset ):
- """Checks for empty meta values"""
- for key, value in dataset.metadata.items():
- if not value:
- return True
- return False
-
- def generate_primary_file( self, dataset = None ):
- rval = ['<html><head><title>Files for Composite Dataset (%s)</title></head><p/>This composite dataset is composed of the following files:<p/><ul>' % ( self.file_ext ) ]
- for composite_name, composite_file in self.get_composite_files( dataset = dataset ).iteritems():
- opt_text = ''
- if composite_file.optional:
- opt_text = ' (optional)'
- rval.append( '<li><a href="%s">%s</a>%s' % ( composite_name, composite_name, opt_text ) )
- rval.append( '</ul></html>' )
- return "\n".join( rval )
-
-class SNPMatrix(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="snpmatrix"
-
- def set_peek( self, dataset ):
- if not dataset.dataset.purged:
- dataset.peek = "Binary RGenetics file"
- dataset.blurb = data.nice_size( dataset.get_size() )
- else:
- dataset.peek = 'file does not exist'
- dataset.blurb = 'file purged from disk'
-
-
-class Lped(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="lped"
-
- def __init__( self, **kwd ):
- Rgenetics.__init__( self, **kwd )
- self.add_composite_file( '%s.ped', description = 'Pedigree File', substitute_name_with_metadata = 'base_name', is_binary = True )
- self.add_composite_file( '%s.map', description = 'Map File', substitute_name_with_metadata = 'base_name', is_binary = True )
-
-
-class Pphe(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="pphe"
-
-class Lmap(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="lmap"
-
-class Fphe(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="fphe"
-
-class Phe(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="phe"
-
-
-class Fped(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="fped"
-
-
-class Pbed(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="pbed"
-
- def __init__( self, **kwd ):
- Rgenetics.__init__( self, **kwd )
- self.add_composite_file( '%s.bim', substitute_name_with_metadata = 'base_name', is_binary = True )
- self.add_composite_file( '%s.bed', substitute_name_with_metadata = 'base_name', is_binary = True )
- self.add_composite_file( '%s.fam', substitute_name_with_metadata = 'base_name', is_binary = True )
- self.add_composite_file( '%s.map', substitute_name_with_metadata = 'base_name', is_binary = True )
-
-
-class Eigenstratgeno(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="eigenstratgeno"
-
- def __init__( self, **kwd ):
- Rgenetics.__init__( self, **kwd )
- self.add_composite_file( '%s.eigenstratgeno', substitute_name_with_metadata = 'base_name', is_binary = True )
- self.add_composite_file( '%s.ind', substitute_name_with_metadata = 'base_name', is_binary = True )
- self.add_composite_file( '%s.map', substitute_name_with_metadata = 'base_name', is_binary = True )
- self.add_composite_file( '%s_fo.eigenstratgeno', substitute_name_with_metadata = 'base_name', optional = 'True', is_binary = True )
- self.add_composite_file( '%s_fo.ind', substitute_name_with_metadata = 'base_name', optional = 'True', is_binary = True )
- self.add_composite_file( '%s_fo.map', substitute_name_with_metadata = 'base_name', optional = 'True', is_binary = True )
- self.add_composite_file( '%s_oo.eigenstratgeno', substitute_name_with_metadata = 'base_name', optional = 'True', is_binary = True )
- self.add_composite_file( '%s_oo.ind', substitute_name_with_metadata = 'base_name', optional = 'True', is_binary = True )
- self.add_composite_file( '%s_oo.map', substitute_name_with_metadata = 'base_name', optional = 'True', is_binary = True )
-
-
-
-class Eigenstratpca(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="eigenstratpca"
-
-class Snptest(Rgenetics):
- """fake class to distinguish different species of Rgenetics data collections
- """
- file_ext="snptest"
-
-class RexpBase( Html ):
- """base class for BioC data structures in Galaxy
- must be constructed with the pheno data in place since that
- goes into the metadata for each instance"""
-
- """Add metadata elements"""
- MetadataElement( name="columns", default=0, desc="Number of columns", readonly=True, visible=False )
- MetadataElement( name="column_names", default=[], desc="Column names", readonly=True,visible=True )
- MetadataElement( name="base_name",
- desc="base name for all transformed versions of this genetic dataset", readonly=True, default='galaxy', set_in_upload=True)
- ### Do we really need these below? can we rely on dataset.extra_files_path: os.path.join( dataset.extra_files_path, '%s.phenodata' % dataset.metadata.base_name ) ?
- ### Do these have a different purpose? Ross will need to clarify
- ### Uploading these datatypes will not work until this is sorted out (set_peek fails)...
- MetadataElement( name="pheno_path",
- desc="Path to phenotype data for this experiment", readonly=True)
- MetadataElement( name="pheno",
- desc="Phenotype data for this experiment", readonly=True)
-
- file_ext = None
-
- is_binary = True
-
- allow_datatype_change = False
-
- composite_type = 'basic'
-
- def __init__( self, **kwd ):
- Html.__init__( self, **kwd )
- self.add_composite_file( '%s.phenodata', substitute_name_with_metadata = 'base_name', is_binary = True )
-
- def set_peek( self, dataset ):
- """expects a .pheno file in the extra_files_dir - ugh
- note that R is wierd and does not include the row.name in
- the header. why?"""
- p = file(dataset.metadata.pheno_path,'r').readlines() #this fails
- head = p[0].strip().split('\t')
- head.insert(0,'ChipFileName') # fix R write.table b0rken-ness
- p[0] = '\t'.join(head)
- p = '\n'.join(p)
- dataset.peek = p
- dataset.metadata.pheno = p
- dataset.blurb = 'R loadable BioC expression object for the Rexpression Galaxy toolkit'
-
- # stolen from Tabular
- # class Tabular( data.Text ):
- """Tab delimited data"""
-
- """Add metadata elements"""
- def init_meta( self, dataset, copy_from=None ):
- if copy_from:
- dataset.metadata = copy_from.metadata
-
-
- #def set_readonly_meta( self, dataset, skip=0, **kwd ):
- # """Resets the values of readonly metadata elements."""
- # RexpBase.set_meta( self, dataset, skip=skip )
-
- def set_readonly_meta( self, dataset, **kwd ):
- """Resets the values of readonly metadata elements."""
- RexpBase.set_meta( self, dataset )
-
- #def set_meta( self, dataset, skip=0, **kwd ):
- def set_meta( self, dataset, **kwd ):
-
- """
- NOTE we apply the tabular machinary to the phenodata extracted
- from a BioC eSet or affybatch.
-
- """
- if not dataset.peek:
- dataset.set_peek()
- pk = dataset.peek # use the peek which is the pheno data insead of dataset (!)
- ###this is probably not the best source, can we just access the raw data directly?
- if pk:
- p = pk.split('\n')
- h = p[0].strip().split('\t') # hope is header
- h = [escape(x) for x in h]
- dataset.metadata.column_names = h
- dataset.metadata.columns = len(h)
- else:
- dataset.metadata.column_names = []
- dataset.metadata.columns = 0
-
- def make_html_table( self, dataset):
- """Create HTML table, used for displaying peek"""
- out = ['<table cellspacing="0" cellpadding="3">',]
- try:
- # Generate column header
- pk = dataset.peek
- p = pk.split('\n')
- for i,row in enumerate(p):
- lrow = row.strip().split('\t')
- if i == 0:
- orow = ['<th>%s</th>' % escape(x) for x in lrow]
- orow.insert(0,'<tr>')
- orow.append('</tr>')
- else:
- orow = ['<td>%s</td>' % escape(x) for x in lrow]
- orow.insert(0,'<tr>')
- orow.append('</tr>')
- out.append(''.join(orow))
- out.append( '</table>' )
- out = "\n".join( out )
- except Exception, exc:
- out = "Can't create peek %s" % str( exc )
- return out
-
- def display_peek( self, dataset ):
- """Returns formatted html of peek"""
- if not dataset.peek:
- dataset.set_peek()
- return self.make_html_table( dataset )
-
- def get_mime(self):
- """Returns the mime type of the datatype"""
- return 'application/gzip'
-
-
-class AffyBatch( RexpBase ):
- """derived class for BioC data structures in Galaxy """
- file_ext = "affybatch"
-
-
-class ESet( RexpBase ):
- """derived class for BioC data structures in Galaxy """
- file_ext = "eset"
-
-
-class MAList( RexpBase ):
- """derived class for BioC data structures in Galaxy """
- file_ext = "malist"
-
-
-if __name__ == '__main__':
- import doctest, sys
- doctest.testmod(sys.modules[__name__])
-
+/opt/galaxy/tools/rgenetics/genetics.py
\ No newline at end of file
1
0