Interactive plots in R using plotly

I found out about plotly a couple of months ago via R-bloggers: Gantt charts in R using Plotly via @Rbloggers #rstats https://t.co/LuW8nuQr6c — Dave Tang (@davetang31) May 13, 2016 I finally gave it a go when a friend asked me for help making a Gantt chart and I was impressed with plotly’s interactivity and ease…

Continue Reading

Learning R through a mini game

Just last night I found this educational mini game written in R and decided to have a go at it: This was a fairly fun #Rstats game: https://t.co/0zGCQqCxvw (Only after brute-forcing it, I realised I didn't have to.) — Dave Tang (@davetang31) December 5, 2015 I completed it but as I alluded to in my…

Continue Reading

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