Hi Guys,

I'm doing a very simple test about deseq2...there is a weird situation always happening:

It looks like the deseq2 tool executed just fine, without any error, and the result files were created, but after the set_metadata, galaxy always 'set dataset state to ERROR'. 

The xml file for this test is:

<tool id="deseq2 test" name="DESeq2" version="2">
  <description>Determines differentially expressed transcripts from read alignments</description>
  <command>
       t.sh $input1 $test $out $log
    </command>
  <inputs>
    <param format="txt" name="input1" type="data" label="Quant"/>
    <param format="txt" name="input2" type="data" label="Conditions"/>
    <param name="test" type="select" label="please choose control condition">
            <options from_dataset="input2">
              <column name="value" index="0"/>
            </options>
   </param>
  </inputs>

  <outputs>
    <data format="txt" name="out" label="DESeq result"/>
    <data format="txt" name="log" label="DESeq log file"/>
  </outputs>
</tool>

Basically, we have an input file from Partek flow(input1), input2 is one column
from input1, which has all the conditions, in our test, it has 3 conditions, CTC, LM, PT.

input name "test" is the dropdown list that contain all 3 conditions, and we choose
one as control condition, in our case it is CTC.

t.sh is very simple, it basically calls R script:

Rscript /home/bioinfo/app/galaxy-dist/tools/Deseq/workflow.R $1 $2 $3 $4

now, in the workflow.R, the related output part is:

for (i in 2:3) {
  res <- results(dds, contrasts[i])

  ## sort the result table by FDR
  res <- res[order(res$padj),]

  ## Output the results
 write.table(as.data.frame(res), file=paste0(args[i+1]), sep = "\t")
}

So, it looks like the result files were generated as expected, with the correct information.
However, it always was set to state ERROR. Am I missing something? Or did anyone see this before? 

Any inputs will be greatly appreciated!

Thanks,
Rui