-
Notifications
You must be signed in to change notification settings - Fork 1
/
MDS plot.txt
31 lines (25 loc) · 961 Bytes
/
MDS plot.txt
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
Phenotype
Sample.name Group
1 1_023JJA Control
2 2_02BA ModerateDiabetes
3 3_001BJ SevereDiabetes
4 4_027KAN Control
sampNames <- t(Phenotype)[1,]
sampGroups <- as.factor(Phenotype[,2])
require(RColorBrewer)
pal = brewer.pal(8, "Dark2")
col <- pal[sampGroups]
o_10000 <- order(-apply(bmatrix_pc,1,sd))[1:10000]
d <- dist(t(bmatrix_pc[o_10000,]))
fit <- cmdscale(d)
xlim <- range(fit[, 1]) * 1.2
ylim <- range(fit[, 2]) * 1.2
main <- sprintf("Beta MDS\n2500 Selected loci based on supplied genes")
plot(0, 0, type = "n", xlim = xlim, ylim = ylim, xlab = "",ylab = "", main = main)
text(fit[, 1], fit[, 2], sampNames, cex=.5, col=col)
legend("topleft", legend = levels(sampGroups), ncol = 3,text.col = pal[1:3])
d <- dist(t(dataf_logit_PC_STATreg@bmatrix[,]))
fit <- cmdscale(d)
xlim <- range(fit[, 1]) * 1.1
ylim <- range(fit[, 2]) * 1.1
main <- sprintf("M-value MDS\n3161 loci in STAT-regulated genes")