Question: Filter options from history dataset in tool xml file
1
gravatar for jeroen.galle
22 months ago by
jeroen.galle30
Belgium
jeroen.galle30 wrote:

Hi

I am currently migrating a tool that worked fine in galaxy 15.05 but has some problems in 16.07.

In this tool we want offer parameter options based on the content of a dataset which has a custom datatype.

The xml file looks like this, the problem is situated inside the "when" tag.

<inputs>

    <param name="sqlite_db" type="data" format="sqlite" size="30" label="Sqlite DB with information of steps 1-2-3, optionally 5" help="The sqlite results database should contain output from the mapping (step 1), the transcript calling (step 2), TIS calling (step 3) and optionally SNP calling (step 5)."/>
    <param name="snp" type="select" size="15" multiple="false">
        <option value="NO" selected="true">NO</option>
        <option value="samtools">samtools</option>
    </param>

    <conditional name="tisids">
        <param name="assembl" type="select" label="Select options for assembly based on TIS calling analysis">
            <option value="all">Perform assembly for all TIS-analysis ids</option>
            <option value="specific">Perform assembly for specific TIS-analysis ids</option>
        </param>
        <when value="specific">
            <param name="overview_in" type="data" size="30" format="tis" label="TIS overview file (Sqlite DB specific, see data number)" help="if your history does not contain the correct TIS overview file, first run the TIS overview tool selected Sqlite DB, see above."/>
            <param name="specific" type="select" display="checkboxes" label="TIS ids - Pick IDs for assembly" multiple="true">
                <options>
                    <filter type="data_meta" ref="overview_in" key="args" />
                </options>
            </param>
        </when>
        <when value="all">
            <param name="all" type="hidden" value ="all" />
        </when>

    </conditional>
</inputs>

Our datatype looks like this:

from galaxy import eggs

import pkg_resources
pkg_resources.require( "bx-python" )

import logging, os, sys, time, sets, tempfile, shutil
import data
from galaxy import util
from galaxy.datatypes import metadata
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.tabular import Tabular
from galaxy.datatypes.binary import Binary

log = logging.getLogger(__name__)

## PROTEOFORMER pipeline Classes

class TisOverview(Tabular):
    file_ext = 'tis'
    MetadataElement( name="args", default=[], desc="Tis Args", readonly=True, visible=True, no_value=[] )
    def __init__(self, **kwd):
        Tabular.__init__( self, **kwd )
        self.column_names = ['ID','local_max','min_count_aTIS','R_aTis','min_count_5UTR','R_5UTR','min_count_CDS','R_CDS','min_count_3UTR','R_3UTR','min_count_no_trans','R_no_trans','SNP','filter']
        self.columns = 14

    def set_meta( self, dataset, overwrite = True, skip = None, max_data_lines = None, **kwd ):
        Tabular.set_meta(self, dataset, overwrite, skip, max_data_lines)
        tis_args = set()
        try:
            fh = open( dataset.file_name )

            for line in fh:
                fields = line.strip().split('\t')
                try:
                    tis_args.add(fields[0])
                except IndexError:
                    pass
            dataset.metadata.args = []
            dataset.metadata.args += tis_args


        finally:
            fh.close()

I hope anyone can help.

Thanks in advance!

Jeroen

What it is What it should be

toolconfig xml datatypes • 566 views
ADD COMMENTlink modified 22 months ago • written 22 months ago by jeroen.galle30
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: 166 users visited in the last hour