R/qtlcharts is an R package to create interactive charts for quantitative trait locus (QTL) mapping data, for use with R/qtl.
The charts are saved to a temporary file and opened in a web browser, though you may also save them to a specific file, to be viewed later. We are focusing development on the Chrome browser. The graphs may also be viewed in other browsers, such as Safari, Opera and Firefox, but it can be hard to accommodate all possible browser differences.
Information on installing R/qtlcharts is available here; it requires installation of the packages R/qtl and htmlwidgets.
You first need to load the package.
library(qtlcharts)
Let’s begin by considering the function iplotCorr
, which creates a heatmap of a correlation matrix, linked to scatterplots of the underlying variables.
We’ll first load the geneExpr
dataset, included with the R/qtlcharts package.
data(geneExpr)
This is a list with two components. The first component, geneExpr$expr
, is a 491 × 100 matrix of gene expression data; the second component, geneExpr$genotype
, is a vector of genotypes (of length 491) at a QTL that influences those 100 genes’ expression values. (The genes were selected from a larger expression genetics study, on that basis: that they are all influenced by this QTL.)
Let’s pull out those two components of geneExpr
as separate objects, expr
and geno
.
expr <- geneExpr$expr
geno <- geneExpr$genotype
The simplest use of iplotCorr
is with a numeric matrix, as with the expr
dataset. For example:
iplotCorr(expr, reorder=TRUE)
This will open an interactive figure in a web browser, with a heat map of the correlation matrix of the genes on the left linked to the underlying scatterplots. With the argument reorder=TRUE
, the genes are reordered (by hierarchical clustering with the R function hclust
) to bring genes with similar expression patterns next to each other.
The following is a snapshot. (See a live example at the R/qtlcharts website.)