https://github.com/banhbio/metaphylo.jl
Phylogenetic trees with metadata by Julia based on Graphs.jl and AbstractTrees.jl.
https://github.com/banhbio/metaphylo.jl
biodiversity bioinformatics julia phylogeny
Last synced: 4 months ago
JSON representation
Phylogenetic trees with metadata by Julia based on Graphs.jl and AbstractTrees.jl.
- Host: GitHub
- URL: https://github.com/banhbio/metaphylo.jl
- Owner: banhbio
- License: mit
- Created: 2023-01-11T02:32:36.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-22T02:41:23.000Z (over 2 years ago)
- Last Synced: 2025-06-12T15:09:28.813Z (4 months ago)
- Topics: biodiversity, bioinformatics, julia, phylogeny
- Language: Julia
- Homepage:
- Size: 240 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MetaPhylo
[](https://banhbio.github.io/MetaPhylo.jl/stable/)
[](https://banhbio.github.io/MetaPhylo.jl/dev/)
[](https://github.com/banhbio/MetaPhylo.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/banhbio/MetaPhylo.jl)
[](https://zenodo.org/badge/latestdoi/587552550)`MetaPhylo.jl` is Julia package for dealing with phylogenetic trees.
This package is in the early stage of development and probably has many bugs (especially around Newick format). Bug reports and any suggestions are welcomeπ!## Acknowledgements
`MetaPhylo.jl` is inspired by [MetaGraphs.jl](https://github.com/JuliaGraphs/MetaGraphs.jl) and implemented with [Graphs.jl](https://github.com/JuliaGraphs/Graphs.jl) and [AbstractTrees.jl](https://github.com/JuliaCollections/AbstractTrees.jl).## Example
```julia
julia> import Pkg; Pkg.add("MetaPhylo");julia> using MetaPhylo
julia> tree = parse_newick("((A:0.1,B:0.2)100:0.3,((C:0.4,D:0.5)77:0.6,E:0.7)98:0.8,F:0.9);", MetaPhylo.Tree{Int, UnRooted, ReRootable})
MetaPhylo.Tree with 6 leaves.
Rooted: false
Rerootable: truejulia> print_tree(tree)
1: [root]
ββ 2: [value:100.0, length:0.3]
β ββ 3: [length:0.1] label:"A"
β ββ 4: [length:0.2] label:"B"
ββ 5: [value:98.0, length:0.8]
β ββ 6: [value:77.0, length:0.6]
β β ββ 7: [length:0.4] label:"C"
β β ββ 8: [length:0.5] label:"D"
β ββ 9: [length:0.7] label:"E"
ββ 10: [length:0.9] label:"F"julia> tree[3]
Dict{Symbol, Any} with 1 entry:
:label => "A"julia> tree[5,6]
Dict{Symbol, Any} with 2 entries:
:value => 77.0
:length => 0.6julia> findnodes(tree, :label => isequal("A"))
1-element Vector{Int64}:
3julia> findbranches(tree, :value => x -> x β₯ 90)
1-element Vector{Graphs.SimpleGraphs.SimpleEdge{Int64}}:
Edge 1 => 2
Edge 1 => 5julia> @time big_tree = Newick.File("/path/to/big_tree") |> MetaPhylo.Tree{Int, UnRooted, ReRootable}
3.394991 seconds (23.63 M allocations: 1.180 GiB, 32.24% gc time)
MetaPhylo.Tree with 54327 leaves.
Rooted: false
Rerootable: truejulia> freeze(big_tree)
MetaPhylo.StaticTree with 54327 leaves.
Rooted: false
branch_data: NamedTuple{(:length,), Tuple{Float64}}
node_data: NamedTuple{(), Tuple{}}
```