### R Example: Loading treeio and Getting Help Source: https://rdrr.io/bioc/treeio/src/R/offspring This R snippet demonstrates how to load the `treeio` package and access its documentation for the `offspring.treedata` function using the `help()` command. This is a common way to get started with an R package. ```R library(treeio) help(offspring.treedata) ``` -------------------------------- ### Example Usage of treeio Package and .onAttach Help Source: https://rdrr.io/bioc/treeio/src/R/zzz This R code demonstrates how to load the treeio package into an R session and access the help documentation specifically for the `.onAttach` function. It provides a quick way to get information about the package's startup behavior and other functions. ```R library(treeio) help(.onAttach) ``` -------------------------------- ### Example R Code to Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/newick This R code demonstrates how to load the 'treeio' package and access the documentation for the 'read.newick' function using the `help()` command. This is useful for quickly exploring package functionalities in an R environment. ```R library(treeio) help(read.newick) ``` -------------------------------- ### R Example: Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/sequence-utilities Demonstrates how to load the `treeio` package into an R session and access the documentation for a specific function, `guess_fasta_type`, using the `help()` command. ```R library(treeio) help(guess_fasta_type) ``` -------------------------------- ### R Usage Example: Loading treeio and Getting Help Source: https://rdrr.io/bioc/treeio/src/R/mega Demonstrates how to load the `treeio` R package and access the help documentation for the `read.mega_tabular` function using `library()` and `help()`. ```R library(treeio) help(read.mega_tabular) ``` -------------------------------- ### R Example: Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/mask A simple R snippet demonstrating how to load the `treeio` package and access the help documentation for the `mask` function. ```R library(treeio) help(mask) ``` -------------------------------- ### Load and Get Help for treeio Package in R Source: https://rdrr.io/bioc/treeio/src/tests/testthat This R code snippet shows how to load the 'treeio' package and then access its help documentation. This is a common way for users to get started with a package, understand its functionalities, and explore available functions and examples. ```R library(treeio) help(treeio) ``` -------------------------------- ### Load and Get Help for treeio R Package Source: https://rdrr.io/bioc/treeio/f/inst/doc/treeio Demonstrates how to load the treeio package into an R session using `library()` and how to access its comprehensive help documentation using `help()`. This is a standard procedure for starting to use an R package. ```R library(treeio) help(treeio) ``` -------------------------------- ### Example: Reading HYPHY Output with treeio::read.hyphy Source: https://rdrr.io/bioc/treeio/man/read.hyphy Demonstrates how to use the `read.hyphy` function to load HYPHY output files. It uses `system.file` to locate example data files within the `treeio` package. ```R nwk <- system.file("extdata/HYPHY", "labelledtree.tree", package="treeio") ancseq <- system.file("extdata/HYPHY", "ancseq.nex", package="treeio") read.hyphy(nwk, ancseq) ``` -------------------------------- ### R Example: Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/merge_tree This R snippet demonstrates how to load the 'treeio' package and access the help documentation for the 'merge_tree' function directly within an R console or script. ```R library(treeio) help(merge_tree) ``` -------------------------------- ### R: Loading treeio and Accessing Documentation Source: https://rdrr.io/bioc/treeio/src/R/write-beast This snippet demonstrates how to load the `treeio` R package and access its help documentation for the `write_beast_newick` function. This is a common pattern for users to get started with a package and explore its functionalities. ```R library(treeio) help(write_beast_newick) ``` -------------------------------- ### Load and Get Help for the `treeio` R Package Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-r8s This R code snippet shows how to load the `treeio` package into the current R session using `library()` and then access its documentation using `help()`. This is a standard way to start using and learning about an R package. ```R library(treeio) help(treeio) ``` -------------------------------- ### R Example: Loading treeio Package and Getting Function Help Source: https://rdrr.io/bioc/treeio/src/R/jplace This R code snippet demonstrates basic interaction with the 'treeio' package. It loads the 'treeio' library into the R session, making its functions available, and then uses the 'help()' function to display the documentation for the 'getnewplacements' function, which is likely part of or related to the 'treeio' package, providing quick access to its usage details. ```R library(treeio) help(getnewplacements) ``` -------------------------------- ### Example: Reading a Sample Phylip File in R Source: https://rdrr.io/bioc/treeio/man/read.phylip Illustrates how to read a sample phylip file using the `read.phylip` function. It shows how to locate an example file provided within the `treeio` package and then parse it. The output is a 'phylip' S4 object containing tree and sequence alignment information. ```R phyfile <- system.file("extdata", "sample.phy", package="treeio") read.phylip(phyfile) ``` -------------------------------- ### R Example: Loading treeio and Accessing Documentation Source: https://rdrr.io/bioc/treeio/src/R/method-drop-tip This snippet demonstrates how to load the treeio package and access the help documentation for the drop.tip.treedata function using the help() function in R. ```R library(treeio) help(drop.tip.treedata) ``` -------------------------------- ### R: Example Usage of read.codeml Source: https://rdrr.io/bioc/treeio/src/R/codeml Demonstrates how to use the `read.codeml` function by loading example `rst` and `mlc` files from the `treeio` package's `extdata` directory and then calling the function with these file paths. ```R rstfile <- system.file("extdata/PAML_Codeml", "rst", package="treeio") mlcfile <- system.file("extdata/PAML_Codeml", "mlc", package="treeio") read.codeml(rstfile, mlcfile) ``` -------------------------------- ### Load and Get Help for treeio Package in R Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-merge-tree This R code snippet shows how to load the `treeio` package into the R session and access its help documentation, providing a quick way to get started with the package. ```R library(treeio) help(treeio) ``` -------------------------------- ### R Example: Loading treeio Package and Accessing Help Source: https://rdrr.io/bioc/treeio/src/R/method-nodeid This R code snippet demonstrates the basic steps to load the `treeio` package into an R session using `library()` and how to access specific function documentation, such as for `nodelab.treedata`, using the `help()` function. ```R library(treeio) help(nodelab.treedata) ``` -------------------------------- ### R Example: Loading treeio Package and Accessing Help Source: https://rdrr.io/bioc/treeio/src/R/iqtree This R code demonstrates how to load the `treeio` package into an R session using `library()` and how to access the help documentation for a specific function, `read.iqtree`, within the package using `help()`. ```R library(treeio) help(read.iqtree) ``` -------------------------------- ### R Example: Loading treeio and Accessing Help Source: https://rdrr.io/bioc/treeio/src/R/AllGenerics This short R snippet demonstrates how to load the treeio package into an R session and how to access the help documentation for a specific function, isTip, using the help() function. ```R library(treeio) help(isTip) ``` -------------------------------- ### R: Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/codeml Shows how to load the `treeio` package into the R session and then access the help documentation for the `read.codeml` function using the `help()` command. ```R library(treeio) help(read.codeml) ``` -------------------------------- ### R Example: Loading treeio Package and Help Source: https://rdrr.io/bioc/treeio/src/R/paml_rst This R code snippet demonstrates how to load the `treeio` package into the R session and how to access the help documentation for a specific function, `read.paml_rst`, using the `help()` function. ```R library(treeio) help(read.paml_rst) ``` -------------------------------- ### Basic treeio Package Usage (R) Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-treedata-accessor Provides a simple example of loading the `treeio` package and accessing its help documentation within an R environment. ```R library(treeio) help(treeio) ``` -------------------------------- ### Example Usage of read.raxml in R Source: https://rdrr.io/bioc/treeio/man/read.raxml Demonstrates how to use the `read.raxml` function to parse a RAxML bootstrapping analysis output file from the `treeio` package's example data. ```R raxml_file <- system.file("extdata/RAxML", "RAxML_bipartitionsBranchLabels.H3", package="treeio") read.raxml(raxml_file) ``` -------------------------------- ### Load treeio Package and Get Help in R Source: https://rdrr.io/bioc/treeio/src/R/raxml2nwk This R snippet demonstrates how to load the `treeio` package into the R session and access the help documentation for the `raxml2nwk` function. This is a common way to start using an R package and learn about its functions. ```R library(treeio) help(raxml2nwk) ``` -------------------------------- ### Load treeio package and get help in R Source: https://rdrr.io/bioc/treeio/src/R/ape Demonstrates how to load the `treeio` package and access its documentation for a specific function, `is.rooted.treedata`, using the `help()` function. ```R library(treeio) help(is.rooted.treedata) ``` -------------------------------- ### Example Usage of read.paml_rst function in R Source: https://rdrr.io/bioc/treeio/man/read.paml_rst An R code example demonstrating how to use the `read.paml_rst` function to load an rst file from the 'treeio' package's example data. ```R rstfile <- system.file("extdata/PAML_Baseml", "rst", package="treeio") read.paml_rst(rstfile) ``` -------------------------------- ### Install treeio R Package Development Version from GitHub Source: https://rdrr.io/bioc/treeio/f/README This snippet provides the R commands to install the development version of the 'treeio' package directly from GitHub. It assumes 'devtools' is installed or suggests installing it first. ```R ## install.packages("devtools") devtools::install_github("GuangchuangYu/treeio") ``` -------------------------------- ### R Example: Load treeio Package and Access Help Source: https://rdrr.io/bioc/treeio/src/R/jtree This R code snippet demonstrates how to load the `treeio` package into an R session using `library()` and how to access the help documentation for a specific function, `write.jtree`, using `help()`. ```R library(treeio) help(write.jtree) ``` -------------------------------- ### Loading and Accessing Help for treeio Package in R Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-fulljoin This R code snippet shows the basic commands to load the `treeio` package into an R session and access its main help documentation, useful for initial setup and exploration. ```R library(treeio) help(treeio) ``` -------------------------------- ### R: Example Parsing HYPHY Ancestral Sequences Source: https://rdrr.io/bioc/treeio/man/read.hyphy.seq Demonstrates a practical example of using `read.hyphy.seq` in R to load ancestral sequence data from a sample HYPHY output file included with the `treeio` package. ```R ancseq <- system.file("extdata/HYPHY", "ancseq.nex", package="treeio") read.hyphy.seq(ancseq) ``` -------------------------------- ### R: Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/tree-subset This R snippet demonstrates how to load the `treeio` package and access its documentation for the `tree_subset.treedata` function using the `help()` command. ```R library(treeio) help(tree_subset.treedata) ``` -------------------------------- ### Example Usage of read.codeml in R Source: https://rdrr.io/bioc/treeio/man/read.codeml Demonstrates how to use the `read.codeml` function in R to parse PAML codeml output files by specifying the rst and mlc file paths, typically retrieved from package examples. ```R rstfile <- system.file("extdata/PAML_Codeml", "rst", package="treeio") mlcfile <- system.file("extdata/PAML_Codeml", "mlc", package="treeio") read.codeml(rstfile, mlcfile) ``` -------------------------------- ### Load and Get Help for treeio R Package Source: https://rdrr.io/bioc/treeio/index Demonstrates how to load the treeio package into an R session and access its help documentation. ```R library(treeio) help(treeio) ``` -------------------------------- ### Displaying treeio R Package Example Output Source: https://rdrr.io/bioc/treeio/man/read.jplace This snippet shows a console output example from the 'treeio' R package, demonstrating the S3 method overwrite, package version, citation information, and the structure of a 'treedata' S4 object loaded from a '.jplace' file. It details the phylogenetic tree's characteristics like tip labels, rooting status, branch lengths, and available features. ```R Registered S3 method overwritten by 'treeio': method from root.phylo ape treeio v1.14.3 For help: https://yulab-smu.top/treedata-book/ If you use treeio in published research, please cite: 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 'treedata' S4 object that stored information of '/usr/lib/R/site-library/treeio/extdata/sample.jplace'. ...@ phylo: Phylogenetic tree with 13 tips and 12 internal nodes. Tip labels: A, B, C, D, E, F, ... Rooted; includes branch lengths. with the following features available: 'nplace'. ``` -------------------------------- ### Loading and Getting Help for treeio Package Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-as-phylo This R code snippet shows how to load the `treeio` package into the R environment and how to access its comprehensive help documentation. ```R library(treeio) help(treeio) ``` -------------------------------- ### R: Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/method-as-treedata This snippet demonstrates how to load the `treeio` R package and access documentation for a specific function, `as.phylo.hclust_node`, using the `help()` function. ```R library(treeio) help(as.phylo.hclust_node) ``` -------------------------------- ### R: Load treeio and get help Source: https://rdrr.io/bioc/treeio/src/R/phangorn An interactive R snippet demonstrating how to load the `treeio` package and access the help documentation for the `matrix2vector.phyDat.item` function. ```R library(treeio) help(matrix2vector.phyDat.item) ``` -------------------------------- ### R Package Usage: Load and Get Help Source: https://rdrr.io/bioc/treeio/src/R/rescale_tree This R snippet demonstrates how to load the `treeio` package and access the help documentation for the `rescale_tree` function within an R environment. ```R library(treeio) help(rescale_tree) ``` -------------------------------- ### R: Usage Example for drop.tip Method Source: https://rdrr.io/bioc/treeio/man/drop.tip-methods Illustrates the basic syntax for calling the 'drop.tip' method on phylogenetic tree objects in R, including its S4 method for 'phylo' signatures. ```R drop.tip(object, tip, ...) drop.tip(object, tip, ...) ## S4 method for signature 'phylo' drop.tip(object, tip, ...) ``` -------------------------------- ### Load and Get Help for treeio R Package Source: https://rdrr.io/bioc/treeio/f/README This snippet demonstrates basic R commands to load the 'treeio' package and access its help documentation, typically used when trying out the package in an interactive R environment. ```R library(treeio) help(treeio) ``` -------------------------------- ### R: Load treeio Package and Get Help Source: https://rdrr.io/bioc/treeio/src/R/ASTRAL This R snippet demonstrates how to load the `treeio` package into the R session and how to access the help documentation for the `read.astral` function, providing quick access to its usage details. ```R library(treeio) help(read.astral) ``` -------------------------------- ### R: Load treeio package and get help Source: https://rdrr.io/bioc/treeio/src/R/full-join This snippet demonstrates how to load the `treeio` package in R and access the help documentation for the `full_join.phylo` function, useful for interactive exploration. ```R library(treeio) help(full_join.phylo) ``` -------------------------------- ### R Example: Loading treeio Package and Accessing Help Source: https://rdrr.io/bioc/treeio/src/R/method-groupClade This snippet demonstrates how to load the `treeio` package in R and access the help documentation for the `groupClade.treedata` function. ```R library(treeio) help(groupClade.treedata) ``` -------------------------------- ### Load treeio and Get Help for get.tree Source: https://rdrr.io/bioc/treeio/src/R/method-as-phylo This R snippet demonstrates how to load the `treeio` package and access the help documentation for the `get.tree` function within an R environment. ```R library(treeio) help(get.tree) ``` -------------------------------- ### Example Usage of treeio Package in R Source: https://rdrr.io/bioc/treeio/src/R/phylip This snippet demonstrates how to load the `treeio` package and access help documentation for a specific function, `getPhyInfo`, within an R environment. ```R library(treeio) help(getPhyInfo) ``` -------------------------------- ### Load and Get Help for treeio R Package Source: https://rdrr.io/bioc/treeio/src/R/AllClasses This R code snippet demonstrates how to load the 'treeio' package into the R session and access its help documentation. It's a common first step when working with a new R package. ```R library(treeio) help(treeio) ``` -------------------------------- ### Load and Get Help for treeio Package in R Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-tree-subset This snippet shows how to load the `treeio` package and access its help documentation in an R environment. ```R library(treeio) help(treeio) ``` -------------------------------- ### R Package Startup Message and Citation for treeio Source: https://rdrr.io/bioc/treeio/src/R/zzz This R function, `.onAttach`, is executed when the treeio package is loaded. It displays a startup message including the package version and a citation request for published research using the package, guiding users on how to properly acknowledge its use. ```R globalVariables(".") ##' @importFrom utils packageDescription .onAttach <- function(libname, pkgname) { pkgVersion <- packageDescription(pkgname, fields="Version") msg <- paste0(pkgname, " v", pkgVersion, " ", "For help: https://yulab-smu.top/treedata-book/", "\n\n") citation <- paste0("If you use ", pkgname, " in published research, please cite:\n\n", "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\n" ) packageStartupMessage(paste0(msg, citation)) } ``` -------------------------------- ### Load treeio Package and Get Help in R Source: https://rdrr.io/bioc/treeio/src/R/paml This R code demonstrates how to load the 'treeio' package into the current R session and then access its documentation for the 'read.dnds_mlc' function, which opens the help page for that specific function. ```R library(treeio) help(read.dnds_mlc) ``` -------------------------------- ### Load treeio and Get Help (R) Source: https://rdrr.io/bioc/treeio/src/R/tree-utilities This snippet demonstrates how to load the `treeio` package and access help documentation for a specific function, `getNodeName`, in an R environment. ```R library(treeio) help(getNodeName) ``` -------------------------------- ### Loading and Getting Help for treeio Package in R Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-jplace This R snippet shows how to load the `treeio` package into the R session and access its help documentation, providing an entry point for users to explore its functionalities. ```R library(treeio) help(treeio) ``` -------------------------------- ### Basic `treeio` Package Usage in R Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-access-related-nodes This snippet demonstrates how to load the `treeio` package and access its help documentation, providing a starting point for users to explore its functionalities. ```R library(treeio) help(treeio) ``` -------------------------------- ### Load treeio package and get help in R Source: https://rdrr.io/bioc/treeio/src/R/sibling This R code demonstrates how to load the `treeio` package into the R environment and access the documentation for the `sibling.phylo` function using the `help()` command, which is useful for understanding function usage and parameters. ```R library(treeio) help(sibling.phylo) ``` -------------------------------- ### Load treeio Package and Get Help in R Source: https://rdrr.io/bioc/treeio/src/R/print This R code demonstrates how to load the 'treeio' package into the R session and how to access the documentation for a specific function, 'print.treedataList', using the 'help()' function. ```R library(treeio) help(print.treedataList) ``` -------------------------------- ### Load treeio Package and Get Help for has.slot in R Source: https://rdrr.io/bioc/treeio/src/R/utilities This snippet demonstrates how to load the `treeio` R package and access its documentation for the `has.slot` function using the `help()` command. This is typically used to explore package functionalities in an R environment. ```R library(treeio) help(has.slot) ``` -------------------------------- ### Load treeio Package and Access read.nhx Help (R) Source: https://rdrr.io/bioc/treeio/src/R/nhx Demonstrates how to load the `treeio` R package into the current session and access the help documentation for the `read.nhx` function, useful for interactive exploration. ```R library(treeio) help(read.nhx) ``` -------------------------------- ### Install treeio R Package Source: https://rdrr.io/bioc/treeio/index Instructions to install the treeio package from Bioconductor using BiocManager. It first checks if BiocManager is installed and installs it if not, then proceeds to install treeio. ```R if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("treeio") ``` -------------------------------- ### R: Load treeio Package and Access Documentation Source: https://rdrr.io/bioc/treeio/src/R/beast This R code snippet demonstrates how to load the 'treeio' package into the R session using `library()` and how to access the help documentation for a specific function, `read.trans_beast`, within that package using `help()`. This is a standard way to begin using and understanding functions from an installed R package. ```R library(treeio) help(read.trans_beast) ``` -------------------------------- ### Install treeio R Package from Bioconductor Source: https://rdrr.io/bioc/treeio/f/README This snippet provides the R commands to install the released version of the 'treeio' package from Bioconductor. It first checks for 'BiocManager' and installs it if necessary, then proceeds with the 'treeio' installation. ```R ## try http:// if https:// URLs are not supported if (!requireNamespace("BiocManager", quietly=TRUE)) install.packages("BiocManager") ## BiocManager::install("BiocUpgrade") ## you may need this BiocManager::install("treeio") ``` -------------------------------- ### Loading treeio and Accessing Help Source: https://rdrr.io/bioc/treeio/src/R/method-reroot This simple R snippet demonstrates how to load the `treeio` package into an R session and then access the detailed help documentation for the `root.treedata` method, which is useful for understanding its usage and parameters. ```R library(treeio) help(root.treedata) ``` -------------------------------- ### R Function: read.paml_rst Definition and Documentation Source: https://rdrr.io/bioc/treeio/src/R/paml_rst Defines the `read.paml_rst` function in R, which reads RST output files from PAML (baseml and codeml) and constructs a `treedata` object. The function processes phylogenetic tree and ancestral sequence data. It includes Roxygen comments detailing its purpose, parameters (`rstfile`, `type`), return value, author, and an example of how to get a sample file path. ```R ##' read rst file from paml (both baseml and codeml) output ##' ##' ##' @title read.paml_rst ##' @param rstfile rst file ##' @param type one of 'Marginal' or 'Joint' ##' @return A \code{treedata} object ##' @export ##' @author Guangchuang Yu \url{https://guangchuangyu.github.io} ##' @examples ##' rstfile <- system.file("extdata/PAML_Baseml", "rst", package="treeio") ##' read.paml_rst(rstfile) read.paml_rst <- function(rstfile, type = "Joint") { phylo <- read.phylo_paml_rst(rstfile) seqs <- read.ancseq_paml_rst(rstfile, by = type) seq_type <- get_seqtype(seqs[1]) seqs <- string2DNAbin(seqs) tip_seq <- seqs[labels(seqs) %in% phylo$tip.label] anc_seq <- seqs[!labels(seqs) %in% phylo$tip.label] res <- new("treedata", treetext = read.treetext_paml_rst(rstfile), phylo = phylo, seq_type = seq_type, anc_seq = anc_seq, tip_seq = tip_seq, file = filename(rstfile), info = list(type = type) ) set_substitution(res) } ``` -------------------------------- ### R: Example Usage of Nnode for Random Tree Source: https://rdrr.io/bioc/treeio/man/Nnode.treedata An R code example demonstrating how to use the `Nnode` function with a randomly generated tree (`rtree(30)`) to count its nodes. ```R Nnode(rtree(30)) ``` -------------------------------- ### R: Load treeio Package and Access Help Source: https://rdrr.io/bioc/treeio/src/R/hyphy This snippet demonstrates how to load the `treeio` R package into the current session using `library()` and how to access the help documentation for a specific function, `get_seqtype`, using `help()`. ```R library(treeio) help(get_seqtype) ``` -------------------------------- ### Load and get help for treeio R package Source: https://rdrr.io/bioc/treeio/f/vignettes/treeio This R code demonstrates how to load the 'treeio' package into the current R session using `library()` and how to access its help documentation using `help()`, providing an entry point for users to explore the package's functionalities. ```R library(treeio) help(treeio) ``` -------------------------------- ### APIDOC: read.astral Function Reference and Example Source: https://rdrr.io/bioc/treeio/src/R/ASTRAL Documents the `read.astral` function, which parses ASTRAL output Newick text. It details parameters, return values, and provides an example of how to use the function with a sample Newick string. ```APIDOC Function: read.astral Description: parse ASTRAL output newick text Parameters: file: ASTRAL Newick file Returns: treedata object ``` ```R tt <- paste0( "((species1,(species2,species3)'[pp1=0.75;pp2=0.24;pp3=0.01]':", "1.2003685744180805)'[pp1=0.98;pp2=0.02;pp3=0]':0.9679599282730038,", "((species4,species5)'[pp1=0.88;pp2=0.11;pp3=0.01]':1.2454851536484994))" ) read.astral(textConnection(tt)) ``` -------------------------------- ### Example Usage of read.nhx in R Source: https://rdrr.io/bioc/treeio/man/read.nhx Demonstrates how to use the 'read.nhx' function in R to read an NHX file. The example retrieves a sample NHX file ('ADH.nhx') from the 'treeio' package's 'extdata' directory and then processes it. ```R nhxfile <- system.file("extdata/NHX", "ADH.nhx", package="treeio") read.nhx(nhxfile) ``` -------------------------------- ### Example Usage of tree_subset Function Source: https://rdrr.io/bioc/treeio/man/tree_subset Demonstrates how to use the `tree_subset` function to subset a phylogenetic tree and visualize it with `ggtree`. This example shows how to extract a subtree based on a specified node ('A') and a number of levels back (3), then plot it with tip and node labels. ```R ## Not run: nwk <- system.file("extdata", "sample.nwk", package="treeio") tree <- read.tree(nwk) sub_tree <- tree_subset(tree, node = "A", levels_back = 3) ggtree(sub_tree) + geom_tiplab() + geom_nodelab() ## End(Not run) ``` -------------------------------- ### R treeio: Load Package and Access Help Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-nhx This R code snippet shows how to load the 'treeio' package into the R session using `library()` and how to access its documentation and help files using the `help()` function, which is a common first step when working with a new R package. ```R library(treeio) help(treeio) ``` -------------------------------- ### Example: Reading ASTRAL Newick Text with read.astral in R Source: https://rdrr.io/bioc/treeio/man/read.astral This R code example demonstrates how to use the `read.astral` function to parse a sample ASTRAL Newick string directly from a text connection, illustrating its basic usage and expected input format. ```R tt <- paste0( "((species1,(species2,species3)'[pp1=0.75;pp2=0.24;pp3=0.01]':", "1.2003685744180805)'[pp1=0.98;pp2=0.02;pp3=0]':0.9679599282730038,", "((species4,species5)'[pp1=0.88;pp2=0.11;pp3=0.01]':1.2454851536484994))" ) read.astral(textConnection(tt)) ``` -------------------------------- ### R Example for Reading PhyloXML Files with treeio Source: https://rdrr.io/bioc/treeio/man/read.phyloxml This R code snippet demonstrates how to use the `read.phyloxml` function from the `treeio` package to load phylogenetic tree data. It shows examples of reading single and multiple phyloxml files, and inspecting the resulting `treedata` objects. ```R xmlfile <- system.file("extdata/phyloxml", "test_x2.xml", package="treeio") px <- read.phyloxml(xmlfile) px xmlfile2 <- system.file("extdata/phyloxml", "phyloxml_examples.xml", package="treeio") px2 <- read.phyloxml(xmlfile2) class(px2) ``` -------------------------------- ### Load R Package and Access Function Help Source: https://rdrr.io/bioc/treeio/src/R/codeml_mlc This R code snippet demonstrates the basic steps to load an installed R package, 'treeio', into the current session and then access the help documentation for a specific function, 'read.codeml_mlc', which is part of that package. This is a common procedure for users to understand how to use functions within a new package. ```R library(treeio) help(read.codeml_mlc) ``` -------------------------------- ### Example Output: Phylogenetic Tree in NEXUS Format from treeio Source: https://rdrr.io/bioc/treeio/man/write.beast This snippet displays a phylogenetic tree in NEXUS format, generated as an example output from the treeio R package. It includes taxonomic labels for 16 taxa and a detailed tree structure with branch lengths and node annotations (Ev, S, ND). This format is commonly used for phylogenetic data exchange. ```NEXUS #NEXUS [R-package treeio, Mon Dec 21 06:10:01 2020] BEGIN TAXA; DIMENSIONS NTAX = 16; TAXLABELS Prayidae_D27SS7@2825365 Kephyes_ovata@2606431 Chuniphyes_multidentata@1277217 Apolemia_sp_@1353964 Bargmannia_amoena@263997 Bargmannia_elongata@946788 Physonect_sp_@2066767 Stephalia_dilata@2960089 Frillagalma_vityazi@1155031 Resomia_ornicephala@3111757 Lychnagalma_utricularia@2253871 Nanomia_bijuga@717864 Cordagalma_sp_@1525873 Rhizophysa_filiformis@3073669 Hydra_magnipapillata@52244 Ectopleura_larynx@3556167 ; END; BEGIN TREES; TRANSLATE 1 Prayidae_D27SS7@2825365, 2 Kephyes_ovata@2606431, 3 Chuniphyes_multidentata@1277217, 4 Apolemia_sp_@1353964, 5 Bargmannia_amoena@263997, 6 Bargmannia_elongata@946788, 7 Physonect_sp_@2066767, 8 Stephalia_dilata@2960089, 9 Frillagalma_vityazi@1155031, 10 Resomia_ornicephala@3111757, 11 Lychnagalma_utricularia@2253871, 12 Nanomia_bijuga@717864, 13 Cordagalma_sp_@1525873, 14 Rhizophysa_filiformis@3073669, 15 Hydra_magnipapillata@52244, 16 Ectopleura_larynx@3556167 ; TREE * UNTITLED = [&R] (((1[&Ev=S,S=58,ND=0]:0.0682841,(2[&Ev=S,S=69,ND=1]:0.0193941,3[&Ev=S,S=70,ND=2]:0.0121378)[&Ev=S,S=60,ND=3]:0.0217782)[&Ev=S,S=36,ND=4]:0.0607598,((4[&Ev=S,S=31,ND=9]:0.11832,(((5[&Ev=S,S=37,ND=10]:0.0144549,6[&Ev=S,S=38,ND=11]:0.0149723)[&Ev=S,S=33,ND=12]:0.0925388,7[&Ev=S,S=61,ND=13]:0.077429)[&Ev=S,S=24,ND=14]:0.0274637,(8[&Ev=S,S=52,ND=15]:0.0761163,((9[&Ev=S,S=53,ND=16]:0.0906068,10[&Ev=S,S=54,ND=17]:1e-06)[&Ev=S,S=45,ND=18]:1e-06,((11[&Ev=S,S=65,ND=19]:0.120851,12[&Ev=S,S=71,ND=20]:0.133939)[&Ev=S,S=56,ND=21]:1e-06,13[&Ev=S,S=64,ND=22]:0.0693814)[&Ev=S,S=46,ND=23]:1e-06)[&Ev=S,S=40,ND=24]:0.0333823)[&Ev=S,S=35,ND=25]:1e-06)[&Ev=D,S=24,ND=26]:0.0431861)[&Ev=S,S=19,ND=27]:1e-06,14[&Ev=S,S=26,ND=28]:0.22283)[&Ev=S,S=17,ND=29]:0.0292362)[&Ev=D,S=17,ND=8]:0.185603,(15[&Ev=S,S=16,ND=5]:0.0621782,16[&Ev=S,S=15,ND=6]:0.332505)[&Ev=S,S=12,ND=7]:0.185603)[&Ev=S,S=9,ND=30]; END; ``` -------------------------------- ### Get Number of Nodes (Nnode.treedata) Source: https://rdrr.io/bioc/treeio/src/R/ancestor Returns the total number of nodes (internal and tips) in a 'treedata' object. ```APIDOC Nnode: Returns the number of nodes in a treedata object. ``` -------------------------------- ### API Documentation for treeio Package Methods Source: https://rdrr.io/bioc/treeio/src/R/AllGenerics Detailed API documentation for core methods in the treeio R package, outlining their purpose, parameters, return values, and usage. This includes get.placements, isTip, get.treetext, and drop.tip. ```APIDOC APIDOC for treeio Methods: Method: get.placements Description: access placement information Parameters: tree: tree object ...: additional parameters Returns: placement tibble Method: isTip Description: whether the node is a tip Parameters: .data: phylo, treedata or tbl_tree object .node: node number ...: additional parameters Returns: logical value Author: Guangchuang Yu Method: get.treetext Description: access tree text (newick text) from tree object Parameters: object: treedata object ...: additional parameter Returns: phylo object Method: drop.tip Description: drop.tip method Parameters: object: A treedata or phylo object tip: a vector of mode numeric or character specifying the tips to delete ...: additional parameters Returns: updated object ``` -------------------------------- ### Get Node Number (getNodeNum) Source: https://rdrr.io/bioc/treeio/src/R/ancestor Retrieves the numerical identifier for a specific node within a phylogenetic tree. ```APIDOC getNodeNum: Retrieves the node number. ``` -------------------------------- ### API Reference for `Nnode.treedata` Function Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-r8s Documentation for the `Nnode.treedata` function, used to get the number of nodes in a `treedata` object. ```APIDOC Function: Nnode.treedata Description: Returns the number of nodes in a treedata object. ``` -------------------------------- ### Loading and Accessing Help for the treeio R Package Source: https://rdrr.io/bioc/treeio/src/R/reexport This R code snippet illustrates the basic steps to load the `treeio` package into an R session using `library()` and how to access its comprehensive help documentation using `help()`. This is a standard procedure for initiating work with any R package and exploring its functionalities. ```R library(treeio) help(treeio) ``` -------------------------------- ### Get Tree Text Representation (get.treetext method) Source: https://rdrr.io/bioc/treeio/src/R/ancestor Retrieves the Newick or similar text representation of a phylogenetic tree. ```APIDOC get.treetext method: Retrieves the tree's text representation. ``` -------------------------------- ### Nnode.treedata Function Source: https://rdrr.io/bioc/treeio/man API documentation for the 'Nnode.treedata' function in the treeio R package, used for getting the number of nodes in a treedata object. ```APIDOC Nnode ``` -------------------------------- ### Load and Get Help for R treeio Package Source: https://rdrr.io/bioc/treeio/src/tests/testthat/test-beast This R code snippet demonstrates how to load the 'treeio' package into the current R session using `library()` and then access its help documentation using `help()`. It's a common initial step when working with a new R package. ```R library(treeio) help(treeio) ``` -------------------------------- ### API Documentation for read.beast Function Source: https://rdrr.io/bioc/treeio/src/R/beast Formal documentation for the `read.beast` function, detailing its purpose, parameters, return value, dependencies, author, and usage examples. ```APIDOC Function: read.beast Description: read beast/mrbayes/mega Nexus output Parameters: file: beast file (type: string) Returns: treedata object Imports: ape::read.nexus Exported: Yes Author: Guangchuang Yu (https://guangchuangyu.github.io) Examples: file <- system.file("extdata/BEAST", "beast_mcc.tree", package="treeio") read.beast(file) ``` -------------------------------- ### APIDOC: drop.tip Method Documentation Source: https://rdrr.io/bioc/treeio/man/drop.tip-methods Comprehensive documentation for the 'drop.tip' method in the 'treeio' package, detailing its purpose, parameters, return value, and origin as a wrapper for 'ape::drop.tip'. ```APIDOC Function: drop.tip Description: Removes specified tips from a phylogenetic tree object. Parameters: object: A treedata or phylo object. tip: A vector of mode numeric or character specifying the tips to delete. ...: Additional parameters. Returns: updated object Source: Wrapper method of ape::drop.tip from the ape package. ``` -------------------------------- ### Load treeio Package and Access Help Source: https://rdrr.io/bioc/treeio/f/NEWS This R code snippet demonstrates how to load the 'treeio' package into the R session and how to access its built-in help documentation. It's a standard way to begin using and learning about an R package's functionalities. ```R library(treeio) help(treeio) ```