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
April 2010
- 37 participants
- 148 discussions
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/b95a24c9187e
changeset: 3602:b95a24c9187e
user: fubar: ross Lazarus at gmail period com
date: Fri Apr 02 14:23:55 2010 -0400
description:
Two small fixes for WGA/SNP tools needed so they work on test.
Remove bogus extra_ from file_path for output files - works on rgenetics.org but breaks on test - fixed
Need to create output extra_files_path in rgGRR.py
diffstat:
tools/rgenetics/rgGRR.py | 4 ++++
tools/rgenetics/rgGRR.xml | 2 +-
tools/rgenetics/rgfakePed.xml | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diffs (38 lines):
diff -r 6bbe3704b015 -r b95a24c9187e tools/rgenetics/rgGRR.py
--- a/tools/rgenetics/rgGRR.py Fri Apr 02 12:24:39 2010 -0400
+++ b/tools/rgenetics/rgGRR.py Fri Apr 02 14:23:55 2010 -0400
@@ -1037,6 +1037,10 @@
basename = sys.argv[2]
outhtml = sys.argv[3]
newfilepath = sys.argv[4]
+ try:
+ os.makedirs(newfilepath)
+ except:
+ pass
title = sys.argv[5].translate(ptran)
logfname = 'Log_%s.txt' % title
logpath = os.path.join(newfilepath,logfname) # log was a child - make part of html extra_files_path zoo
diff -r 6bbe3704b015 -r b95a24c9187e tools/rgenetics/rgGRR.xml
--- a/tools/rgenetics/rgGRR.xml Fri Apr 02 12:24:39 2010 -0400
+++ b/tools/rgenetics/rgGRR.xml Fri Apr 02 14:23:55 2010 -0400
@@ -3,7 +3,7 @@
<description>Pairwise Allele Sharing</description>
<command interpreter="python">
rgGRR.py $i.extra_files_path/$i.metadata.base_name "$i.metadata.base_name"
- '$out_file1' '$out_file1.extra_files_path' "$title1" '$n' '$Z'
+ '$out_file1' '$out_file1.files_path' "$title1" '$n' '$Z'
</command>
<inputs>
<param name="i" type="data" label="Genotype data file from your current history"
diff -r 6bbe3704b015 -r b95a24c9187e tools/rgenetics/rgfakePed.xml
--- a/tools/rgenetics/rgfakePed.xml Fri Apr 02 12:24:39 2010 -0400
+++ b/tools/rgenetics/rgfakePed.xml Fri Apr 02 14:23:55 2010 -0400
@@ -2,7 +2,7 @@
<description>for testing</description>
<code file="rgfakePed_code.py"/>
<command interpreter="python">rgfakePed.py --title '$title1'
- -o '$out_file1' -p '$out_file1.extra_files_path' -c '$ncases' -n '$ntotal'
+ -o '$out_file1' -p '$out_file1.files_path' -c '$ncases' -n '$ntotal'
-s '$nsnp' -w '$lowmaf' -v '$missingValue' -l '$outFormat'
-d '$mafdist' -m '$missingRate' -M '$mendelRate' </command>
<inputs>
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/6bbe3704b015
changeset: 3601:6bbe3704b015
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Fri Apr 02 12:24:39 2010 -0400
description:
Fix value-entry bug in dbkey select input component. Bug reported by Assaf Gordon.
diffstat:
static/scripts/galaxy.base.js | 4 +++-
static/scripts/packed/galaxy.base.js | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diffs (24 lines):
diff -r 146eae852b97 -r 6bbe3704b015 static/scripts/galaxy.base.js
--- a/static/scripts/galaxy.base.js Fri Apr 02 11:10:23 2010 -0400
+++ b/static/scripts/galaxy.base.js Fri Apr 02 12:24:39 2010 -0400
@@ -146,9 +146,11 @@
return;
}
- // Set options and mapping.
+ // Set options and mapping. Mapping is (i) [from text to value] AND (ii) [from value to value]. This
+ // enables a user to type the value directly rather than select the text that represents the value.
dbkey_options.push( text );
dbkey_mapping[ text ] = value;
+ dbkey_mapping[ value ] = value;
// If this is the start value, set value of input element.
if ( value == start_value ) {
diff -r 146eae852b97 -r 6bbe3704b015 static/scripts/packed/galaxy.base.js
--- a/static/scripts/packed/galaxy.base.js Fri Apr 02 11:10:23 2010 -0400
+++ b/static/scripts/packed/galaxy.base.js Fri Apr 02 12:24:39 2010 -0400
@@ -1,1 +1,1 @@
-$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function ensure_popup_helper(){if($("#popup-helper").length===0){$("<div id='popup-helper'/>").css({background:"white",opacity:0,zIndex:15000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function attach_popupmenu(b,d){var a=function(){d.unbind().hide();$("#popup-helper").unbind("click.popupmenu").hide()};var c=function(g){$("#popup-helper").bind("click.popupmenu",a).show();d.click(a).css({left:0,top:-1000}).show();var f=g.pageX-d.width()/2;f=Math.min(f,$(document).scrollLeft()+$(window).width()-$(d).width()-20);f=Math.max(f,$(document).scrollLeft()+20);d.css({top:g.pageY-5,left:f});return false};$(b).click(c)}function make_popupmenu(c,b){ensure_popup_helper();var a=$("<ul id='"+c.attr("id"!
)+"-menu'></ul>");$.each(b,function(f,e){if(e){$("<li/>").html(f).click(e).appendTo(a)}else{$("<li class='head'/>").html(f).appendTo(a)}});var d=$("<div class='popmenu-wrapper'>");d.append(a).append("<div class='overlay-border'>").css("position","absolute").appendTo("body").hide();attach_popupmenu(c,d)}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var c={};$(this).find("a").each(function(){var b=$(this).attr("confirm"),d=$(this).attr("href"),e=$(this).attr("target");c[$(this).text()]=function(){if(!b||confirm(b)){var g=window;if(e=="_parent"){g=window.parent}else{if(e=="_top"){g=window.top}}g.location=d}}});var a=$("#"+$(this).attr("popupmenu"));make_popupmenu(a,c);$(this).remove();a.addClass("popup").show()})}function array_length(b){if(b.length){return b.length}var c=0;for(var a in b){c++}return c}function replace_dbkey_select(){var c=$("select[name=dbkey]");var d=c.attr("value");if(c.length!==0){var e=$("<input id='dbkey-input' type='text'></input>!
");e.attr("size",40);e.attr("name",c.attr("name"));e.click(function(){
var g=$(this).attr("value");$(this).attr("value","Loading...");$(this).showAllInCache();$(this).attr("value",g);$(this).select()});var b=[];var a={};c.children("option").each(function(){var h=$(this).text();var g=$(this).attr("value");if(g=="?"){return}b.push(h);a[h]=g;if(g==d){e.attr("value",h)}});if(e.attr("value")==""){e.attr("value","Click to Search or Select Build")}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:1000,minChars:0,hideForLessThanMinChars:false};e.autocomplete(b,f);c.replaceWith(e);$("form").submit(function(){var i=$("#dbkey-input");if(i.length!==0){var h=i.attr("value");var g=a[h];if(g!==null&&g!==undefined){i.attr("value",g)}else{if(d!=""){i.attr("value",d)}else{i.attr("value","?")}}}})}}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,!
cols:c}).text(k)}else{j=$("<input type='text'></input>").attr({value:k,size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){l.text(o);if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}$(document).ready(function(){$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus()});
\ No newline at end of file
+$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function ensure_popup_helper(){if($("#popup-helper").length===0){$("<div id='popup-helper'/>").css({background:"white",opacity:0,zIndex:15000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function attach_popupmenu(b,d){var a=function(){d.unbind().hide();$("#popup-helper").unbind("click.popupmenu").hide()};var c=function(g){$("#popup-helper").bind("click.popupmenu",a).show();d.click(a).css({left:0,top:-1000}).show();var f=g.pageX-d.width()/2;f=Math.min(f,$(document).scrollLeft()+$(window).width()-$(d).width()-20);f=Math.max(f,$(document).scrollLeft()+20);d.css({top:g.pageY-5,left:f});return false};$(b).click(c)}function make_popupmenu(c,b){ensure_popup_helper();var a=$("<ul id='"+c.attr("id"!
)+"-menu'></ul>");$.each(b,function(f,e){if(e){$("<li/>").html(f).click(e).appendTo(a)}else{$("<li class='head'/>").html(f).appendTo(a)}});var d=$("<div class='popmenu-wrapper'>");d.append(a).append("<div class='overlay-border'>").css("position","absolute").appendTo("body").hide();attach_popupmenu(c,d)}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var c={};$(this).find("a").each(function(){var b=$(this).attr("confirm"),d=$(this).attr("href"),e=$(this).attr("target");c[$(this).text()]=function(){if(!b||confirm(b)){var g=window;if(e=="_parent"){g=window.parent}else{if(e=="_top"){g=window.top}}g.location=d}}});var a=$("#"+$(this).attr("popupmenu"));make_popupmenu(a,c);$(this).remove();a.addClass("popup").show()})}function array_length(b){if(b.length){return b.length}var c=0;for(var a in b){c++}return c}function replace_dbkey_select(){var c=$("select[name=dbkey]");var d=c.attr("value");if(c.length!==0){var e=$("<input id='dbkey-input' type='text'></input>!
");e.attr("size",40);e.attr("name",c.attr("name"));e.click(function(){
var g=$(this).attr("value");$(this).attr("value","Loading...");$(this).showAllInCache();$(this).attr("value",g);$(this).select()});var b=[];var a={};c.children("option").each(function(){var h=$(this).text();var g=$(this).attr("value");if(g=="?"){return}b.push(h);a[h]=g;a[g]=g;if(g==d){e.attr("value",h)}});if(e.attr("value")==""){e.attr("value","Click to Search or Select Build")}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:1000,minChars:0,hideForLessThanMinChars:false};e.autocomplete(b,f);c.replaceWith(e);$("form").submit(function(){var i=$("#dbkey-input");if(i.length!==0){var h=i.attr("value");var g=a[h];if(g!==null&&g!==undefined){i.attr("value",g)}else{if(d!=""){i.attr("value",d)}else{i.attr("value","?")}}}})}}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({!
rows:i,cols:c}).text(k)}else{j=$("<input type='text'></input>").attr({value:k,size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){l.text(o);if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}$(document).ready(function(){$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus()});
\ No newline at end of file
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/146eae852b97
changeset: 3600:146eae852b97
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Fri Apr 02 11:10:23 2010 -0400
description:
Make visualizations (a) importable and (b) embeddable in pages. Still need to add code for displaying visualizations in pages.
diffstat:
lib/galaxy/web/base/controller.py | 2 +-
lib/galaxy/web/controllers/page.py | 35 +++++++++++++++-
lib/galaxy/web/controllers/visualization.py | 63 ++++++++++++++++++++++++++++-
lib/galaxy/web/controllers/workflow.py | 4 -
static/june_2007_style/blue/embed_item.css | 2 +
static/june_2007_style/embed_item.css.tmpl | 10 ++++
templates/page/editor.mako | 32 ++++++++++++--
templates/visualization/embed.mako | 4 +
8 files changed, 140 insertions(+), 12 deletions(-)
diffs (337 lines):
diff -r b07142ce9dbb -r 146eae852b97 lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py Thu Apr 01 22:48:57 2010 -0400
+++ b/lib/galaxy/web/base/controller.py Fri Apr 02 11:10:23 2010 -0400
@@ -178,7 +178,7 @@
if not visualization:
error( "Visualization not found" )
else:
- return self.security_check( trans.get_user(), stored, check_ownership, check_accessible )
+ return self.security_check( trans.get_user(), visualization, check_ownership, check_accessible )
class UsesStoredWorkflow( SharableItemSecurity ):
""" Mixin for controllers that use StoredWorkflow objects. """
diff -r b07142ce9dbb -r 146eae852b97 lib/galaxy/web/controllers/page.py
--- a/lib/galaxy/web/controllers/page.py Thu Apr 01 22:48:57 2010 -0400
+++ b/lib/galaxy/web/controllers/page.py Fri Apr 02 11:10:23 2010 -0400
@@ -186,6 +186,25 @@
key="free-text-search", visible=False, filterable="standard" )
)
+class VisualizationSelectionGrid( ItemSelectionGrid ):
+ """ Grid for selecting visualizations. """
+ # Grid definition.
+ title = "Saved Visualizations"
+ model_class = model.Visualization
+ columns = [
+ grids.TextColumn( "Title", key="title", model_class=model.Visualization, filterable="advanced" ),
+ grids.TextColumn( "Type", key="type", model_class=model.Visualization ),
+ grids.IndividualTagsColumn( "Tags", "tags", model.Visualization, model.VisualizationTagAssociation, filterable="advanced", grid_name="VisualizationListGrid" ),
+ grids.SharingStatusColumn( "Sharing", key="sharing", model_class=model.Visualization, filterable="advanced", sortable=False ),
+ grids.GridColumn( "Last Updated", key="update_time", format=time_ago ),
+ ]
+ columns.append(
+ grids.MulticolFilterColumn(
+ "Search",
+ cols_to_filter=[ columns[0], columns[2] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
+
class _PageContentProcessor( _BaseHTMLProcessor ):
""" Processes page content to produce HTML that is suitable for display. For now, processor renders embedded objects. """
@@ -249,7 +268,7 @@
# Default behavior:
_BaseHTMLProcessor.unknown_endtag( self, tag )
-class PageController( BaseController, Sharable, UsesAnnotations, UsesHistory, UsesStoredWorkflow, UsesHistoryDatasetAssociation ):
+class PageController( BaseController, Sharable, UsesAnnotations, UsesHistory, UsesStoredWorkflow, UsesHistoryDatasetAssociation, UsesVisualization ):
_page_list = PageListGrid()
_all_published_list = PageAllPublishedGrid()
@@ -257,6 +276,7 @@
_workflow_selection_grid = WorkflowSelectionGrid()
_datasets_selection_grid = HistoryDatasetAssociationSelectionGrid()
_page_selection_grid = PageSelectionGrid()
+ _visualization_selection_grid = VisualizationSelectionGrid()
@web.expose
@web.require_login()
@@ -626,6 +646,13 @@
return self._workflow_selection_grid( trans, **kwargs )
@web.expose
+ @web.require_login("select a visualization from saved visualizations")
+ def list_visualizations_for_selection( self, trans, **kwargs ):
+ """ Returns HTML that enables a user to select one or more visualizations. """
+ # Render the list view
+ return self._visualization_selection_grid( trans, **kwargs )
+
+ @web.expose
@web.require_login("select a page from saved pages")
def list_pages_for_selection( self, trans, **kwargs ):
""" Returns HTML that enables a user to select one or more pages. """
@@ -685,6 +712,12 @@
if workflow:
self.get_stored_workflow_steps( trans, workflow )
return trans.fill_template( "workflow/embed.mako", item=workflow, item_data=workflow.latest_workflow.steps )
+ elif item_class == model.Visualization:
+ visualization = self.get_visualization( trans, item_id, False, True )
+ visualization.annotation = self.get_item_annotation_str( trans.sa_session, visualization.user, visualization )
+ if visualization:
+ return trans.fill_template( "visualization/embed.mako", item=visualization, item_data=None )
+
elif item_class == model.Page:
pass
diff -r b07142ce9dbb -r 146eae852b97 lib/galaxy/web/controllers/visualization.py
--- a/lib/galaxy/web/controllers/visualization.py Thu Apr 01 22:48:57 2010 -0400
+++ b/lib/galaxy/web/controllers/visualization.py Fri Apr 02 11:10:23 2010 -0400
@@ -73,6 +73,12 @@
else:
# Render grid wrapped in panels
return trans.fill_template( "visualization/list_published.mako", grid=grid )
+
+ @web.expose
+ @web.require_login( "use Galaxy visualizations", use_panels=True )
+ def index( self, trans, *args, **kwargs ):
+ """ Lists user's saved visualizations. """
+ return self.list( trans, args, kwargs )
@web.expose
@web.require_login( "use Galaxy visualizations", use_panels=True )
@@ -110,6 +116,61 @@
visualization.slug = new_slug
trans.sa_session.flush()
return visualization.slug
+
+ @web.expose
+ @web.require_login( "use Galaxy visualizations" )
+ def set_accessible_async( self, trans, id=None, accessible=False ):
+ """ Set visualization's importable attribute and slug. """
+ visualization = self.get_visualization( trans, id )
+
+ # Only set if importable value would change; this prevents a change in the update_time unless attribute really changed.
+ importable = accessible in ['True', 'true', 't', 'T'];
+ if visualization and visualization.importable != importable:
+ if importable:
+ self._make_item_accessible( trans.sa_session, visualization )
+ else:
+ visualization.importable = importable
+ trans.sa_session.flush()
+
+ return
+
+ @web.expose
+ @web.require_login( "share Galaxy visualizations" )
+ def imp( self, trans, id ):
+ """ Import a visualization into user's workspace. """
+ # Set referer message.
+ referer = trans.request.referer
+ if referer is not "":
+ referer_message = "<a href='%s'>return to the previous page</a>" % referer
+ else:
+ referer_message = "<a href='%s'>go to Galaxy's start page</a>" % url_for( '/' )
+
+ # Do import.
+ session = trans.sa_session
+ visualization = self.get_visualization( trans, id, check_ownership=False )
+ if visualization.importable == False:
+ return trans.show_error_message( "The owner of this visualization has disabled imports via this link.<br>You can %s" % referer_message, use_panels=True )
+ elif visualization.user == trans.user:
+ return trans.show_error_message( "You can't import this visualization because you own it.<br>You can %s" % referer_message, use_panels=True )
+ elif visualization.deleted:
+ return trans.show_error_message( "You can't import this visualization because it has been deleted.<br>You can %s" % referer_message, use_panels=True )
+ else:
+ # Create imported visualization via copy. TODO: Visualizations use datasets -- do we need to check to ensure that
+ # datasets can be imported/viewed and/or copy datasets to user?
+ imported_visualization = model.Visualization()
+ imported_visualization.title = "imported: " + visualization.title
+ imported_visualization.latest_revision = visualization.latest_revision
+ imported_visualization.user = trans.user
+ # Save new visualization.
+ session = trans.sa_session
+ session.add( imported_visualization )
+ session.flush()
+
+ # Redirect to load galaxy frames.
+ return trans.show_ok_message(
+ message="""Visualization "%s" has been imported. <br>You can <a href="%s">start using this visualization</a> or %s."""
+ % ( visualization.title, web.url_for( controller='visualization' ), referer_message ), use_panels=True )
+
@web.expose
@web.require_login( "share Galaxy visualizations" )
@@ -214,7 +275,7 @@
@web.require_login("get item content asynchronously")
def get_item_content_async( self, trans, id ):
""" Returns item content in HTML format. """
- pass
+ return "TODO: visualization content"
@web.expose
@web.require_login( "create visualizations" )
diff -r b07142ce9dbb -r 146eae852b97 lib/galaxy/web/controllers/workflow.py
--- a/lib/galaxy/web/controllers/workflow.py Thu Apr 01 22:48:57 2010 -0400
+++ b/lib/galaxy/web/controllers/workflow.py Fri Apr 02 11:10:23 2010 -0400
@@ -294,10 +294,6 @@
return trans.show_error_message( "You can't import this workflow because you own it.<br>You can %s" % referer_message, use_panels=True )
elif stored.deleted:
return trans.show_error_message( "You can't import this workflow because it has been deleted.<br>You can %s" % referer_message, use_panels=True )
- elif session.query( model.StoredWorkflowUserShareAssociation ) \
- .filter_by( user=trans.user, stored_workflow=stored ).count() > 0:
- # TODO: this is only reasonable as long as import creates a sharing relation.
- return trans.show_error_message( "You can't import this workflow because it is already shared with you.<br>You can %s" % referer_message, use_panels=True )
else:
# Create imported workflow via copy.
imported_stored = model.StoredWorkflow()
diff -r b07142ce9dbb -r 146eae852b97 static/june_2007_style/blue/embed_item.css
--- a/static/june_2007_style/blue/embed_item.css Thu Apr 01 22:48:57 2010 -0400
+++ b/static/june_2007_style/blue/embed_item.css Fri Apr 02 11:10:23 2010 -0400
@@ -6,6 +6,8 @@
.embedded-item.dataset p{background:#CFC no-repeat 2px 2px;margin-top:0;margin-bottom:0;}
.embedded-item.workflow{background-color:#FBDDB3}
.embedded-item.workflow p{background:#FBDDB3 no-repeat 2px 2px;margin-top:0;margin-bottom:0;}
+.embedded-item.visualization{background-color:#BBBBBB}
+.embedded-item.visualization p{background:#BBBBBB no-repeat 2px 2px;margin-top:0;margin-bottom:0;}
.embedded-item.placeholder{}
.embedded-item .item-content{max-height:25em;overflow:auto;display:none;}
.embedded-item .title{vertical-align:top;text-align:center;font-weight:bold;}
diff -r b07142ce9dbb -r 146eae852b97 static/june_2007_style/embed_item.css.tmpl
--- a/static/june_2007_style/embed_item.css.tmpl Thu Apr 01 22:48:57 2010 -0400
+++ b/static/june_2007_style/embed_item.css.tmpl Fri Apr 02 11:10:23 2010 -0400
@@ -41,6 +41,16 @@
margin-bottom:0;
}
+.embedded-item.visualization {
+ background-color:#BBBBBB
+}
+
+.embedded-item.visualization p {
+ background:#BBBBBB no-repeat 2px 2px;
+ margin-top:0;
+ margin-bottom:0;
+}
+
.embedded-item.placeholder{}
.embedded-item .item-content {
diff -r b07142ce9dbb -r 146eae852b97 templates/page/editor.mako
--- a/templates/page/editor.mako Thu Apr 01 22:48:57 2010 -0400
+++ b/templates/page/editor.mako Fri Apr 02 11:10:23 2010 -0400
@@ -34,18 +34,21 @@
ITEM_DATASET : "item_dataset",
ITEM_WORKFLOW : "item_workflow",
ITEM_PAGE : "item_page",
+ ITEM_VISUALIZATION : "item_visualization",
// Link dialogs.
DIALOG_HISTORY_LINK : "link_history",
DIALOG_DATASET_LINK : "link_dataset",
DIALOG_WORKFLOW_LINK : "link_workflow",
DIALOG_PAGE_LINK : "link_page",
+ DIALOG_VISUALIZATION_LINK : "link_visualization",
// Embed dialogs.
DIALOG_EMBED_HISTORY : "embed_history",
DIALOG_EMBED_DATASET : "embed_dataset",
DIALOG_EMBED_WORKFLOW : "embed_workflow",
DIALOG_EMBED_PAGE : "embed_page",
+ DIALOG_EMBED_VISUALIZATION : "embed_visualization",
// Annotation dialogs.
DIALOG_HISTORY_ANNOTATE : "history_annotate",
@@ -101,6 +104,11 @@
item_plural = "Pages";
item_controller = "page";
item_class = "Page";
+ case( Galaxy.ITEM_VISUALIZATION ):
+ item_singular = "Visualization";
+ item_plural = "Visualizations";
+ item_controller = "visualization";
+ item_class = "Visualization";
break;
}
@@ -316,9 +324,10 @@
);
}
- // INSERT "GALAXY ITEM" (HISTORY, DATASET, WORKFLOW, PAGE) LINK DIALOG
+ // INSERT "GALAXY ITEM" LINK DIALOG
if ( dialogType == Galaxy.DIALOG_HISTORY_LINK || dialogType == Galaxy.DIALOG_DATASET_LINK ||
- dialogType == Galaxy.DIALOG_WORKFLOW_LINK || dialogType == Galaxy.DIALOG_PAGE_LINK ) {
+ dialogType == Galaxy.DIALOG_WORKFLOW_LINK || dialogType == Galaxy.DIALOG_PAGE_LINK ||
+ dialogType == Galaxy.DIALOG_VISUALIZATION_LINK ) {
// Based on item type, set useful vars.
var item_info;
switch(dialogType)
@@ -335,6 +344,9 @@
case(Galaxy.DIALOG_PAGE_LINK):
item_info = get_item_info(Galaxy.ITEM_PAGE);
break;
+ case(Galaxy.DIALOG_VISUALIZATION_LINK):
+ item_info = get_item_info(Galaxy.ITEM_VISUALIZATION);
+ break;
}
$.ajax(
@@ -405,7 +417,7 @@
});
}
// EMBED GALAXY OBJECT DIALOGS
- if ( dialogType == Galaxy.DIALOG_EMBED_HISTORY || dialogType == Galaxy.DIALOG_EMBED_DATASET || dialogType == Galaxy.DIALOG_EMBED_WORKFLOW || dialogType == Galaxy.DIALOG_EMBED_PAGE ) {
+ if ( dialogType == Galaxy.DIALOG_EMBED_HISTORY || dialogType == Galaxy.DIALOG_EMBED_DATASET || dialogType == Galaxy.DIALOG_EMBED_WORKFLOW || dialogType == Galaxy.DIALOG_EMBED_PAGE || dialogType == Galaxy.DIALOG_EMBED_VISUALIZATION ) {
// Based on item type, set useful vars.
var item_info;
switch(dialogType)
@@ -422,6 +434,9 @@
case(Galaxy.DIALOG_EMBED_PAGE):
item_info = get_item_info(Galaxy.ITEM_PAGE);
break;
+ case(Galaxy.DIALOG_EMBED_VISUALIZATION):
+ item_info = get_item_info(Galaxy.ITEM_VISUALIZATION);
+ break;
}
$.ajax(
@@ -432,7 +447,8 @@
success: function(list_html)
{
// Can make histories, workflows importable; cannot make datasets importable.
- if (dialogType == Galaxy.DIALOG_EMBED_HISTORY || dialogType == Galaxy.DIALOG_EMBED_WORKFLOW)
+ if (dialogType == Galaxy.DIALOG_EMBED_HISTORY || dialogType == Galaxy.DIALOG_EMBED_WORKFLOW
+ || dialogType == Galaxy.DIALOG_EMBED_VISUALIZATION)
list_html = list_html + "<div><input id='make-importable' type='checkbox' checked/>" +
"Make the selected " + item_info.plural.toLowerCase() + " accessible so that they can viewed by everyone.</div>";
show_modal(
@@ -687,7 +703,10 @@
},
"Insert Page Link": function() {
editor.dialog(Galaxy.DIALOG_PAGE_LINK);
- }
+ },
+ "Insert Visualization Link": function() {
+ editor.dialog(Galaxy.DIALOG_VISUALIZATION_LINK);
+ },
});
//
@@ -709,6 +728,9 @@
"Embed Workflow": function() {
editor.dialog(Galaxy.DIALOG_EMBED_WORKFLOW);
},
+ "Embed Visualization": function() {
+ editor.dialog(Galaxy.DIALOG_EMBED_VISUALIZATION);
+ },
##"Embed Page": function() {
## editor.dialog(Galaxy.DIALOG_EMBED_PAGE);
##}
diff -r b07142ce9dbb -r 146eae852b97 templates/visualization/embed.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/visualization/embed.mako Fri Apr 02 11:10:23 2010 -0400
@@ -0,0 +1,4 @@
+<%inherit file="/embed_base.mako"/>
+
+<%def name="render_summary_content( workflow, steps )">
+</%def>
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/b07142ce9dbb
changeset: 3599:b07142ce9dbb
user: Kanwei Li <kanwei(a)gmail.com>
date: Thu Apr 01 22:48:57 2010 -0400
description:
New tool to select N random lines from a file/dataset. Closes #238
diffstat:
tool_conf.xml.sample | 1 +
tools/filters/randomlines.py | 33 +++++++++++++++++++++++++++++++++
tools/filters/randomlines.xml | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+), 0 deletions(-)
diffs (94 lines):
diff -r 9f7d7e900cdf -r b07142ce9dbb tool_conf.xml.sample
--- a/tool_conf.xml.sample Thu Apr 01 20:36:31 2010 -0400
+++ b/tool_conf.xml.sample Thu Apr 01 22:48:57 2010 -0400
@@ -46,6 +46,7 @@
<tool file="filters/changeCase.xml" />
<tool file="filters/pasteWrapper.xml" />
<tool file="filters/remove_beginning.xml" />
+ <tool file="filters/randomlines.xml" />
<tool file="filters/headWrapper.xml" />
<tool file="filters/tailWrapper.xml" />
<tool file="filters/trimmer.xml" />
diff -r 9f7d7e900cdf -r b07142ce9dbb tools/filters/randomlines.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/filters/randomlines.py Thu Apr 01 22:48:57 2010 -0400
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# Kanwei Li, 2010
+# Selects N random lines from a file and outputs to another file
+
+import random, sys
+
+def main():
+ infile = open(sys.argv[1], 'r')
+ total_lines = int(sys.argv[2])
+
+ if total_lines < 1:
+ sys.stderr.write( "Must select at least one line." )
+ sys.exit()
+
+ kept = []
+ n = 0
+ for line in infile:
+ line = line.rstrip("\n")
+ n += 1
+ if (n <= total_lines):
+ kept.append(line)
+ elif random.randint(1, n) <= total_lines:
+ kept.pop(random.randint(0, total_lines-1))
+ kept.append(line)
+
+ if n < total_lines:
+ sys.stderr.write( "Error: asked to select more lines than there were in the file." )
+ sys.exit()
+
+ open(sys.argv[3], 'w').write( "\n".join(kept) )
+
+if __name__ == "__main__":
+ main()
diff -r 9f7d7e900cdf -r b07142ce9dbb tools/filters/randomlines.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/filters/randomlines.xml Thu Apr 01 22:48:57 2010 -0400
@@ -0,0 +1,42 @@
+<tool id="random_lines1" name="Select random lines">
+ <description>from a file</description>
+ <command interpreter="python">randomlines.py $input $num_lines $out_file1</command>
+ <inputs>
+ <param name="num_lines" size="5" type="integer" value="1" label="Randomly select" help="lines"/>
+ <param format="txt" name="input" type="data" label="from"/>
+ </inputs>
+ <outputs>
+ <data format="input" name="out_file1" metadata_source="input"/>
+ </outputs>
+ <tests>
+ <test>
+ <param name="num_lines" value="65"/>
+ <param name="input" value="1.bed"/>
+ <output name="out_file1" file="1.bed"/>
+ </test>
+ </tests>
+ <help>
+
+**What it does**
+
+This tool selects N random lines from a file, with no repeats, and preserving ordering.
+
+-----
+
+**Example**
+
+Input File::
+
+ chr7 56632 56652 D17003_CTCF_R6 310 +
+ chr7 56736 56756 D17003_CTCF_R7 354 +
+ chr7 56761 56781 D17003_CTCF_R4 220 +
+ chr7 56772 56792 D17003_CTCF_R7 372 +
+ chr7 56775 56795 D17003_CTCF_R4 207 +
+
+Selecting 2 random lines might return this::
+
+ chr7 56736 56756 D17003_CTCF_R7 354 +
+ chr7 56775 56795 D17003_CTCF_R4 207 +
+
+ </help>
+</tool>
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/9f7d7e900cdf
changeset: 3598:9f7d7e900cdf
user: Kanwei Li <kanwei(a)gmail.com>
date: Thu Apr 01 20:36:31 2010 -0400
description:
Sync hashbangs
diffstat:
lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py | 2 +-
lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py | 2 +-
lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py | 2 +-
scripts/check_eggs.py | 2 +-
scripts/galaxy_messaging/server/daemon.py | 2 +-
scripts/galaxy_messaging/server/data_transfer.py | 2 +-
scripts/metagenomics/convert_title.py | 2 +-
scripts/tools/re_escape_output.py | 2 +-
tools/fasta_tools/fasta_compute_length.py | 2 +-
tools/fasta_tools/fasta_concatenate_by_species.py | 2 +-
tools/fasta_tools/fasta_filter_by_length.py | 2 +-
tools/fasta_tools/fasta_to_tabular.py | 2 +-
tools/metag_tools/blat_coverage_report.py | 2 +-
tools/metag_tools/blat_mapping.py | 2 +-
tools/metag_tools/blat_wrapper.py | 2 +-
tools/metag_tools/convert_SOLiD_color2nuc.py | 2 +-
tools/metag_tools/fastqsolexa_to_fasta_qual.py | 2 +-
tools/metag_tools/mapping_to_ucsc.py | 2 +-
tools/metag_tools/megablast_wrapper.py | 2 +-
tools/metag_tools/megablast_xml_parser.py | 2 +-
tools/metag_tools/rmap_wrapper.py | 2 +-
tools/metag_tools/rmapq_wrapper.py | 2 +-
tools/metag_tools/short_reads_figure_high_quality_length.py | 2 +-
tools/metag_tools/short_reads_figure_score.py | 2 +-
tools/metag_tools/short_reads_trim_seq.py | 2 +-
tools/metag_tools/shrimp_color_wrapper.py | 2 +-
tools/metag_tools/shrimp_wrapper.py | 2 +-
tools/metag_tools/split_paired_reads.py | 2 +-
tools/new_operations/get_flanks.py | 2 +-
tools/next_gen_conversion/fastq_conversions.py | 2 +-
tools/next_gen_conversion/solid_to_fastq.py | 2 +-
tools/regVariation/getIndels.py | 2 +-
tools/regVariation/maf_cpg_filter.py | 2 +-
tools/regVariation/quality_filter.py | 2 +-
tools/regVariation/substitution_rates.py | 2 +-
tools/regVariation/substitutions.py | 2 +-
tools/regVariation/windowSplitter.py | 2 +-
tools/samtools/pileup_interval.py | 2 +-
tools/samtools/sam_merge.py | 2 +-
tools/samtools/sam_pileup.py | 2 +-
tools/samtools/sam_to_bam.py | 2 +-
tools/solid_tools/maq_cs_wrapper.py | 2 +-
tools/solid_tools/solid_qual_stats.py | 2 +-
tools/sr_mapping/bowtie_wrapper.py | 2 +-
tools/sr_mapping/bwa_wrapper.py | 2 +-
tools/sr_mapping/lastz_paired_reads_wrapper.py | 2 +-
tools/sr_mapping/lastz_wrapper.py | 2 +-
tools/stats/gsummary.py | 2 +-
tools/tophat/tophat_wrapper.py | 2 +-
49 files changed, 49 insertions(+), 49 deletions(-)
diffs (441 lines):
diff -r 8457a6f3214a -r 9f7d7e900cdf lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py
--- a/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py Thu Apr 01 16:02:19 2010 -0400
+++ b/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
# This code exists in 2 places: ~/datatypes/converters and ~/tools/fasta_tools
"""
Input: fasta, minimal length, maximal length
diff -r 8457a6f3214a -r 9f7d7e900cdf lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py
--- a/lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py Thu Apr 01 16:02:19 2010 -0400
+++ b/lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
convert fastqsolexa file to separated sequence and quality files.
diff -r 8457a6f3214a -r 9f7d7e900cdf lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py
--- a/lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py Thu Apr 01 16:02:19 2010 -0400
+++ b/lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
convert fastqsolexa file to separated sequence and quality files.
diff -r 8457a6f3214a -r 9f7d7e900cdf scripts/check_eggs.py
--- a/scripts/check_eggs.py Thu Apr 01 16:02:19 2010 -0400
+++ b/scripts/check_eggs.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
usage: check_eggs.py
"""
diff -r 8457a6f3214a -r 9f7d7e900cdf scripts/galaxy_messaging/server/daemon.py
--- a/scripts/galaxy_messaging/server/daemon.py Thu Apr 01 16:02:19 2010 -0400
+++ b/scripts/galaxy_messaging/server/daemon.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
"""
Data Transfer Script Daemon
diff -r 8457a6f3214a -r 9f7d7e900cdf scripts/galaxy_messaging/server/data_transfer.py
--- a/scripts/galaxy_messaging/server/data_transfer.py Thu Apr 01 16:02:19 2010 -0400
+++ b/scripts/galaxy_messaging/server/data_transfer.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
"""
Data Transfer Script: Sequencer to Galaxy
diff -r 8457a6f3214a -r 9f7d7e900cdf scripts/metagenomics/convert_title.py
--- a/scripts/metagenomics/convert_title.py Thu Apr 01 16:02:19 2010 -0400
+++ b/scripts/metagenomics/convert_title.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
convert nt and wgs data (fasta format) to giNumber_seqLen
diff -r 8457a6f3214a -r 9f7d7e900cdf scripts/tools/re_escape_output.py
--- a/scripts/tools/re_escape_output.py Thu Apr 01 16:02:19 2010 -0400
+++ b/scripts/tools/re_escape_output.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Escapes a file into a form suitable for use with tool tests using re_match or re_match_multiline (when -m/--multiline option is used)
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/fasta_tools/fasta_compute_length.py
--- a/tools/fasta_tools/fasta_compute_length.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/fasta_tools/fasta_compute_length.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Input: fasta, int
Output: tabular
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/fasta_tools/fasta_concatenate_by_species.py
--- a/tools/fasta_tools/fasta_concatenate_by_species.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/fasta_tools/fasta_concatenate_by_species.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
#Dan Blankenberg
"""
Takes a Multiple Alignment FASTA file and concatenates
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/fasta_tools/fasta_filter_by_length.py
--- a/tools/fasta_tools/fasta_filter_by_length.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/fasta_tools/fasta_filter_by_length.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Input: fasta, minimal length, maximal length
Output: fasta
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/fasta_tools/fasta_to_tabular.py
--- a/tools/fasta_tools/fasta_to_tabular.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/fasta_tools/fasta_to_tabular.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
# This code exists in 2 places: ~/datatypes/converters and ~/tools/fasta_tools
"""
Input: fasta, int
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/blat_coverage_report.py
--- a/tools/metag_tools/blat_coverage_report.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/blat_coverage_report.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import os, sys
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/blat_mapping.py
--- a/tools/metag_tools/blat_mapping.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/blat_mapping.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import os, sys
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/blat_wrapper.py
--- a/tools/metag_tools/blat_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/blat_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import os, sys, tempfile
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/convert_SOLiD_color2nuc.py
--- a/tools/metag_tools/convert_SOLiD_color2nuc.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/convert_SOLiD_color2nuc.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
convert SOLiD calor-base data to nucleotide sequence
example: T011213122200221123032111221021210131332222101
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/fastqsolexa_to_fasta_qual.py
--- a/tools/metag_tools/fastqsolexa_to_fasta_qual.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/fastqsolexa_to_fasta_qual.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
convert fastqsolexa file to separated sequence and quality files.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/mapping_to_ucsc.py
--- a/tools/metag_tools/mapping_to_ucsc.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/mapping_to_ucsc.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
from galaxy import eggs
import sys, tempfile, os
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/megablast_wrapper.py
--- a/tools/metag_tools/megablast_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/megablast_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
run megablast for metagenomics data
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/megablast_xml_parser.py
--- a/tools/metag_tools/megablast_xml_parser.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/megablast_xml_parser.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import sys, os, re
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/rmap_wrapper.py
--- a/tools/metag_tools/rmap_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/rmap_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import os, sys, tempfile
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/rmapq_wrapper.py
--- a/tools/metag_tools/rmapq_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/rmapq_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import os, sys, tempfile
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/short_reads_figure_high_quality_length.py
--- a/tools/metag_tools/short_reads_figure_high_quality_length.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/short_reads_figure_high_quality_length.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import os, sys, math, tempfile, zipfile, re
from rpy import *
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/short_reads_figure_score.py
--- a/tools/metag_tools/short_reads_figure_score.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/short_reads_figure_score.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
boxplot:
- box: first quartile and third quartile
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/short_reads_trim_seq.py
--- a/tools/metag_tools/short_reads_trim_seq.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/short_reads_trim_seq.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
trim reads based on the quality scores
input: read file and quality score file
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/shrimp_color_wrapper.py
--- a/tools/metag_tools/shrimp_color_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/shrimp_color_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
SHRiMP wrapper : Color space
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/shrimp_wrapper.py
--- a/tools/metag_tools/shrimp_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/shrimp_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
TODO
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/metag_tools/split_paired_reads.py
--- a/tools/metag_tools/split_paired_reads.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/metag_tools/split_paired_reads.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Split fixed length paired end reads
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/new_operations/get_flanks.py
--- a/tools/new_operations/get_flanks.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/new_operations/get_flanks.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
#Done by: Guru
"""
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/next_gen_conversion/fastq_conversions.py
--- a/tools/next_gen_conversion/fastq_conversions.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/next_gen_conversion/fastq_conversions.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Performs various conversions around Sanger FASTQ data
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/next_gen_conversion/solid_to_fastq.py
--- a/tools/next_gen_conversion/solid_to_fastq.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/next_gen_conversion/solid_to_fastq.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Converts SOLiD data to Sanger FASTQ format.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/regVariation/getIndels.py
--- a/tools/regVariation/getIndels.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/regVariation/getIndels.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
"""
Estimate INDELs for pair-wise alignments.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/regVariation/maf_cpg_filter.py
--- a/tools/regVariation/maf_cpg_filter.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/regVariation/maf_cpg_filter.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
#Guruprasad Ananda
#Adapted from bx/scripts/maf_mask_cpg.py
"""
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/regVariation/quality_filter.py
--- a/tools/regVariation/quality_filter.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/regVariation/quality_filter.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
#Guruprasad Ananda
"""
Filter based on nucleotide quality (PHRED score).
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/regVariation/substitution_rates.py
--- a/tools/regVariation/substitution_rates.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/regVariation/substitution_rates.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
#guruprasad Ananda
"""
Estimates substitution rates from pairwise alignments using JC69 model.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/regVariation/substitutions.py
--- a/tools/regVariation/substitutions.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/regVariation/substitutions.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
#Guruprasad ANanda
"""
Fetches substitutions from pairwise alignments.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/regVariation/windowSplitter.py
--- a/tools/regVariation/windowSplitter.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/regVariation/windowSplitter.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Split into windows.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/samtools/pileup_interval.py
--- a/tools/samtools/pileup_interval.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/samtools/pileup_interval.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Condenses pileup format into ranges of bases.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/samtools/sam_merge.py
--- a/tools/samtools/sam_merge.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/samtools/sam_merge.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Merges any number of BAM files
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/samtools/sam_pileup.py
--- a/tools/samtools/sam_pileup.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/samtools/sam_pileup.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Creates a pileup file from a bam file and a reference.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/samtools/sam_to_bam.py
--- a/tools/samtools/sam_to_bam.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/samtools/sam_to_bam.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Converts SAM data to sorted BAM data.
usage: sam_to_bam.py [options]
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/solid_tools/maq_cs_wrapper.py
--- a/tools/solid_tools/maq_cs_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/solid_tools/maq_cs_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
#Guruprasad Ananda
#MAQ mapper for SOLiD colourspace-reads
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/solid_tools/solid_qual_stats.py
--- a/tools/solid_tools/solid_qual_stats.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/solid_tools/solid_qual_stats.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
#Guruprasad Ananda
import sys, os, zipfile, tempfile
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/sr_mapping/bowtie_wrapper.py
--- a/tools/sr_mapping/bowtie_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/sr_mapping/bowtie_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Runs Bowtie on single-end or paired-end data.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/sr_mapping/bwa_wrapper.py
--- a/tools/sr_mapping/bwa_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/sr_mapping/bwa_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Runs BWA on single-end or paired-end data.
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/sr_mapping/lastz_paired_reads_wrapper.py
--- a/tools/sr_mapping/lastz_paired_reads_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/sr_mapping/lastz_paired_reads_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Runs Lastz paired read alignment process
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/sr_mapping/lastz_wrapper.py
--- a/tools/sr_mapping/lastz_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/sr_mapping/lastz_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
"""
Runs Lastz
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/stats/gsummary.py
--- a/tools/stats/gsummary.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/stats/gsummary.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import sys, re, tempfile
from rpy import *
diff -r 8457a6f3214a -r 9f7d7e900cdf tools/tophat/tophat_wrapper.py
--- a/tools/tophat/tophat_wrapper.py Thu Apr 01 16:02:19 2010 -0400
+++ b/tools/tophat/tophat_wrapper.py Thu Apr 01 20:36:31 2010 -0400
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
import optparse, os, shutil, sys, tempfile
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/8457a6f3214a
changeset: 3597:8457a6f3214a
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Thu Apr 01 16:02:19 2010 -0400
description:
Fix workflow annotation bug.
diffstat:
lib/galaxy/web/controllers/workflow.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (16 lines):
diff -r 9c1a0eeac431 -r 8457a6f3214a lib/galaxy/web/controllers/workflow.py
--- a/lib/galaxy/web/controllers/workflow.py Thu Apr 01 15:10:45 2010 -0400
+++ b/lib/galaxy/web/controllers/workflow.py Thu Apr 01 16:02:19 2010 -0400
@@ -665,8 +665,10 @@
step.temp_input_connections = step_dict['input_connections']
# Save step annotation.
- annotation = sanitize_html( step_dict[ 'annotation' ], 'utf-8', 'text/html' )
- self.add_item_annotation( trans, step, annotation )
+ annotation = step_dict[ 'annotation' ]
+ if annotation:
+ annotation = sanitize_html( annotation, 'utf-8', 'text/html' )
+ self.add_item_annotation( trans, step, annotation )
# Second pass to deal with connections between steps
for step in steps:
# Input connections
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/9c1a0eeac431
changeset: 3596:9c1a0eeac431
user: rc
date: Thu Apr 01 15:10:45 2010 -0400
description:
lims: sample form defs dont include field type: addressfield & textarea
diffstat:
lib/galaxy/web/controllers/forms.py | 46 +++++++++++++++++++++++++-----------
lib/galaxy/web/form_builder.py | 11 ++++----
2 files changed, 37 insertions(+), 20 deletions(-)
diffs (120 lines):
diff -r 0998e47bb63c -r 9c1a0eeac431 lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Thu Apr 01 14:46:41 2010 -0400
+++ b/lib/galaxy/web/controllers/forms.py Thu Apr 01 15:10:45 2010 -0400
@@ -521,7 +521,7 @@
return fd, msg
class FieldUI(object):
- def __init__(self, layout_grids, index, field=None, field_type=None):
+ def __init__(self, trans, layout_grids, index, field=None, field_type=None, form_type=None):
'''
This method returns a list of widgets which describes a field. This
includes label, helptext, type, & required/optional
@@ -533,8 +533,15 @@
refresh_on_change=True,
refresh_on_change_values=['SelectField'])
self.selectbox_options = []
- for ft in BaseField.form_field_types():
- self.fieldtype.add_option(ft, ft)
+ # if the form is for defining samples, then use the sample field types
+ # which does not include TextArea & AddressField
+ print >> sys.stderr, 'form_type', form_type
+ if form_type == trans.app.model.FormDefinition.types.SAMPLE:
+ for ft in BaseField.sample_field_types():
+ self.fieldtype.add_option(ft, ft)
+ else:
+ for ft in BaseField.form_field_types():
+ self.fieldtype.add_option(ft, ft)
self.required = SelectField('field_required_'+str(index), display='radio')
self.required.add_option('Required', 'required')
self.required.add_option('Optional', 'optional', selected=True)
@@ -544,8 +551,8 @@
for index, grid_name in enumerate(layout_grids):
self.layout_selectbox.add_option("%i. %s" %(index+1, grid_name), index)
if field:
- self.fill(field, field_type)
- def fill(self, field, field_type=None):
+ self.fill(trans, field, field_type, form_type)
+ def fill(self, trans, field, field_type=None, form_type=None):
# label
self.label.value = field['label']
# helptext
@@ -558,13 +565,24 @@
field['type'] = unicode(field_type)
if field_type == 'SelectField' and not field['selectlist']:
field['selectlist'] = ['', '']
- for ft in BaseField.form_field_types():
- if ft == field['type']:
- self.fieldtype.add_option(ft, ft, selected=True)
- if ft == 'SelectField':
- self.selectbox_ui(field)
- else:
- self.fieldtype.add_option(ft, ft)
+ # if the form is for defining samples, then use the sample field types
+ # which does not include TextArea & AddressField
+ if form_type == trans.app.model.FormDefinition.types.SAMPLE:
+ for ft in BaseField.sample_field_types():
+ if ft == field['type']:
+ self.fieldtype.add_option(ft, ft, selected=True)
+ if ft == 'SelectField':
+ self.selectbox_ui(field)
+ else:
+ self.fieldtype.add_option(ft, ft)
+ else:
+ for ft in BaseField.form_field_types():
+ if ft == field['type']:
+ self.fieldtype.add_option(ft, ft, selected=True)
+ if ft == 'SelectField':
+ self.selectbox_ui(field)
+ else:
+ self.fieldtype.add_option(ft, ft)
# required/optional
if field['required'] == 'required':
self.required = SelectField('field_required_'+str(self.index), display='radio')
@@ -623,9 +641,9 @@
field_details = []
for index, field in enumerate( current_form[ 'fields' ] ):
if current_form['type'] == trans.app.model.FormDefinition.types.SAMPLE:
- field_ui = self.FieldUI( current_form['layout'], index, field )
+ field_ui = self.FieldUI( trans, current_form['layout'], index, field, form_type=current_form['type'] )
else:
- field_ui = self.FieldUI( None, index, field )
+ field_ui = self.FieldUI( trans, None, index, field, form_type=current_form['type'] )
field_details.append( field_ui.get() )
return trans.fill_template( '/admin/forms/edit_form.mako',
form_details=form_details,
diff -r 0998e47bb63c -r 9c1a0eeac431 lib/galaxy/web/form_builder.py
--- a/lib/galaxy/web/form_builder.py Thu Apr 01 14:46:41 2010 -0400
+++ b/lib/galaxy/web/form_builder.py Thu Apr 01 15:10:45 2010 -0400
@@ -13,6 +13,10 @@
@staticmethod
def form_field_types():
return ['TextField', 'TextArea', 'SelectField', 'CheckboxField', 'AddressField', 'WorkflowField']
+ @staticmethod
+ def sample_field_types():
+ return ['TextField', 'SelectField', 'CheckboxField', 'WorkflowField']
+
class TextField(BaseField):
"""
@@ -443,11 +447,6 @@
self.select_workflow = None
self.params = params
def get_html(self):
- from galaxy import util
- add_ids = ['none']
- if self.user:
- for a in self.user.stored_workflows:
- add_ids.append(str(a.id))
self.select_workflow = SelectField(self.name)
if self.value == 'none':
self.select_workflow.add_option('Select one', 'none', selected=True)
@@ -456,7 +455,7 @@
if self.user:
for a in self.user.stored_workflows:
if not a.deleted:
- if self.value == str(a.id):
+ if str(self.value) == str(a.id):
self.select_workflow.add_option(a.name, str(a.id), selected=True)
else:
self.select_workflow.add_option(a.name, str(a.id))
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/0998e47bb63c
changeset: 3595:0998e47bb63c
user: rc
date: Thu Apr 01 14:46:41 2010 -0400
description:
lims: required fields of samples are now enforced before submission. (resolves issue #301)
diffstat:
lib/galaxy/web/controllers/requests.py | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diffs (50 lines):
diff -r ab118eb3cfa6 -r 0998e47bb63c lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Thu Apr 01 14:27:13 2010 -0400
+++ b/lib/galaxy/web/controllers/requests.py Thu Apr 01 14:46:41 2010 -0400
@@ -726,8 +726,27 @@
msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
for ef in empty_fields:
msg = msg + '<b>' +ef + '</b><br/>'
- return msg
- return None
+ return trans.response.send_redirect( web.url_for( controller='requests',
+ action='list',
+ operation='edit',
+ messagetype = 'error',
+ msg=msg,
+ id=trans.security.encode_id(request.id) ))
+ # now check the required fields of all the samples of this request
+ for s in request.samples:
+ for index, field in enumerate(request.type.sample_form.fields):
+ if field['required'] == 'required' and s.values.content[index] in ['', None]:
+ empty_fields.append((s.name, field['label']))
+ if empty_fields:
+ msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
+ for sname, ef in empty_fields:
+ msg = msg + '<b>%s</b> field of sample <b>%s</b><br/>' % (ef, sname)
+ return trans.response.send_redirect( web.url_for( controller='requests',
+ action='list',
+ operation='show_request',
+ messagetype = 'error',
+ msg=msg,
+ id=trans.security.encode_id(request.id) ))
def __save_request(self, trans, request=None, **kwd):
'''
This method saves a new request if request_id is None.
@@ -948,14 +967,8 @@
status='error',
message=msg,
**kwd) )
- msg = self.__validate(trans, request)
- if msg:
- return trans.response.send_redirect( web.url_for( controller='requests',
- action='list',
- operation='edit',
- messagetype = 'error',
- msg=msg,
- id=trans.security.encode_id(request.id) ))
+ # check if all the required request and its sample fields have been filled
+ self.__validate(trans, request)
# change the request state to 'Submitted'
comments = "Sequencing request is in progress."
event = trans.app.model.RequestEvent(request, request.states.SUBMITTED, comments)
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/ab118eb3cfa6
changeset: 3594:ab118eb3cfa6
user: fubar: ross Lazarus at gmail period com
date: Thu Apr 01 14:27:13 2010 -0400
description:
update to 3593
diffstat:
datatypes_conf.xml.sample | 2 +-
lib/galaxy/datatypes/binary.py | 2 +-
lib/galaxy/datatypes/converters/bam_to_bai.xml | 8 +-
lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.py | 32 +---
lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.xml | 4 +-
lib/galaxy/datatypes/converters/bed_to_summary_tree_converter.py | 2 +-
lib/galaxy/datatypes/data.py | 14 +-
lib/galaxy/datatypes/display_applications/parameters.py | 2 +-
lib/galaxy/datatypes/interval.py | 4 +-
lib/galaxy/datatypes/registry.py | 12 +-
lib/galaxy/model/__init__.py | 51 +++++-
lib/galaxy/visualization/tracks/data/array_tree.py | 3 +
lib/galaxy/visualization/tracks/data/bam.py | 5 +-
lib/galaxy/visualization/tracks/data/interval_index.py | 2 +-
lib/galaxy/web/controllers/tracks.py | 82 ++-------
static/scripts/packed/trackster.js | 2 +-
static/scripts/trackster.js | 12 +-
17 files changed, 118 insertions(+), 121 deletions(-)
diffs (513 lines):
diff -r e1b63ac74b35 -r ab118eb3cfa6 datatypes_conf.xml.sample
--- a/datatypes_conf.xml.sample Thu Apr 01 14:25:27 2010 -0400
+++ b/datatypes_conf.xml.sample Thu Apr 01 14:27:13 2010 -0400
@@ -5,7 +5,7 @@
<datatype extension="axt" type="galaxy.datatypes.sequence:Axt" display_in_upload="true"/>
<datatype extension="bam" type="galaxy.datatypes.binary:Bam" mimetype="application/octet-stream" display_in_upload="true">
<converter file="bam_to_bai.xml" target_datatype="bai"/>
- <converter file="bam_to_summary_tree_converter.xml" target_datatype="summary_tree"/>
+ <converter file="bam_to_summary_tree_converter.xml" target_datatype="summary_tree" depends_on="bai"/>
<display file="ucsc/bam.xml" />
</datatype>
<datatype extension="bed" type="galaxy.datatypes.interval:Bed" display_in_upload="true">
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/binary.py Thu Apr 01 14:27:13 2010 -0400
@@ -139,7 +139,7 @@
except:
return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) )
def get_track_type( self ):
- return "ReadTrack", ["bai", "summary_tree"]
+ return "ReadTrack", {"data": "bai", "index": "summary_tree"}
class Binseq( Binary ):
"""Class describing a zip archive of binary sequence files"""
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/converters/bam_to_bai.xml
--- a/lib/galaxy/datatypes/converters/bam_to_bai.xml Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/converters/bam_to_bai.xml Thu Apr 01 14:27:13 2010 -0400
@@ -1,12 +1,12 @@
-<tool id="INDEXER_Bam_Bai_0" name="Bam to Bai">
- <command>samtools index $input $output</command>
+<tool id="CONVERTER_Bam_Bai_0" name="Bam to Bai">
+ <command>samtools index $input1 $output1</command>
<inputs>
<page>
- <param format="bam" name="input" type="data" label="Choose BAM"/>
+ <param format="bam" name="input1" type="data" label="Choose BAM"/>
</page>
</inputs>
<outputs>
- <data format="bai" name="output"/>
+ <data format="bai" name="output1"/>
</outputs>
<help>
</help>
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.py
--- a/lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.py Thu Apr 01 14:27:13 2010 -0400
@@ -4,26 +4,10 @@
import sys
from galaxy import eggs
-import pkg_resources; pkg_resources.require( "bx-python" ); pkg_resources.require( "pysam" )
+import pkg_resources; pkg_resources.require( "pysam" )
from pysam import csamtools
-from bx.arrays.array_tree import *
-
-BLOCK_SIZE = 1000
-
-class BamReader:
- def __init__( self, input_fname, index_fname ):
- self.bamfile = csamtools.Samfile( filename=input_fname, mode='rb', index_filename=index_fname )
- self.iterator = self.bamfile.fetch()
-
- def __iter__( self ):
- return self
-
- def __next__( self ):
- while True:
- read = self.iterator.next()
- return read.rname, read.mpos, read.pos + read.rlen, None, mapq
-
+from galaxy.visualization.tracks.summary import *
def main():
@@ -31,15 +15,13 @@
index_fname = sys.argv[2]
out_fname = sys.argv[3]
- reader = BamReader( input_fname, index_fname )
+ bamfile = csamtools.Samfile( filename=input_fname, mode='rb', index_filename=index_fname )
- # Fill array from reader
- d = array_tree_dict_from_reader( reader, {}, block_size = BLOCK_SIZE )
+ st = SummaryTree(block_size=100, levels=4, draw_cutoff=100, detail_cutoff=20)
+ for read in bamfile.fetch():
+ st.insert_range(read.rname, read.mpos, read.pos + read.rlen)
- for array_tree in d.itervalues():
- array_tree.root.build_summary()
-
- FileArrayTreeDict.dict_to_file( d, open( out_fname, "w" ), no_leaves=True )
+ st.write(out_fname)
if __name__ == "__main__":
main()
\ No newline at end of file
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.xml
--- a/lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.xml Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/converters/bam_to_summary_tree_converter.xml Thu Apr 01 14:27:13 2010 -0400
@@ -1,10 +1,10 @@
<tool id="CONVERTER_bam_to_summary_tree_0" name="Convert BAM to Summary Tree" version="1.0.0">
<!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> -->
- <command interpreter="python">bam_to_summary_tree_converter.py $input1 $output1</command>
+ <command interpreter="python">bam_to_summary_tree_converter.py $input1 $bai $output1</command>
<inputs>
<page>
<param format="bam" name="input1" type="data" label="Choose BAM file"/>
- <param format="bai" name="index" type="data" label="BAM index file"/>
+ <param format="bai" name="bai" type="data" label="BAI index file"/>
</page>
</inputs>
<outputs>
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/converters/bed_to_summary_tree_converter.py
--- a/lib/galaxy/datatypes/converters/bed_to_summary_tree_converter.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/converters/bed_to_summary_tree_converter.py Thu Apr 01 14:27:13 2010 -0400
@@ -19,7 +19,7 @@
for chrom, chrom_start, chrom_end, name, score in reader:
st.insert_range(chrom, chrom_start, chrom_end)
- st.write(out_fname)
+ st.write(out_fname)
if __name__ == "__main__":
main()
\ No newline at end of file
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/data.py Thu Apr 01 14:27:13 2010 -0400
@@ -251,9 +251,10 @@
def find_conversion_destination( self, dataset, accepted_formats, datatypes_registry, **kwd ):
"""Returns ( target_ext, existing converted dataset )"""
return datatypes_registry.find_conversion_destination_for_dataset_by_extensions( dataset, accepted_formats, **kwd )
- def convert_dataset(self, trans, original_dataset, target_type, return_output = False, visible = True ):
+ def convert_dataset(self, trans, original_dataset, target_type, return_output = False, visible = True, deps=None):
"""This function adds a job to the queue to convert a dataset to another type. Returns a message about success/failure."""
converter = trans.app.datatypes_registry.get_converter_by_target_type( original_dataset.ext, target_type )
+
if converter is None:
raise Exception( "A converter does not exist for %s to %s." % ( original_dataset.ext, target_type ) )
#Generate parameter dictionary
@@ -261,9 +262,11 @@
#determine input parameter name and add to params
input_name = 'input1'
for key, value in converter.inputs.items():
- if value.type == 'data':
+ if value.name in deps:
+ params[value.name] = deps[value.name]
+ elif value.type == 'data':
input_name = key
- break
+
params[input_name] = original_dataset
#Run converter, job is dispatched through Queue
converted_dataset = converter.execute( trans, incoming = params, set_output_hid = visible )[1]
@@ -481,5 +484,8 @@
if file_type in [ 'gzipped', 'binary' ]:
text = "%s file" % file_type
else:
- text = unicode( '\n'.join( lines ), 'utf-8' )
+ try:
+ text = unicode( '\n'.join( lines ), 'utf-8' )
+ except UnicodeDecodeError:
+ text = "binary/unknown file"
return text
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/display_applications/parameters.py
--- a/lib/galaxy/datatypes/display_applications/parameters.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/display_applications/parameters.py Thu Apr 01 14:27:13 2010 -0400
@@ -73,7 +73,7 @@
for ext in self.extensions:
rval = data.get_converted_files_by_type( ext )
if rval:
- return rval[0]
+ return rval
assert data.find_conversion_destination( self.formats )[0] is not None, "No conversion path found for data param: %s" % self.name
return None
return data
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/interval.py
--- a/lib/galaxy/datatypes/interval.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/interval.py Thu Apr 01 14:27:13 2010 -0400
@@ -504,7 +504,7 @@
except: return False
def get_track_type( self ):
- return "FeatureTrack", ["interval_index", "summary_tree"]
+ return "FeatureTrack", {"data": "interval_index", "index": "summary_tree"}
class BedStrict( Bed ):
"""Tab delimited data in strict BED format - no non-standard columns allowed"""
@@ -965,7 +965,7 @@
resolution = max( resolution, 1 )
return resolution
def get_track_type( self ):
- return "LineTrack", ["array_tree"]
+ return "LineTrack", {"data": "array_tree"}
class CustomTrack ( Tabular ):
"""UCSC CustomTrack"""
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/datatypes/registry.py
--- a/lib/galaxy/datatypes/registry.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/datatypes/registry.py Thu Apr 01 14:27:13 2010 -0400
@@ -19,6 +19,7 @@
self.datatype_converters = odict()
self.datatype_indexers = odict()
self.converters = []
+ self.converter_deps = {}
self.available_tracks = []
self.set_external_metadata_tool = None
self.indexers = []
@@ -68,6 +69,11 @@
# into the calling app's toolbox.
converter_config = converter.get( 'file', None )
target_datatype = converter.get( 'target_datatype', None )
+ depends_on = converter.get( 'depends_on', None )
+ if depends_on and target_datatype:
+ if extension not in self.converter_deps:
+ self.converter_deps[extension] = {}
+ self.converter_deps[extension][target_datatype] = depends_on.split(',')
if converter_config and target_datatype:
self.converters.append( ( converter_config, extension, target_datatype ) )
for indexer in elem.findall( 'indexer' ):
@@ -363,9 +369,9 @@
"""Returns ( target_ext, existing converted dataset )"""
for convert_ext in self.get_converters_by_datatype( dataset.ext ):
if isinstance( self.get_datatype_by_extension( convert_ext ), accepted_formats ):
- datasets = dataset.get_converted_files_by_type( convert_ext )
- if datasets:
- ret_data = datasets[0]
+ dataset = dataset.get_converted_files_by_type( convert_ext )
+ if dataset:
+ ret_data = dataset
elif not converter_safe:
continue
else:
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/model/__init__.py Thu Apr 01 14:27:13 2010 -0400
@@ -577,11 +577,54 @@
def display_info( self ):
return self.datatype.display_info( self )
def get_converted_files_by_type( self, file_type ):
- valid = []
for assoc in self.implicitly_converted_datasets:
if not assoc.deleted and assoc.type == file_type:
- valid.append( assoc.dataset )
- return valid
+ return assoc.dataset
+ return None
+ def get_converted_dataset(self, trans, target_ext):
+ """
+ Return converted dataset(s) if they exist. If not converted yet, do so and return None (the first time).
+ If unconvertible, raise exception.
+ """
+ # See if we can convert the dataset
+ if target_ext not in self.get_converter_types():
+ raise ValueError("Conversion from '%s' to '%s' not possible", self.extension, target_ext)
+
+ # See if converted dataset already exists
+ converted_dataset = self.get_converted_files_by_type( target_ext )
+ if converted_dataset:
+ return converted_dataset
+
+ # Conversion is possible but hasn't been done yet, run converter.
+ # Check if we have dependencies
+ deps = {}
+ try:
+ fail_dependencies = False
+ depends_on = trans.app.datatypes_registry.converter_deps[self.extension][target_ext]
+ for dependency in depends_on:
+ dep_dataset = self.get_converted_dataset(trans, dependency)
+ if dep_dataset is None or dep_dataset.state != trans.app.model.Job.states.OK:
+ fail_dependencies = True
+ else:
+ deps[dependency] = dep_dataset
+ if fail_dependencies:
+ return None
+ except ValueError:
+ log.debug("WTF")
+ raise ValueError("A dependency could not be converted.")
+ except KeyError:
+ pass # No deps
+
+ assoc = ImplicitlyConvertedDatasetAssociation( parent=self, file_type=target_ext, metadata_safe=False )
+ new_dataset = self.datatype.convert_dataset( trans, self, target_ext, return_output=True, visible=False, deps=deps ).values()[0]
+ new_dataset.hid = self.hid
+ new_dataset.name = self.name
+ trans.sa_session.add( new_dataset )
+ trans.sa_session.flush()
+ assoc.dataset = new_dataset
+ trans.sa_session.add( assoc )
+ trans.sa_session.flush()
+ return None
def clear_associated_files( self, metadata_safe = False, purge = False ):
raise 'Unimplemented'
def get_child_by_designation(self, designation):
@@ -590,7 +633,7 @@
return child
return None
def get_converter_types(self):
- return self.datatype.get_converter_types( self, datatypes_registry)
+ return self.datatype.get_converter_types( self, datatypes_registry )
def find_conversion_destination( self, accepted_formats, **kwd ):
"""Returns ( target_ext, existing converted dataset )"""
return self.datatype.find_conversion_destination( self, accepted_formats, datatypes_registry, **kwd )
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/visualization/tracks/data/array_tree.py
--- a/lib/galaxy/visualization/tracks/data/array_tree.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/visualization/tracks/data/array_tree.py Thu Apr 01 14:27:13 2010 -0400
@@ -44,6 +44,9 @@
return float(n)
def get_data( self, chrom, start, end, **kwargs ):
+ if 'stats' in kwargs:
+ return self.get_stats(chrom)
+
f = open( self.dataset.file_name )
d = FileArrayTreeDict( f )
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/visualization/tracks/data/bam.py
--- a/lib/galaxy/visualization/tracks/data/bam.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/visualization/tracks/data/bam.py Thu Apr 01 14:27:13 2010 -0400
@@ -1,5 +1,6 @@
"""
Visualization data provider for BAM format.
+Kanwei Li, 2010
"""
import pkg_resources; pkg_resources.require( "pysam" )
@@ -7,7 +8,7 @@
from pysam import csamtools
from math import floor, ceil, log
import logging
-# log = logging.getLogger(__name__)
+log = logging.getLogger(__name__)
class BamDataProvider( object ):
"""
@@ -36,7 +37,7 @@
# Encode reads as list of dictionaries
results = []
for read in data:
- payload = { 'uid': str(read.pos) + str(read.seq), 'start': read.pos, 'end': read.pos + read.rlen, 'name': read.seq }
+ payload = [ str(read.pos) + str(read.seq), read.pos, read.pos + read.rlen, read.seq ]
results.append(payload)
bamfile.close()
return results
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/visualization/tracks/data/interval_index.py
--- a/lib/galaxy/visualization/tracks/data/interval_index.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/visualization/tracks/data/interval_index.py Thu Apr 01 14:27:13 2010 -0400
@@ -1,6 +1,6 @@
"""
Interval index data provider for the Galaxy track browser.
-Kanwei Li, 2009
+Kanwei Li, 2010
Payload format: [ uid (offset), start, end, name, strand, thick_start, thick_end, blocks ]
"""
diff -r e1b63ac74b35 -r ab118eb3cfa6 lib/galaxy/web/controllers/tracks.py
--- a/lib/galaxy/web/controllers/tracks.py Thu Apr 01 14:25:27 2010 -0400
+++ b/lib/galaxy/web/controllers/tracks.py Thu Apr 01 14:27:13 2010 -0400
@@ -199,78 +199,38 @@
if dataset.state != trans.app.model.Job.states.OK:
return messages.PENDING
- track_type, indexes = dataset.datatype.get_track_type()
- converted = dict([ (index, self.__dataset_as_type( trans, dataset, index )) for index in indexes ])
- extra_info = None
-
- for index, converted_dataset in converted.iteritems():
- if not converted_dataset:
+ track_type, data_sources = dataset.datatype.get_track_type()
+ for source_type, data_source in data_sources.iteritems():
+ try:
+ converted_dataset = dataset.get_converted_dataset(trans, data_source)
+ except ValueError:
return messages.NO_CONVERTER
# Need to check states again for the converted version
+ if not converted_dataset or converted_dataset.state != model.Dataset.states.OK:
+ return messages.PENDING
+
if converted_dataset.state == model.Dataset.states.ERROR:
return messages.ERROR
- if converted_dataset.state != model.Dataset.states.OK:
- return messages.PENDING
-
- if len(converted) > 1:
- # Have to choose between array_tree and other provider
- summary_tree = SummaryTreeDataProvider( converted['summary_tree'], dataset )
- freqs = summary_tree.get_summary( chrom, low, high, **kwargs )
- if freqs is not None:
- frequencies, max_v, avg_v = freqs
+
+ extra_info = None
+ if 'index' in data_sources:
+ # Have to choose between indexer and data provider
+ indexer = dataset_type_to_data_provider[data_sources['index']]( dataset.get_converted_dataset(trans, data_sources['index']), dataset )
+ summary = indexer.get_summary( chrom, low, high, **kwargs )
+ if summary is not None:
+ frequencies, max_v, avg_v = summary
if frequencies != "no_detail":
- return { "dataset_type": "summary_tree", "data": frequencies, "max": max_v, "avg": avg_v }
+ return { "dataset_type": data_sources['index'], "data": frequencies, "max": max_v, "avg": avg_v }
else:
kwargs["no_detail"] = True # meh
extra_info = "no_detail"
- dataset_type = "interval_index"
- else:
- dataset_type = converted.keys()[0]
-
- data_provider = dataset_type_to_data_provider[ dataset_type ]( converted[dataset_type], dataset )
+
+ dataset_type = data_sources['data']
+ data_provider = dataset_type_to_data_provider[ dataset_type ]( dataset.get_converted_dataset(trans, dataset_type), dataset )
- if 'stats' in kwargs:
- data = data_provider.get_stats( chrom )
- else:
- data = data_provider.get_data( chrom, low, high, **kwargs )
-
+ data = data_provider.get_data( chrom, low, high, **kwargs )
return { "dataset_type": dataset_type, "extra_info": extra_info, "data": data }
-
- def __dataset_as_type( self, trans, dataset, type ):
- """
- Given a dataset, try to find a way to adapt it to a different type. If the
- dataset is already of that type it is returned, if it can be converted a
- converted dataset (possibly new) is returned, if it cannot be converted,
- None is returned.
- """
- # Already of correct type
- if dataset.extension == type:
- return dataset
- # See if we can convert the dataset
- if type not in dataset.get_converter_types():
- log.debug( "Conversion from '%s' to '%s' not possible", dataset.extension, type )
- return None
- # See if converted dataset already exists
- converted_datasets = [c for c in dataset.get_converted_files_by_type( type ) if c != None]
- if converted_datasets:
- if converted_datasets[0].state != 'error':
- return converted_datasets[0]
- else:
- return None
-
- # Conversion is possible but hasn't been done yet, run converter here
- # FIXME: this is largely duplicated from DefaultToolAction
- assoc = model.ImplicitlyConvertedDatasetAssociation( parent = dataset, file_type = type, metadata_safe = False )
- new_dataset = dataset.datatype.convert_dataset( trans, dataset, type, return_output = True, visible = False ).values()[0]
- new_dataset.hid = dataset.hid # Hrrmmm....
- new_dataset.name = dataset.name
- trans.sa_session.add( new_dataset )
- trans.sa_session.flush()
- assoc.dataset = new_dataset
- trans.sa_session.add( assoc )
- trans.sa_session.flush()
- return new_dataset
@web.json
def save( self, trans, **kwargs ):
diff -r e1b63ac74b35 -r ab118eb3cfa6 static/scripts/packed/trackster.js
--- a/static/scripts/packed/trackster.js Thu Apr 01 14:25:27 2010 -0400
+++ b/static/scripts/packed/trackster.js Thu Apr 01 14:27:13 2010 -0400
@@ -1,1 +1,1 @@
-var DEBUG=false;var DENSITY=1000,FEATURE_LEVELS=10,DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=20,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="../images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="../images/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src="../images/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv!
,"repeat")};var left_img_inv=new Image();left_img_inv.src="../images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var Drawer=function(){};$.extend(Drawer.prototype,{intensity:function(b,a,c){},});drawer=new Drawer();var View=function(b,d,c,a){this.vis_id=c;this.dbkey=a;this.title=d;this.chrom=b;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_!
high=0;this.center=(this.max_high-this.max_low)/2;this.zoom_factor=3;t
his.zoom_level=0;this.track_id_counter=0};$.extend(View.prototype,{add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[a]},update_options:function(){var b=$("ul#sortable-ul").sortable("toArray");var d=[];var c=$("#viewport > div").sort(function(g,f){return b.indexOf($(g).attr("id"))>b.indexOf($(f).attr("id"))});$("#viewport > div").remove();$("#viewport").html(c);for(var e in view.tracks){var a=view.tracks[e];if(a.update_options){a.update_options(e)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.center=this.center=(this.max_high-this.max_low)/2;this.zoom_level=0;$(".yaxislabel").remove()},redraw:function(f){this.span=this.max_high-this.max_low;var d=this.sp!
an/Math.pow(this.zoom_factor,this.zoom_level),b=this.center-(d/2),e=b+d;if(b<0){b=0;e=b+d}else{if(e>this.max_high){e=this.max_high;b=e-d}}this.low=Math.floor(b);this.high=Math.ceil(e);this.center=Math.round(this.low+(this.high-this.low)/2);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));$("#overview-box").css({left:(this.low/this.span)*$("#overview-viewport").width(),width:Math.max(12,((this.high-this.low)/this.span)*$("#overview-viewport").width())}).show();$("#low").val(commatize(this.low));$("#high").val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(a,b){if(this.max_high===0||this.high-this.low<30){return}if(a){this.center=a/b.width()*(this.!
high-this.low)+this.low}this.zoom_level+=1;this.redraw()},zoom_out:fun
ction(){if(this.max_high===0){return}if(this.zoom_level<=0){this.zoom_level=0;return}this.zoom_level-=1;this.redraw()}});var Track=function(a,b){this.name=a;this.parent_element=b;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div></div>").addClass("track").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.content_div.css("height","30px");a.content_div.text(DATA_LOADING);a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR)}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if((d.da!
ta&&d.data.length===0)||d==="no data"){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var i=this.view.low,e=this.view.high,f=e-i,d=this.view.resolution;if(DEBUG){$("#debug").text(d+" "+this.view.zoom_res)}var k=$("<div style='position: relative;'></div>");this.content_div.children(":first").remove();this.content_div.append(k);var l=this.content_div.width()/f;var h;var a=Math.floor(i/d/DENSITY);while((a*DENSITY*d)<e){var j=this.content_div.width()+"_"+this.view.zoom_level+"_"+a;var c=this.tile_cache.get(j);if(c){var g=a*DENSITY*d;var b=(g-i)*l;if(this.left_offse!
t){b-=this.left_offset}c.css({left:b});k.append(c);this.max_height=Mat
h.max(this.max_height,c.height())}else{this.delayed_draw(this,j,i,e,a,d,k,l)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a){Track.call(this,null,a);this.track_type="LabelTrack";this.hidden=true;this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.app!
end(b)}});var LineTrack=function(c,a,b){this.track_type="LineTrack";Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.height_px=100;this.container_div.addClass("line-track");this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode:"line"};if(b.min_value!==undefined){this.prefs.min_value=b.min_value}if(b.max_value!==undefined){this.prefs.max_value=b.max_value}if(b.max_value!==undefined){this.prefs.mode=b.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.pre!
fs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.t
otal_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div></div>").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);var d=$("<div></div>").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,q,c,e){if(this.vertical_range===undefined){return}var r=q*DENSITY*o,a=DENSITY*o,b=$("<canvas class!
='tile'></canvas>"),u=o+"_"+q;if(!this.data_cache.get(u)){this.get_data(o,q);return}var t=this.data_cache.get(u);b.css({position:"absolute",top:0,left:(r-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,s=this.total_frequency,d=this.height_px;n.beginPath();if(t.length>1){var f=Math.ceil((t[1][0]-t[0][0])*e)}else{var f=10}for(var p=0;p<t.length;p++){var j=t[p][0]-r;var h=t[p][1];if(this.prefs.mode=="intensity"){if(h===null){continue}j=j*e;if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(j,0,f,30)}else{if(h===null){k=false;continue}else{j=j*e;if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/m*d);if(k){n.lineTo(j,h)}else{n.moveTo(j,h);k=true}}}}n.stroke();c.append(b);return b},gen_options:function(n){var a=$("<div></div>").addClass("form-row");var h="track_"+n+"_minval",k="tra!
ck_"+n+"_maxval",e="track_"+n+"_mode",l=$("<label></label>").attr("for
",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),m=$("<input></input>").attr("id",h).val(b),g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j),d=$("<label></label>").attr("for",e).text("Display mode:"),i=(this.prefs.mode===undefined?"line":this.prefs.mode),c=$('<select id="'+e+'"><option value="line" id="mode_line">Line</option><option value="intensity" id="mode_intensity">Intensity</option></select>');$("#"+e+" #mode_"+i).attr("selected","selected");return a.append(l).append(m).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!=this.prefs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=b;this.vertica!
l_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(c,a,b){this.track_type="FeatureTrack";Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.height_px=100;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.default_font="9px Monaco, Lucida Console, monospace";this.left_offset=200;this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.prefs={block_color:"black",label_color:"black",show_counts:true};if(b.block_color!==undefined){this.prefs.block_color=b.block_color}if(b.label_color!==undefined){this.prefs.label_color=b.label_color}if(b.show_counts!==undefined){this.pre!
fs.show_counts=b.show_counts}};$.extend(FeatureTrack.prototype,TiledTr
ack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution},function(c){a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,c){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,u=[],h=0,b=$("<canvas></canvas>").get(0).getContext("2d"),n=this.view.max_low;var d,f,w=[];for(var r=0,s=g.length;r<s;r++){var e=g[r],l=e[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);w.push(this.inc_slots[a][l])}else{u.push(r)}}for(var r=0,s=u.length;r<s;r++){var e=g[u[r]];!
l=e[0],feature_start=e[1],feature_end=e[2],feature_name=e[3];d=Math.floor((feature_start-n)*m);if(!c){d-=b.measureText(feature_name).width}f=Math.ceil((feature_end-n)*m);var q=0;while(true){var o=true;if(this.s_e_by_tile[a][q]!==undefined){for(var p=0,v=this.s_e_by_tile[a][q].length;p<v;p++){var t=this.s_e_by_tile[a][q][p];if(f>t[0]&&d<t[1]){o=false;break}}}if(o){if(this.s_e_by_tile[a][q]===undefined){this.s_e_by_tile[a][q]=[]}this.s_e_by_tile[a][q].push([d,f]);this.inc_slots[a][l]=q;h=Math.max(h,q);break}q++}}return h},draw_tile:function(R,h,m,ae){var z=h*DENSITY*R,X=(h+1)*DENSITY*R,w=DENSITY*R;var ac,ad,p;var Y=z+"_"+X;var ac=this.data_cache.get(Y);if(!ac){this.data_queue[[z,X]]=true;this.get_data(z,X);return}if(ac.dataset_type=="array_tree"){p=30}else{var P=(ac.extra_info==="no_detail");var af=(P?this.vertical_nodetail_px:this.vertical_detail_px);p=this.incremental_slots(this.view.zoom_res,ac.data,P)*af+15;m.parent().css("height",Math.max(this.height_px,p)+"px");ad=this.!
inc_slots[this.view.zoom_res]}var a=Math.ceil(w*ae),F=$("<canvas class
='tile'></canvas>"),T=this.prefs.label_color,f=this.prefs.block_color,J=this.left_offset;F.css({position:"absolute",top:0,left:(z-this.view.low)*ae-J});F.get(0).width=a+J;F.get(0).height=p;var t=F.get(0).getContext("2d");t.fillStyle=this.prefs.block_color;t.font=this.default_font;t.textAlign="right";var C=55,W=255-C,g=W*2/3;if(ac.dataset_type=="summary_tree"){var L=ac.data;var v=ac.max;var l=ac.avg;if(ac.data.length>2){var b=Math.ceil((L[1][0]-L[0][0])*ae)}else{var b=50}for(var aa=0,s=L.length;aa<s;aa++){var N=Math.ceil((L[aa][0]-z)*ae);var M=L[aa][1];if(!M){continue}var E=Math.floor(W-(M/v)*W);t.fillStyle="rgb("+E+","+E+","+E+")";t.fillRect(N+J,0,b,20);if(this.prefs.show_counts){if(E>g){t.fillStyle="black"}else{t.fillStyle="#ddd"}t.textAlign="center";t.fillText(L[aa][1],N+J+(b/2),12)}}m.append(F);return F}var ac=ac.data;var Z=0;for(var aa=0,s=ac.length;aa<s;aa++){var G=ac[aa],D=G[0],ab=G[1],O=G[2],A=G[3];if(ab<=X&&O>=z){var Q=Math.floor(Math.max(0,(ab-z)*ae)),u=Math.ceil(Ma!
th.min(a,(O-z)*ae)),K=ad[D]*af;if(P){t.fillRect(Q+J,K+5,u-Q,1)}else{var r=G[4],I=G[5],S=G[6],e=G[7];var q,U,B=null,ag=null;if(I&&S){B=Math.floor(Math.max(0,(I-z)*ae));ag=Math.ceil(Math.min(a,(S-z)*ae))}if(ab>z){t.fillStyle=T;t.fillText(A,Q-1+J,K+8);t.fillStyle=f}if(e){if(r){if(r=="+"){t.fillStyle=RIGHT_STRAND}else{if(r=="-"){t.fillStyle=LEFT_STRAND}}t.fillRect(Q+J,K,u-Q,10);t.fillStyle=f}for(var Y=0,d=e.length;Y<d;Y++){var n=e[Y],c=Math.floor(Math.max(0,(n[0]-z)*ae)),H=Math.ceil(Math.min(a,(n[1]-z)*ae));if(c>H){continue}q=5;U=3;t.fillRect(c+J,K+U,H-c,q);if(B!==undefined&&!(c>ag||H<B)){q=9;U=1;var V=Math.max(c,B),o=Math.min(H,ag);t.fillRect(V+J,K+U,o-V,q)}}}else{q=9;U=1;t.fillRect(Q+J,K+U,u-Q,q);if(G.strand){if(G.strand=="+"){t.fillStyle=RIGHT_STRAND_INV}else{if(G.strand=="-"){t.fillStyle=LEFT_STRAND_INV}}t.fillRect(Q+J,K,u-Q,10);t.fillStyle=prefs.block_color}}}Z++}}m.append(F);return F},gen_options:function(h){var a=$("<div></div>").addClass("form-row");var d="track_"+h+"_b!
lock_color",j=$("<label></label>").attr("for",d).text("Block color:"),
k=$("<input></input>").attr("id",d).attr("name",d).val(this.prefs.block_color),i="track_"+h+"_label_color",f=$("<label></label>").attr("for",i).text("Text color:"),g=$("<input></input>").attr("id",i).attr("name",i).val(this.prefs.label_color),e="track_"+h+"_show_count",c=$("<label></label>").attr("for",e).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",e).attr("name",e).attr("checked",this.prefs.show_counts);return a.append(j).append(k).append(f).append(g).append(b).append(c)},update_options:function(d){var b=$("#track_"+d+"_block_color").val(),c=$("#track_"+d+"_label_color").val(),a=$("#track_"+d+"_show_count").attr("checked");if(b!==this.prefs.block_color||c!==this.prefs.label_color||a!=this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=c;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(c,a,b){this.track_type="ReadTrack";this.tile_cache=new Cache(CACHED_TILES_FEATUR!
E);Track.call(this,c,$("#viewport"));TiledTrack.call(this);FeatureTrack.call(this,c,a,b)};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{draw_tile:function(v,z,m,n){if(!this.values){return}var A=z*DENSITY*v,e=(z+1)*DENSITY*v,q=DENSITY*v;var D,p,h;h=this.height_px;p=this.zo_slots;D=this.values;var t=Math.ceil(q*n),r=$("<canvas class='tile'></canvas>");r.css({position:"absolute",top:0,left:(A-this.view.low)*n-this.left_offset});r.get(0).width=t+this.left_offset;r.get(0).height=h;var u=r.get(0).getContext("2d");u.fillStyle=this.prefs.block_color;u.font=this.default_font;u.textAlign="right";var s=u.measureText("A").width;var w=0;for(var x=0,y=D.length;x<y;x++){var l=D[x];if(l.start<=e&&l.end>=A){var g=Math.floor(Math.max(0,(l.start-A)*n)),k=Math.ceil(Math.min(t,(l.end-A)*n)),f=p[l.uid]*this.vertical_detail_px;var a,E,d=null,o=null;if(n>s){for(var B=0,b=l.name.length;B<b;B++){var C=Math.floor(Math.max(0,(l.start+B-A)*n));u.fillText(l.name[B],C+this.lef!
t_offset,f+8)}}else{u.fillRect(g+this.left_offset,f+4,k-g,3)}}}m.appen
d(r);return r}});
\ No newline at end of file
+var DEBUG=false;var DENSITY=1000,FEATURE_LEVELS=10,DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=20,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="../images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="../images/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src="../images/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv!
,"repeat")};var left_img_inv=new Image();left_img_inv.src="../images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var Drawer=function(){};$.extend(Drawer.prototype,{intensity:function(b,a,c){},});drawer=new Drawer();var View=function(b,d,c,a){this.vis_id=c;this.dbkey=a;this.title=d;this.chrom=b;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_!
high=0;this.center=(this.max_high-this.max_low)/2;this.zoom_factor=3;t
his.zoom_level=0;this.track_id_counter=0};$.extend(View.prototype,{add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[a]},update_options:function(){var b=$("ul#sortable-ul").sortable("toArray");var d=[];var c=$("#viewport > div").sort(function(g,f){return b.indexOf($(g).attr("id"))>b.indexOf($(f).attr("id"))});$("#viewport > div").remove();$("#viewport").html(c);for(var e in view.tracks){var a=view.tracks[e];if(a.update_options){a.update_options(e)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.center=this.center=(this.max_high-this.max_low)/2;this.zoom_level=0;$(".yaxislabel").remove()},redraw:function(f){this.span=this.max_high-this.max_low;var d=this.sp!
an/Math.pow(this.zoom_factor,this.zoom_level),b=this.center-(d/2),e=b+d;if(b<0){b=0;e=b+d}else{if(e>this.max_high){e=this.max_high;b=e-d}}this.low=Math.floor(b);this.high=Math.ceil(e);this.center=Math.round(this.low+(this.high-this.low)/2);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));$("#overview-box").css({left:(this.low/this.span)*$("#overview-viewport").width(),width:Math.max(12,((this.high-this.low)/this.span)*$("#overview-viewport").width())}).show();$("#low").val(commatize(this.low));$("#high").val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(a,b){if(this.max_high===0||this.high-this.low<30){return}if(a){this.center=a/b.width()*(this.!
high-this.low)+this.low}this.zoom_level+=1;this.redraw()},zoom_out:fun
ction(){if(this.max_high===0){return}if(this.zoom_level<=0){this.zoom_level=0;return}this.zoom_level-=1;this.redraw()}});var Track=function(a,b){this.name=a;this.parent_element=b;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div></div>").addClass("track").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.content_div.css("height","30px");a.content_div.text(DATA_LOADING);a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR)}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if((d.da!
ta&&d.data.length===0)||d==="no data"){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var i=this.view.low,e=this.view.high,f=e-i,d=this.view.resolution;if(DEBUG){$("#debug").text(d+" "+this.view.zoom_res)}var k=$("<div style='position: relative;'></div>");this.content_div.children(":first").remove();this.content_div.append(k);var l=this.content_div.width()/f;var h;var a=Math.floor(i/d/DENSITY);while((a*DENSITY*d)<e){var j=this.content_div.width()+"_"+this.view.zoom_level+"_"+a;var c=this.tile_cache.get(j);if(c){var g=a*DENSITY*d;var b=(g-i)*l;if(this.left_offse!
t){b-=this.left_offset}c.css({left:b});k.append(c);this.max_height=Mat
h.max(this.max_height,c.height())}else{this.delayed_draw(this,j,i,e,a,d,k,l)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a){Track.call(this,null,a);this.track_type="LabelTrack";this.hidden=true;this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.app!
end(b)}});var LineTrack=function(c,a,b){this.track_type="LineTrack";Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.height_px=100;this.container_div.addClass("line-track");this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode:"line"};if(b.min_value!==undefined){this.prefs.min_value=b.min_value}if(b.max_value!==undefined){this.prefs.max_value=b.max_value}if(b.max_value!==undefined){this.prefs.mode=b.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.pre!
fs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.t
otal_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div></div>").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);var d=$("<div></div>").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,q,c,e){if(this.vertical_range===undefined){return}var r=q*DENSITY*o,a=DENSITY*o,b=$("<canvas class!
='tile'></canvas>"),u=o+"_"+q;if(!this.data_cache.get(u)){this.get_data(o,q);return}var t=this.data_cache.get(u);b.css({position:"absolute",top:0,left:(r-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,s=this.total_frequency,d=this.height_px;n.beginPath();if(t.length>1){var f=Math.ceil((t[1][0]-t[0][0])*e)}else{var f=10}for(var p=0;p<t.length;p++){var j=t[p][0]-r;var h=t[p][1];if(this.prefs.mode=="intensity"){if(h===null){continue}j=j*e;if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(j,0,f,30)}else{if(h===null){k=false;continue}else{j=j*e;if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/m*d);if(k){n.lineTo(j,h)}else{n.moveTo(j,h);k=true}}}}n.stroke();c.append(b);return b},gen_options:function(n){var a=$("<div></div>").addClass("form-row");var h="track_"+n+"_minval",k="tra!
ck_"+n+"_maxval",e="track_"+n+"_mode",l=$("<label></label>").attr("for
",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),m=$("<input></input>").attr("id",h).val(b),g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j),d=$("<label></label>").attr("for",e).text("Display mode:"),i=(this.prefs.mode===undefined?"line":this.prefs.mode),c=$('<select id="'+e+'"><option value="line" id="mode_line">Line</option><option value="intensity" id="mode_intensity">Intensity</option></select>');$("#"+e+" #mode_"+i).attr("selected","selected");return a.append(l).append(m).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!=this.prefs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=b;this.vertica!
l_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(c,a,b){this.track_type="FeatureTrack";Track.call(this,c,$("#viewport"));TiledTrack.call(this);this.height_px=100;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.default_font="9px Monaco, Lucida Console, monospace";this.left_offset=200;this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.prefs={block_color:"black",label_color:"black",show_counts:true};if(b.block_color!==undefined){this.prefs.block_color=b.block_color}if(b.label_color!==undefined){this.prefs.label_color=b.label_color}if(b.show_counts!==undefined){this.pre!
fs.show_counts=b.show_counts}};$.extend(FeatureTrack.prototype,TiledTr
ack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution},function(c){a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,c){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,u=[],h=0,b=$("<canvas></canvas>").get(0).getContext("2d"),n=this.view.max_low;var d,f,w=[];for(var r=0,s=g.length;r<s;r++){var e=g[r],l=e[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);w.push(this.inc_slots[a][l])}else{u.push(r)}}for(var r=0,s=u.length;r<s;r++){var e=g[u[r]];!
l=e[0],feature_start=e[1],feature_end=e[2],feature_name=e[3];d=Math.floor((feature_start-n)*m);if(!c){d-=b.measureText(feature_name).width}f=Math.ceil((feature_end-n)*m);var q=0;while(true){var o=true;if(this.s_e_by_tile[a][q]!==undefined){for(var p=0,v=this.s_e_by_tile[a][q].length;p<v;p++){var t=this.s_e_by_tile[a][q][p];if(f>t[0]&&d<t[1]){o=false;break}}}if(o){if(this.s_e_by_tile[a][q]===undefined){this.s_e_by_tile[a][q]=[]}this.s_e_by_tile[a][q].push([d,f]);this.inc_slots[a][l]=q;h=Math.max(h,q);break}q++}}return h},draw_tile:function(R,h,m,ae){var z=h*DENSITY*R,X=(h+1)*DENSITY*R,w=DENSITY*R;var ac,ad,p;var Y=z+"_"+X;var ac=this.data_cache.get(Y);if(!ac){this.data_queue[[z,X]]=true;this.get_data(z,X);return}if(ac.dataset_type=="array_tree"){p=30}else{var P=(ac.extra_info==="no_detail");var af=(P?this.vertical_nodetail_px:this.vertical_detail_px);p=this.incremental_slots(this.view.zoom_res,ac.data,P)*af+15;m.parent().css("height",Math.max(this.height_px,p)+"px");ad=this.!
inc_slots[this.view.zoom_res]}var a=Math.ceil(w*ae),F=$("<canvas class
='tile'></canvas>"),T=this.prefs.label_color,f=this.prefs.block_color,J=this.left_offset;F.css({position:"absolute",top:0,left:(z-this.view.low)*ae-J});F.get(0).width=a+J;F.get(0).height=p;var t=F.get(0).getContext("2d");t.fillStyle=this.prefs.block_color;t.font=this.default_font;t.textAlign="right";var C=55,W=255-C,g=W*2/3;if(ac.dataset_type=="summary_tree"){var L=ac.data;var v=ac.max;var l=ac.avg;if(ac.data.length>2){var b=Math.ceil((L[1][0]-L[0][0])*ae)}else{var b=50}for(var aa=0,s=L.length;aa<s;aa++){var N=Math.ceil((L[aa][0]-z)*ae);var M=L[aa][1];if(!M){continue}var E=Math.floor(W-(M/v)*W);t.fillStyle="rgb("+E+","+E+","+E+")";t.fillRect(N+J,0,b,20);if(this.prefs.show_counts){if(E>g){t.fillStyle="black"}else{t.fillStyle="#ddd"}t.textAlign="center";t.fillText(L[aa][1],N+J+(b/2),12)}}m.append(F);return F}var ac=ac.data;var Z=0;for(var aa=0,s=ac.length;aa<s;aa++){var G=ac[aa],D=G[0],ab=G[1],O=G[2],A=G[3];if(ab<=X&&O>=z){var Q=Math.floor(Math.max(0,(ab-z)*ae)),u=Math.ceil(Ma!
th.min(a,(O-z)*ae)),K=ad[D]*af;if(P){t.fillRect(Q+J,K+5,u-Q,1)}else{var r=G[4],I=G[5],S=G[6],e=G[7];var q,U,B=null,ag=null;if(I&&S){B=Math.floor(Math.max(0,(I-z)*ae));ag=Math.ceil(Math.min(a,(S-z)*ae))}if(ab>z){t.fillStyle=T;t.fillText(A,Q-1+J,K+8);t.fillStyle=f}if(e){if(r){if(r=="+"){t.fillStyle=RIGHT_STRAND}else{if(r=="-"){t.fillStyle=LEFT_STRAND}}t.fillRect(Q+J,K,u-Q,10);t.fillStyle=f}for(var Y=0,d=e.length;Y<d;Y++){var n=e[Y],c=Math.floor(Math.max(0,(n[0]-z)*ae)),H=Math.ceil(Math.min(a,(n[1]-z)*ae));if(c>H){continue}q=5;U=3;t.fillRect(c+J,K+U,H-c,q);if(B!==undefined&&!(c>ag||H<B)){q=9;U=1;var V=Math.max(c,B),o=Math.min(H,ag);t.fillRect(V+J,K+U,o-V,q)}}}else{q=9;U=1;t.fillRect(Q+J,K+U,u-Q,q);if(G.strand){if(G.strand=="+"){t.fillStyle=RIGHT_STRAND_INV}else{if(G.strand=="-"){t.fillStyle=LEFT_STRAND_INV}}t.fillRect(Q+J,K,u-Q,10);t.fillStyle=prefs.block_color}}}Z++}}m.append(F);return F},gen_options:function(h){var a=$("<div></div>").addClass("form-row");var d="track_"+h+"_b!
lock_color",j=$("<label></label>").attr("for",d).text("Block color:"),
k=$("<input></input>").attr("id",d).attr("name",d).val(this.prefs.block_color),i="track_"+h+"_label_color",f=$("<label></label>").attr("for",i).text("Text color:"),g=$("<input></input>").attr("id",i).attr("name",i).val(this.prefs.label_color),e="track_"+h+"_show_count",c=$("<label></label>").attr("for",e).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",e).attr("name",e).attr("checked",this.prefs.show_counts);return a.append(j).append(k).append(f).append(g).append(b).append(c)},update_options:function(d){var b=$("#track_"+d+"_block_color").val(),c=$("#track_"+d+"_label_color").val(),a=$("#track_"+d+"_show_count").attr("checked");if(b!==this.prefs.block_color||c!==this.prefs.label_color||a!=this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=c;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(c,a,b){FeatureTrack.call(this,c,a,b);this.track_type="ReadTrack"};$.extend(ReadT!
rack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
\ No newline at end of file
diff -r e1b63ac74b35 -r ab118eb3cfa6 static/scripts/trackster.js
--- a/static/scripts/trackster.js Thu Apr 01 14:25:27 2010 -0400
+++ b/static/scripts/trackster.js Thu Apr 01 14:27:13 2010 -0400
@@ -89,7 +89,6 @@
drawer = new Drawer();
-
var View = function( chrom, title, vis_id, dbkey ) {
this.vis_id = vis_id;
this.dbkey = dbkey;
@@ -852,7 +851,7 @@
}
j++;
}
- }
+ }
parent_element.append( new_canvas );
return new_canvas;
@@ -885,15 +884,12 @@
});
var ReadTrack = function ( name, dataset_id, prefs ) {
+ FeatureTrack.call( this, name, dataset_id, prefs );
this.track_type = "ReadTrack";
- this.tile_cache = new Cache(CACHED_TILES_FEATURE);
- Track.call( this, name, $("#viewport") );
- TiledTrack.call( this );
- FeatureTrack.call( this, name, dataset_id, prefs );
};
$.extend( ReadTrack.prototype, TiledTrack.prototype, FeatureTrack.prototype, {
- draw_tile: function( resolution, tile_index, parent_element, w_scale ) {
+ /*draw_tile: function( resolution, tile_index, parent_element, w_scale ) {
if (!this.values) {
return;
}
@@ -947,5 +943,5 @@
parent_element.append( new_canvas );
return new_canvas;
- }
+ }*/
});
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/e1b63ac74b35
changeset: 3593:e1b63ac74b35
user: fubar: ross Lazarus at gmail period com
date: Thu Apr 01 14:25:27 2010 -0400
description:
Add rgtest.sh to generate test outputs
Minor changes to rgManQQ tool documentation
Minor fixes to rgQQ
diffstat:
tools/rgenetics/rgManQQ.py | 41 ++++++---
tools/rgenetics/rgManQQ.xml | 3 +
tools/rgenetics/rgQC.py | 14 +++
tools/rgenetics/rgtest.sh | 182 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 227 insertions(+), 13 deletions(-)
diffs (343 lines):
diff -r 40e8c99829e0 -r e1b63ac74b35 tools/rgenetics/rgManQQ.py
--- a/tools/rgenetics/rgManQQ.py Thu Apr 01 13:08:48 2010 -0400
+++ b/tools/rgenetics/rgManQQ.py Thu Apr 01 14:25:27 2010 -0400
@@ -70,8 +70,9 @@
}
if (max.y=="max") maxy=ceiling(max(d$logp)) else maxy=max.y
- if (maxy<8) maxy=8
-
+ maxy = max(maxy,1.1*genomewideline)
+ # if (maxy<8) maxy=8
+ # only makes sense if genome wide is assumed - we could have a fine mapping region?
if (annotate) d.annotate=d[as.numeric(substr(d$SNP,3,100)) %in% SNPlist, ]
plot=qplot(pos,logp,data=d, ylab=expression(-log[10](italic(p))) , colour=factor(CHR))
@@ -83,11 +84,13 @@
plot=plot + opts(title=title)
plot=plot+opts(
panel.background=theme_blank(),
- panel.grid.minor=theme_blank(),
axis.text.x=theme_text(size=size.x.labels, colour="grey50"),
axis.text.y=theme_text(size=size.y.labels, colour="grey50"),
axis.ticks=theme_segment(colour=NA)
)
+ #plot = plot + opts(panel.grid.y.minor=theme_blank(),panel.grid.y.major=theme_blank())
+ #plot = plot + opts(panel.grid.major=theme_blank())
+
if (suggestiveline) plot=plot+geom_hline(yintercept=suggestiveline,colour="blue", alpha=I(1/3))
if (genomewideline) plot=plot+geom_hline(yintercept=genomewideline,colour="red")
plot
@@ -120,11 +123,11 @@
# instantiate rcode2 string with infile,chromcol,offsetcol,pvalscols,title before saving and running
rcode2 = """rgqqMan = function(infile="%s",chromcolumn=%d, offsetcolumn=%d, pvalscolumns=%s,
- title="%s",grey=%d) {
- d = read.table(infile,head=T,sep='\t')
- print(paste('###',length(d[,1]),'values read from',infile,'read - now running plots',sep=' '))
- for (pvalscolumn in pvalscolumns) {
- if (pvalscolumn > 0)
+title="%s",grey=%d) {
+d = read.table(infile,head=T,sep='\t')
+print(paste('###',length(d[,1]),'values read from',infile,'read - now running plots',sep=' '))
+for (pvalscolumn in pvalscolumns) {
+if (pvalscolumn > 0)
{
cname = names(d)[pvalscolumn]
mytitle = paste('p=',cname,', ',title,sep='')
@@ -154,12 +157,24 @@
"""
+def doManQQ(input_fname,chrom_col,offset_col,pval_cols,title,grey,ctitle,outdir):
+ """ draw a qq for pvals and a manhattan plot if chrom/offset <> 0
+ contains some R scripts as text strings - we substitute defaults into the calls
+ to make them do our bidding - and save the resulting code for posterity
+ this can be called externally, I guess...for QC eg?
+ """
+
+ rcmd = '%s%s' % (rcode,rcode2 % (input_fname,chrom_col,offset_col,pval_cols,title,grey))
+ rlog,flist = RRun(rcmd=rcmd,title=ctitle,outdir=outdir)
+ return rlog,flist
+
+
def main():
u = """<command interpreter="python">
rgManQQ.py '$input_file' "$name" '$out_html' '$out_html.files_path' '$chrom_col' '$offset_col' '$pval_col'
</command>
"""
- print >> sys.stdout,'## rgManQQ.py. cl=',sys.argv
+ print >> sys.stdout,'## rgManQQ.py. cl= \n%s' % ' '.join(['"%s"' % x for x in sys.argv])
npar = 8
if len(sys.argv) < npar:
print >> sys.stdout, '## error - too few command line parameters - wanting %d' % npar
@@ -177,13 +192,13 @@
except:
chrom_col = 0
try:
- offset_col = int(sys.argv[6]) + 1
+ offset_col = int(sys.argv[6]) + 1
except:
offset_col = 0
p = sys.argv[7].strip().split(',')
try:
p = [int(x)+1 for x in p]
- pval_cols = 'c(%s)' % ','.join(map(str,p))
+ pval_cols = 'c(%s)' % ','.join(map(str,p))
except:
pval_cols = 'c(0)'
if chrom_col == 1 or offset_col == 1: # was passed as zero - do not do manhattan plots
@@ -192,8 +207,7 @@
grey = 0
if (sys.argv[8].lower() in ['1','true']):
grey = 1
- rcmd = '%s%s' % (rcode,rcode2 % (input_fname,chrom_col,offset_col,pval_cols,title,grey))
- rlog,flist = RRun(rcmd=rcmd,title=ctitle,outdir=outdir)
+ rlog,flist = doManQQ(input_fname,chrom_col,offset_col,pval_cols,title,grey,ctitle,outdir)
flist.sort()
html = [galhtmlprefix % progname,]
html.append('<h1>%s</h1>' % title)
@@ -221,6 +235,7 @@
htmlf.write('\n')
htmlf.close()
+
if __name__ == "__main__":
main()
diff -r 40e8c99829e0 -r e1b63ac74b35 tools/rgenetics/rgManQQ.xml
--- a/tools/rgenetics/rgManQQ.xml Thu Apr 01 13:08:48 2010 -0400
+++ b/tools/rgenetics/rgManQQ.xml Thu Apr 01 14:25:27 2010 -0400
@@ -66,6 +66,9 @@
- **Offset Column** contains the offset within the chromosome
- **P Value Column** contains the (untransformed) p values at that locus - choose multiple columns if needed
+NOTE - plotting millions of p values may take tens of minutes depending on
+how busy the server is - be patient please.
+
-----
.. class:: infomark
diff -r 40e8c99829e0 -r e1b63ac74b35 tools/rgenetics/rgQC.py
--- a/tools/rgenetics/rgQC.py Thu Apr 01 13:08:48 2010 -0400
+++ b/tools/rgenetics/rgQC.py Thu Apr 01 14:25:27 2010 -0400
@@ -37,12 +37,25 @@
# note no ped file passed so had to remove the -l option
# for plinkParse.py that makes a heterozygosity report from the ped
# file - needs fixing...
+# new: importing manhattan/qqplot plotter
+# def doManQQ(input_fname,chrom_col,offset_col,pval_cols,title,grey,ctitle,outdir):
+# """ draw a qq for pvals and a manhattan plot if chrom/offset <> 0
+# contains some R scripts as text strings - we substitute defaults into the calls
+# to make them do our bidding - and save the resulting code for posterity
+# this can be called externally, I guess...for QC eg?
+# """
+#
+# rcmd = '%s%s' % (rcode,rcode2 % (input_fname,chrom_col,offset_col,pval_cols,title,grey))
+# rlog,flist = RRun(rcmd=rcmd,title=ctitle,outdir=outdir)
+# return rlog,flist
+
from optparse import OptionParser
import sys,os,shutil, glob, math, subprocess, time, operator, random, tempfile, copy, string
from os.path import abspath
from rgutils import galhtmlprefix, galhtmlpostfix, RRun, timenow, plinke, rexe, runPlink, pruneLD
+import rgManQQ
prog = os.path.split(sys.argv[0])[1]
vers = '0.4 april 2009 rml'
@@ -57,6 +70,7 @@
mogresize = "x300" # this controls the width for jpeg thumbnails
+
def makePlots(markers=[],subjects=[],newfpath='.',basename='test',nbreaks='20',nup=3,height=10,width=8,rgbin=''):
"""
diff -r 40e8c99829e0 -r e1b63ac74b35 tools/rgenetics/rgtest.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/rgenetics/rgtest.sh Thu Apr 01 14:25:27 2010 -0400
@@ -0,0 +1,182 @@
+#!/bin/sh
+# script to generate all functional test outputs for each rgenetics tool
+# could be run at installation to ensure all dependencies are in place?
+GALAXYROOT=`pwd`
+echo "using $GALAXYROOT"
+# change this as needed for your local install
+INPATH="${GALAXYROOT}/test-data"
+BINPATH="${GALAXYROOT}/tool-data/rg/bin"
+TOOLPATH="${GALAXYROOT}/tools/rgenetics"
+OROOT="${GALAXYROOT}/test-data/rgtestouts"
+NORMALOROOT="${GALAXYROOT}/test-data"
+mkdir -p $OROOT
+rm -rf $OROOT/*
+# needed for testing - but tool versions should be bumped if this is rerun?
+TOOL="rgManQQ"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+CL="python $TOOLPATH/$TOOL.py "$INPATH/smallwgaP.xls" $NPRE ${OUTPATH}/${NPRE}.html $OUTPATH 1 2 5,7 0"
+# rgManQQ.py '$input_file' "$name" '$out_html' '$out_html.files_path' '$chrom_col' '$offset_col'
+# '$pval_col'
+#python /opt/galaxy/tools/rgenetics/rgManQQ.py /opt/galaxy/test-data/smallwgaP.xls rgManQQtest1
+#/opt/galaxy/test-data/rgtestouts/rgManQQ/rgManQQtest1.html /opt/galaxy/test-data/rgtestouts/rgManQQ 1 2 5,7
+echo "Testing $TOOL using $CL"
+python $TOOLPATH/$TOOL.py "$INPATH/smallwgaP.xls" $NPRE ${OUTPATH}/${NPRE}.html $OUTPATH 1 2 5,7 0
+TOOL="rgfakePhe"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+PSSCRIPT="$OUTPATH/script_file"
+echo "{'pN':'normtest','pT':'rnorm','pP':\"{'Mean':'100', 'SD':'10'}\"}" > $PSSCRIPT
+echo "{'pN':'cattest','pT':'cat','pP':\"{'values':'red,green,blue'}\"}" >> $PSSCRIPT
+echo "{'pN':'uniftest','pT':'$f.series.phetype','pP':\"{'low':'1','hi':'100'}\"}" >> $PSSCRIPT
+echo "{'pN':'gammatest','pT':'rgamma','pP':\"{'Alpha':'1', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "{'pN':'poissontest','pT':'poisson','pP':\"{'lamb':'1.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'exptest','pT':'exponential','pP':\"{'Mean':'100.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'weibtest','pT':'weibull','pP':\"{'Alpha':'1.0', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py ${INPATH}/tinywga $NPRE $NPRE.pphe $OUTPATH $PSSCRIPT
+# <command interpreter="python">rgfakePhe.py '$infile1.extra_files_path/$infile1.metadata.base_name'
+# "$title1" '$ppheout' '$ppheout.files_path' '$script_file'
+#
+#
+TOOL="rgQC"
+NPRE=${TOOL}test1
+echo "now doing $TOOL"
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+python $TOOLPATH/$TOOL.py -i "$INPATH/tinywga" -o $NPRE -s ${OUTPATH}/${NPRE}.html -p $OUTPATH
+# rgQC.py -i '$input_file.extra_files_path/$input_file.metadata.base_name' -o "$out_prefix"
+# -s '$html_file' -p '$html_file.files_path'
+#
+TOOL="rgGRR"
+NPRE=${TOOL}test1
+echo "now doing $TOOL"
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga" "tinywga" $OUTPATH/${NPRE}.html $OUTPATH "$NPRE" '100' '6'
+# rgGRR.py $i.extra_files_path/$i.metadata.base_name "$i.metadata.base_name"
+#'$out_file1' '$out_file1.files_path' "$title" '$n' '$Z'
+#
+TOOL="rgLDIndep"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+python $TOOLPATH/$TOOL.py "$INPATH" "tinywga" "$NPRE" 1 1 0 0 1 1 $OUTPATH/${NPRE}.pbed $OUTPATH 10000 5000 0.1
+#rgLDIndep.py '$input_file.extra_files_path' '$input_file.metadata.base_name' '$title' '$mind'
+# '$geno' '$hwe' '$maf' '$mef' '$mei' '$out_file1'
+#'$out_file1.files_path' '$window' '$step' '$r2'
+TOOL="rgPedSub"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+PSSCRIPT="$OUTPATH/pedsub.script"
+echo "title~~~~$NPRE" > $PSSCRIPT
+echo "output1~~~~${OUTPATH}/${NPRE}.lped" >> $PSSCRIPT
+echo "outformat~~~~lped" >> $PSSCRIPT
+echo "basename~~~~tinywga" >> $PSSCRIPT
+echo "inped~~~~$INPATH/tinywga" >> $PSSCRIPT
+echo "outdir~~~~$OUTPATH" >> $PSSCRIPT
+echo "region~~~~" >> $PSSCRIPT
+echo "relfilter~~~~all" >> $PSSCRIPT
+echo "rslist~~~~rs2283802Xrs2267000Xrs16997606Xrs4820537Xrs3788347Xrs756632Xrs4820539Xrs2283804Xrs2267006Xrs4822363X" >> $PSSCRIPT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py $PSSCRIPT
+rm -rf $PSSCRIPT
+#
+TOOL="rgfakePhe"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+PSSCRIPT="$OUTPATH/script_file"
+echo "{'pN':'normtest','pT':'rnorm','pP':\"{'Mean':'100', 'SD':'10'}\"}" > $PSSCRIPT
+echo "{'pN':'cattest','pT':'cat','pP':\"{'values':'red,green,blue'}\"}" >> $PSSCRIPT
+echo "{'pN':'uniftest','pT':'$f.series.phetype','pP':\"{'low':'1','hi':'100'}\"}" >> $PSSCRIPT
+echo "{'pN':'gammatest','pT':'rgamma','pP':\"{'Alpha':'1', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "{'pN':'poissontest','pT':'poisson','pP':\"{'lamb':'1.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'exptest','pT':'exponential','pP':\"{'Mean':'100.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'weibtest','pT':'weibull','pP':\"{'Alpha':'1.0', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py $PSSCRIPT
+#
+echo "Now doing rgclean"
+TOOL="rgClean"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+python $TOOLPATH/$TOOL.py $INPATH "tinywga" "$NPRE" 1 1 0 0 1 1 $OUTPATH/${NPRE}.pbed $OUTPATH 0 0 0 0
+# rgClean.py '$input_file.extra_files_path' '$input_file.metadata.base_name' '$title' '$mind'
+# '$geno' '$hwe' '$maf' '$mef' '$mei' '$out_file1' '$out_file1.files_path'
+# '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink' '$relfilter' '$afffilter' '$sexfilter' '$fixaff'
+#
+echo "Now doing rgEigPCA"
+TOOL="rgEigPCA"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga" "$NPRE" ${OUTPATH}/${NPRE}.html $OUTPATH 4 2 2 2 $OUTPATH/rgEigPCAtest1.txt
+# rgEigPCA.py "$i.extra_files_path/$i.metadata.base_name" "$title" "$out_file1"
+# "$out_file1.files_path" "$k" "$m" "$t" "$s" "$pca"
+#
+TOOL="rgfakePed"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py --title "$NPRE" -o $OUTPATH/${NPRE}.lped -p $OUTPATH -c "20" -n "40" -s "10" -w "0" -v "0" -l "pbed" -d "T" -m "0" -M "0"
+#rgfakePed.py --title '$title1'
+# -o '$out_file1' -p '$out_file1.extra_files_path' -c '$ncases' -n '$ntotal'
+# -s '$nsnp' -w '$lowmaf' -v '$missingValue' -l '$outFormat'
+# -d '$mafdist' -m '$missingRate' -M '$mendelRate'
+#
+TOOL="rgHaploView"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+mkdir $OUTPATH
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py "" "rs2283802Xrs2267000Xrs16997606Xrs4820537Xrs3788347Xrs756632Xrs4820539Xrs2283804Xrs2267006Xrs4822363X" \
+"$NPRE" $OUTPATH/${NPRE}.html "$INPATH" "tinywga" 0.0 200000 "RSQ" "lo" "2048" "$OUTPATH" "noinfo" "0.8" \
+"YRI" $BINPATH/haploview.jar
+# rgHaploView.py "$ucsc_region" "$rslist" "$title" "$output1"
+# "$lhistIn.extra_files_path" "$lhistIn.metadata.base_name"
+# "$minmaf" "$maxdist" "$ldtype" "$hires" "$memsize" "$output1.files_path"
+# "$infoTrack" "$tagr2" "$hmpanel" ${GALAXY_DATA_INDEX_DIR}/rg/bin/haploview.jar
+# note these statistical tools do NOT generate composite outputs
+TOOL="rgGLM"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga" $INPATH/tinywga "$NPRE" "c1" "" $OUTPATH/${NPRE}_GLM.xls \
+$OUTPATH/${NPRE}_GLM_log.txt "tinywga" "" "" "" 1 1 0 0 $OUTPATH/${NPRE}_GLM_topTable.gff
+## rgGLM.py '$i.extra_files_path/$i.metadata.base_name' '$phef.extra_files_path/$phef.metadata.base_name'
+## "$title1" '$predvar' '$covar' '$out_file1' '$logf' '$dbkey' '$i.metadata.base_name'
+## '$inter' '$cond' '$gender' '$mind' '$geno' '$maf' '$logistic' '$gffout'
+#
+TOOL="rgTDT"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py -i "$INPATH/tinywga" -o "$NPRE" -r $OUTPATH/${NPRE}_TDT.xls \
+-l $OUTPATH/${NPRE}_TDT_log.txt -g $OUTPATH/${NPRE}_TDT_topTable.gff
+## rgTDT.py -i '$infile.extra_files_path/$infile.metadata.base_name' -o '$title'
+## -r '$out_file1' -l '$logf' -x '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+## -g '$gffout'
+#
+TOOL="rgCaCo"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+echo "now doing $TOOL"
+python $TOOLPATH/rgCaCo.py $INPATH/tinywga "$NPRE" $OUTPATH/${NPRE}_CaCo.xls $OUTPATH/${NPRE}_CaCo_log.txt $OUTPATH $OUTPATH/${NPRE}_CaCo_topTable.gff
+# echo tp=$TOOLPATH t=$TOOL op=$OUTPATH b=$BINPATH
+# rgCaCo.py '$i.extra_files_path/$i.metadata.base_name' "$name" '$out_file1' '$logf' '$logf.files_path' '$gffout'
+#
+TOOL="rgQQ"
+echo "now doing $TOOL"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+CL="python $TOOLPATH/$TOOL.py "$INPATH/tinywga.pphe" "$NPRE" 1 3 $OUTPATH/$NPRE.pdf 8 10 "false" 1 $OUTPATH"
+echo "running $TOOL using $CL"
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga.pphe" "$NPRE" 1 3 $OUTPATH/$NPRE.pdf 8 10 "false" 1 $OUTPATH
+# rgQQ.py "$input1" "$name" $sample "$cols" $allqq $height $width $log $allqq.id $__new_file_path__
+#
1
0