Wordcloud of PubMed searches

At the start of this year I created a Twitter account that automatically tweets out papers related to transcriptomes, i.e. a Twitter literature bot. This idea isn’t new and there are over 200 Twitter literature bots. However, I wrote my Twitter bot using R (and using the RISmed package to search PubMed for papers) and…

Continue Reading

Miscellaneous plots in R

The R Graphics Cookbook is an awesome book; it’s so awesome that I bought the ebook after I bought the hardcopy because one copy of it wasn’t enough. I haven’t read the book in its entirety yet, but I thought I’ll share with you some of the recipes in Chapter 13, which illustrates how to…

Continue Reading

How do I fetch lincRNAs from Ensembl?

Here’s a very short post on how to fetch lincRNAs from Ensembl using R and the biomaRt package. For those who are not familiar with biomaRt, you can check out my older post on biomaRt. Firstly, start R and install the biomaRt package from Bioconductor by copying and pasting the code below:

Continue Reading

Animated plots using R

I learned the simple concept of animation back in school, when some of my classmates would draw stick figures on the edge of large textbooks. At first I was wondering why one would defile a textbook in such a way, but then as they flipped through the pages and brought the stick figures to life,…

Continue Reading

BED to GRanges

Updated 2015 April 6th to include the intersect_bed() function in the bedr package. Last year I saw a post on Writing an R package from scratch and I always wanted to follow the tutorial. Yesterday while trying to make some plots using Gviz, I had some BED-like files (not supported by Gviz), which I wanted…

Continue Reading

Using the GenometriCorr package

I was reading through the bedtools jaccard documentation when I saw the reference “Exploring Massive, Genome Scale Datasets with the GenometriCorr Package”. Firstly for those wondering what the Jaccard index is, it’s a simple metric that is defined as so: $$!J(A,B) = \frac{| A \cap B |}{| A \cup B |}$$ The numerator is the…

Continue Reading

Quantile normalisation in R

Updated 2019 October 11th to explain the index_to_mean function. From Wikipedia: In statistics, quantile normalization is a technique for making two distributions identical in statistical properties. To quantile normalize two or more distributions to each other, without a reference distribution, sort as before, then set to the average (usually, arithmetical mean) of the distributions. So…

Continue Reading

Plotting error bars with R

Updated 2018 May 20th Error bars may show confidence intervals, standard errors, and standard deviations. Each feature conveys a different message and this paper on error bars in experimental biology explains it very nicely. For this post I will demonstrate how to plot error bars that show the standard error (SE) or standard error of…

Continue Reading

Merging multiple data frames

When I searched for “merging multiple data frames”, I got this hit as the top result. The post was a bit too terse for me, so here’s my expansion of merging multiple data frames in R.

Continue Reading

Making symmetric matrices in R

A quick short post on making symmetric matrices in R, as it could potentially be a nasty gotcha. So in R, there are two functions for accessing the lower and upper triangular part of a matrix, called lower.tri() and upper.tri() respectively. Let me illustrate:

Continue Reading