def ucsc_links( self, dataset, type, app, base_url ):
     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]
             if start == '' or int(start) < 1:
                 start='1'
             if stop == '' or int(stop) <= int(start):
                 stop = '%d' % (int(start) + 10000)
             for site_name, site_url in util.get_ucsc_by_build(dataset.dbkey):
                 if site_name in app.config.ucsc_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='ucsc_' + 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) )
         else:
             gal_Log.debug('@@@ gg ucsc_links - no viewport_tuple')
     return ret_val
Beispiel #2
0
 def ucsc_links( self, dataset, type, app, base_url ):
     """ from the ever-helpful angie hinrichs [email protected]
     a genome graphs call looks like this 
     http://genome.ucsc.edu/cgi-bin/hgGenome?clade=mammal&org=Human&db=hg18&hgGenome_dataSetName=dname
     &hgGenome_dataSetDescription=test&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess
     &hgGenome_columnLabels=best%20guess&hgGenome_maxVal=&hgGenome_labelVals=
     &hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=http://galaxy.esphealth.org/datasets/333/display/index
     &hgGenome_doSubmitUpload=submit
             Galaxy gives this for an interval file
     http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg18&position=chr1:1-1000&hgt.customText=
     http%3A%2F%2Fgalaxy.esphealth.org%2Fdisplay_as%3Fid%3D339%26display_app%3Ducsc
     """
     ret_val = []
     ggtail = '&hgGenome_doSubmitUpload=submit'
     if not dataset.dbkey:
           dataset.dbkey = 'hg18' # punt!
     if dataset.has_data:
           for site_name, site_url in util.get_ucsc_by_build(dataset.dbkey):
                 if site_name in app.config.ucsc_display_sites:
                     site_url = site_url.replace('/hgTracks?','/hgGenome?') # for genome graphs
                     display_url = urllib.quote_plus( "%s%s/display_as?id=%i&display_app=%s" % (base_url, url_for( controller='root' ), dataset.id, type))
                     sl = ["%sdb=%s" % (site_url,dataset.dbkey ),]
                     sl.append("&hgGenome_dataSetName=%s&hgGenome_dataSetDescription=%s" % (dataset.name, 'GalaxyGG_data'))
                     sl.append("&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess")
                     sl.append("&hgGenome_columnLabels=first%20row&hgGenome_maxVal=&hgGenome_labelVals=")
                     sl.append("&hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=")
                     s = ''.join(sl)
                     link = "%s%s%s" % (s, display_url, ggtail )
                     ret_val.append( (site_name, link) )
     return ret_val
Beispiel #3
0
    def ucsc_links(self, dataset, type, app, base_url):
        """
        from the ever-helpful angie hinrichs [email protected]
        a genome graphs call looks like this

        http://genome.ucsc.edu/cgi-bin/hgGenome?clade=mammal&org=Human&db=hg18&hgGenome_dataSetName=dname
        &hgGenome_dataSetDescription=test&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess
        &hgGenome_columnLabels=best%20guess&hgGenome_maxVal=&hgGenome_labelVals=
        &hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=http://galaxy.esphealth.org/datasets/333/display/index
        &hgGenome_doSubmitUpload=submit

        Galaxy gives this for an interval file

        http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg18&position=chr1:1-1000&hgt.customText=
        http%3A%2F%2Fgalaxy.esphealth.org%2Fdisplay_as%3Fid%3D339%26display_app%3Ducsc

        """
        ret_val = []
        ggtail = 'hgGenome_doSubmitUpload=submit'
        if not dataset.dbkey:
            dataset.dbkey = 'hg18'  # punt!
        if dataset.has_data():
            for site_name, site_url in util.get_ucsc_by_build(dataset.dbkey):
                if site_name in app.config.ucsc_display_sites:
                    site_url = site_url.replace(
                        '/hgTracks?', '/hgGenome?')  # for genome graphs
                    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
Beispiel #4
0
 def ucsc_links( self, dataset, type, app, base_url ):
     ret_val = []
     chrom, start, stop = self._get_viewer_range( dataset )
     if chrom is not None:
         for site_name, site_url in util.get_ucsc_by_build( dataset.dbkey ):
             if site_name in app.config.ucsc_display_sites:
                 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 ) )
     return ret_val
Beispiel #5
0
 def ucsc_links( self, dataset, type, app, base_url ):
     ret_val = []
     if dataset.has_data:
         seqid, start, stop = self.get_estimated_display_viewport( dataset )
         if seqid and start and stop:
             for site_name, site_url in util.get_ucsc_by_build( dataset.dbkey ):
                 if site_name in app.config.ucsc_display_sites:
                     redirect_url = urllib.quote_plus(
                             "%sdb=%s&position=%s:%s-%s&hgt.customText=%%s" %
                             ( site_url, dataset.dbkey, seqid, start, stop ) )
                     link = self._get_remote_call_url( redirect_url, site_name, dataset, type, app, base_url )
                     ret_val.append( ( site_name, link ) )
     return ret_val
Beispiel #6
0
 def ucsc_links( self, dataset, type, app, base_url ):
     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_ucsc_by_build(dataset.dbkey):
                 if site_name in app.config.ucsc_display_sites:
                     display_url = urllib.quote_plus( "%s%s/display_as?id=%i&display_app=%s" % (base_url, url_for( controller='root' ), dataset.id, type) )
                     link = "%sdb=%s&position=%s:%s-%s&hgt.customText=%s" % (site_url, dataset.dbkey, chrom, start, stop, display_url )
                     ret_val.append( (site_name, link) )
     return ret_val
Beispiel #7
0
 def ucsc_links( self, dataset, type, app, base_url ):
     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_ucsc_by_build(dataset.dbkey):
                 if site_name in app.config.ucsc_display_sites:
                     internal_url = "%s" % url_for( controller='dataset', dataset_id=dataset.id, action='display_at', filename='ucsc_' + 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 ucsc_links( self, dataset, type, app, base_url ):
     """ 
     from the ever-helpful angie hinrichs [email protected]
     a genome graphs call looks like this 
     http://genome.ucsc.edu/cgi-bin/hgGenome?clade=mammal&org=Human&db=hg18&hgGenome_dataSetName=dname
     &hgGenome_dataSetDescription=test&hgGenome_formatType=best%20guess&hgGenome_markerType=best%20guess
     &hgGenome_columnLabels=best%20guess&hgGenome_maxVal=&hgGenome_labelVals=
     &hgGenome_maxGapToFill=25000000&hgGenome_uploadFile=http://galaxy.esphealth.org/datasets/333/display/index
     &hgGenome_doSubmitUpload=submit
             Galaxy gives this for an interval file
     http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg18&position=chr1:1-1000&hgt.customText=
     http%3A%2F%2Fgalaxy.esphealth.org%2Fdisplay_as%3Fid%3D339%26display_app%3Ducsc
     """
     ret_val = []
     ggtail = 'hgGenome_doSubmitUpload=submit'
     if not dataset.dbkey:
           dataset.dbkey = 'hg18' # punt!
     if dataset.has_data:
           for site_name, site_url in util.get_ucsc_by_build(dataset.dbkey):
                 if site_name in app.config.ucsc_display_sites:
                     site_url = site_url.replace('/hgTracks?','/hgGenome?') # for genome graphs
                     internal_url = "%s" % url_for( controller='dataset',
                             dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name )
                     if base_url.startswith( 'https://' ):
                         base_url = base_url.replace( 'https', 'http', 1 )
                     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
                     log.debug('## rg gg ucsc rdurl=%s; s = %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
Beispiel #9
0
 def ucsc_links( self, dataset, type, app, base_url ):
     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_ucsc_by_build(dataset.dbkey):
                 if site_name in app.config.ucsc_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.
                     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" % (base_url, url_for( controller='root' ), dataset.id, type) )
                     link = "%sdb=%s&position=%s:%s-%s&hgt.customText=%s" % (site_url, dataset.dbkey, chrom, start, stop, display_url )
                     ret_val.append( (site_name, link) )
     return ret_val
Beispiel #10
0
 def ucsc_links(self, dataset, type, app, base_url):
     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]
             if start == '' or int(start) < 1:
                 start = '1'
             if stop == '' or int(stop) <= start:
                 stop = '%d' % (int(start) + 10000)
             for site_name, site_url in util.get_ucsc_by_build(
                     dataset.dbkey):
                 if site_name in app.config.ucsc_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='ucsc_' + 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))
         else:
             log.debug('@@@ gg ucsc_links - no viewport_tuple')
     return ret_val
Beispiel #11
0
 def get_ucsc_sites(self, dataset):
     return util.get_ucsc_by_build(dataset.dbkey)
Beispiel #12
0
 def get_ucsc_sites(self, dataset):
     return util.get_ucsc_by_build(dataset.dbkey)