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

use check_installed to check whether the suggest pkgs is installed #107

Closed xiangpin closed 1 year ago

xiangpin commented 1 year ago

Description

using check_installed to check whether the suggested package is installed. I think this can avoid confusion when some functions was used but the suggested package is not installed.

Related Issue

Example

> library(treeio)
treeio v1.25.2.001 For help:
https://yulab-smu.top/treedata-book/

If you use the ggtree package suite in published research, please cite
the appropriate paper(s):

LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR
Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu. treeio: an R package
for phylogenetic tree input and output with richly annotated and
associated data. Molecular Biology and Evolution. 2020, 37(2):599-603.
doi: 10.1093/molbev/msz240

Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. Two methods
for mapping and visualizing associated data on phylogeny using ggtree.
Molecular Biology and Evolution. 2018, 35(12):3041-3043.
doi:10.1093/molbev/msy194

S Xu, Z Dai, P Guo, X Fu, S Liu, L Zhou, W Tang, T Feng, M Chen, L
Zhan, T Wu, E Hu, Y Jiang, X Bo, G Yu. ggtreeExtra: Compact
visualization of richly annotated phylogenetic data. Molecular Biology
and Evolution. 2021, 38(9):4039-4042. doi: 10.1093/molbev/msab166
> example(read.treeqza)

rd.trq> qzafile1 <- system.file("extdata/qiime2treeqza", "fasttree-tree.qza", package="treeio")

rd.trq> qzafile2 <- system.file("extdata/qiime2treeqza", "iqt-tree.qza", package="treeio")

rd.trq> qzafile3 <- system.file("extdata/qiime2treeqza", "raxml-cat-tree.qza", package="treeio")

rd.trq> tr1 <- read.treeqza(qzafile1)
ℹ The package "yaml" is required for `read.treeqza()`.
✖ Would you like to install it?

1: Yes
2: No

Selection:
GuangchuangYu commented 1 year ago

We have a yulab.utils:::check_pkg() for similar purpose. This one seems better.