-## DNA.R (2008-03-10)
+## DNA.R (2008-06-08)
## Manipulations and Comparisons of DNA Sequences
## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.
+del.gaps <- function(x)
+{
+ deleteGaps <- function(x) {
+ i <- which(x == 4)
+ x[-i]
+ }
+
+ if (class(x) != "DNAbin") x <- as.DNAbin(x)
+ if (is.matrix(x)) {
+ n <- dim(x)[1]
+ y <- vector("list", n)
+ for (i in 1:n) y[[i]] <- x[i, ]
+ x <- y
+ rm(y)
+ }
+ if (!is.list(x)) return(deleteGaps(x))
+ x <- lapply(x, deleteGaps)
+ class(x) <- "DNAbin"
+ x
+}
+
as.alignment <- function(x)
{
if (is.list(x)) n <- length(x)
BF
}
-GC.content <- function(x)
-{
- BF <- base.freq(x)
- sum(BF[2:3])
-}
+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]