Hi Jeremy,

I understood the <filter> tags help if you want to filter input data
based on options in a .loc file, right?
My aim is to extract the column names of an input dataset, present them
in a selection box or dropdown list, let the user choose one, and
process the input set (with two inputs, the input set itself and the
selection made based on the input set).

Do you think that something like this is possible at all?

I attach the source of my dummy module and the python library which I
use via <code file="...">. The Syntax error I get is
SyntaxError: invalid syntax (<string>, line 1)
The complete traceback is below.

The thread I was referring to in my mail can be found here:
http://www.mail-archive.com/galaxy-dev@lists.bx.psu.edu/msg03666.html
(Dec 12, 2011; Dynamic Tool Parameter Lists).

Cheers,
Holger




Module weberror.evalexception.middleware:364 in respond         view
>>  app_iter = self.application(environ, detect_start_response)
Module paste.debug.prints:98 in __call__         view
>>  environ, self.app)
Module paste.wsgilib:539 in intercept_output         view
>>  app_iter = application(environ, replacement_start_response)
Module paste.recursive:80 in __call__         view
>>  return self.application(environ, start_response)
Module paste.httpexceptions:632 in __call__         view
>>  return self.application(environ, start_response)
Module galaxy.web.framework.base:160 in __call__         view
>>  body = method( trans, **kwargs )
Module galaxy.web.controllers.tool_runner:68 in index         view
>>  template, vars = tool.handle_input( trans, params.__dict__ )
Module galaxy.tools:1147 in handle_input         view
>>  state = self.new_state( trans )
Module galaxy.tools:1075 in new_state         view
>>  self.fill_in_new_state( trans, inputs, state.inputs )
Module galaxy.tools:1084 in fill_in_new_state         view
>>  state[ input.name ] = input.get_initial_value( trans, context )
Module galaxy.tools.parameters.basic:788 in get_initial_value         view
>>  options = list( self.get_options( trans, context ) )
Module galaxy.tools.parameters.basic:641 in get_options         view
>>  return eval( self.dynamic_options, self.tool.code_namespace,
other_values )
SyntaxError: invalid syntax (<string>, line 1)




On 02/13/2012 03:04 PM, Jeremy Goecks wrote:
> Holger,
> 
> Have you looked at how dynamic options work and whether they would be
> sufficient for your use? See the<filter> tag syntax for details:
> 
> http://wiki.g2.bx.psu.edu/Admin/Tools/Tool%20Config%20Syntax#A.3Cfilter.3E_tag_set
> <http://wiki.g2.bx.psu.edu/Admin/Tools/Tool Config
> Syntax#A.3Cfilter.3E_tag_set>
> 
> To specifically address your problem: can you determine the particular
> place where the syntax error is appearing? And can you provide a link to
> the thread that you're using as a starting point?
> 
> Thanks,
> J.
> 
> 
> On Feb 10, 2012, at 3:43 PM, Holger Klein wrote:
> 
>> Dear all,
>>
>> I'm still stuck with the problem to dynamically generate an option list
>> extracted from a user-selectable input dataset. Does anybody have
>> experience here, or is this not possible at all?
>>
>> Have a nice weekend,
>> Holger
>>
>>
>> On 02/07/2012 09:58 PM, Holger Klein wrote:
>>> Dear all,
>>>
>>> I have a working module which generates wig files for genomic annotation
>>> from a single column of a bigger input data matrix (Input A). In the
>>> current state, the user has to input the column name (Input B) from
>>> which to calculate the values in the wig file.
>>>
>>> Now I'd like to modify the xml in such a way, that depending on the
>>> input dataset (Input A) a dynamic list for Input B is generated.
>>>
>>> I found Hans-Rudolf Hotz' hints from some time ago on this list and
>>> thought that the following would be a good start:
>>>
>>> <param name   = "InputB"
>>>       label  = "InputBName"
>>>       format = "data"
>>>       type   = "select"
>>>       help   = "Use tickboxes to select model"
>>>       display = "radio"
>>>       dynamic_options = "getInputBOptions($InputA)" />
>>>
>>> <code file="getInputBOptionsFromInputA.py">
>>>
>>> getInputBOptionsFromInputA.py contains a single function
>>> def getInputBOptions($InputA):
>>>    ## parse Input A
>>>    ## create list InputBOptions
>>>    return(InputBOptions)
>>>
>>> Using this approach I get an invalid syntax message when trying to even
>>> open the module - in any case I have the feeling that something is still
>>> missing here.
>>> Did anybody solve a similar problem already and could give me a hint on
>>> how to solve that?
>>>
>>> Cheers,
>>> Holger
>>>
>>>
>>>
>>>
>>
>>
>> -- 
>> Dr. Holger Klein
>> Core Facility Bioinformatics
>> Institute of Molecular Biology gGmbH (IMB)
>> http://www.imb-mainz.de/
>> Tel: +49(6131) 39 21511
>> ___________________________________________________________
>> 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/
> 


-- 
Dr. Holger Klein
Core Facility Bioinformatics
Institute of Molecular Biology gGmbH (IMB)
http://www.imb-mainz.de/
Tel: +49(6131) 39 21511
def getDynamicOptions(Outfile):
    MO = open(Outfile, "r")
    header = True
    ModelList = []
    while(1):
        line = MO.readline()
        if not line:
            break
        if line.startswith("#"): continue
        elif header:
            ModelList = str.split(line.strip(), "\t")
            header = False
        else: continue
    MO.close()
    return ModelList
<tool id="mmtw_dummy" name="mmtw_dummy">
  <description>
    Dummy to test dynamic list generation based on input dataset
  </description>
  
  <command interpreter="python">
    echo $MashMatrix $WigFile $ModelName
  </command>
  
  <inputs>
    <param name   = "MashMatrix" 
	   label  = "result matrix"
	   type   = "data"
	   format = "tabular"
	   />
    
    <param name   = "ModelName"
    	   label  = "Name of single model"
    	   format = "data"
    	   type   = "select"
    	   help   = "Use tickboxes to select model"
    	   display = "radio"
    	   dynamic_options = "getDynamicOptions($MashMatrix)" />
  </inputs>
  

  <outputs>
    <data format="wig" name="WigFile" />
  </outputs>
  
  <code file="getDynamicOptions.py"/>
  
  <help>
    Dummy
  </help>
  </tool>

___________________________________________________________
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