On Tue, Aug 12, 2014 at 5:31 PM, John Chilton <jmchil...@gmail.com> wrote:
> Fun question! I have opened a pull request with my answer -
> https://bitbucket.org/galaxy/galaxy-central/pull-request/457/allow-cheetah-tool-templates-to-reason/diff.
>
> There are three different hacks you can use right now... here is a
> diff against tools/filters/catWrapper.xml I was using the to test them
> - all of them require more about the internals of Galaxy then I really
> think should be exposed to the tool (or tool author).
>
> diff --git a/tools/filters/catWrapper.xml b/tools/filters/catWrapper.xml
> index ec52ba8..060362b 100644
> --- a/tools/filters/catWrapper.xml
> +++ b/tools/filters/catWrapper.xml
> @@ -7,6 +7,11 @@
>          #for $q in $queries
>              ${q.input2}
>          #end for
> +        #import galaxy.datatypes.sequence
> +        ; echo "${isinstance($input1.datatype,
> galaxy.datatypes.sequence.Fastq )}"
> +        ; echo
> "$input1.datatype.matches_any([galaxy.datatypes.sequence.Fastq])"
> +        ; echo "$input1.datatype.matches_any([
> $__app__.datatypes_registry.get_datatype_by_extension( 'fastq' )])"
> +        ; echo "$input1.is_of_type( 'fastq' )" <!-- Doesn't work yet -->
>      </command>
>      <inputs>
>          <param name="input1" type="data" label="Concatenate Dataset"/>
>
> I think the last variant of this is what you want though
> $input.is_of_type( ext ). You don't need to know the full module path
> to the parent type - you are referring to it using the same extension
> the rest of the tool uses and it doesn't require the use of $__app__
> which... well we shouldn't be exposing to tools - it is not safe and
> is a hindrance to ensuring backward compatibility.
>
> Hope this helps.

That looks good John :)

I had considered something like your first hack using isinstance,
but much prefer your proposed $input.is_of_type(ext) solution :)

Peter
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Reply via email to