1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/dd777fbcc5fa/ changeset: dd777fbcc5fa user: dan date: 2012-05-04 20:31:22 summary: Update GenomeSpace exporter tool to use the newly introduced /personaldirectory as the root for auto-generated export paths. affected #: 2 files diff -r 1eb32dbab2c1a0bc308eb4d3a069fa55ff6ecb83 -r dd777fbcc5fa1fee5939db5d914611b8b466eed6 tools/genomespace/genomespace_exporter.py --- a/tools/genomespace/genomespace_exporter.py +++ b/tools/genomespace/genomespace_exporter.py @@ -50,6 +50,7 @@ def get_directory( url_opener, dm_url, path ): url = dm_url i = None + dir_dict = {} for i, sub_path in enumerate( path ): url = "%s/%s" % ( url, sub_path ) dir_request = urllib2.Request( url, headers = { 'Content-Type': 'application/json', 'Accept': 'application/json' } ) @@ -57,7 +58,7 @@ try: dir_dict = simplejson.loads( url_opener.open( dir_request ).read() ) except urllib2.HTTPError, e: - #print "e", e, url #punting, assuming lack of permisions at this low of a level... + #print "e", e, url #punting, assuming lack of permissions at this low of a level... continue break if i is not None: @@ -69,6 +70,9 @@ def get_default_directory( url_opener, dm_url ): return get_directory( url_opener, dm_url, ["defaultdirectory"] )[0] +def get_personal_directory( url_opener, dm_url ): + return get_directory( url_opener, dm_url, [ "%s/personaldirectory" % ( GENOMESPACE_API_VERSION_STRING ) ] )[0] + def create_directory( url_opener, directory_dict, new_dir, dm_url ): payload = { "isDirectory": True } for dir_slice in new_dir: @@ -134,7 +138,9 @@ genomespace_site_dict = get_genomespace_site_urls()[ genomespace_site ] dm_url = genomespace_site_dict['dmServer'] #get default directory - directory_dict = get_default_directory( url_opener, dm_url )['directory'] + directory_dict = get_default_directory( url_opener, dm_url ).get( 'directory', None ) + if directory_dict is None: + return [] #what directory to stuff this in recurse_directory_dict( url_opener, rval, directory_dict.get( 'url' ) ) @@ -150,7 +156,7 @@ directory_dict, target_directory = get_directory( url_opener, dm_url, [ "%s/%s/%s" % ( GENOMESPACE_API_VERSION_STRING, 'file', target_directory[1] ) ] + target_directory[2:] ) directory_dict = directory_dict['directory'] else: - directory_dict = get_default_directory( url_opener, dm_url )['directory'] + directory_dict = get_personal_directory( url_opener, dm_url )['directory'] #this is the base for the auto-generated galaxy export directories #what directory to stuff this in target_directory_dict = create_directory( url_opener, directory_dict, target_directory, dm_url ) #get upload url @@ -208,6 +214,6 @@ (options, args) = parser.parse_args() - send_file_to_genomespace( options.genomespace_site, options.username, options.token, options.dataset, map( binascii.unhexlify, options.subdirectory ), options.filename, options.file_type, options.content_type, options.log ) + send_file_to_genomespace( options.genomespace_site, options.username, options.token, options.dataset, map( binascii.unhexlify, options.subdirectory ), binascii.unhexlify( options.filename ), options.file_type, options.content_type, options.log ) diff -r 1eb32dbab2c1a0bc308eb4d3a069fa55ff6ecb83 -r dd777fbcc5fa1fee5939db5d914611b8b466eed6 tools/genomespace/genomespace_exporter.xml --- a/tools/genomespace/genomespace_exporter.xml +++ b/tools/genomespace/genomespace_exporter.xml @@ -25,9 +25,9 @@ --subdirectory "${ binascii.hexlify( str( $base_url ).split( '://', 1 )[-1] ) }" ##Protocol removed by request #end if #if $filename: - --filename "${filename}" + --filename "${ binascii.hexlify( str( $filename ) ) }" #else: - --filename "Galaxy History Item ${__app__.security.encode_id( $input1.id )} (${__app__.security.encode_id( $output_log.id )}) - ${input1.hid}: ${input1.name}.${input1.ext}" + --filename "${ binascii.hexlify( "Galaxy History Item %s (%s) - %s: %s.%s" % ( $__app__.security.encode_id( $input1.id ), $__app__.security.encode_id( $output_log.id ), $input1.hid, $input1.name, $input1.ext ) ) }" #end if --file_type "${input1.ext}" --content_type "${input1.get_mime()}" @@ -36,7 +36,6 @@ <inputs><param format="data" name="input1" type="data" label="Send this dataset to GenomeSpace" /><param name="base_url" type="baseurl" /> - <!-- <param name="subdirectory" type="text" size="80" help="Leave blank to generate automatically" /> --><param name="subdirectory" type="drill_down" display="radio" hierarchy="exact" multiple="False" label="Choose Target Directory" dynamic_options="galaxy_code_get_genomespace_folders( genomespace_site = 'prod', trans=__trans__, value=__value__, input_dataset=input1 )" help="Leave blank to generate automatically"/><param name="filename" type="text" size="80" help="Leave blank to generate automatically" /></inputs> 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.