Description Usage Arguments Value Examples
View source: R/plotCorrStructure.R
Plot correlation structure of a gene based on random effects
1 2 3 4 5 6 7 | plotCorrStructure(
fit,
varNames = names(coef(fit)),
reorder = TRUE,
pal = colorRampPalette(c("white", "red", "darkred")),
hclust.method = "complete"
)
|
fit |
linear mixed model fit of a gene produced by lmer() or fitVarPartModel() |
varNames |
variables in the metadata for which the correlation structure should be shown. Variables must be random effects |
reorder |
how to reorder the rows/columns of the correlation matrix. reorder=FALSE gives no reorder. reorder=TRUE reorders based on hclust. reorder can also be an array of indices to reorder the samples manually |
pal |
color palette |
hclust.method |
clustering methods for hclust |
Image of correlation structure between each pair of experiments for a single gene
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # load library
# library(variancePartition)
# Intialize parallel backend with 4 cores
library(BiocParallel)
register(SnowParam(4))
# load simulated data:
data(varPartData)
# specify formula
form <- ~ Age + (1|Individual) + (1|Tissue)
# fit and return linear mixed models for each gene
fitList <- fitVarPartModel( geneExpr[1:10,], form, info )
# Focus on the first gene
fit = fitList[[1]]
# plot correlation sturcture based on Individual, reordering samples with hclust
plotCorrStructure( fit, "Individual" )
# don't reorder
plotCorrStructure( fit, "Individual", reorder=FALSE )
# plot correlation sturcture based on Tissue, reordering samples with hclust
plotCorrStructure( fit, "Tissue" )
# don't reorder
plotCorrStructure( fit, "Tissue", FALSE )
# plot correlation structure based on all random effects
# reorder manually by Tissue and Individual
idx = order(info$Tissue, info$Individual)
plotCorrStructure( fit, reorder=idx )
# plot correlation structure based on all random effects
# reorder manually by Individual, then Tissue
idx = order(info$Individual, info$Tissue)
plotCorrStructure( fit, reorder=idx )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.