[adegenet-commits] r378 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 8 11:22:56 CEST 2009


Author: jombart
Date: 2009-06-08 11:22:53 +0200 (Mon, 08 Jun 2009)
New Revision: 378

Modified:
   pkg/R/haploSim.R
Log:
SOme fixes in haploSim


Modified: pkg/R/haploSim.R
===================================================================
--- pkg/R/haploSim.R	2009-06-05 21:14:27 UTC (rev 377)
+++ pkg/R/haploSim.R	2009-06-08 09:22:53 UTC (rev 378)
@@ -318,16 +318,21 @@
 ####################
 ## na.omit.haploSim
 ####################
-na.omit.haploSim <- function(object, ...){
-    res <- object
-    isNA <- is.na(res$ances)
-    res$seq <- res$seq[!isNA,]
-    res$ances <- res$ances[!isNA]
-    res$dates <- res$dates[!isNA]
-    if(!is.null(res$xy)) res$xy <- res$xy[!isNA,]
+##
+## ACTUALLY THIS FUNCTION MAKES NO SENSE FOR NOW
+## AS STRAINS WITH NO ANCESTOR MAY BE ANCESTORS OF
+## OTHER STRAINS.
+##
+## na.omit.haploSim <- function(object, ...){
+##     res <- object
+##     isNA <- is.na(res$ances)
+##     res$seq <- res$seq[!isNA,]
+##     res$ances <- res$ances[!isNA]
+##     res$dates <- res$dates[!isNA]
+##     if(!is.null(res$xy)) res$xy <- res$xy[!isNA,]
 
-    return(res)
-}
+##     return(res)
+## }
 
 
 
@@ -398,8 +403,8 @@
 ## as.seqTrack.haploSim
 ########################
 as.seqTrack.haploSim <- function(x){
-    x.ori <- x
-    x <- na.omit(x)
+    ## x.ori <- x
+    ## x <- na.omit(x)
     toSetToNA <- x$dates==min(x$dates)
     res <- list()
     res$id <- labels(x)
@@ -408,8 +413,8 @@
     res$ances[toSetToNA] <- NA
     res$weight <- 1 # ??? have to recompute that...
     res$weight[toSetToNA] <- NA
-    res$date <- as.POSIXct(x.ori)[labels(x)]
-    res$ances.date <- as.POSIXct(x.ori)[x$ances]
+    res$date <- as.POSIXct(x)[labels(x)]
+    res$ances.date <- as.POSIXct(x)[x$ances]
 
     ## set results as indices rather than labels
     res$ances <- match(res$ances, res$id)
@@ -432,7 +437,7 @@
 
 
     ## ## CONVERSION TO A SEQTRACK-LIKE OBJECT ##
-    xy <- na.omit(x)$xy
+    xy <- x$xy
     res <- as.seqTrack.haploSim(x)
 
     ##     res <- list()



More information about the adegenet-commits mailing list