Re: [galaxy-dev] galaxy-dev] format="input"
I added an attribute "format_source" (analogous to metadata_source) to the <data> tag to deal with that kind of issue: see: https://bitbucket.org/galaxy/galaxy-central/wiki/ToolConfigSyntax <inputs> <param name="input" type="data" format="sff,fasta,fastq" label="454 reads" /> <param name="qual_file" type="data" format="qual" optional="true" label="Quality reads file (if input is a fasta)" /> </inputs> <outputs> <data name="output" format_source="input" label="${tool.name} on ${on_string}: cleaned reads"/> <data name="out_qual" format_source="qual_file" label="${tool.name} on ${on_string}: cleaned reads"> <filter>qual_file != None</filter> </data> </outputs> JJ
Hi everyone,
I'm facing a little problem ...
I have the following input : <param name="input" type="data" format="sff,fasta,fastq" label="454 reads" /> <param name="qual_file" type="data" format="qual" optional="true" label="Quality reads file (if input is a fasta)" />
and the following output: <data name="output" format="input" label="${tool.name} on ${on_string}: cleaned reads"/> <data name="out_qual" format="qual" label="${tool.name} on ${on_string}: cleaned reads"> <filter>qual_file != None</filter> </data>
If I provide the tool a sff file, the output is sff, if I only provide a fasta file and no qual file the output will be a fasta. However if I provide a fasta+qual the output will be considered as qual file even if it's a fasta file.
I don't get how it can mark my output file as a qual file knowing it's not a valid input file format.
Any ideas ? thx,
Jerome
On Wed, Jun 8, 2011 at 9:26 PM, Jim Johnson <johns198@umn.edu> wrote:
I added an attribute "format_source" (analogous to metadata_source) to the <data> tag to deal with that kind of issue: see: https://bitbucket.org/galaxy/galaxy-central/wiki/ToolConfigSyntax
Where is the code to handle this? Maybe I missed the commit with all the recent activity. What happens if both format and format_source are given? I would hope an error - which means the wiki is misleading in that format is listed as required. Peter
It went into galaxy-central: $ hg log -pr 5082 changeset: 5082:a86e1fa82a89 user: Kanwei Li <kanwei@gmail.com> date: Thu Feb 17 15:35:07 2011 -0500 summary: Add a "format_source" attribute to the ToolConfig output data element [JJ Johnson]. Closes #470 diff -r 885f04ae671e -r a86e1fa82a89 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py Thu Feb 17 14:48:53 2011 -0500 +++ b/lib/galaxy/tools/__init__.py Thu Feb 17 15:35:07 2011 -0500 @@ -249,10 +249,11 @@ (format, metadata_source, parent) """ - def __init__( self, name, format=None, metadata_source=None, + def __init__( self, name, format=None, format_source=None, metadata_source=None, parent=None, label=None, filters = None, actions = None ): self.name = name self.format = format + self.format_source = format_source self.metadata_source = metadata_source self.parent = parent self.label = label @@ -559,6 +560,7 @@ output = ToolOutput( data_elem.get("name") ) output.format = data_elem.get("format", "data") output.change_format = data_elem.findall("change_format") + output.format_source = data_elem.get("format_source", None) output.metadata_source = data_elem.get("metadata_source", "") output.parent = data_elem.get("parent", None) output.label = util.xml_text( data_elem, "label" ) diff -r 885f04ae671e -r a86e1fa82a89 lib/galaxy/tools/actions/__init__.py --- a/lib/galaxy/tools/actions/__init__.py Thu Feb 17 14:48:53 2011 -0500 +++ b/lib/galaxy/tools/actions/__init__.py Thu Feb 17 15:35:07 2011 -0500 @@ -244,6 +244,12 @@ ext = output.format if ext == "input": ext = input_ext + if output.format_source is not None and output.format_source in inp_data: + try: + ext = inp_data[output.format_source].ext + except Exception, e: + pass + #process change_format tags if output.change_format: if params is None: And I should have put an example in: https://bitbucket.org/galaxy/galaxy-central/wiki/ToolConfigSyntax On 6/8/11 3:32 PM, Peter Cock wrote:
On Wed, Jun 8, 2011 at 9:26 PM, Jim Johnson<johns198@umn.edu> wrote:
I added an attribute "format_source" (analogous to metadata_source) to the<data> tag to deal with that kind of issue: see: https://bitbucket.org/galaxy/galaxy-central/wiki/ToolConfigSyntax
Where is the code to handle this? Maybe I missed the commit with all the recent activity.
What happens if both format and format_source are given? I would hope an error - which means the wiki is misleading in that format is listed as required.
Peter
On Wed, Jun 8, 2011 at 9:59 PM, Jim Johnson <johns198@umn.edu> wrote:
It went into galaxy-central:
$ hg log -pr 5082 changeset: 5082:a86e1fa82a89 user: Kanwei Li <kanwei@gmail.com> date: Thu Feb 17 15:35:07 2011 -0500 summary: Add a "format_source" attribute to the ToolConfig output data element [JJ Johnson]. Closes #470
...
And I should have put an example in: https://bitbucket.org/galaxy/galaxy-central/wiki/ToolConfigSyntax
Oh right - better late than never ;) On the bright side because this commit was a while ago, it has already been included in the stable Galaxy releases. Thanks for this, I can think of several of my own tools where this will work much more cleanly than the current solution using <change_format> and <when>. Regards, Peter
I added an example taken from trim.seqs.xml in the Mothur metagenomics tool_suite to: https://bitbucket.org/galaxy/galaxy-central/wiki/ToolConfigSyntax The following will create datasets in the history panel, setting the output data type to be the same as that of an input dataset named by the "format_source" attribute. Note that a conditional name is not included, so 2 separate conditional blocks should not contain parameters with the same name. <inputs> <!-- fasta may be an aligned fasta that subclasses Fasta --> <param name="fasta" type="data" format="fasta" label="fasta - Sequences"/> <conditional name="qual"> <param name="add" type="select" label="Trim based on a quality file?" help=""> <option value="no">no</option> <option value="yes">yes</option> </param> <when value="no"/> <when value="yes"> <!-- qual454, qualsolid, qualillumina --> <param name="qfile" type="data" format="qual" label="qfile - a quality file"/> </when> </conditional> </inputs> <outputs> <data format_source="fasta" name="trim_fasta" label="${tool.name} on ${on_string}: trim.fasta"/> <data format_source="qfile" name="trim_qual" label="${tool.name} on ${on_string}: trim.qual"> <filter>(qual['add'] == 'yes')</filter> </data> </outputs> On 6/9/11 2:39 AM, Peter Cock wrote:
On Wed, Jun 8, 2011 at 9:59 PM, Jim Johnson<johns198@umn.edu> wrote:
It went into galaxy-central:
$ hg log -pr 5082 changeset: 5082:a86e1fa82a89 user: Kanwei Li<kanwei@gmail.com> date: Thu Feb 17 15:35:07 2011 -0500 summary: Add a "format_source" attribute to the ToolConfig output data element [JJ Johnson]. Closes #470
...
And I should have put an example in: https://bitbucket.org/galaxy/galaxy-central/wiki/ToolConfigSyntax Oh right - better late than never ;)
On the bright side because this commit was a while ago, it has already been included in the stable Galaxy releases.
Thanks for this, I can think of several of my own tools where this will work much more cleanly than the current solution using <change_format> and<when>.
Regards,
Peter
On Thu, Jun 9, 2011 at 8:39 AM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
Thanks for this, I can think of several of my own tools where this will work much more cleanly than the current solution using <change_format> and <when>.
There is still a bit of work needed: https://bitbucket.org/galaxy/galaxy-central/issue/582 #582 output format_source not supported in workflow editor Peter P.S. I found your original email on this approach, http://lists.bx.psu.edu/pipermail/galaxy-dev/2011-February/004334.html
I put a patch for lib/galaxy/workflow/modules.py in: https://bitbucket.org/galaxy/galaxy-central/issue/582/output-format_source-n... On Thu, Jun 9, 2011 at 11:24 AM, Peter Cock <p.j.a.cock@googlemail.com>wrote:
On Thu, Jun 9, 2011 at 8:39 AM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
Thanks for this, I can think of several of my own tools where this will work much more cleanly than the current solution using <change_format> and <when>.
There is still a bit of work needed: https://bitbucket.org/galaxy/galaxy-central/issue/582 #582 output format_source not supported in workflow editor
Peter
P.S. I found your original email on this approach, http://lists.bx.psu.edu/pipermail/galaxy-dev/2011-February/004334.html
participants (3)
-
James Johnson
-
Jim Johnson
-
Peter Cock