Question: Dynamic Options Not Filling In
0
gravatar for marcoalbuquerque.sfu
2.3 years ago by
Canada
marcoalbuquerque.sfu50 wrote:

I am trying to use dynamic options in galaxy but it isn't working.

Essentially a user can include a covariate tabular file. In this file there will be columns which could be added to a multi plot figure script we are working on to summarize SNVs across a cohort. Here is an example tool config file I am using:

<tool id="testdynamicoptions" name="TestDynamicOptions" version="1.0.0">
  <description>test</description>
  <command detect_errors="aggressive">echo $option</command>
  <inputs>  
    <param type="data" format="tabular" name="optionfile" label="Test Tabular Data"/>
    <param type="select" name="option" label="Select Option From Tabular Data File" dynamic_options="fetch_patient_covariates( optionfile )" />
  </inputs>
  <code file="test_dynamic_options.py"/>
</tool>

Then I have the test_dynamic_options.py here:

import csv

def fetch_patient_covariates( covariate_file ):
    covariate_fh = open(covariate_file,'rb')
    covariates = csv.reader(covariate_fh, delimiter='\t')
    header = covariates.next()
    options = []
    for item in header:
        if item.endswith("_col"):
            continue
        if item == "patient":
            continue
        options.append((item,item,False))
    return options

If there is anything obvious about this that is wrong, please let me know :)

galaxy dynamic_options • 703 views
ADD COMMENTlink modified 2.3 years ago by Hotz, Hans-Rudolf1.8k • written 2.3 years ago by marcoalbuquerque.sfu50
0
gravatar for Hotz, Hans-Rudolf
2.3 years ago by
Switzerland
Hotz, Hans-Rudolf1.8k wrote:

Hi

I don't think this actually possible using the 'dynamic_options'/'code file' trick.

Instead, I recommend using the "options" tag set (see: https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax#A.3Coptions.3E_tag_set ), in partyicular the "from_dataset" "attribute"

Regards, Hans-Rudolf

ADD COMMENTlink written 2.3 years ago by Hotz, Hans-Rudolf1.8k

This seems inconvenient. So you need to run a tool prior that fetches this data before running the actual tool? Would be nice if it was handled internally. Is there a way to run a pre-command and generate a dataset of options before submitting a tool?

ADD REPLYlink written 2.2 years ago by marcoalbuquerque.sfu50

sorry, I misunderstood your question. I was under the impression, you have already a data set containing the options in your history (since you used the 'param type': "data" in your example)

ADD REPLYlink written 2.2 years ago by Hotz, Hans-Rudolf1.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 169 users visited in the last hour