commit/galaxy-central: natefoo: Merged in natefoo/galaxy-central (pull request #481)
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9b6cccb3af2d/ Changeset: 9b6cccb3af2d User: natefoo Date: 2014-09-04 17:38:26 Summary: Merged in natefoo/galaxy-central (pull request #481) Make build sites files configurable Affected #: 27 files diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 datatypes_conf.xml.sample --- a/datatypes_conf.xml.sample +++ b/datatypes_conf.xml.sample @@ -312,4 +312,22 @@ <sniffer type="galaxy.datatypes.assembly:Amos"/> --></sniffers> + <build_sites> + <!-- + 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 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"/> + <site type="rviewer" file="tool-data/shared/rviewer/rviewer_build_sites.txt"/> + </build_sites></datatypes> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ensembl/ensembl_bam.xml --- a/display_applications/ensembl/ensembl_bam.xml +++ b/display_applications/ensembl/ensembl_bam.xml @@ -1,7 +1,7 @@ <display id="ensembl_bam" version="1.0.0" name="display at Ensembl"><!-- Current Ensembl method of attaching user data via URL; archives older than ~November 2008 will use a different method --><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ensembl/ensembl_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="ensembl" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ensembl/ensembl_gff.xml --- a/display_applications/ensembl/ensembl_gff.xml +++ b/display_applications/ensembl/ensembl_gff.xml @@ -1,7 +1,7 @@ <display id="ensembl_gff" version="1.0.0" name="display at Ensembl"><!-- Current Ensembl method of attaching user data via URL; archives older than ~November 2008 will use a different method --><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ensembl/ensembl_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="ensembl" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> @@ -41,7 +41,7 @@ <!-- Old Ensembl method of attaching user data via URL --><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ensembl/ensembl_sites_data_URL.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="ensembl_data_url" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ensembl/ensembl_interval_as_bed.xml --- a/display_applications/ensembl/ensembl_interval_as_bed.xml +++ b/display_applications/ensembl/ensembl_interval_as_bed.xml @@ -1,7 +1,7 @@ <display id="ensembl_interval" version="1.0.0" name="display at Ensembl"><!-- Current Ensembl method of attaching user data via URL; archives older than ~November 2008 will use a different method --><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ensembl/ensembl_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="ensembl" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> @@ -41,7 +41,7 @@ <!-- Old Ensembl method of attaching user data via URL --><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ensembl/ensembl_sites_data_URL.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="ensembl_data_url" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/gbrowse/gbrowse_gff.xml --- a/display_applications/gbrowse/gbrowse_gff.xml +++ b/display_applications/gbrowse/gbrowse_gff.xml @@ -1,6 +1,6 @@ <display id="gbrowse_gff" version="1.0.0" name="display at GBrowse"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/gbrowse/gbrowse_build_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="gbrowse" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> @@ -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 --> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/gbrowse/gbrowse_interval_as_bed.xml --- a/display_applications/gbrowse/gbrowse_interval_as_bed.xml +++ b/display_applications/gbrowse/gbrowse_interval_as_bed.xml @@ -1,6 +1,6 @@ <display id="gbrowse_interval_as_bed" version="1.0.0" name="display at GBrowse"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/gbrowse/gbrowse_build_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="gbrowse" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> @@ -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 --> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/gbrowse/gbrowse_wig.xml --- a/display_applications/gbrowse/gbrowse_wig.xml +++ b/display_applications/gbrowse/gbrowse_wig.xml @@ -1,6 +1,6 @@ <display id="gbrowse_wig" version="1.0.0" name="display at GBrowse"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/gbrowse/gbrowse_build_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="gbrowse" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> @@ -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 --> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/igv/bam.xml --- a/display_applications/igv/bam.xml +++ b/display_applications/igv/bam.xml @@ -2,7 +2,7 @@ <display id="igv_bam" version="1.0.0" name="display with IGV"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/igv/igv_build_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="igv" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> @@ -92,4 +92,4 @@ </display> -<!-- Dan Blankenberg --> \ No newline at end of file +<!-- Dan Blankenberg --> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/igv/vcf.xml --- a/display_applications/igv/vcf.xml +++ b/display_applications/igv/vcf.xml @@ -2,7 +2,7 @@ <display id="igv_vcf" version="1.0.0" name="display with IGV"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/igv/igv_build_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="igv" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> @@ -92,4 +92,4 @@ </display> -<!-- Dan Blankenberg --> \ No newline at end of file +<!-- Dan Blankenberg --> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/rviewer/bed.xml --- a/display_applications/rviewer/bed.xml +++ b/display_applications/rviewer/bed.xml @@ -2,7 +2,7 @@ <display id="rviewer_interval" version="1.0.0" name="display at RViewer"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/rviewer/rviewer_build_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="rviewer" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/rviewer/vcf.xml --- a/display_applications/rviewer/vcf.xml +++ b/display_applications/rviewer/vcf.xml @@ -2,7 +2,7 @@ <display id="rviewer_vcf" version="1.0.0" name="display at RViewer"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/rviewer/rviewer_build_sites.txt" skip_startswith="#" id="0" name="1"> + <dynamic_links site_type="rviewer" skip_startswith="#" id="0" name="1"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ucsc/bam.xml --- a/display_applications/ucsc/bam.xml +++ b/display_applications/ucsc/bam.xml @@ -1,6 +1,6 @@ <display id="ucsc_bam" version="1.0.0" name="display at UCSC"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ucsc/ucsc_build_sites.txt" skip_startswith="#" id="0" name="0"> + <dynamic_links site_type="ucsc" skip_startswith="#" id="0" name="0"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/><dynamic_param name="ucsc_link" value="1"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ucsc/bigbed.xml --- a/display_applications/ucsc/bigbed.xml +++ b/display_applications/ucsc/bigbed.xml @@ -1,6 +1,6 @@ <display id="ucsc_bigbed" version="1.0.0" name="display at UCSC"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ucsc/ucsc_build_sites.txt" skip_startswith="#" id="0" name="0"> + <dynamic_links site_type="ucsc" skip_startswith="#" id="0" name="0"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/><dynamic_param name="ucsc_link" value="1"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ucsc/bigwig.xml --- a/display_applications/ucsc/bigwig.xml +++ b/display_applications/ucsc/bigwig.xml @@ -1,6 +1,6 @@ <display id="ucsc_bigwig" version="1.0.0" name="display at UCSC"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ucsc/ucsc_build_sites.txt" skip_startswith="#" id="0" name="0"> + <dynamic_links site_type="ucsc" skip_startswith="#" id="0" name="0"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/><dynamic_param name="ucsc_link" value="1"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ucsc/interval_as_bed.xml --- a/display_applications/ucsc/interval_as_bed.xml +++ b/display_applications/ucsc/interval_as_bed.xml @@ -1,6 +1,6 @@ <display id="ucsc_interval_as_bed" version="1.0.0" name="display at UCSC" inherit="True"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ucsc/ucsc_build_sites.txt" skip_startswith="#" id="0" name="0"> + <dynamic_links site_type="ucsc" skip_startswith="#" id="0" name="0"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/><dynamic_param name="ucsc_link" value="1"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ucsc/maf_customtrack.xml --- a/display_applications/ucsc/maf_customtrack.xml +++ b/display_applications/ucsc/maf_customtrack.xml @@ -1,6 +1,6 @@ <display id="ucsc_maf_customtrack" version="1.0.0" name="display at UCSC" inherit="True"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ucsc/ucsc_build_sites.txt" skip_startswith="#" id="0" name="0"> + <dynamic_links site_type="ucsc" skip_startswith="#" id="0" name="0"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/><dynamic_param name="ucsc_link" value="1"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 display_applications/ucsc/vcf.xml --- a/display_applications/ucsc/vcf.xml +++ b/display_applications/ucsc/vcf.xml @@ -1,6 +1,6 @@ <display id="ucsc_vcf" version="1.0.0" name="display at UCSC"><!-- Load links from file: one line to one link --> - <dynamic_links from_file="tool-data/shared/ucsc/ucsc_build_sites.txt" skip_startswith="#" id="0" name="0"> + <dynamic_links site_type="ucsc" skip_startswith="#" id="0" name="0"><!-- Define parameters by column from file, allow splitting on builds --><dynamic_param name="site_id" value="0"/><dynamic_param name="ucsc_link" value="1"/> diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/app.py --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -64,9 +64,6 @@ # Load dbkey / genome build manager self._configure_genome_builds( data_table_name="__dbkeys__", load_old_style=True ) - # Load build sites (old-style) - self._configure_build_sites() - # Genomes self.genomes = Genomes( self ) # Data providers registry. diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -16,7 +16,6 @@ from galaxy.util import string_as_bool from galaxy.util import listify from galaxy.util.dbkeys import GenomeBuilds -from galaxy.util.build_sites import BuildSites from galaxy import eggs log = logging.getLogger( __name__ ) @@ -224,10 +223,6 @@ 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_build_sites = resolve_path( kwargs.get( 'ucsc_build_sites', os.path.join( self.tool_data_path, 'shared', 'ucsc', 'ucsc_build_sites.txt') ), self.root ) - self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",") - self.gbrowse_build_sites = resolve_path( kwargs.get( 'gbrowse_build_sites', os.path.join( self.tool_data_path, 'shared', 'gbrowse', 'gbrowse_build_sites.txt') ), self.root ) - 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. @@ -575,9 +570,6 @@ def _configure_genome_builds( self, data_table_name="__dbkeys__", load_old_style=True ): self.genome_builds = GenomeBuilds( self, data_table_name=data_table_name, load_old_style=load_old_style ) - def _configure_build_sites( self ): - self.build_sites = BuildSites( self ) - def _configure_toolbox( self ): # Initialize the tools, making sure the list of tool configs includes the reserved migrated_tools_conf.xml file. tool_configs = self.config.tool_configs diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/datatypes/display_applications/application.py --- a/lib/galaxy/datatypes/display_applications/application.py +++ b/lib/galaxy/datatypes/display_applications/application.py @@ -81,9 +81,13 @@ class DynamicDisplayApplicationBuilder( object ): @classmethod - def __init__( self, elem, display_application ): + def __init__( self, elem, display_application, build_sites ): rval = [] - filename = elem.get( 'from_file', None ) + filename = None + if elem.get( 'site_type', None ) is not None: + filename = build_sites.get( elem.get( 'site_type' ) ) + else: + filename = elem.get( 'from_file', None ) assert filename is not None, 'Filename and id attributes required for dynamic_links' skip_startswith = elem.get( 'skip_startswith', None ) separator = elem.get( 'separator', '\t' ) @@ -176,7 +180,7 @@ if link: rval.links[ link.id ] = link for dynamic_links in elem.findall( 'dynamic_links' ): - for link in DynamicDisplayApplicationBuilder( dynamic_links, rval ): + for link in DynamicDisplayApplicationBuilder( dynamic_links, rval, datatypes_registry.build_sites ): rval.links[ link.id ] = link return rval def __init__( self, display_id, name, datatypes_registry, version = None ): diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/datatypes/genetics.py --- a/lib/galaxy/datatypes/genetics.py +++ b/lib/galaxy/datatypes/genetics.py @@ -83,29 +83,31 @@ ret_val = [] ggtail = 'hgGenome_doSubmitUpload=submit' if not dataset.dbkey: - dataset.dbkey = 'hg18' # punt! + dataset.dbkey = 'hg18' # punt! if dataset.has_data(): - for site_name, site_url in app.build_sites.get_ucsc_sites_by_build(dataset.dbkey): - if site_name in app.config.ucsc_display_sites: - 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 ) - display_url = "%s%s/display_as?id=%i&display_app=%s&authz_method=display_at" % (base_url, url_for( controller='root' ), dataset.id, type) - display_url = urllib.quote_plus( display_url ) - # was display_url = urllib.quote_plus( "%s/display_as?id=%i&display_app=%s" % (base_url, dataset.id, type) ) - #redirect_url = urllib.quote_plus( "%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" % (site_url, dataset.dbkey, chrom, start, stop) ) - sl = ["%sdb=%s" % (site_url,dataset.dbkey ),] - #sl.append("&hgt.customText=%s") - sl.append("&hgGenome_dataSetName=%s&hgGenome_dataSetDescription=%s" % (dataset.name, 'GalaxyGG_data')) - sl.append("&hgGenome_formatType=best guess&hgGenome_markerType=best guess") - sl.append("&hgGenome_columnLabels=first row&hgGenome_maxVal=&hgGenome_labelVals=") - sl.append("&hgGenome_doSubmitUpload=submit") - sl.append("&hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=%s" % display_url) - s = ''.join(sl) - s = urllib.quote_plus(s) - redirect_url = s - link = '%s?redirect_url=%s&display_url=%s' % ( internal_url, redirect_url, display_url ) - ret_val.append( (site_name, link) ) + for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey): + 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 ) + display_url = "%s%s/display_as?id=%i&display_app=%s&authz_method=display_at" % (base_url, url_for( controller='root' ), dataset.id, type) + display_url = urllib.quote_plus( display_url ) + # was display_url = urllib.quote_plus( "%s/display_as?id=%i&display_app=%s" % (base_url, dataset.id, type) ) + #redirect_url = urllib.quote_plus( "%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" % (site_url, dataset.dbkey, chrom, start, stop) ) + sl = ["%sdb=%s" % (site_url,dataset.dbkey ),] + #sl.append("&hgt.customText=%s") + sl.append("&hgGenome_dataSetName=%s&hgGenome_dataSetDescription=%s" % (dataset.name, 'GalaxyGG_data')) + sl.append("&hgGenome_formatType=best guess&hgGenome_markerType=best guess") + sl.append("&hgGenome_columnLabels=first row&hgGenome_maxVal=&hgGenome_labelVals=") + sl.append("&hgGenome_doSubmitUpload=submit") + sl.append("&hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=%s" % display_url) + s = ''.join(sl) + s = urllib.quote_plus(s) + redirect_url = s + link = '%s?redirect_url=%s&display_url=%s' % ( internal_url, redirect_url, display_url ) + ret_val.append( (site_name, link) ) return ret_val def make_html_table( self, dataset, skipchars=[] ): diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/datatypes/interval.py --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -234,8 +234,8 @@ # Filter UCSC sites to only those that are supported by this build and # enabled. valid_sites = [ ( name, url ) - for name, url in app.build_sites.get_ucsc_sites_by_build( dataset.dbkey ) - if name in app.config.ucsc_display_sites ] + for name, url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey ) + 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 @@ -750,8 +750,8 @@ ret_val = [] seqid, start, stop = self.get_estimated_display_viewport( dataset ) if seqid is not None: - for site_name, site_url in app.build_sites.get_ucsc_sites_by_build( dataset.dbkey ): - if site_name in app.config.ucsc_display_sites: + for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey ): + 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 ) ) @@ -762,8 +762,8 @@ ret_val = [] seqid, start, stop = self.get_estimated_display_viewport( dataset ) if seqid is not None: - for site_name, site_url in app.build_sites.get_gbrowse_sites_by_build( dataset.dbkey ): - if site_name in app.config.gbrowse_display_sites: + for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('gbrowse', dataset.dbkey ): + 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 ) ) @@ -1091,8 +1091,8 @@ ret_val = [] chrom, start, stop = self.get_estimated_display_viewport( dataset ) if chrom is not None: - for site_name, site_url in app.build_sites.get_gbrowse_sites_by_build( dataset.dbkey ): - if site_name in app.config.gbrowse_display_sites: + for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('gbrowse', dataset.dbkey ): + 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 ) ) @@ -1103,8 +1103,8 @@ ret_val = [] chrom, start, stop = self.get_estimated_display_viewport( dataset ) if chrom is not None: - for site_name, site_url in app.build_sites.get_ucsc_sites_by_build( dataset.dbkey ): - if site_name in app.config.ucsc_display_sites: + for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc', dataset.dbkey ): + 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 ) ) @@ -1285,8 +1285,8 @@ ret_val = [] chrom, start, stop = self.get_estimated_display_viewport(dataset) if chrom is not None: - for site_name, site_url in app.build_sites.get_ucsc_sites_by_build(dataset.dbkey): - if site_name in app.config.ucsc_display_sites: + for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build('ucsc',dataset.dbkey): + 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 ) ) diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/datatypes/registry.py --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -69,6 +69,10 @@ self.datatype_elems = [] self.sniffer_elems = [] 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 ): """ @@ -285,6 +289,8 @@ handling_proprietary_datatypes=handling_proprietary_datatypes, override=override ) self.upload_file_formats.sort() + # Load build sites + self.load_build_sites( root ) # Persist the xml form of the registry into a temporary file so that it can be loaded from the command line by tools and # set_metadata processing. self.to_xml_file() @@ -303,6 +309,34 @@ self.sniff_order.append( datatype ) append_to_sniff_order() + def load_build_sites( self, root ): + if root.find( 'build_sites' ): + for elem in root.find( 'build_sites' ).findall( 'site' ): + if not (elem.get( 'type' ) and elem.get( 'file' )): + self.log.exception( "Site is missing required 'type' and 'file' attributes: %s" ) + else: + 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.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 diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -844,6 +844,30 @@ return db_names +def read_build_sites( filename, check_builds=True ): + """ read db names to ucsc mappings from file, this file should probably be merged with the one above """ + build_sites = [] + try: + for line in open(filename): + try: + if line[0:1] == "#": + continue + fields = line.replace("\r", "").replace("\n", "").split("\t") + site_name = fields[0] + site = fields[1] + if check_builds: + site_builds = fields[2].split(",") + site_dict = {'name': site_name, 'url': site, 'builds': site_builds} + else: + site_dict = {'name': site_name, 'url': site} + build_sites.append( site_dict ) + except: + continue + except: + print "ERROR: Unable to read builds for site file %s" % filename + return build_sites + + def relativize_symlinks( path, start=None, followlinks=False): for root, dirs, files in os.walk( path, followlinks=followlinks ): rel_start = None diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/util/build_sites.py --- a/lib/galaxy/util/build_sites.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Functionality for dealing with build sites for legacy display applications. -""" -import os.path - - -class BuildSites( object ): - - def __init__( self, app ): - self._app = app - self._build_sites = {} - self.load_build_sites() - - def read_build_sites( self, filename, check_builds=True ): - """ read db names to ucsc mappings from file, this file should probably be merged with the one above """ - build_sites = [] - try: - for line in open(filename): - try: - if line[0:1] == "#": - continue - fields = line.replace("\r", "").replace("\n", "").split("\t") - site_name = fields[0] - site = fields[1] - if check_builds: - site_builds = fields[2].split(",") - site_dict = {'name': site_name, 'url': site, 'builds': site_builds} - else: - site_dict = {'name': site_name, 'url': site} - build_sites.append( site_dict ) - except: - continue - except: - print "ERROR: Unable to read builds for site file %s" % filename - return build_sites - - def load_build_sites( self ): - self._build_sites['ucsc'] = self.read_build_sites( self._app.config.ucsc_build_sites ) - self._build_sites['gbrowse'] = self.read_build_sites( self._app.config.gbrowse_build_sites ) - - def _get_site_by_build( self, site_type, build ): - sites = [] - for site in self._build_sites[site_type]: - if build in site['builds']: - sites.append((site['name'], site['url'])) - return sites - - def get_ucsc_sites_by_build( self, build ): - return self._get_site_by_build( 'ucsc', build ) - - def get_gbrowse_sites_by_build( self, build ): - return self._get_site_by_build( 'gbrowse', build ) diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 lib/galaxy/web/framework/__init__.py --- a/lib/galaxy/web/framework/__init__.py +++ b/lib/galaxy/web/framework/__init__.py @@ -926,7 +926,7 @@ 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 ): diff -r 9fdca7477f44165ae894177a2fef78a4ff9dc5bf -r 9b6cccb3af2d6b13a1a1da7def87dcc19172be88 universe_wsgi.ini.sample --- a/universe_wsgi.ini.sample +++ b/universe_wsgi.ini.sample @@ -364,14 +364,6 @@ # which browsers should be available. URLs and builds available at these # browsers are defined in the specifield files. -# UCSC browsers: -#ucsc_build_sites = tool-data/shared/ucsc/ucsc_build_sites.txt -#ucsc_display_sites = main,test,archaea,ucla - -# GBrowse servers: -#gbrowse_build_sites = 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 Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org