Dear Authorized Sir / Madam, I need your help on clustering with R. I have symmetric distance matrix which i created usign ClustalOmega program. and used this R codes for clustering purpose. *data=read.table("my_distance_matrix", header=FALSE)[-1]* *attach(data)* *head(data)* *d=as.dist(data);* *hc.complete=hclust(d,method="complete")* *cutree(hc.complete, k=6)* *groups<- cutree(hc.complete, k=6)* *x<-cbind(groups)* *x* *x1<- subset(x,groups==1)* *write.table(x, "results.txt", sep="\t")* *plot(hc.complete)* I am wondering am i doing wrong usign this code ?(*data=read.table("my_distance_matrix or data file ???", header=FALSE)[-1]*) Is this line requires normal data values? In this line what kind of file have to use? Normal data file or distance matrix? *d=as.dist(data); *With this line am i calculating twice distance matrix? Thanks in advance. -------------- next part -------------- d1dlwa_ 0.000000 0.655172 0.836207 0.827586 0.724138 0.896552 0.836207 0.870690 0.870690 0.896552 d2gkma_ 0.655172 0.000000 0.849206 0.803150 0.723577 0.874016 0.874016 0.881890 0.874016 0.858268 d2qrwa_ 0.836207 0.849206 0.000000 0.674603 0.804878 0.888889 0.865079 0.880952 0.896825 0.880952 d2bkma_ 0.827586 0.803150 0.674603 0.000000 0.804878 0.882812 0.890625 0.875000 0.882812 0.843750 d4i0va_ 0.724138 0.723577 0.804878 0.804878 0.000000 0.861789 0.829268 0.861789 0.886179 0.869919 d1asha_ 0.896552 0.874016 0.888889 0.882812 0.861789 0.000000 0.884354 0.890511 0.897059 0.871429 d2dc3a_ 0.836207 0.874016 0.865079 0.890625 0.829268 0.884354 0.000000 0.875912 0.845588 0.864286 d4hsxa_ 0.870690 0.881890 0.880952 0.875000 0.861789 0.890511 0.875912 0.000000 0.867647 0.883212 1ecaa_ 0.870690 0.874016 0.896825 0.882812 0.886179 0.897059 0.845588 0.867647 0.000000 0.882353 d1x9fd_ 0.896552 0.858268 0.880952 0.843750 0.869919 0.871429 0.864286 0.883212 0.882353 0.000000
Hi, what is the exact problem? I tried you code and it works fine... Best, Kimmo 24.08.2016, 10:07, Serpil ?EN wrote:> Dear Authorized Sir / Madam, > > I need your help on clustering with R. > > I have symmetric distance matrix which i created usign ClustalOmega program. > > and used this R codes for clustering purpose. > > *data=read.table("my_distance_matrix", header=FALSE)[-1]* > *attach(data)* > *head(data)* > *d=as.dist(data);* > > *hc.complete=hclust(d,method="complete")* > > *cutree(hc.complete, k=6)* > *groups<- cutree(hc.complete, k=6)* > *x<-cbind(groups)* > *x* > *x1<- subset(x,groups==1)* > *write.table(x, "results.txt", sep="\t")* > *plot(hc.complete)* > > > I am wondering am i doing wrong usign this code > ?(*data=read.table("my_distance_matrix > or data file ???", header=FALSE)[-1]*) > Is this line requires normal data values? In this line what kind of file > have to use? Normal data file or distance matrix? > > *d=as.dist(data); *With this line am i calculating twice distance > matrix? > > Thanks in advance. > > > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >