Question: Dynamic Options Not Filling In
gravatar for marcoalbuquerque.sfu
2.3 years ago by
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">
  <command detect_errors="aggressive">echo $option</command>
    <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 )" />
  <code file=""/>

Then I have the here:

import csv

def fetch_patient_covariates( covariate_file ):
    covariate_fh = open(covariate_file,'rb')
    covariates = csv.reader(covariate_fh, delimiter='\t')
    header =
    options = []
    for item in header:
        if item.endswith("_col"):
        if item == "patient":
    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
gravatar for Hotz, Hans-Rudolf
2.3 years ago by
Hotz, Hans-Rudolf1.8k wrote:


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

Instead, I recommend using the "options" tag set (see: ), 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.


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