Phylogenetic diversity
When both Diversity
and Phylo
are loaded, we generate Phylogenetic diversity measures, based on Faith PD and extended by Chao.
Usage
Using the functionality in the package is simple:
- Create a tree (using our Phylo package)
- Create a PhyloBranches (AbstractTypes subtype) object from it
- Create a Metacommunity from that
- Calculate diversity!
julia> using Diversity, Phylo
julia> species = ["Dog", "Cat", "Human", "Potato"];
julia> community = [4, 1, 3, 2] ./ 10;
julia> nt = rand(Nonultrametric(species))
RootedTree with 4 tips, 7 nodes and 6 branches.
Leaf names are Dog, Human, Potato and Cat
julia> collect(getbranches(nt))
6-element Vector{LinkBranch{OneRoot, String, Dict{String, Any}, Float64}}:
LinkBranch 7, from node Node 5 to node Human (length 0.48129057007442144).
LinkBranch 8, from node Node 5 to node Potato (length 0.04547304399403693).
LinkBranch 9, from node Node 6 to node Node 5 (length 0.5257296693452039).
LinkBranch 10, from node Node 6 to node Cat (length 1.2058770065006985).
LinkBranch 11, from node Node 7 to node Dog (length 1.0055430448967724).
LinkBranch 12, from node Node 7 to node Node 6 (length 0.07011899861455448).
julia> ph = PhyloBranches(nt);
julia> metaphylo = Metacommunity(community, ph);
julia> leafnames = gettypenames(metaphylo, true)
4-element Vector{String}:
"Dog"
"Human"
"Potato"
"Cat"
julia> meta_gamma(metaphylo, 0)
1×8 DataFrame
│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │
│ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │
├─────┼─────────────────────┼─────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤
│ 1 │ Phylogenetic Branch │ Gamma │ 0 │ types │ │ metacommunity │ │ 3.48192 │
Diversity.API
Diversity.Diversity
Diversity.Ecology
Diversity.Hill
Diversity.Jost
Diversity.ShortNames
Diversity.individualDiversity
Diversity.metacommunityDiversity
Diversity.subcommunityDiversity
Diversity.API.AbstractMetacommunity
Diversity.API.AbstractPartition
Diversity.API.AbstractTypes
Diversity.DiversityLevel
Diversity.DiversityMeasure
Diversity.Gamma
Diversity.GeneralTypes
Diversity.GeneralTypes
Diversity.Metacommunity
Diversity.NormalisedAlpha
Diversity.NormalisedBeta
Diversity.NormalisedRho
Diversity.Onecommunity
Diversity.PowerMeanMeasure
Diversity.RawAlpha
Diversity.RawBeta
Diversity.RawRho
Diversity.RelativeEntropyMeasure
Diversity.Species
Diversity.Subcommunities
Diversity.Taxonomy
Diversity.UniqueTypes
Diversity.API._addedoutputcols
Diversity.API._calcabundance
Diversity.API._calcordinariness
Diversity.API._calcsimilarity
Diversity.API._countsubcommunities
Diversity.API._counttypes
Diversity.API._getabundance
Diversity.API._getaddedoutput
Diversity.API._getdiversityname
Diversity.API._getmetaabundance
Diversity.API._getmetaordinariness!
Diversity.API._getordinariness!
Diversity.API._getpartition
Diversity.API._getscale
Diversity.API._getsubcommunitynames
Diversity.API._gettypenames
Diversity.API._gettypes
Diversity.API._getweight
Diversity.API.floattypes
Diversity.API.mcmatch
Diversity.API.typematch
Diversity.Ecology.generalisedjaccard
Diversity.Ecology.generalisedrichness
Diversity.Ecology.generalisedshannon
Diversity.Ecology.generalisedsimpson
Diversity.Ecology.gower
Diversity.Ecology.jaccard
Diversity.Ecology.pielou
Diversity.Ecology.richness
Diversity.Ecology.shannon
Diversity.Ecology.simpson
Diversity.Hill.hillnumber
Diversity.Jost.jostalpha
Diversity.Jost.jostbeta
Diversity._getmeta
Diversity.addedoutputcols
Diversity.calcsimilarity
Diversity.countsubcommunities
Diversity.counttypes
Diversity.diversity
Diversity.getASCIIName
Diversity.getFullName
Diversity.getName
Diversity.getabundance
Diversity.getaddedoutput
Diversity.getdiversityname
Diversity.getmetaabundance
Diversity.getmetaordinariness!
Diversity.getordinariness!
Diversity.getpartition
Diversity.getsubcommunitynames
Diversity.gettypenames
Diversity.gettypes
Diversity.getweight
Diversity.hassimilarity
Diversity.inddiv
Diversity.metadiv
Diversity.powermean
Diversity.qD
Diversity.qDZ
Diversity.subdiv