Optional 3 and report
This commit is contained in:
parent
cadea6e1d4
commit
e859b7daac
@ -1 +0,0 @@
|
||||
,noah,NovaArchSys,30.09.2022 13:06,file:///home/noah/.config/libreoffice/4;
|
||||
@ -171,3 +171,45 @@ colors = rep("black",nrow(SxG.df))
|
||||
colors[startsWith(rownames(SxG.df),"MDD")] <- "red"
|
||||
plot(obs_umap$layout, col=colors,
|
||||
main="umap of observations", xlab="umap dim1", ylab="umap dim2")
|
||||
|
||||
#### Optional 3: WGCNA and UMAP of Genes
|
||||
if (!require("BiocManager")) install.packages("BiocManager")
|
||||
library(BiocManager)
|
||||
if (!require("WGCNA")) BiocManager::install("WGCNA")
|
||||
library(WGCNA)
|
||||
|
||||
# change umap config parameters
|
||||
custom.config = umap.defaults
|
||||
custom.config$random_state = 123
|
||||
custom.config$n_epochs = 50
|
||||
custom.config$n_neighbors=30
|
||||
custom.config$metric = "pearson"
|
||||
custom.config$input = "dist"
|
||||
custom.config$a = 9.5
|
||||
custom.config$b = 0.5
|
||||
|
||||
GxS.df <- data.frame(GxS.covfilter)
|
||||
|
||||
obs_umap = umap(GxS.df, config=custom.config)
|
||||
#add colors for MDD/HC
|
||||
colors = rep("black",nrow(GxS.df))
|
||||
colors[startsWith(colnames(GxS.df),"MDD")] <- "red"
|
||||
plot(obs_umap$layout, col=colors,
|
||||
main="umap of observations", xlab="umap dim1", ylab="umap dim2")
|
||||
|
||||
# Plot the dendrogram and colors underneath
|
||||
num.clust <- 2
|
||||
mddCuts <- cutree(mddTree,k=num.clust)
|
||||
|
||||
sizeGrWindow(8,6)
|
||||
dynamicMods = cutreeDynamic(dendro = mddTree, distM = d,
|
||||
deepSplit = 2, pamRespectsDendro = FALSE,
|
||||
minClusterSize = 2, method = "hybrid")
|
||||
mddColors = labels2colors(dynamicMods)
|
||||
table(mddColors)
|
||||
mddColorstable <- table(mddColors,names(mddCuts))
|
||||
prop.table(mddColorstable, margin = 1)
|
||||
plotDendroAndColors(mddTree, mddColors, "Dynamic Clusters",
|
||||
dendroLabels = NULL, # hang = -1,
|
||||
addGuide = TRUE, #guideHang = 0.05,
|
||||
main = "Clustering with WGCNA")
|
||||
|
||||
Binary file not shown.
BIN
Schrick-Noah_CS-6643_Lab-4.pdf
Normal file
BIN
Schrick-Noah_CS-6643_Lab-4.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user