[R] Joining nodes on a minimum spanning tree
angela McCann
ang.mccann at gmail.com
Sun Mar 14 20:28:20 CET 2010
Hi,
I am new to R and I am trying to plot a minimum spanning tree from a
distance matrix. The following code will plot the minimum spanning
tree for me, however, genomes that have a distance of 0 between them
in the distance matrix are plotted as two separate nodes on the
minimum spanning tree i.e. there is an edge that links them. What I
would like to do is to plot nodes which are separated by distance of 0
as the same node ? however I am having trouble achieving this
library(ade4)
library(graph)
library(Rgraphviz)
mat <- read.table("SquareMatrixOfDistancefor106SNPs.txt")
M <- neig2mat(mstree(as.dist(mat)))
rownames(M) <- colnames(M) <- rownames(mat)
myGraph <- as(M, "graphNEL")
plot(myGraph)
Thank you
Angela
More information about the R-help
mailing list