Final edits
This commit is contained in:
parent
26e4e4fe97
commit
798191249d
@ -38,8 +38,10 @@ my.dist1 <- read.table("distance_matrix.txt",sep="\t", header=T)
|
||||
rownames(my.dist1) = colnames(my.dist1)
|
||||
my.dist1[lower.tri(my.dist1)] = t(my.dist1)[lower.tri(my.dist1)]
|
||||
hc1 <- hclust(as.dist(my.dist1), method="average")
|
||||
hc1
|
||||
plot(hc1,hang=-1)
|
||||
|
||||
|
||||
## 2 - Paste the distance matrix in the report. Use header=T
|
||||
|
||||
## 3 - no supporting code
|
||||
@ -48,6 +50,7 @@ plot(hc1,hang=-1)
|
||||
# Install
|
||||
if (!require("BiocManager")) install.packages("BiocManager")
|
||||
library(BiocManager)
|
||||
if (!require("WGCNA"))
|
||||
BiocManager::install("WGCNA")
|
||||
|
||||
# load WGCNA and run on the hc1 dendrogram
|
||||
@ -61,7 +64,9 @@ dynamicMods = cutreeDynamic(
|
||||
minClusterSize = 2)
|
||||
names(dynamicMods) <- colnames(my.dist1)
|
||||
|
||||
## 5 - no supporting code
|
||||
## 5 - identify clusters
|
||||
dynamicMods
|
||||
|
||||
|
||||
## 6 - show clustered data
|
||||
dynamicColors = labels2colors(dynamicMods) # colors might not work
|
||||
@ -91,18 +96,17 @@ a <- list()
|
||||
|
||||
# each merged pair in a row
|
||||
a$merge <- rbind(c(-1, -2), # +1 (A-B)
|
||||
c(1,-3) , # +2 (A-B)-C
|
||||
_______ , # +3 (D-E)
|
||||
_______ , # +4 ((A-B)-C)-(DE)
|
||||
_______) # +5 (((A-B)-C)-(DE))-F
|
||||
c(1, -4), # +2 (A-B)-D
|
||||
c(2, -3)) # +3 ((A-B)-D)-C
|
||||
|
||||
a$height <- c(1, 2, 1.5, 3, 4) # merge heights
|
||||
a$order <- 1:6 # order of leaves
|
||||
a$labels <- LETTERS[1:6] # labels of leaves as Letters
|
||||
|
||||
a$height <- c(0.14, 0.305, 0.51) # merge heights
|
||||
a$order <- 1:4 # order of leaves
|
||||
a$labels <- LETTERS[1:4] # labels of leaves as Letters
|
||||
class(a) <- "hclust" # force a to be hclust object
|
||||
# plot the tree
|
||||
# plot knows that a is an hclust object and plots accordingly
|
||||
plot(a,hang=-1) # or use plot(as.dendrogram(a))
|
||||
plot(a) # or use plot(as.dendrogram(a))
|
||||
|
||||
|
||||
## 4 - Verify results
|
||||
@ -121,7 +125,7 @@ test$merge
|
||||
test$height
|
||||
test$order
|
||||
test$labels<-LETTERS[1:4]
|
||||
plot(test,hang=-1)
|
||||
plot(test)
|
||||
|
||||
#### Part D - MDS
|
||||
## 1 - Show the 2D MDS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user