root/galaxy-central/lib/galaxy/datatypes/tracks.py

リビジョン 2, 1.7 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1"""
2Datatype classes for tracks/track views within galaxy.
3"""
4
5import binary, binascii, logging
6from galaxy import util
7from galaxy.web import url_for
8from galaxy.util.hash_util import hmac_new
9from urllib import quote_plus
10
11log = logging.getLogger(__name__)
12
13class GeneTrack( binary.Binary ):
14    file_ext = "genetrack"
15   
16    def __init__(self, **kwargs):
17        super( GeneTrack, self ).__init__( **kwargs )
18        self.add_display_app( 'genetrack', 'View in', '', 'genetrack_link' )
19    def get_display_links( self, dataset, type, app, base_url, target_frame='galaxy_main', **kwd ): #Force target_frame to be 'galaxy_main'
20        return binary.Binary.get_display_links( self, dataset, type, app, base_url, target_frame=target_frame, **kwd )
21    def genetrack_link( self, hda, type, app, base_url ):
22        ret_val = []
23        if hda.dataset.has_data():
24            # Get the disk file name and data id
25            file_name = hda.dataset.get_file_name()
26            data_id  = quote_plus( str( hda.id ) )
27            galaxy_url = quote_plus( "%s%s" % ( base_url, url_for( controller = 'tool_runner', tool_id='predict2genetrack' ) ) )
28            # Make it secure
29            hashkey = quote_plus( hmac_new( app.config.tool_secret, file_name ) )
30            encoded = quote_plus( binascii.hexlify( file_name ) )
31            for name, url in util.get_genetrack_sites():
32                if name.lower() in app.config.genetrack_display_sites:
33                    # send both  parameters filename and hashkey
34                    link = "%s?filename=%s&hashkey=%s&input=%s&GALAXY_URL=%s" % ( url, encoded, hashkey, data_id, galaxy_url )
35                    ret_val.append( ( name, link ) )
36            return ret_val
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。