Publications by January
Pathway analysis in R and BioConductor.
There are many options to do pathway analysis with R and BioConductor. First, it is useful to get the KEGG pathways: library( gage ) kg.hsa <- kegg.gsets( "hsa" ) kegg.gs2 <- kg.hsa$kg.sets[ kg.hsa$sigmet.idx ] Of course, “hsa” stands for Homo sapiens, “mmu” would stand for Mus musuculus etc. Incidentally, we can immediately make an anal...
2716 sym R (289 sym/3 pcs) 4 img
The biomaRt package
The biomaRt package allows to query the gigantic ensembl data base directly from R. Since it happens only once in a while, I find myself reading the biomaRt vignette every time I’m using it. Here are the crucial points for the most common application. ensembl <- useMart( "ensembl", dataset="hsapiens_gene_ensembl" ) f <- listFilters( ensembl ) ...
1426 sym R (1676 sym/7 pcs) 4 img
Troubles with sapply
Say your function in sapply returns a matrix with a variable number of rows. For example ff <- function( i ) matrix( i, ncol= 3, nrow= i ) pipa <- sapply( 1:3, , simplify= "array" ) sapply is too stupid to see the pattern here (or maybe I don’t know how to cast the return value into an appropriate shape…). The result of the above is a list: ...
734 sym R (346 sym/3 pcs) 4 img
tagcloud: creating tag / word clouds
May I present my new package: tagcloud. Tag clouds is for creating, um, tag clouds (aka word clouds). It is based on the code from the wordcloud package, but (i) has no tools for analysing word frequencies, instead (ii) focuses on doing better tag clouds. As to (ii), it adapts to the geometry of the window better and can produce different layouts...
2444 sym R (808 sym/8 pcs) 18 img
Adding authentication to a shiny server
Umph, that was a tough one. I spent ages figuring out how to do it correctly. I have a server running apache (on port 80) and shiny on port (say) 11111. Shiny has its own document root, and within this root, we have a shiny app, say, “example”. So to view this app you need to type http://server:1111/example/. So far, so good. What I wanted, t...
2459 sym R (937 sym/5 pcs) 4 img
Creating a graph with variable edge width in Rgraphviz
This was waaaaay more complicated than necessary. Figuring it out took me almost a whole day. In essence, there is the graph package in R, which provides graph objects and methods, and there is the Rgraphviz package, which allows you to plot the graphs on the screen. They work well. library(graph) library(Rgraphviz) nodes <- c( LETTERS[1:3] ) edg...
1231 sym R (946 sym/4 pcs) 10 img
pandoc, markdown and pander
Pandoc + markdown seem to be a great way of documenting my work. Markdown syntax is very simple and allows to add basic formatting and figures to an otherwise simple text document, without obfuscating the actual text. Then I simply compile the document using the pandoc command: pandoc -o document.docx document.md pandoc -o document.pdf document....
2203 sym R (247 sym/3 pcs) 4 img
Kneat tricks
So I have finally switched to knitr for doing my vignettes. The result is satisfactory, but the process was not entirely painless. The command to run instead of “R CMD Sweave foo.Rnw” is Rscript -e 'rmarkdown::render("foo.rmd")' I think that the concept of writing a package which has the main purpose to generate documentation in literate pr...
3217 sym R (673 sym/1 pcs) 4 img
Presentations in (R)markdown
There are many ways to turn a markdown or Rmarkdown document into a presentation. Way too many, and none of them is perfect. I made my first presentation with knitr / Rmarkdown for the tmod package. After trying various options in knitr, I decided on an approach in which the Rmarkdown document is oblivious of the presentation system and the job o...
6629 sym Python (2766 sym/15 pcs) 8 img
R-devel in parallel to regular R installation
Unfortunately, you need both: R-devel (development version of R) if you want to submit your packages to CRAN, and regular R for your research (you don’t want the unstable release for that). Fortunately, installing R-devel in parallel is less trouble than one might think. Say, we want to install R-devel into a directory called ~/R-devel/, and we...
1690 sym R (468 sym/5 pcs) 4 img