'from the ever-helpful angie hinrichs angie@soe.ucsc.edu
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'

def ucsc_links(self, dataset, type, app, base_url):

    ret_val = []
    if (not dataset.dbkey):
        dataset.dbkey = 'hg18'
    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.datatypes_registry.get_display_sites('ucsc')):
                site_url = site_url.replace('/hgTracks?', '/hgGenome?')
                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 = quote_plus(display_url)
                sl = [('%sdb=%s' % (site_url, dataset.dbkey))]
                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 = 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
