[hg] galaxy 3406: Add the bx browser as a display app for builds...
details: http://www.bx.psu.edu/hg/galaxy/rev/297d8c9c5eb0 changeset: 3406:297d8c9c5eb0 user: Greg Von Kuster <greg@bx.psu.edu> date: Wed Feb 17 12:45:32 2010 -0500 description: Add the bx browser as a display app for builds hg18,hg19.mm8.mm9, and add the bx browser to the tool config for main. diffstat: lib/galaxy/config.py | 1 + lib/galaxy/datatypes/interval.py | 24 ++++++++++++++++++++++++ lib/galaxy/datatypes/tabular.py | 2 ++ lib/galaxy/util/__init__.py | 8 +++++++- tool-data/shared/bx/bx_build_sites.txt | 1 + tool_conf.xml.main | 1 + universe_wsgi.ini.sample | 3 ++- 7 files changed, 38 insertions(+), 2 deletions(-) diffs (118 lines): diff -r 43249ea9d72a -r 297d8c9c5eb0 lib/galaxy/config.py --- a/lib/galaxy/config.py Wed Feb 17 12:25:17 2010 -0500 +++ b/lib/galaxy/config.py Wed Feb 17 12:45:32 2010 -0500 @@ -81,6 +81,7 @@ self.log_memory_usage = string_as_bool( kwargs.get( 'log_memory_usage', 'False' ) ) self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) ) self.log_events = string_as_bool( kwargs.get( 'log_events', 'False' ) ) + self.bx_display_sites = kwargs.get( 'bx_display_sites', "main" ).lower().split(",") self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",") self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "main,test,tair" ).lower().split(",") self.genetrack_display_sites = kwargs.get( 'genetrack_display_sites', "main,test" ).lower().split(",") diff -r 43249ea9d72a -r 297d8c9c5eb0 lib/galaxy/datatypes/interval.py --- a/lib/galaxy/datatypes/interval.py Wed Feb 17 12:25:17 2010 -0500 +++ b/lib/galaxy/datatypes/interval.py Wed Feb 17 12:45:32 2010 -0500 @@ -54,6 +54,7 @@ """Initialize interval datatype, by adding UCSC display apps""" Tabular.__init__(self, **kwd) self.add_display_app ( 'ucsc', 'display at UCSC', 'as_ucsc_display_file', 'ucsc_links' ) + self.add_display_app ( 'main', 'BX', 'as_bx_display_file', 'bx_links' ) def init_meta( self, dataset, copy_from=None ): Tabular.init_meta( self, dataset, copy_from=copy_from ) @@ -246,6 +247,29 @@ link = '%s?redirect_url=%s&display_url=%s' % ( internal_url, redirect_url, display_url ) ret_val.append( (site_name, link) ) return ret_val + def bx_links( self, dataset, type, app, base_url ): + # TODO: abstract these methods to eliminate duplicate code. + ret_val = [] + if dataset.has_data: + viewport_tuple = self.get_estimated_display_viewport(dataset) + if viewport_tuple: + chrom = viewport_tuple[0] + start = viewport_tuple[1] + stop = viewport_tuple[2] + for site_name, site_url in util.get_bx_by_build(dataset.dbkey): + if site_name in app.config.bx_display_sites: + # HACK: UCSC doesn't support https, so force http even + # if our URL scheme is https. Making this work + # requires additional hackery in your upstream proxy. + # If UCSC ever supports https, remove this hack. + internal_url = "%s" % url_for( controller='dataset', dataset_id=dataset.id, action='display_at', filename='bx_' + site_name ) + if base_url.startswith( 'https://' ): + base_url = base_url.replace( 'https', 'http', 1 ) + display_url = urllib.quote_plus( "%s%s/display_as?id=%i&display_app=%s&authz_method=display_at" % (base_url, url_for( controller='root' ), dataset.id, type) ) + redirect_url = urllib.quote_plus( "%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" % (site_url, dataset.dbkey, chrom, start, stop ) ) + link = '%s?redirect_url=%s&display_url=%s' % ( internal_url, redirect_url, display_url ) + ret_val.append( (site_name, link) ) + return ret_val def validate( self, dataset ): """Validate an interval file using the bx GenomicIntervalReader""" diff -r 43249ea9d72a -r 297d8c9c5eb0 lib/galaxy/datatypes/tabular.py --- a/lib/galaxy/datatypes/tabular.py Wed Feb 17 12:25:17 2010 -0500 +++ b/lib/galaxy/datatypes/tabular.py Wed Feb 17 12:45:32 2010 -0500 @@ -214,6 +214,8 @@ return open( dataset.file_name ) def as_ucsc_display_file( self, dataset, **kwd ): return open( dataset.file_name ) + def as_bx_display_file( self, dataset, **kwd ): + return open( dataset.file_name ) class Taxonomy( Tabular ): def __init__(self, **kwd): diff -r 43249ea9d72a -r 297d8c9c5eb0 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py Wed Feb 17 12:25:17 2010 -0500 +++ b/lib/galaxy/util/__init__.py Wed Feb 17 12:45:32 2010 -0500 @@ -278,7 +278,12 @@ def string_to_object( s ): return pickle.loads( binascii.unhexlify( s ) ) - +def get_bx_by_build(build): + sites = [] + for site in bx_build_sites: + if build in site['builds']: + sites.append((site['name'],site['url'])) + return sites def get_ucsc_by_build(build): sites = [] for site in ucsc_build_sites: @@ -471,6 +476,7 @@ galaxy_root_path = os.path.join(__path__[0], "..","..","..") # The dbnames list is used in edit attributes and the upload tool dbnames = read_dbnames( os.path.join( galaxy_root_path, "tool-data", "shared", "ucsc", "builds.txt" ) ) +bx_build_sites = read_build_sites( os.path.join( galaxy_root_path, "tool-data", "shared", "bx", "bx_build_sites.txt" ) ) ucsc_build_sites = read_build_sites( os.path.join( galaxy_root_path, "tool-data", "shared", "ucsc", "ucsc_build_sites.txt" ) ) gbrowse_build_sites = read_build_sites( os.path.join( galaxy_root_path, "tool-data", "shared", "gbrowse", "gbrowse_build_sites.txt" ) ) genetrack_sites = read_build_sites( os.path.join( galaxy_root_path, "tool-data", "shared", "genetrack", "genetrack_sites.txt" ), check_builds=False ) diff -r 43249ea9d72a -r 297d8c9c5eb0 tool-data/shared/bx/bx_build_sites.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/shared/bx/bx_build_sites.txt Wed Feb 17 12:45:32 2010 -0500 @@ -0,0 +1,1 @@ +main http://main.genome-browser.bx.psu.edu/cgi-bin/hgTracks? hg18,hg19,mm8,mm9 diff -r 43249ea9d72a -r 297d8c9c5eb0 tool_conf.xml.main --- a/tool_conf.xml.main Wed Feb 17 12:25:17 2010 -0500 +++ b/tool_conf.xml.main Wed Feb 17 12:45:32 2010 -0500 @@ -4,6 +4,7 @@ <tool file="data_source/upload.xml"/> <tool file="data_source/ucsc_tablebrowser.xml" /> <tool file="data_source/ucsc_tablebrowser_archaea.xml" /> + <tool file="data_source/bx_browser.xml" /> <tool file="data_source/microbial_import.xml" /> <tool file="data_source/biomart.xml" /> <tool file="data_source/gramene_mart.xml" /> diff -r 43249ea9d72a -r 297d8c9c5eb0 universe_wsgi.ini.sample --- a/universe_wsgi.ini.sample Wed Feb 17 12:25:17 2010 -0500 +++ b/universe_wsgi.ini.sample Wed Feb 17 12:45:32 2010 -0500 @@ -105,7 +105,8 @@ # Use the new iframe / javascript based layout use_new_layout = true -# Comma separated list of UCSC / gbrowse / GeneTrack browsers to use for viewing +# Comma separated list of bx / UCSC / gbrowse / GeneTrack browsers to use for viewing +bx_display_sites = main ucsc_display_sites = main,test,archaea,ucla gbrowse_display_sites = main,test,tair # Define your GeneTrack servers in tool-data/shared/genetrack/genetrack_sites.txt
participants (1)
-
Greg Von Kuster