I am trying to develop a tool based on R script. The tool should provided several methods for correlation calculation. Then there should be a parameter with options for different methods. I have set the parameter, but “there is no options available” on my local galaxy.
Here is my code:
<param name="method" type="select" label="methods for correlation calculation"/>
<option value="pearson">Pearson </option>
<option value="spearman">Spearman </option>
<option value="kendall">kendall </option>
</param>
In the corresponding R script:
spec_list$expr <- c(‘expr’, ‘f’, ‘1’, ‘character’)
spec_list$method <- c(‘method’, ‘m’, 1, ‘character’)
spec_list$correlationMatrix <- c(‘correlationMatrix’, ‘c’, 1, ‘character’)
spec <- t(as.data.frame(spec_list))
opt <- getopt(spec)
…
if(!is.null(opt$method)){
corMatrix <- cor(expr, method=opt$method)
}
1 Like
marten
June 11, 2019, 3:12pm
2
I am unclear here, does the select element render fine for you in the toolform? (it should)
How do you pass it to the R script? Can you show us the command
from the tool?
1 Like
Hi,
I have copied the R code, I think the problem is in the tool definition xml file.
1 Like
Here are the R code:
spec_list<-list()
spec_list$help <- c(‘help’, ‘h’, ‘0’, ‘logical’)
spec_list$expressionData <- c(‘expressionData’, ‘f’, ‘1’, ‘character’)
spec_list$method <- c(‘method’, ‘m’, 1, ‘character’)
spec_list$correlationMatrix <- c(‘correlationMatrix’, ‘c’, 1, ‘character’)
spec <- t(as.data.frame(spec_list))
opt <- getopt(spec)
expressionData <- read.table(opt$expressionData)
if(!is.null(opt$method)){
corMatrix <- cor(expressionData, method=opt$method)
}
write.table(corMatrix)
1 Like
marten
June 14, 2019, 2:22am
5
Could you please show us your <command>
from the xml tool file?
1 Like
Here are my commands:
<command>
<![CDATA[
Rscript '${__tool_directory__}/correlationMatrix.R'
-f $expressionData
-m $method
-c $correlationMatrix
]]>
</command>
pietro
September 23, 2019, 11:38am
7
<param name="method" type="select" label="methods for correlation calculation"/>
there is a typo "/ "
you close the parameter block before the options
2 Likes