[adegenet-commits] r415 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jun 19 22:17:04 CEST 2009
Author: jombart
Date: 2009-06-19 22:17:03 +0200 (Fri, 19 Jun 2009)
New Revision: 415
Modified:
pkg/R/seqTrack.R
Log:
Fixed major bug in color handling in plotSeqTrack: color was not subsetted for the NAs, and was recycled at the wrong time.
Is now ok.
Modified: pkg/R/seqTrack.R
===================================================================
--- pkg/R/seqTrack.R 2009-06-19 00:13:48 UTC (rev 414)
+++ pkg/R/seqTrack.R 2009-06-19 20:17:03 UTC (rev 415)
@@ -139,7 +139,7 @@
################
plotSeqTrack <- function(x, xy, useArrows=TRUE, annot=TRUE, dateRange=NULL,
col=NULL, bg="grey", add=FALSE, quiet=FALSE,
- showAmbiguous=TRUE, mu0=NULL, chr.length=NULL, prob=0.75,
+ showAmbiguous=FALSE, mu0=NULL, chr.length=NULL, prob=0.75,
plot=TRUE,...){
## CHECKS ##
@@ -153,12 +153,20 @@
isAmbig <- NULL
+ ## RECYCLE COL
+ if(!is.null(col)){
+ col <- rep(col,length=nrow(x))
+ }
+
## SUBSET DATA (REMOVE NAs) ##
isNA <- is.na(x[,2])
x <- x[!isNA,,drop=FALSE]
xy.all <- xy ## used to retrieve all coordinates
xy <- xy[!isNA,,drop=FALSE]
+ if(!is.null(col)){
+ col <- col[!isNA]
+ }
## FIND AMBIGUOUS TEMPORAL ORDERING ##
@@ -181,7 +189,7 @@
## FIND THE COLOR FOR EDGES ##
if(is.null(col)){
if(is.null(mu0) & is.null(chr.length)) {
- col <- "black"
+ col <- rep("black", length(x.from))
} else {
## w <- .pAbeforeB(x$ances.date, x$date, mu0, chr.length, 200) # beware, lots of steps take time
## isAmbig <- w < prob
@@ -216,10 +224,6 @@
## }
- ## recycle col
- col <- rep(col,length=length(x.from))
-
-
## HANDLE RANGE OF DATES ##
if(!is.null(dateRange)){
More information about the adegenet-commits
mailing list