Question: Get specific elements from clustered data in R
0
gravatar for prp291
3.9 years ago by
prp29150
United States
prp29150 wrote:

I generate this image using the hclust function. Now I wand to ID of those elements highlighted by squares.

Is there any way to get the ID and related value from the clusted datasets?

I used this R script

library(gplots) library(geneplotter) # read the data in from URL bots <- read.table("expression.txt") # get just the alpha data abot <- bots[,c(1:9)] rownames(abot) <- bots[,1] abot[1:7,] # get rid of NAs abot[is.na(abot)] <- 0 # we need to find a way of reducing the data. Can't do ANOVA as there are no # replicates. Sort on max difference and take first 1000 min <-apply(abot, 1, min) max <- apply(abot, 1, max) sabot <- abot[order(max - min, decreasing=TRUE),][1:1000,] # cluster on correlation cdist <- as.dist(1 - cor(t(sabot))) hc <- hclust(cdist, "average") # draw a heatmap x11() heatmap.2(as.matrix(sabot), Rowv=as.dendrogram(hc), Colv=FALSE, cexRow=1, cexCol=1, dendrogram="row", scale="row", trace="none", density.info="none", key=FALSE, col=greenred.colors(80))

and my data look like this

YF MF SF YL ML SL Stem Root SULE

1 31.64075611 32.2728151 38.81790359 252.8901009 269.7599455 138.5011042 16.58308894 10.47935935 3.364295997

2 6.484902171 9.141084197 5.748798541 3.637332586 4.762966989 4.149302282 7.194971046 9.932508868 1.600027931

3 14.15218386 8.784155316 9.740794214 6.566584262 6.130503033 7.747728536 12.57014531 15.75181203 9.22907038

4 15.72881736 19.95755802 10.13050089 10.31313758 9.838844457 14.24864327 13.00442008 23.85404067 12.17251862

5 30.45475953 15.57131432 17.15277867 8.884751572 8.78786964 12.4745649 11.90176123 35.9844343 6.904763942

6 15.87149807 19.05523246 13.12846166 12.99750491 15.3775883 19.0044086 21.66051467 20.38501538 39.58478032

7 16.58935728 18.63990933 17.20955634 13.04423927 29.98424087 18.02165996 22.22403582 32.38377369 10.90832984

8 29.91118855 19.65844846 23.45958109 62.56338088 55.3926187 39.85296152 31.4832543 14.8484163 1.326553777

9 4.09192129 15.52499475 12.14321788 1.680854758 3.448485979 5.245481483 15.14443161 28.85873063 1.073855381

10 7.02768911 4.267210165 3.383501945 3.53716686 3.105614581 3.493791292 3.806360251 6.713067543 3.338740245

11 17.61821596 18.03607855 12.939663 8.951935241 15.45268577 15.53817186 20.5098186 23.42760284 27.97680418

12 66.35291651 40.41837702 37.7239447 32.42998176 30.09696289 27.81089554 33.27197681 46.5393928 4.141505618

13 15.45804403 15.98469202 17.21176468 9.105208867 11.76140929 13.9751105 14.72159466 25.68388472 7.493988128

Thanks

 

 

I asked same question HERE

clustering R • 1.5k views
ADD COMMENTlink modified 3.9 years ago • written 3.9 years ago by prp29150
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1179 users visited in the last hour