phylobase: Base package for phylogenetic structures and comparative data
系統比較のための基本的なパッケージ
- CRAN: http://cran.r-project.org/web/packages/phylobase/index.html
- GitHub: https://github.com/fmichonneau/phylobase
> library(phylobase)
バージョン: 0.8.0
関数名 | 概略 |
---|---|
addData |
Adding data to a phylo4 or a phylo4d object |
as |
Converting between phylo4/phylo4d and other phylogenetic tree formats |
checkPhylo4 |
Validity checking for phylo4 objects |
children |
tree traversal and utility functions |
extractTree |
Get tree from tree+data object |
formatData |
Format data for use in phylo4d objects |
geospiza |
Data from Darwin's finches |
getNode |
node and edge look-up functions |
hasNodeData |
Tests for presence of data associated with |
trees |
stored as phylo4d objects |
hasSingle |
Test trees for polytomies, inline nodes, or reticulation |
labels<- |
Labels for phylo4/phylo4d objects |
multiPhylo-class |
multiPhylo4 and extended classes |
nData |
Retrieves the number of datasets in phylo4d objects |
nNodes |
Methods for S4 phylogeny classes |
owls4 |
'Owls' data from ape |
pdata |
Constructor for pdata (phylogenetic data) class |
pdata-class |
Class "pdata" |
phylo4-class |
The phylo4 class |
phylo4-methods |
Create a phylogenetic tree |
phylo4d |
Combine a phylogenetic tree with data |
phylo4d-class |
phylo4d class |
phylo4vcov-class |
matrix classes for phylobase |
phyloXXYY |
Calculate node x and y coordinates |
phylobase-package |
Utilities and Tools for Phylogenetics |
phylobase.options |
Set or return options of phylobase |
phylobubbles |
Bubble plots for phylo4d objects |
phylog-class |
Class "phylog" |
plotOneTree |
Plot a phylo4 object |
print,phylo4-method |
Displaying phylo4 object |
printphylo4 |
print a phylogeny |
readNexus |
Create a phylo4, phylo4d or data.frame object from a Nexus or a Newick file |
reorder-methods |
reordering trees within phylobase objects show,phylo4d-method Display methods for phylo4d objects |
subset-methods |
Methods for creating subsets of phylogenies |
tdata |
Retrieving or updating tip and node data in phylo4d objects |
tip.data.plot |
Plotting trees and associated data |
treePlot |
Phylogeny plotting |
as
phyloクラス等への変換。
変換できるクラスの例({phylobase}, {ape}, {ade4})...phylo4
, phylo4d
, phylo
, multiPhylo
, multiPhylo4
, phylog
, data.frame
> trString <- "(((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);"
> (tree.owls <- ape::read.tree(text = trString))
Phylogenetic tree with 4 tips and 3 internal nodes.
Tip labels:
[1] "Strix_aluco" "Asio_otus" "Athene_noctua" "Tyto_alba"
Rooted; includes branch lengths.
> class(tree.owls)
[1] "phylo"
> as(object = tree.owls, Class = "phylo4") %>% class()
[1] "phylo4"
attr(,"package")
[1] "phylobase"
> as(object = tree.owls, Class = "phylo4") %>% as(., "phylo4d") %>% class()
[1] "phylo4d"
attr(,"package")
[1] "phylobase"
> as(object = tree.owls, Class = "phylo4") %>% as(., "data.frame") %>% class()
[1] "data.frame"
checkPhylo4
phylo4オブジェクトの確認
> trString <- "(((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);"
> (tree.owls <- ape::read.tree(text = trString))
Phylogenetic tree with 4 tips and 3 internal nodes.
Tip labels:
[1] "Strix_aluco" "Asio_otus" "Athene_noctua" "Tyto_alba"
Rooted; includes branch lengths.
> # 変換には`as()`を使う
> as(object = tree.owls, Class = "phylo4") %>% checkPhylo4() # checkTree(), checkPhylo4Data()
[1] TRUE
extractTree
phylo4dオブジェクト(系統樹とデータ)から系統樹オブジェクトを抽出する
> tree.phylo <- ape::read.tree(text = "((a,b),c);")
> tree <- as(tree.phylo, "phylo4") # phylo4 オブジェクトに変換(dataスロットなし)
> tip.data <- data.frame(size = c(1, 2, 3), row.names = c("a", "b", "c"))
> (treedata <- phylo4d(tree, tip.data)) # phylo4オブジェクト(dataスロットなし)とデータを結合
label node ancestor edge.length node.type size
1 a 1 5 NA tip 1
2 b 2 5 NA tip 2
3 c 3 4 NA tip 3
4 <NA> 4 0 NA root NA
5 <NA> 5 4 NA internal NA
> extractTree(treedata)
label node ancestor edge.length node.type
1 a 1 5 NA tip
2 b 2 5 NA tip
3 c 3 4 NA tip
4 <NA> 4 0 NA root
5 <NA> 5 4 NA internal
geospiza
ダーウィンフィンチのデータ(phylo4dクラス)
> data(geospiza)
> class(geospiza)
[1] "list"
> names(geospiza)
[1] "geospiza.tree" "geospiza.data" "phy" "dat"
> dplyr::glimpse(geospiza@data)
Error in nrow(tbl): trying to get slot "data" from an object of a basic class ("list") with no slots