X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2Fread.dna.R;h=ab8051e023afeb2c48c4613348fe360c4dce224c;hb=b0d1251527d8dd48ca1703b1cfaf217f413eda0e;hp=4b2ddd8e2a65dd7b664071251fd17824320a160e;hpb=a0436318d70829a2d16134be7ca1d6d454613a20;p=ape.git diff --git a/R/read.dna.R b/R/read.dna.R index 4b2ddd8..ab8051e 100644 --- a/R/read.dna.R +++ b/R/read.dna.R @@ -1,8 +1,8 @@ -## read.dna.R (2013-01-04) +## read.dna.R (2013-04-02) ## Read DNA Sequences in a File -## Copyright 2003-2012 Emmanuel Paradis +## Copyright 2003-2013 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -11,11 +11,10 @@ read.FASTA <- function(file) { sz <- file.info(file)$size x <- readBin(file, "raw", sz) - if (Sys.info()[1] == "Windows") { - icr <- which(x == as.raw(0x0d)) # CR - x <- x[-icr] - } + icr <- which(x == as.raw(0x0d)) # CR + if (length(icr)) x <- x[-icr] res <- .Call("rawStreamToDNAbin", x, PACKAGE = "ape") + names(res) <- sub("^ +", "", names(res)) # to permit phylosim class(res) <- "DNAbin" res }