X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2FDNA.R;h=dd9c60bb63ace9abfe1350c73664e365ed91ac36;hb=3ad385892d75db5c646c92f0f631ae9c5e3da4f6;hp=d74d1881f432abe4dfbc8042c30da5564c114099;hpb=507aa18c4e3f9312efcb07b90766df1158a39402;p=ape.git diff --git a/R/DNA.R b/R/DNA.R index d74d188..dd9c60b 100644 --- a/R/DNA.R +++ b/R/DNA.R @@ -1,4 +1,4 @@ -## DNA.R (2009-05-19) +## DNA.R (2009-09-06) ## Manipulations and Comparisons of DNA Sequences @@ -274,9 +274,13 @@ GC.content <- function(x) sum(base.freq(x)[2:3]) seg.sites <- function(x) { if (is.list(x)) x <- as.matrix(x) - n <- dim(x) - s <- n[2] - n <- n[1] + if (is.vector(x)) n <- 1 + else { # 'x' is a matrix + n <- dim(x) + s <- n[2] + n <- n[1] + } + if (n == 1) return(integer(0)) ans <- .C("SegSites", x, n, s, integer(s), DUP = FALSE, NAOK = TRUE, PACKAGE = "ape") which(as.logical(ans[[4]]))