R/qtlcharts within R Markdown

This document serves to test each of the main chart functions in R/qtlcharts.

knitr::opts_chunk$set(fig.width=9, fig.height=6)
set.seed(69891250)
library(qtl)
library(qtlcharts)
data(grav)

iboxplot

iboxplot(t(grav$pheno), breaks=51, orderByMedian=FALSE,
         chartOpts=list(xlab="Time index", ylab="Root tip angle (degrees)"))

Subset phenotypes and run scanone

Reduce size of data.

grav$pheno <- grav$pheno[,seq(1, nphe(grav), by=5)]
times <- as.numeric(sub("T", "", phenames(grav)))/60

Run scanone.

grav <- calc.genoprob(grav, step=1)
out.hk <- scanone(grav, pheno.col=1:nphe(grav), method="hk")

iheatmap

n <- 101
x <- y <- seq(-2, 2, len=n)
z <- matrix(ncol=n, nrow=n)
for(i in seq(along=x))
    for(j in seq(along=y))
        z[i,j] <- x[i]*y[j]*exp(-x[i]^2 - y[j]^2)
iheatmap(z, x, y)

iplot

rowmedian <- apply(grav$pheno, 1, median, na.rm=TRUE)
grp <- as.numeric(rowmedian < median(unlist(grav$pheno), na.rm=TRUE))+1
iplot(grav$pheno$T0, grav$pheno$T60,
      group=grp,
      indID=paste0("RIL", 1:nind(grav)),
      chartOpts=list(xlab="Angle at time 0", ylab="Angle at 60 min"))

iplotCorr

iplotCorr(grav$pheno)

iplotCurves

iplotCurves(grav$pheno, times,
            grav$pheno[,c("T30", "T240")],
            grav$pheno[,c("T240", "T480")],
            chartOpts=list(curves_xlab="Time", curves_ylab="Root tip angle",
                           scat1_xlab="Angle at 30 min", scat1_ylab="Angle at 4 hrs",
                           scat2_xlab="Angle at 4 hrs", scat2_ylab="Angle at 8 hrs"))

iplotMScanone

iplotMScanone(out.hk, grav, chartOpts=list(eff_ylab="QTL effect"))

iplotMap

iplotMap(grav)

iplotPXG

iplotPXG(grav, marker="BF.206L-Col", pheno.col="T320")

iplotRF

gravsub <- pull.markers(grav, sample(markernames(grav), 50, replace=FALSE))
gravsub <- est.rf(gravsub)
iplotRF(gravsub)

iplotScanone

iplotScanone(out.hk, lodcolumn=32)
iplotScanone(out.hk, grav, lodcolumn=32, pheno.col=32)
iplotScanone(out.hk, grav, lodcolumn=32, pheno.col=32, pxgtype="raw")

iplotScantwo

grav <- calc.genoprob(grav, step=5)
out2 <- scantwo(grav, pheno.col=32, method="hk", verbose=FALSE)
iplotScantwo(out2)
iplotScantwo(out2, grav, pheno.col=32)

scat2scat

set.seed(69891250)
p <- 500
n <- 300
SD <- runif(p, 1, 5)
r <- runif(p, -1, 1)
scat2 <- vector("list", p)
for(i in 1:p)
   scat2[[i]] <- matrix(rnorm(2*n), ncol=2) %*% chol(SD[i]^2*matrix(c(1, r[i], r[i], 1), ncol=2))
scat1 <- cbind(SD=SD, r=r)
scat2scat(scat1, scat2, chartOpts=list(width=1000, height=500))


Try the qtlcharts package in your browser

Any scripts or data that you put into this service are public.

qtlcharts documentation built on Jan. 8, 2022, 1:06 a.m.