On Thu, May 26, 2011 at 1:22 PM, Kempenaar, M (med) <m.kempen...@med.umcg.nl> wrote: > Hi list, > I've been working on a single Galaxy tool for a while now, and I'm running > into all sorts of difficulties that can probably all be fixed using Cheetah. > However I've been trying several ways of utilizing the (enormous) powers of > Cheetah but so far I'm not successful. I'll try to ask my questions as clear > as possible, please let me know if anything is unclear. > In my tool I use the following input parameter: > ----------------------- > <param name="report_options" type="select" multiple="True" > display="checkboxes"> > <option value="overview">phyla distribution</option> > <option value="phyladend">phyla dendograms</option> > <option value="heatmap">heatmap</option> > <option value="dendogram">dendogram</option> > <option value="pca">principal component analysis</option> > <option value="mds">multi dimensional scaling</option> > </param> > ----------------------- > Each of these options corresponds to a function in my R script, thus I want > to do an if-else if-else to execute these functions that the user selected > (note that multiple="True"). > Now the problem is, I also use R Sweave (sweaving R output (text/graphics) > into LaTeX) to generate a nice looking PDF report, and since that's not a > 'real' programming/ scripting language, I can't for instance split the > string (as I used to do in R) and check for the boxes a user selected, so my > questions are: > I planned on using Cheetah to include sections of Sweave LaTeX code for each > box checked by the user, perfectly doable with an #if-#elif you'd think, > however since the $report_options contains a comma-separated single string, > I would need to split (or use regular expressions) to be able to do such an > #if-#elif like: > #if "heatmap" in $report_options.split(",") > results in: "NotFound: cannot find 'split' while searching for 'split'"
Try changing this: #if "heatmap" in $report_options.split(",") to: #if "heatmap" in str($report_options).split(",") Although $report_options acts a bit like a Python string, it isn't one, and lacks lots of useful string methods. We can turn it into a string using the Python str function. > Q: Followup from previous question, where within the sections of my tool XML > file can I actually use Cheetah? This of course has to do with the order in > which a tool is executed. I believe only within the <command>...</command> tag. Peter ___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/