hclust

Exporting hclust cluster membership

断了今生、忘了曾经 提交于 2019-12-12 08:14:44
问题 I am new to R. I am trying to do hclust and export the cluster membership. I have used the following. Is this correct or is there a better way? FCtable1<-as.matrix(read.delim("table1.txt", row.names=1, header=TRUE, sep="\t")) Disttab1<-dist(FCtable1, method="euclidean") Hclustout1<-hclust(Disttab1, method="average") clustnumber<- cutree(Hclustout1, h=1000) tab1clustn <-data.frame(FCtable1, clustnumber) write.table(tab1clustn, file=" tab1clustn.xls", row.names=T, sep="\t") Thanks R 来源: https:/

selecting number of leaf nodes of dendrogram in heatmap.2 in R

孤街浪徒 提交于 2019-12-11 18:46:15
问题 In Matlab you can designate the number of nodes in a dendrogram that you wish to plot as part of the dendrogram function: dendrogram(tree,P) generates a dendrogram plot with no more than P leaf nodes. My attempts to do the same with heatmap2 in R have failed miserably. The posts to stackoverflow and biostars have suggested using cutree but heatmap2 gets stuck with postings' suggestions on Rowv option. Here "TAD" is the data matrix 8 columns by 831 rows. # cluster it hr <- hclust(dist(TAD,

Consensus tree or “bootstrap proportions” from multiple hclust objects

元气小坏坏 提交于 2019-12-11 03:25:50
问题 I have a list of hclust objects resulting from slight variations in one variable (for calculating the distance matrix) now I would like to make a consensus tree from this list. Is there a generic package to do this? I am hacking my way through some code from maanova and it seems to work - but it's ugly and it needs a lot of hacking since I am not doing "normal" bootstrapping (it's chemical data). /Palle Villesen, Denmark c1_list <- seq(10,100,by=10) c2 <- 30 e<- 1 mboot <- list() for (i in 1:

Exporting dendrogram as table in R

拜拜、爱过 提交于 2019-12-09 04:55:06
问题 I would like to export an hclust-dendrogram from R into a data table in order to subsequently import it into another ("home-made") software. str(unclass(fit)) provides a text overview for the dendrogram, but what I'm looking for is really a numeric table. I've looked at the Bioconductor ctc package, but the output it's producing looks somewhat cryptical. I would like to have something similar to this table: http://stn.spotfire.com/spotfire_client_help/heat/heat_importing_exporting_dendrograms

match and add the cluster number to the original data

我与影子孤独终老i 提交于 2019-12-08 13:50:37
I am using the regular method to do a Hierarchical Clustering project. mydata.dtm <- TermDocumentMatrix(mydata.corpus) mydata.dtm2 <- removeSparseTerms(mydata.dtm, sparse=0.98) mydata.df <- as.data.frame(inspect(mydata.dtm2)) mydata.df.scale <- scale(mydata.df) d <- dist(mydata.df.scale, method = "euclidean") # distance matrix fit <- hclust(d, method="ward") groups <- cutree(fit, k=10) groups congestion cough ear eye fever flu fluzonenon medicare painpressure physical pink ppd pressure 1 2 3 4 5 6 5 5 5 7 4 8 5 rash screening shot sinus sore sports symptoms throat uti 5 5 6 1 9 7 5 9 10 And I

match and add the cluster number to the original data

半城伤御伤魂 提交于 2019-12-08 07:14:50
问题 I am using the regular method to do a Hierarchical Clustering project. mydata.dtm <- TermDocumentMatrix(mydata.corpus) mydata.dtm2 <- removeSparseTerms(mydata.dtm, sparse=0.98) mydata.df <- as.data.frame(inspect(mydata.dtm2)) mydata.df.scale <- scale(mydata.df) d <- dist(mydata.df.scale, method = "euclidean") # distance matrix fit <- hclust(d, method="ward") groups <- cutree(fit, k=10) groups congestion cough ear eye fever flu fluzonenon medicare painpressure physical pink ppd pressure 1 2 3

is there a way to preserve the clustering in a heatmap but reduce the number of observations?

旧街凉风 提交于 2019-12-08 06:35:35
问题 I have data-set with 90 observations(rows) across 20 columns. I have generated a pretty neat heatmap which clusters my data in two groups with the package pheatmap. Although its not entirely clean but the two clusters of dendrogram pretty much separates my samples in 2 distinct groups as per my conditions. Now I want to reduce this set of 90 to a stricter set around 20-30 obeservations but still want to preserve the same clustering order as shown in pheatmap . Is there a way to do that? or

is there a way to preserve the clustering in a heatmap but reduce the number of observations?

十年热恋 提交于 2019-12-07 03:09:29
I have data-set with 90 observations(rows) across 20 columns. I have generated a pretty neat heatmap which clusters my data in two groups with the package pheatmap. Although its not entirely clean but the two clusters of dendrogram pretty much separates my samples in 2 distinct groups as per my conditions. Now I want to reduce this set of 90 to a stricter set around 20-30 obeservations but still want to preserve the same clustering order as shown in pheatmap . Is there a way to do that? or any other package that reduces my observations to a minimum set which can still preserve by clustering

Change label size of Cluster Dendrogram in R 3.01

旧巷老猫 提交于 2019-12-05 16:52:16
问题 Has anybody found a workaround to the apparent bug in R 3 which prohibits changing the label size on a Cluster Dendrogram? The following code used to work fine before updating R to 3.01 (prior version was 2.15 I think): plot(hclust, labels = data[, 1], cex = 0.3) Now there is no change to label size when altering the cex argument. 回答1: You could set the cex parameter using the par() function before the call to plot() . For example: # example from ?hclust hc <- hclust(dist(USArrests), "ave") #

Change label size of Cluster Dendrogram in R 3.01

懵懂的女人 提交于 2019-12-04 03:23:52
Has anybody found a workaround to the apparent bug in R 3 which prohibits changing the label size on a Cluster Dendrogram? The following code used to work fine before updating R to 3.01 (prior version was 2.15 I think): plot(hclust, labels = data[, 1], cex = 0.3) Now there is no change to label size when altering the cex argument. You could set the cex parameter using the par() function before the call to plot() . For example: # example from ?hclust hc <- hclust(dist(USArrests), "ave") # default label size plot(hc, xlab="xlab", ylab="ylab", main="main", sub="") # reduced label size par(cex=0.3