details: http://www.bx.psu.edu/hg/galaxy/rev/566d4061cb19 changeset: 3324:566d4061cb19 user: Dan Blankenberg <dan@bx.psu.edu> date: Wed Feb 03 16:33:25 2010 -0500 description: Make the GeneTrack datatype binary, containing only the 'indexed' data needed by the GeneTrack server. Better creation of the URL for running the peak predictor tool. \nStill some cleanup/decoupling possible. diffstat: eggs.ini | 4 +- lib/galaxy/datatypes/tracks.py | 29 +++++++++------------- tools/visualization/genetrack_indexer.py | 11 -------- tools/visualization/genetrack_indexer.xml | 2 +- tools/visualization/genetrack_peak_prediction.xml | 2 +- 5 files changed, 16 insertions(+), 32 deletions(-) diffs (120 lines): diff -r ab1c33257cb3 -r 566d4061cb19 eggs.ini --- a/eggs.ini Wed Feb 03 13:53:16 2010 -0500 +++ b/eggs.ini Wed Feb 03 16:33:25 2010 -0500 @@ -61,7 +61,7 @@ MySQL_python = _5.0.67_static python_lzo = _static bx_python = _dev_3b9d30e47619 -GeneTrack = _dev_86867fc7bf46680cfafbb0749be8410b749c5593 +GeneTrack = _dev_bf44f7054c30f19bd9f79106c1fd69849562b361 SQLAlchemy = _dev_r6498 ; nose = .dev_r7156749efc58 @@ -84,7 +84,7 @@ decorator = http://pypi.python.org/packages/source/d/decorator/decorator-3.1.2.tar.gz docutils = http://downloads.sourceforge.net/docutils/docutils-0.4.tar.gz elementtree = http://effbot.org/downloads/elementtree-1.2.6-20050316.tar.gz -GeneTrack = http://github.com/ialbert/genetrack-central/tarball/86867fc7bf46680cfafbb074... +GeneTrack = http://github.com/ialbert/genetrack-central/tarball/bf44f7054c30f19bd9f79106... lrucache = http://evan.prodromou.name/lrucache/lrucache-0.2.tar.gz Mako = http://www.makotemplates.org/downloads/Mako-0.2.5.tar.gz nose = http://pypi.python.org/packages/source/n/nose/nose-0.11.1.tar.gz diff -r ab1c33257cb3 -r 566d4061cb19 lib/galaxy/datatypes/tracks.py --- a/lib/galaxy/datatypes/tracks.py Wed Feb 03 13:53:16 2010 -0500 +++ b/lib/galaxy/datatypes/tracks.py Wed Feb 03 16:33:25 2010 -0500 @@ -2,41 +2,36 @@ Datatype classes for tracks/track views within galaxy. """ -import data -import tabular, binascii, logging -from galaxy.datatypes.metadata import MetadataElement -from galaxy.datatypes import metadata -import galaxy.model +import binary, binascii, logging from galaxy import util from galaxy.web import url_for -from sniff import * -from galaxy.util.hash_util import * +from galaxy.util.hash_util import hmac_new +import urllib log = logging.getLogger(__name__) -class GeneTrack( tabular.Tabular ): +class GeneTrack( binary.Binary ): file_ext = "genetrack" - MetadataElement( name="genetrack", default="data.genetrack", desc="HDF index", readonly=True, visible=True, no_value=0 ) - MetadataElement( name="label", default="Custom", desc="Track Label", readonly=True, visible=True, no_value="Custom" ) - def __init__(self, **kwargs): super( GeneTrack, self ).__init__( **kwargs ) self.add_display_app( 'genetrack', 'View in', '', 'genetrack_link' ) - def get_display_links( self, dataset, type, app, base_url, target_frame='galaxy_main', **kwd ): - return data.Data.get_display_links( self, dataset, type, app, base_url, target_frame=target_frame, **kwd ) + def get_display_links( self, dataset, type, app, base_url, target_frame='galaxy_main', **kwd ): #Force target_frame to be 'galaxy_main' + return binary.Binary.get_display_links( self, dataset, type, app, base_url, target_frame=target_frame, **kwd ) def genetrack_link( self, hda, type, app, base_url ): ret_val = [] if hda.has_data: # Get the disk file name and data id file_name = hda.dataset.get_file_name() - data_id = hda.id + data_id = urllib.quote_plus( str( hda.id ) ) #can we name this 'input' in the passed params instead of 'id' to prevent GT from having to map 'id' to 'input'? + galaxy_url = urllib.quote_plus( "%s%s" % ( base_url, url_for( controller = 'tool_runner' ) ) ) + tool_id = urllib.quote_plus( 'predict2genetrack' ) # Make it secure - hashkey = hmac_new( app.config.tool_secret, file_name ) - encoded = binascii.hexlify( file_name ) + hashkey = urllib.quote_plus( hmac_new( app.config.tool_secret, file_name ) ) + encoded = urllib.quote_plus( binascii.hexlify( file_name ) ) for name, url in util.get_genetrack_sites(): if name.lower() in app.config.genetrack_display_sites: # send both parameters filename and hashkey - link = "%s?filename=%s&hashkey=%s&id=%s&GALAXY_URL=%s" % ( url, encoded, hashkey, data_id, base_url ) + link = "%s?filename=%s&hashkey=%s&id=%s&GALAXY_URL=%s&tool_id=%s" % ( url, encoded, hashkey, data_id, galaxy_url, tool_id ) ret_val.append( ( name, link ) ) return ret_val diff -r ab1c33257cb3 -r 566d4061cb19 tools/visualization/genetrack_indexer.py --- a/tools/visualization/genetrack_indexer.py Wed Feb 03 13:53:16 2010 -0500 +++ b/tools/visualization/genetrack_indexer.py Wed Feb 03 16:33:25 2010 -0500 @@ -37,14 +37,3 @@ else: tabs2genetrack.transform(inpname=options.inpname, outname=options.outname,\ format=options.format, shift=options.shift, index=options.index, options=options) - - #HACK ALERT - #output created in job working directory has a different name than the final destination. - #GeneTrack uses dataset_name.hdf for indexes - #This will fix the different name problem, but this is not a secure solution - #This is Exceptionally Fragile as any change to the way that temporary output names are created could break - #GeneTrack should allow explicit definition of the index file, not filename.hdf - if options.workdir and os.path.isdir( options.workdir ): - for filename in os.listdir( options.workdir ): - if filename.endswith( '.dat.hdf' ) and filename.startswith( 'galaxy_dataset_' ): - shutil.move( os.path.join( options.workdir, filename ), os.path.join( options.workdir, filename[ len( 'galaxy_' ): ] ) ) diff -r ab1c33257cb3 -r 566d4061cb19 tools/visualization/genetrack_indexer.xml --- a/tools/visualization/genetrack_indexer.xml Wed Feb 03 13:53:16 2010 -0500 +++ b/tools/visualization/genetrack_indexer.xml Wed Feb 03 16:33:25 2010 -0500 @@ -3,7 +3,7 @@ <description> - creates a visualization from a bed file</description> <command interpreter="python"> - genetrack_indexer.py -i $input -o $output -s $shift -v 0 -f BED -x -w $output.files_path + genetrack_indexer.py -i $input -o $output -s $shift -v 0 -f BED -x </command> <inputs> diff -r ab1c33257cb3 -r 566d4061cb19 tools/visualization/genetrack_peak_prediction.xml --- a/tools/visualization/genetrack_peak_prediction.xml Wed Feb 03 13:53:16 2010 -0500 +++ b/tools/visualization/genetrack_peak_prediction.xml Wed Feb 03 16:33:25 2010 -0500 @@ -3,7 +3,7 @@ <description> - generates peak predictions from an index file</description> <command interpreter="python"> - genetrack_peak_prediction.py -i $input -o $output --level=$level --sigma=$sigma --mode=$mode --exclusion=$exclusion --strand=$strand -v 0 -w $input.extra_files_path + genetrack_peak_prediction.py -i $input -o $output --level=$level --sigma=$sigma --mode=$mode --exclusion=$exclusion --strand=$strand -v 0 -x </command> <inputs>