qtlTools - an R package for plotting and exploration of R/qtl results

839 views
Skip to first unread message

John Lovell

unread,
Oct 15, 2016, 3:08:38 PM10/15/16
to R/qtl discussion
Hi R/qtl users,
I wanted to bring your attention to an R package I am developing that adds some plotting and other functionality to R/qtl - "qtlTools".
qtlTools contains a number of functions, including methods to:
  • Plot QTL confidence intervals on a genetic map
  • Extract statistics from multiple QTL models
  • Compile confidence intervals from either scanone, or multiple qtl models
  • Strategies to reduce the number of markers in large genotype matrices
  • GWERk permutations
The package can be found here: https://github.com/jtlovell/qtlTools

You can install it using the following commands:
> library(devtools)
> install_github("jtlovell/qtlTools")
> library(qtlTools)

There are a number of tutorials included with the package. These, and other information can be found here: http://lovelleeb.weebly.com/qtltools

Please reply to this post if you have questions, find bugs, or have ideas for additional functionality. 
Cheers, John

John T. Lovell
University of Texas at Austin


Malaika

unread,
Nov 22, 2016, 9:30:09 PM11/22/16
to R/qtl discussion
Hi John,
With which R version is qtlTools compatible too. I am having trouble installing it.
Malaika

SKY

unread,
Nov 25, 2016, 7:31:09 AM11/25/16
to R/qtl discussion


Try the following commands for installing qtlTools (I tried them in R version 3.3.2 (2016-10-31)

library(devtools)
install.packages("digest")
 install.packages("R6")
 install.packages("curl")
 library(devtools)
 install_github("jtlovell/qtlTools")

John Lovell

unread,
Nov 25, 2016, 1:31:13 PM11/25/16
to R/qtl discussion
Thanks, 
Yes, the commands you need to install and load qtlTools are:

library(devtools) # make sure devtools is installed

install_github("jtlovell/qtlTools")

library(qtlTools) # make sure qtl is installed


qtlTools was built under 3.3.1, but works fine with 3.3.2. I haven't tested earlier R versions. 
Good luck,
John

Chandra Prakash

unread,
Dec 27, 2016, 12:12:07 AM12/27/16
to R/qtl discussion
Hi John, i tried using segmentsOnMap(cross=cross,calcCisResults=cis,legendPosition = "right", leg.inset=.1,palette = rainbow) and got the results also.But my problem is i am having 30 phenotypes and want to draw on chromosomes like you did in figure below. How to plot multiple phenotypes?

Picture

Thanx in advance,

John Lovell

unread,
Dec 27, 2016, 10:39:19 AM12/27/16
to R/qtl discussion
segmentsOnMap is built for many phenotypes. 30 is about it's upper limit though. 

There are a few ways to use segmentsOnMap, but the easiest is to first make a dataframe where each row is a single qtl peak and contains at least the 1) qtl chromosome, 2) phenotype name, 3) low CI bound, 4) upper CI bound. There can be multiple rows for each phenotype (when that phenotype has >1 QTL). Then feed this data.frame into segmentsOnMap. 

qtlTools::calcCis makes this dataframe for you automatically. See the documentation for more details, but here is an example.

library(qtlTools)

data(multitrait)

cross <- multitrait

cross <- calc.genoprob(cross)

phes <- phenames(cross)[1:20]

s1 <- scanone(cross, pheno.col = phes, method = "hk")

perms <- scanone(cross, pheno.col = phes, method = "hk",

   n.perm = 100, verbose=F)

cis<-calcCis(cross, s1.output = s1, perm.output = perms)

segmentsOnMap(cross, calcCisResults = cis, legendCex = .5)

Chandra Prakash

unread,
Dec 27, 2016, 12:38:53 PM12/27/16
to R/qtl discussion
Thanx a lot, actually I thought calcCis takes only Output from a scantwo call. It would be nice if you also provide links to the calcCis.R function file, so that users can customize chromosomes and other things in the chart. One more request kindly upgrade this calcCis function in such a manner that it can also add user specified genes and miRNAs physical position on the QTL map.

Chandra Prakash

unread,
Dec 28, 2016, 12:46:13 AM12/28/16
to R/qtl discussion
Dear John, i am getting an error message while using the script below.

>
library(devtools) > library(qtlTools) > library(qtl) > library(plyr) > data(multitrait) > cross<-multitrait > cross<-calc.genoprob(cross) > phes <- c("X3.Hydroxypropyl", "X3.Butenyl", "X3.Methylsulfinylpropyl", + "X5.Methylsulfinylpentyl", "X6.Methylthiohexyl", + "X4.Benzoyloxybutyl", "Quercetin.deoxyhexosyl.dihexoside") > stepout<-lapply(phes, function(i) { + stepwiseqtl(cross, pheno.col=i, method="hk", max.qtl=4, + additive.only=TRUE, penalties = c(2.5,3.5,1.5), verbose=F) + }) > names(stepout)<-phes > models.out<-stepout > cis<-lapply(models.out, function(x) { + calcCis(mod=x, qtlnames=x$altname, ci.method="bayes", prob=0.99, returnChr=TRUE, returnMaxLod=TRUE, expandtomarkers=T) + }) > cis.df<-ldply(cis, data.frame) > colnames(cis.df)[1]<-"phe" > segmentsOnMap(cross=cross, phe=cis.df$phe, chr=cis.df$chr, l = cis.df$lowposition, h =cis.df$highposition, + lwd = 8, segSpread=.1) Error in `$<-.data.frame`(`*tmp*`, "x", value = c(0, 1)) : replacement has 2 rows, data has 3 In addition: Warning messages: 1: In m$pos >= tem$l[tem$phe == j] : longer object length is not a multiple of shorter object length 2: In m$pos <= tem$h[tem$phe == j] : longer object length is not a multiple of shorter object length 3: In m$pos >= tem$l[tem$phe == j] : longer object length is not a multiple of shorter object length 4: In m$pos <= tem$h[tem$phe == j] : longer object length is not a multiple of shorter object length

John Lovell

unread,
Dec 28, 2016, 8:00:17 AM12/28/16
to R/qtl discussion
Hi Chandra, 
I am working on map annotation - adding the location of known genes etc. It is a little trickier than you might expect, however, it is on my list of functionality to add to qtlTools. 
As for customizing chromosomes, you can feed segmentsOnMap a subset of the chromosomes by culling your data.frame of confidence intervals by a chromosome.
Cheers,
John

John Lovell

unread,
Dec 28, 2016, 8:02:34 AM12/28/16
to R/qtl discussion
For bug fix questions I have opened a bug reports page on github: https://github.com/jtlovell/qtlTools/issues
Please post there so that we don't fill up the qtl discussion page.
Thanks. 
John
Reply all
Reply to author
Forward
0 new messages