On Thu, Nov 7, 2013 at 3:50 PM, Peter Cock wrote:
Getting back to my motivating example, since fasta_to_tabular.xml does not give the output a label and depends on the default, the small change to $on_string should result in the conversion of a file named "My Genes" as "FASTA-to-Tabular on My Genes", rather than "FASTA-to-Tabular on data 1" as now.
Here's another variant to keep the "data 1" text in $on_string, if people are attached to this functionality. That would result in "FASTA-to-Tabular on data 1 (My Genes)".
...
------------------------------------------------------------------------------------------
$ hg diff lib/galaxy/tools/actions/__init__.py diff -r 77d58fdd1c2e lib/galaxy/tools/actions/__init__.py --- a/lib/galaxy/tools/actions/__init__.py Tue Oct 29 14:21:48 2013 -0400 +++ b/lib/galaxy/tools/actions/__init__.py Thu Nov 07 15:49:15 2013 +0000 @@ -181,6 +181,7 @@ input_names = [] input_ext = 'data' input_dbkey = incoming.get( "dbkey", "?" ) + on_text = '' for name, data in inp_data.items(): if not data: data = NoneDataset( datatypes_registry = trans.app.datatypes_registry ) @@ -194,6 +195,8 @@ else: # HDA if data.hid: input_names.append( 'data %s' % data.hid ) + #Will use this on_text if only one input dataset: + on_text = "data %s (%s)" % (data.id, data.name) input_ext = data.ext
if data.dbkey not in [None, '?']: @@ -230,7 +233,10 @@ output_permissions = trans.app.security_agent.history_get_default_permissions( history ) # Build name for output datasets based on tool name and input names if len( input_names ) == 1: - on_text = input_names[0] + #We recorded the dataset name as on_text earlier... + if not on_text: + #Fall back on the shorter 'data %i' style: + on_text = input_names[0] elif len( input_names ) == 2: on_text = '%s and %s' % tuple(input_names[0:2]) elif len( input_names ) == 3:
Would this patch be welcomed as a pull request? (Expanding $on_string to include the name as well as dataset number when there is only one input dataset) How about renaming the outputs of the conversion tools? Peter