qtlCorrSecondOrder {MetaNetwork} | R Documentation |
Calculate the second-order partial correlation between any pair of QTL profiles to decompose the confounded effect of multiple QTLs.
qtlCorrSecondOrder(corrZeroOrder, topCorNo=20, filename = NULL)
corrZeroOrder |
a zero order correlation matrix that has been calculated before. See corrZeroOrder example data. |
topCorNo |
(optional) to reduce computing time, limit the pairwise
conditioning to only the topCorNo top correlated compounds.
Default is 20. To condition on all pairs, set topCorNo to nrow(corrZeroOrder). |
filename |
(optional) path of the file where the correlations are to be stored. Default NULL. |
First-order correlation between x and y conditional on a single variable z are calculated by
r_{xy arrowvert z} = frac {r_{xy} - r_{xz}r_{yz}} {sqrt{(1-r_{xz}^2)(1-r_{yz}^2)}}
where r_{xy}, r_{xz} and r_{yz} are zero-order correlation coefficients
between traits x and y, x and z,
and y and z, respectively (provided as corrZeroOrder
.
Then second-order partial correlation between x and y, conditional on a pair of variables z and k is a function of the first-order coefficients.
r_{xyarrowvert zk} = frac{r_{xyarrowvert z} - r_{xkarrowvert z}r_{ykarrowvert z}} {sqrt{(1-r_{xkarrowvert z}^2)(1-r_{ykarrowvert z}^2)}}
For each pair x and y, the second-order partial correlations are calculated conditional on each pair z and k and the minimal value is stored.
In order to save computing time, conditional variables z and k can
be chosen from topCorNo
top correlated variable x and y (e.g. topCorNo
= 20).
Returns a matrix of second-order partial correlations.
Jingyuan Fu <j.fu@rug.nl>, Morris Swertz <m.a.swertz@rug.nl>, Ritsert Jansen <r.c.jansen@rug.nl>
Keurentjes JJB, FU J, de vos CHR, Lommen A, Hall RD, Bino RJ, van der Plas LHW, Jansen RC, Vreugdenhil D, and Koornneef M. The genetics of plant metabolism. Nature Genetics (2006) 7: 842-849.
Fu J, Swertz MA, Keurentjes JJB, Jansen RC. MetaNetwork: a computational tool for the genetic study of metabolism. Nature Protocols (2007).
http://gbic.biol.rug.nl/supplementary/2007/MetaNetwork
Use qtlCorrZeroOrder
to calculate corrZeroOrder
zero order correlation.
## load the example data provided with this package data(markers) data(genotypes) data(traits) ##OR: load your own data #markers <- loadData("markers.csv") #genotypes <- loadData("genotypes.csv") #traits <- loadData("traits.csv") ##calculate the two part qtl qtlProfiles <- qtlMapTwoPart(genotypes=genotypes, traits=traits, spike=4) ##set the qtl threshold qtlThres <- 3.79 ##OR: estimate the threshold yourself #qtlThres <- qtlThreshold(genotypes, traits, spike=4) ##calculate zero order correlation corrZeroOrder <- qtlCorrZeroOrder(markers, qtlProfiles, qtlThres) ##calculate the second order correlation corrSecondOrder <- qtlCorrSecondOrder(corrZeroOrder=corrZeroOrder) ##view the correlations corrSecondOrder[1:5,1:5]