On Thu, Nov 7, 2013 at 3:18 PM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
On Thu, Nov 7, 2013 at 12:21 PM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
Related to this, would people prefer if the $on_string in the case of a single input file was the input file's name (e.g. "My Genes") rather than "data 1"? (When there are multiple input files, $on_string needs to be kept short).
That turned out to be quite an easy change (patch below), and personally I think this makes the $on_string much nicer.
Peter
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)". Also, here's an outline patch to explicitly produce my preferred label of "My Genes (as tabular)" etc. (Bjoern is right though - a more long term solution is needed to better address naming, like the tag idea on Trello.) Peter ------------------------------------------------------------------------------------------ $ 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: ------------------------------------------------------------------------------------------ $ hg diff tools diff -r 77d58fdd1c2e tools/fasta_tools/fasta_to_tabular.xml --- a/tools/fasta_tools/fasta_to_tabular.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/fasta_tools/fasta_to_tabular.xml Thu Nov 07 15:42:13 2013 +0000 @@ -11,7 +11,7 @@ </param> </inputs> <outputs> - <data name="output" format="tabular"/> + <data name="output" format="tabular" label="$input.display_name (as tabular)"/> </outputs> <tests> <test> diff -r 77d58fdd1c2e tools/fasta_tools/tabular_to_fasta.xml --- a/tools/fasta_tools/tabular_to_fasta.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/fasta_tools/tabular_to_fasta.xml Thu Nov 07 15:42:13 2013 +0000 @@ -7,7 +7,7 @@ <param name="seq_col" type="data_column" data_ref="input" numerical="False" label="Sequence column" /> </inputs> <outputs> - <data name="output" format="fasta"/> + <data name="output" format="fasta" label="$input.display_name (as FASTA)" /> </outputs> <tests> <test> @@ -40,4 +40,4 @@ GTGATATGTATGTTGACGGCCATAAGGCTGCTTCTT </help> -</tool> \ No newline at end of file +</tool> diff -r 77d58fdd1c2e tools/fastq/fastq_to_fasta.xml --- a/tools/fastq/fastq_to_fasta.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/fastq/fastq_to_fasta.xml Thu Nov 07 15:42:13 2013 +0000 @@ -5,7 +5,7 @@ <param name="input_file" type="data" format="fastq" label="FASTQ file to convert" /> </inputs> <outputs> - <data name="output_file" format="fasta" /> + <data name="output_file" format="fasta" label="$input_file.name (as FASTA)" /> </outputs> <tests> <!-- basic test --> diff -r 77d58fdd1c2e tools/fastq/fastq_to_tabular.xml --- a/tools/fastq/fastq_to_tabular.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/fastq/fastq_to_tabular.xml Thu Nov 07 15:42:13 2013 +0000 @@ -8,7 +8,7 @@ </param> </inputs> <outputs> - <data name="output_file" format="tabular" /> + <data name="output_file" format="tabular" label="$input_file.name (as tabular)" /> </outputs> <tests> <!-- basic test --> diff -r 77d58fdd1c2e tools/fastq/tabular_to_fastq.xml --- a/tools/fastq/tabular_to_fastq.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/fastq/tabular_to_fastq.xml Thu Nov 07 15:42:13 2013 +0000 @@ -8,7 +8,7 @@ <param name="quality" label="Quality column" type="data_column" data_ref="input_file" /> </inputs> <outputs> - <data name="output_file" format="fastq" /> + <data name="output_file" format="fastq" label="$input_file.name (as FASTQ)" /> </outputs> <tests> <!-- basic test --> diff -r 77d58fdd1c2e tools/filters/axt_to_concat_fasta.xml --- a/tools/filters/axt_to_concat_fasta.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/filters/axt_to_concat_fasta.xml Thu Nov 07 15:42:13 2013 +0000 @@ -14,7 +14,7 @@ <param name="axt_input" value="1.axt" ftype="axt" /> <param name="dbkey_1" value='hg17' /> <param name="dbkey_2" value="panTro1" /> - <output name="out_file1" file="axt_to_concat_fasta.dat" /> + <output name="out_file1" file="axt_to_concat_fasta.dat" label="$axt_input.name (as FASTA)"/> </test> </tests> <help> diff -r 77d58fdd1c2e tools/filters/wig_to_bigwig.xml --- a/tools/filters/wig_to_bigwig.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/filters/wig_to_bigwig.xml Thu Nov 07 15:42:13 2013 +0000 @@ -29,7 +29,7 @@ </conditional> </inputs> <outputs> - <data format="bigwig" name="out_file1" /> + <data format="bigwig" name="out_file1" label="$input1.name (as bigwig)" /> </outputs> <tests> <test> diff -r 77d58fdd1c2e tools/filters/wiggle_to_simple.xml --- a/tools/filters/wiggle_to_simple.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/filters/wiggle_to_simple.xml Thu Nov 07 15:42:13 2013 +0000 @@ -5,7 +5,7 @@ <param format="wig" name="input" type="data" label="Convert"/> </inputs> <outputs> - <data format="interval" name="out_file1" /> + <data format="interval" name="out_file1" label="$input.name (as interval)" /> </outputs> <tests> <test> diff -r 77d58fdd1c2e tools/stats/wiggle_to_simple.xml --- a/tools/stats/wiggle_to_simple.xml Tue Oct 29 14:21:48 2013 -0400 +++ b/tools/stats/wiggle_to_simple.xml Thu Nov 07 15:42:13 2013 +0000 @@ -5,7 +5,7 @@ <param format="wig" name="input" type="data" label="Convert"/> </inputs> <outputs> - <data format="interval" name="out_file1" /> + <data format="interval" name="out_file1" label="$input.name (as interval)" /> </outputs> <tests> <test>