Question: <filter> Tags not working for nested conditionals.
0
gravatar for KeyGene
4.1 years ago by
KeyGene10
Netherlands
KeyGene10 wrote:

Hi! I have written a tool that lets the user deside what to do, and depending on those decisions output is generated. If a user chooses to analyse a single fastq file, output is written in "output.fastq". If the use decides to analyse paired-end fastq files, output is written in "output.1.fastq" and "output.2.fastq". However I cannot seperate those output files per analysis. So currently the tool produces those 3 output files, and it depends per analysis in which there is data written. 

I have tried to fix this small issue with <filter> tags however I cannot get it working. 

A part of my conditional;

    <conditional name="selectSet">
      <param name="selectType" type="select" size="100" label="Would you rather use data paths, or upload your files?">
        <option value="" size="100" selected="True"></option>
        <option value="paths" size="100">I want to use paths for my file(s)</option>
        <option value="browse" size="100">I want to browse for my file(s)</option>
      </param>
      <when value="paths">
        <conditional name="pathPaired">
          <param name="selectPairedPath" type="select" size="100" label="Would you rather use a paired-end dataset, or a single dataset?">
            <option value="" size="100" selected="True"></option>
            <option value="notPairedPath" size="100">I want to select a single dataset</option>
            <option value="doPairedPath" size="100">I want to select a paired-end dataset</option>
          </param>
          <when value="doPairedPath">
            <param name="readfile" type="text" size="100" label="Would you please give the data path of your #1 fastq file?"/>
            <param name="readfile2" type="text" size="100" label="Would you please give the data path of your #2 fastq file?"/>
          </when>
          <when value="notPairedPath">
            <param name="readfile" type="text" size="100" label="Would you please give the data path of your #1 fastq file?"/>
          </when>
        </conditional>
      </when>
      <when value="browse">
        <conditional name="browsePaired">
          <param name="selectPairedBrowse" type="select" size="100" label="Would you rather use a paired-end dataset, or a single dataset?">
            <option value="" size="100" selected="True"></option>
            <option value="notPairedBrowse" size="100">I want to select a single dataset</option>
            <option value="doPairedBrowse" size="100">I want to select a paired-end dataset</option>
          </param>
          <when value="doPairedBrowse">
            <param name="readfile" type="data" size="100" label="Would you please select your #1 fastq file?"/>
            <param name="readfile2" type="data" size="100" label="Would you please select your #2 fastq file?"/>
          </when>
          <when value="notPairedBrowse">
            <param name="readfile" type="data" size="100" label="Would you please select your #1 fastq file?"/>
          </when>
        </conditional>
      </when>
    </conditional>

And the output tags:

   <outputs>
    <data format="fastq" name="output.fastq" label="output.fastq" from_work_dir="output.fastq">
    </data>
    <data format="fastq" name="output.1.fastq" label="output.1.fastq" from_work_dir="output.1.fastq">
    </data>
    <data format="fastq" name="output.2.fastq" label="output.2.fastq" from_work_dir="output.2.fastq">
    </data>
  </outputs> 

Which filter commands should I use to determine whether the user has selected 'doPairedPath' or 'doPairedBrowse' for example?

output condition galaxy filter • 1.6k views
ADD COMMENTlink modified 4.1 years ago by Bjoern Gruening5.1k • written 4.1 years ago by KeyGene10
3
gravatar for Wolfgang Maier
4.1 years ago by
Germany
Wolfgang Maier600 wrote:

the <filter> tag is the right thing to look at, but I would only investigate it after cleaning up the inputs section of your xml, which to me looks too deeply nested.

Specifically, why do you have to have the Path/Browse and the Single/Paired Decisions nested ?

You could probably simplify everything greatly by treating the two separately: get rid of all the conditionals and just have to drop-down selections for the two decisions.

Then your filter in outputs could (I think) look something like:

<filter>(paired=="doPaired"</filter>

 

Best,

Wolfgang

ADD COMMENTlink written 4.1 years ago by Wolfgang Maier600

sorry for the typo, should read:

<filter>paired=="doPaired"</filter>

ADD REPLYlink written 4.1 years ago by Wolfgang Maier600

Thanks for your input! I've simplified it indeed, and it works now. 

ADD REPLYlink written 4.1 years ago by KeyGene10
3
gravatar for Bjoern Gruening
4.1 years ago by
Bjoern Gruening5.1k
Germany
Bjoern Gruening5.1k wrote:

Hi KeyGene,

nested filtering is also possible. Have a look at the bismark wrappers as example:

https://github.com/bgruening/galaxytools/blob/master/bismark_wrapper/bismark_bowtie2_wrapper.xml

      <filter>
        ((
            singlePaired['sPaired'] == "paired" and
          params['settingsType'] == "custom" and
          params['unmapped_read_file'] is True
        ))
      </filter>

But simplifying wrappers, as Wolfgang mentioned, is always good!

Cheers,

Bjoern

 

 

ADD COMMENTlink written 4.1 years ago by Bjoern Gruening5.1k

Thanks for the input! I just changed the xml file as Wolfgang suggested, and that works ;)

ADD REPLYlink written 4.1 years ago by KeyGene10
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: 171 users visited in the last hour