Description Usage Arguments Value Examples
Plot correlation heatmap of a module for both phenotype groups. ggcorrplot::ggcorrplot()
is used
to produce the heatmaps, which are returned in a list object in case the user
wants to further customize the plots using ggplot2.
1 2 3 4 5 6 7 8 9 | corrheatmap(
group1_mod,
group2_mod,
cortype = "spearman",
hc.order = TRUE,
group_order = 1,
tl.cex = 6,
...
)
|
group1_mod |
matrix of a single module in phenotype group1 (samples in rows, genes in columns) |
group2_mod |
matrix of the corresponding module in phenotype group1 (samples in rows, genes in columns) |
cortype |
"spearman" (default), "pearson", or "kendall"; type of correlation used to measure the network structure within a module. |
hc.order |
TRUE/FALSE, whether to use hierarchical clustering to sort genes |
group_order |
= 1 or 2, if hc.order=TRUE, then whether to perform the clustering
in group 1 or 2. If you used |
tl.cex |
font size for variable labels (if there are many variable names, e.g. > 100,
you might want to set |
... |
additional parameters passed to |
both_plots
: both heatmaps are combined into a single ggplot2 object using ggpubr::ggarrange()
group1_plot
: ggplot2 correlation heatmap of module in phenotype group 1
group2_plot
: ggplot2 correlation heatmap of module in phenotype group 2
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 41 | ######## load example dataset
library(multtest)
data(golub)
X1 = golub[,which(golub.cl==0)]
X2 = golub[,which(golub.cl==1)]
rownames(X1) = golub.gnames[,3]
rownames(X2) = golub.gnames[,3]
# use subset of 200 genes for example
set.seed(1234)
ind = sample(1:nrow(X1),200)
X1 = X1[ind,]
X2 = X2[ind,]
######## Derive modules in group 1
modules = find_modules(X1,X2,cluster_group=1)
modules$num_modules # number of modules estimated by BIC (modules with < 3 genes are excluded)
ngm = unlist(lapply(modules$group1_modules, ncol)) # number of genes per module
summary(ngm)
######## test modules for differential co-expression
testmods = test_modules(group1_modules = modules$group1_modules,group2_modules = modules$group2_modules)
# View(testmods$pvalues)
# View(testmods$qvalues)
which(testmods$pvalues$PND6 <= 0.05)
which(testmods$qvalues$PND6 <= 0.05)
# use parallel computing:
# testmods = test_modules(group1_modules = modules$group1_modules,
# group2_modules = modules$group2_modules,
# parallel=TRUE,
# cores=4)
######## plot module 5
heat = corrheatmap(modules$group1_modules[[5]],modules$group2_modules[[5]])
# plot(heat$both_plots)
# plot(heat$group1_plot)
# plot(heat$group2_plot)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.