YuLab-SMU / treeio

:seedling: Base Classes and Functions for Phylogenetic Tree Input and Output
https://yulab-smu.top/treedata-book/
94 stars 24 forks source link

phyloXML and missing branch lengths #124

Open jvolkening opened 7 months ago

jvolkening commented 7 months ago

Prerequisites

Describe you issue

Ask in right place

Session Info ```r > sessionInfo() R version 4.1.3 (2022-03-10) Platform: x86_64-conda-linux-gnu (64-bit) Running under: Debian GNU/Linux 12 (bookworm) Matrix products: default BLAS/LAPACK: /home/jeremy/miniconda3/envs/vIL4/lib/libopenblasp-r0.3.26.so locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ggtree_3.2.0 treeio_1.27.0.002 lubridate_1.9.2 forcats_1.0.0 [5] stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2 readr_2.1.4 [9] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.4.2 tidyverse_2.0.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.12 pillar_1.9.0 compiler_4.1.3 yulab.utils_0.1.4 [5] tools_4.1.3 aplot_0.1.10 digest_0.6.34 jsonlite_1.8.8 [9] memoise_2.0.1 tidytree_0.4.6 lifecycle_1.0.4 gtable_0.3.3 [13] nlme_3.1-162 timechange_0.2.0 lattice_0.21-8 pkgconfig_2.0.3 [17] rlang_1.1.3 ggplotify_0.1.0 cli_3.6.2 patchwork_1.1.2 [21] parallel_4.1.3 fastmap_1.1.1 withr_3.0.0 gridGraphics_0.5-1 [25] fs_1.6.3 generics_0.1.3 vctrs_0.6.5 hms_1.1.3 [29] grid_4.1.3 tidyselect_1.2.0 glue_1.7.0 R6_2.5.1 [33] fansi_1.0.6 farver_2.1.1 tzdb_0.4.0 magrittr_2.0.3 [37] scales_1.2.1 colorspace_2.1-0 ape_5.7-1 labeling_0.4.2 [41] utf8_1.2.4 stringi_1.8.3 lazyeval_0.2.2 munsell_0.5.0 [45] cachem_1.0.8 ggfun_0.0.9 ```

Recent versions of treeio don't appear to parse the branch lengths of phyloXML files. With version 1.18.0, running:

library(treeio)
library(ggtree)
xmlfile1 <- system.file("extdata/phyloxml", "test_x2.xml", package="treeio")
px1 <- read.phyloxml(xmlfile1)
px1
ggplot(px1) + geom_tree()

prints to the console (truncated):

Phylogenetic tree with 10 tips and 9 internal nodes.

Tip labels:
  t7, t2, t3, t8, t1, t5, ...

Rooted; includes branch lengths.

and plots: v1 18 0

In later versions (tested v1.22 through latest 1.27.0.002 from devtools::install_github("YuLab-SMU/treeio")), running the same code I see:

Phylogenetic tree with 10 tips and 9 internal nodes.

Tip labels:
  t7, t2, t3, t8, t1, t5, ...

Rooted; no branch lengths.

and plots: recent

Expected: phyloXML file containing branch lengths is recognized as such in read.phyloxml

Observed: Resulting tree object does not contain branch lengths

Possibly related to changes in PR #88 ?