Description Usage Arguments Value Author(s) See Also Examples
matrixQtl calculates the correlation between snp and quantitative trait
1 |
snp |
a matrix of numeric values in size of sample*snp |
trait |
a matrix of numeric values in size of sample*trait |
covariate |
a matrix of numeric values in size of sample*covariate |
A list containing two components:
r a matrix of Pearson correlation between snp and trait in size of snp*trait
df the degree of freedom
Shijia Zhu, shijia.zhu@mssm.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | snp <- sapply(1:100,function(i) rnorm(1000) )
alpha <- sapply(1:10,function(i) rnorm(100) )
trait <- snp %*% alpha
covariates <- prcomp(snp)$x[,1:5]
qtl <- matrixQtl( snp, trait , covariates )
pval1 <- matrixPval( r=qtl$r , df=qtl$df)
pval2 <- matrix(nrow=ncol(snp),ncol=ncol(trait),data=0)
for(i in 1:ncol(snp))
{
for(j in 1:ncol(trait))
{
pval2[i,j] <- summary(lm(trait[,j]~snp[,i]+covariates))$coef[2,4]
}
}
head(pval1)
head(pval2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.