[adegenet-commits] r1049 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 8 17:44:10 CET 2012
Author: jombart
Date: 2012-11-08 17:44:10 +0100 (Thu, 08 Nov 2012)
New Revision: 1049
Modified:
pkg/R/sequences.R
Log:
started a (commented) graphic version of findMutations
Modified: pkg/R/sequences.R
===================================================================
--- pkg/R/sequences.R 2012-11-08 14:13:56 UTC (rev 1048)
+++ pkg/R/sequences.R 2012-11-08 16:44:10 UTC (rev 1049)
@@ -206,11 +206,33 @@
+## ##################
+## ## graphMutations
+## ##################
+## graphMutations <- function(x, plot=TRUE, ...){
+## if(!require(igraph)) stop("igraph is required")
+## ## GET GRAPH ##
+## from.old <- gsub("->.*","",names(x))
+## to.old <- gsub(".*->","",names(x))
+## vnames <- sort(unique(c(from.old,to.old)))
+## from <- match(from.old,vnames)
+## to <- match(to.old,vnames)
+## dat <- data.frame(from,to,stringsAsFactors=FALSE)
+## out <- graph.data.frame(dat, directed=TRUE)
+## ## SET VERTICES LABELS ##
+## V(out)$label <- vnames
+## ## SET ANNOTATIONS FOR THE BRANCHES ##
+## annot <- unlist(lapply(x, function(e) paste(e$short, collapse="\n")))
+## E(out)$label <- annot
+## ## PLOT / RETURN ##
+## if(plot) plot(out, ...)
+## return(out)
+## } # end graphMutations
@@ -220,6 +242,11 @@
+
+
+
+
+
## ###############
## ## transiProb
## ###############
More information about the adegenet-commits
mailing list