Yes! The dynamic_options parameter looks to be just the thing I was looking 
for!  Many thanks for pointing it out as it is missing from the wiki.

-AR


-----Original Message-----
From: Hans-Rudolf Hotz [mailto:h...@fmi.ch] 
Sent: Tuesday, March 08, 2011 3:56 AM
To: Rodriguez, Aaron (NIH/NCI) [C]
Cc: galaxy-dev@lists.bx.psu.edu
Subject: Re: [galaxy-dev] Referencing data library directly from tool's input 
parameter dropdown.



On 03/07/2011 10:58 PM, Rodriguez, Aaron (NIH/NCI) [C] wrote:
> Hello all.  First of all thanks to Galaxy developers and supporters for this 
> great tool  -- I'm experimenting with adding my custom tools to galaxy and 
> I'm very impressed with how simple galaxy makes this process.
>
> Some of the tools that I'm adding to my local instance take reference files 
> as a parameter.  These files are often large and fairly static.   I 
> understand that I can create a data library where users can select the 
> reference file needed and import into "history" for analysis.  However,  I 
> would like to know if it's possible for a tool's input parameter (dropdown) 
> to enumerate these files from a public data-library (to avoid the steps 
> needed to import from library into history) and have that file pathname 
> become the value for my parameter?
>
> As an alternative, would it be possible to load such a drop down from files 
> (of a certain type) existing at some predefined system path?
>

Hi Aaron

Our old trick with the "dynamic_options" attribute will probably work 
for you as well (see also my reply to "Populating tool select menu with 
database data?" I sent on February 8th to this list)

you can do something like:

  <inputs>
     <param name="foo" type="select" label="what"
        help="Use tickboxes to select "
        display="radio"
        dynamic_options="ds_fileOptions()"/>
   </inputs>
   <outputs>


   </outputs>
   <code file="extra_code_for_file_list.py" />
    <help>
    </help>

  </tool>


and then we have a little python script ("extra_code_for_file_list.py") 
with the "ds_fileOptions" function (I am not a python programmer, but I 
managed to get it to work....), which lists files ending with the 
extension ".ref"


import os
import re

import operator

rDir = "/path/to/my/referencefiles/"

def ds_fileOptions():
     l = os.listdir(rDir)
     l.sort()
     p = re.compile('[a-z]+\.ref$')
     diroptions = [(s) for s in l if os.path.exists(rDir + s)]
     dirs = [(s,s,False) for s in diroptions if p.match(s)]
     return dirs





I hope this helps, Hans



> Thanks in advance,
>
> -AR
>
>
>
>
>
>
>
> ___________________________________________________________
> 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/

___________________________________________________________
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/

Reply via email to