liamrevell / Rphylip

An R interface for PHYLIP.
12 stars 12 forks source link

Error when converting phyDat with as.phylip.data #14

Open tpellard opened 1 year ago

tpellard commented 1 year ago

Trying to convert a phyDat object with User-type sequences from phangorn to phylip format with as.phylip.data produces an error: Error in if (N > printlen) cat(paste("Labels:", paste(rownames(x)[1:min(printlen, : argument is of length zero

Minimal example:

library(Rphylip)
library(phangorn)

download.file("https://github.com/KlausVigo/phangorn/raw/master/data/mites.RData", destfile = "mites.RData")
load("mites.RData")

as.phylip.data(mites)

It seems that this is due to X <- toupper(X) within the as.phylip.data function https://github.com/liamrevell/Rphylip/blob/eee8c6eff145aee4030fb6eb9279e204ddcab5de/Rphylip/R/Rphylip.R#L1164

Running the code without that line solves the problem.