Move ucsc_display_sites and gbrowse_display_sites into datatypes_conf.xml's new <build_sites> section, as per the suggestion by @nsoranzo.

This commit is contained in:
Nate Coraor
2014-09-03 12:25:22 -04:00
parent 0ecca12ee3
commit 9c0b88446b
10 changed files with 39 additions and 28 deletions
+12 -2
View File
@@ -313,8 +313,18 @@
-->
</sniffers>
<build_sites>
<site type="ucsc" file="tool-data/shared/ucsc/ucsc_build_sites.txt"/>
<site type="gbrowse" file="tool-data/shared/gbrowse/gbrowse_build_sites.txt"/>
<!--
Build sites define the builds (dbkeys) available at sites used by display
applications and the URL to those sites.
The `display` attributes on the `ucsc` and `gbrowse` sites replace the
`ucsc_display_sites` and `gbrowse_display_sites` options in
universe_wsgi.ini. Because these are used by "old-style" display
applications, their types cannot not change if you want the old-style
display links for these sites to work.
-->
<site type="ucsc" file="tool-data/shared/ucsc/ucsc_build_sites.txt" display="main,test,archaea,ucla"/>
<site type="gbrowse" file="tool-data/shared/gbrowse/gbrowse_build_sites.txt" display="modencode,sgd_yeast,tair,wormbase,wormbase_ws120,wormbase_ws140,wormbase_ws170,wormbase_ws180,wormbase_ws190,wormbase_ws200,wormbase_ws204,wormbase_ws210,wormbase_ws220,wormbase_ws225"/>
<site type="ensembl" file="tool-data/shared/ensembl/ensembl_sites.txt"/>
<site type="ensembl_data_url" file="tool-data/shared/ensembl/ensembl_sites_data_URL.txt"/>
<site type="igv" file="tool-data/shared/igv/igv_build_sites.txt"/>
+1 -1
View File
@@ -10,7 +10,7 @@
<dynamic_param name="site_organisms" value="4" split="True" separator="," />
<!-- Filter out some of the links based upon matching site_id to a Galaxy application configuration parameter and by dataset dbkey -->
<filter>${site_id in $APP.config.gbrowse_display_sites}</filter>
<filter>${site_id in $APP.datatypes_registry.get_display_sites('gbrowse')}</filter>
<filter>${dataset.dbkey in $site_dbkeys}</filter>
<!-- We define url and params as normal, but values defined in dynamic_param are available by specified name -->
@@ -10,7 +10,7 @@
<dynamic_param name="site_organisms" value="4" split="True" separator="," />
<!-- Filter out some of the links based upon matching site_id to a Galaxy application configuration parameter and by dataset dbkey -->
<filter>${site_id in $APP.config.gbrowse_display_sites}</filter>
<filter>${site_id in $APP.datatypes_registry.get_display_sites('gbrowse')}</filter>
<filter>${dataset.dbkey in $site_dbkeys}</filter>
<!-- We define url and params as normal, but values defined in dynamic_param are available by specified name -->
+1 -1
View File
@@ -10,7 +10,7 @@
<dynamic_param name="site_organisms" value="4" split="True" separator="," />
<!-- Filter out some of the links based upon matching site_id to a Galaxy application configuration parameter and by dataset dbkey -->
<filter>${site_id in $APP.config.gbrowse_display_sites}</filter>
<filter>${site_id in $APP.datatypes_registry.get_display_sites('gbrowse')}</filter>
<filter>${dataset.dbkey in $site_dbkeys}</filter>
<!-- We define url and params as normal, but values defined in dynamic_param are available by specified name -->
-2
View File
@@ -223,8 +223,6 @@ class Configuration( object ):
self.sanitize_all_html = string_as_bool( kwargs.get( 'sanitize_all_html', True ) )
self.serve_xss_vulnerable_mimetypes = string_as_bool( kwargs.get( 'serve_xss_vulnerable_mimetypes', False ) )
self.enable_old_display_applications = string_as_bool( kwargs.get( "enable_old_display_applications", "True" ) )
self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",")
self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "modencode,sgd_yeast,tair,wormbase,wormbase_ws120,wormbase_ws140,wormbase_ws170,wormbase_ws180,wormbase_ws190,wormbase_ws200,wormbase_ws204,wormbase_ws210,wormbase_ws220,wormbase_ws225" ).lower().split(",")
self.brand = kwargs.get( 'brand', None )
self.welcome_url = kwargs.get( 'welcome_url', '/static/welcome.html' )
# Configuration for the message box directly below the masthead.
+1 -1
View File
@@ -86,7 +86,7 @@ class GenomeGraphs( Tabular ):
dataset.dbkey = 'hg18' # punt!
if dataset.has_data():
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey):
if site_name in app.config.ucsc_display_sites:
if site_name in datatypes_registry.get_display_sites('ucsc'):
site_url = site_url.replace('/hgTracks?','/hgGenome?') # for genome graphs
internal_url = "%s" % url_for( controller='dataset',
dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name )
+6 -6
View File
@@ -235,7 +235,7 @@ class Interval( Tabular ):
# enabled.
valid_sites = [ ( name, url )
for name, url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey )
if name in app.config.ucsc_display_sites ]
if name in app.datatypes_registry.get_display_sites('ucsc') ]
if not valid_sites:
return []
# If there are any valid sites, we need to generate the estimated
@@ -751,7 +751,7 @@ class Gff( Tabular, _RemoteCallMixin ):
seqid, start, stop = self.get_estimated_display_viewport( dataset )
if seqid is not None:
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey ):
if site_name in app.config.ucsc_display_sites:
if site_name in app.datatypes_registry.get_display_sites('ucsc'):
redirect_url = urllib.quote_plus(
"%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" %
( site_url, dataset.dbkey, seqid, start, stop ) )
@@ -763,7 +763,7 @@ class Gff( Tabular, _RemoteCallMixin ):
seqid, start, stop = self.get_estimated_display_viewport( dataset )
if seqid is not None:
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('gbrowse', dataset.dbkey ):
if site_name in app.config.gbrowse_display_sites:
if site_name in app.datatypes_registry.get_display_sites('gbrowse'):
if seqid.startswith( 'chr' ) and len ( seqid ) > 3:
seqid = seqid[3:]
redirect_url = urllib.quote_plus( "%s/?q=%s:%s..%s&eurl=%%s" % ( site_url, seqid, start, stop ) )
@@ -1092,7 +1092,7 @@ class Wiggle( Tabular, _RemoteCallMixin ):
chrom, start, stop = self.get_estimated_display_viewport( dataset )
if chrom is not None:
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('gbrowse', dataset.dbkey ):
if site_name in app.config.gbrowse_display_sites:
if site_name in app.datatypes_registry.get_display_sites('gbrowse'):
if chrom.startswith( 'chr' ) and len ( chrom ) > 3:
chrom = chrom[3:]
redirect_url = urllib.quote_plus( "%s/?q=%s:%s..%s&eurl=%%s" % ( site_url, chrom, start, stop ) )
@@ -1104,7 +1104,7 @@ class Wiggle( Tabular, _RemoteCallMixin ):
chrom, start, stop = self.get_estimated_display_viewport( dataset )
if chrom is not None:
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey ):
if site_name in app.config.ucsc_display_sites:
if site_name in app.datatypes_registry.get_display_sites('ucsc'):
redirect_url = urllib.quote_plus( "%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" % ( site_url, dataset.dbkey, chrom, start, stop ) )
link = self._get_remote_call_url( redirect_url, site_name, dataset, type, app, base_url )
ret_val.append( ( site_name, link ) )
@@ -1286,7 +1286,7 @@ class CustomTrack ( Tabular ):
chrom, start, stop = self.get_estimated_display_viewport(dataset)
if chrom is not None:
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc',dataset.dbkey):
if site_name in app.config.ucsc_display_sites:
if site_name in app.datatypes_registry.get_display_sites('ucsc'):
internal_url = "%s" % url_for( controller='dataset', dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name )
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 ) )
+16 -7
View File
@@ -71,6 +71,7 @@ class Registry( object ):
self.xml_filename = None
# Build sites
self.build_sites = {}
self.display_sites = {}
self.legacy_build_sites = {}
def load_datatypes( self, root_dir=None, config=None, deactivate=False, override=True ):
@@ -314,20 +315,28 @@ class Registry( object ):
if not (elem.get( 'type' ) and elem.get( 'file' )):
self.log.exception( "Site is missing required 'type' and 'file' attributes: %s" )
else:
self.build_sites[elem.get( 'type' )] = elem.get( 'file' )
self.log.debug( "Loaded build site '%s': %s", elem.get( 'type' ), elem.get( 'file' ) )
for site, file in self.build_sites.items():
if site in ( 'ucsc', 'gbrowse' ):
self.legacy_build_sites[site] = galaxy.util.read_build_sites( file )
self.log.debug( "Loaded legacy build site '%s': %s", site, file )
site_type = elem.get( 'type' )
file = elem.get( 'file' )
self.build_sites[site_type] = file
if site_type in ('ucsc', 'gbrowse'):
self.legacy_build_sites[site_type] = galaxy.util.read_build_sites( file )
if elem.get( 'display', None ):
display = elem.get( 'display' )
self.display_sites[site_type] = [ x.strip() for x in display.lower().split( ',' ) ]
self.log.debug( "Loaded build site '%s': %s with display sites: %s", site_type, file, display )
else:
self.log.debug( "Loaded build site '%s': %s", site_type, file )
def get_legacy_sites_by_build( self, site_type, build ):
sites = []
for site in self.legacy_build_sites[site_type]:
for site in self.legacy_build_sites.get(site_type, []):
if build in site['builds']:
sites.append((site['name'], site['url']))
return sites
def get_display_sites( self, site_type ):
return self.display_sites.get( site_type, [] )
def load_datatype_sniffers( self, root, deactivate=False, handling_proprietary_datatypes=False, override=False ):
"""
Process the sniffers element from a parsed a datatypes XML file located at root_dir/config (if processing the Galaxy
+1 -1
View File
@@ -926,7 +926,7 @@ class GalaxyWebTransaction( base.DefaultWebTransaction, ProvidesAppContext, Prov
url_for( controller='dataset', action='list' )
)
display_as = url_for( controller='root', action='display_as' )
if self.app.config.ucsc_display_sites and self.request.path == display_as:
if self.app.datatypes_registry.get_display_sites('ucsc') and self.request.path == display_as:
try:
host = socket.gethostbyaddr( self.environ[ 'REMOTE_ADDR' ] )[0]
except( socket.error, socket.herror, socket.gaierror, socket.timeout ):
-6
View File
@@ -364,12 +364,6 @@ visualization_plugins_directory = config/plugins/visualizations
# which browsers should be available. URLs and builds available at these
# browsers are defined in the specifield files.
# UCSC browsers: tool-data/shared/ucsc/ucsc_build_sites.txt
#ucsc_display_sites = main,test,archaea,ucla
# GBrowse servers: tool-data/shared/gbrowse/gbrowse_build_sites.txt
#gbrowse_display_sites = modencode,sgd_yeast,tair,wormbase,wormbase_ws120,wormbase_ws140,wormbase_ws170,wormbase_ws180,wormbase_ws190,wormbase_ws200,wormbase_ws204,wormbase_ws210,wormbase_ws220,wormbase_ws225
# If use_remote_user = True, display application servers will be denied access
# to Galaxy and so displaying datasets in these sites will fail.
# display_servers contains a list of hostnames which should be allowed to