[adegenet-commits] r575 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 17 21:39:04 CET 2010


Author: jombart
Date: 2010-02-17 21:39:04 +0100 (Wed, 17 Feb 2010)
New Revision: 575

Modified:
   pkg/R/haploGen.R
Log:
fixes for subsetting objects


Modified: pkg/R/haploGen.R
===================================================================
--- pkg/R/haploGen.R	2010-02-17 20:23:59 UTC (rev 574)
+++ pkg/R/haploGen.R	2010-02-17 20:39:04 UTC (rev 575)
@@ -344,6 +344,7 @@
     res$seq <- res$seq[i,,drop=FALSE]
     res$id <- res$id[i]
     res$ances <- res$ances[i]
+    res$ances[!res$ances %in% res$id] <- NA
     res$dates <- res$dates[i]
     if(!is.null(res$xy)) res$xy <- res$xy[i,,drop=FALSE]
 
@@ -603,10 +604,11 @@
 
     ## EXTRACT WEIGHTS (nb of mutations)
     M <- as.matrix(dist.dna(from$seq, model="raw")*ncol(from$seq))
+    rownames(M) <- colnames(M) <- from$id
     w <- mapply(function(i,j) {M[i, j]}, i=from$ances[!areNA], j=from$id[!areNA])
 
 
     ## CONVERT TO GRAPH
-    res <- ftM2graphNEL(ft=cbind(from$ances[!areNA], (1:N)[!areNA]), W=w, edgemode = "directed", V=from$id)
+    res <- ftM2graphNEL(ft=cbind(from$ances[!areNA], from$id[!areNA]), W=w, edgemode = "directed", V=from$id)
     return(res)
 })



More information about the adegenet-commits mailing list