Diversity

Julia package for diversity measurement

https://github.com/ecojulia/diversity.jl

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Committers with academic emails
    3 of 10 committers (30.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary

Keywords

biodiversity diversity-measurement ecology julia partitioning-diversity phylogenetic-diversity

Keywords from Contributors

phylogenetics hack flux interpretability networks the-human-brain meshing standardization statistical-models mixed-models
Last synced: 6 months ago · JSON representation ·

Repository

Julia package for diversity measurement

Basic Info
Statistics
  • Stars: 34
  • Watchers: 4
  • Forks: 9
  • Open Issues: 7
  • Releases: 25
Topics
biodiversity diversity-measurement ecology julia partitioning-diversity phylogenetic-diversity
Created over 11 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Citation Codemeta Zenodo

README.md

Diversity

A package for measuring and partitioning diversity

| Documentation | Build Status | DOI | |:-----------------:|:--------------------------:|:--------------------------:| | stable docs | build tests JuliaNightly | Zenodo | | dev docs | codecov | |

Summary

Diversity is a Julia package that provides functionality for measuring alpha, beta and gamma diversity of metacommunities (e.g. ecosystems) and their constituent subcommunities. It uses the diversity measures described in the arXiv paper arXiv:1404.6520 (q-bio.QM), How to partition diversity. It also provides a series of other older diversity measures through sub-modules. Currently these are all ecological diversity measures, but this will be expanded through interfacing to EcoJulia and BioJulia.

This package is in beta now, but is cross-validated against our R package boydorr/rdiversity, which is developed independently, so please raise an issue if you find any problems. We now use a DataFrame as the common output format for all of the diversity calculations to provide consistency with our R package rdiversity. The code is not optimised for speed at the moment due to the substantial changes that have happened to it under the hood, and the Phylogenetics submodule is also recently revised, and may need further improvements.

Installation

The package is registered in the General registry on v1.x and so can be installed with add. For example on Julia v1.10:

``julia (@v1.10) pkg> add Diversity Resolving package versions... Updating~/.julia/environments/v1.10/Project.toml [d3d5718d] + Diversity v0.5.15 Updating~/.julia/environments/v1.10/Manifest.toml` [d3d5718d] + Diversity v0.5.15

(@v1.10) pkg> ```

Project Status

The package is confirmed to build and work against Julia v1.9 and the current release and the latest release on Linux, macOS, and Windows. It is also tested against nightly.

Contributing and Questions

Contributions are very welcome, as are feature requests and suggestions. Please open an issue if you encounter any problems or would just like to ask a question.

Usage

Diversity Measures

The main package provides basic numbers-equivalent diversity measures (described in Hill, 1973), similarity-sensitive diversity measures (generalised from Hill, and described in Leinster and Cobbold, 2012), and related alpha, beta and gamma diversity measures at the level of the metacommunity and its component subcommunities (generalised in turn from Leinster and Cobbold, and described in arXiv:1404.6520 (q-bio.QM)). The diversity functions exist both with unicode names (e.g. ᾱ()), which are not automatically exported as we feel they are too short and with matching ascii names (e.g. NormalisedAlpha()), which are. We also provide a general function for extract any diversity measure for a series of subcommunity relative abundances.

Getting started

Before calculating diversity a Metacommunity object must be created. This object contains all the information needed to calculate diversity.

```julia

Load the package into Julia

using Diversity

Example population

pop = [1 1 0; 2 0 0; 3 1 4] pop = pop / sum(pop)

Create Metacommunity object

meta = Metacommunity(pop) ```

Calculating diversity

First we need to calculate the low-level diversity component seperately, by passing a metacommunity object to the appropriate function; RawAlpha(), NormalisedAlpha(), RawBeta(), NormalisedBeta(), RawRho(), NormalisedRho(), or Gamma().

```julia

First, calculate the normalised alpha component

component = NormalisedAlpha(meta) ```

Afterwhich, subdiv() or metadiv() are used to calculate subcommunity or metacommunity diversity, respectively (since both subcommunity and metacommunity diversity measures are transformations of the same low-level components, this is computationally more efficient).

```julia

Then, calculate species richness of the subcommunities

subdiv(component, 0)

or the average (alpha) species richness across the whole population

metadiv(component, 0)

We can also generate a diversity profile by calculating multiple q-values simultaneously

df = subdiv(component, 0:30) ```

In some instances, it may be useful to calculate all subcommunity (or metacommunity) measures. In which case, a Metacommunity object may be passed directly to subdiv() or metadiv():

```julia

To calculate all subcommunity diversity measures

subdiv(meta, 0:2)

To calculate all metacommunity diversity measures

metadiv(meta, 0:2) ```

Alternatively, if computational efficiency is not an issue, a single measure of diversity may be calculated directly by calling a wrapper function:

julia norm_sub_alpha(meta, 0:2)

A complete list of these functions is shown below:

  • raw_sub_alpha() : per-subcommunity estimate of naive-community metacommunity diversity
  • norm_sub_alpha() : similarity-sensitive diversity of each subcommunity in isolation
  • raw_sub_rho() : redundancy of individual subcommunities
  • norm_sub_rho() : representativeness of individual subcommunities
  • raw_sub_beta() : distinctiveness of individual subcommunities
  • norm_sub_beta() : per-subcommunity estimate of effective number of distinct subcommunities
  • sub_gamma() : contribution per individual in a subcommunity toward metacommunity diversity
  • raw_meta_alpha() : naive-community metacommunity diversity
  • norm_meta_alpha() : average similarity-sensitive diversity of subcommunities
  • raw_meta_rho() : average redundancy of subcommunities
  • norm_meta_rho() : average representativeness of subcommunities
  • raw_meta_beta() : average distinctiveness of subcommunities
  • norm_meta_beta() : effective number of distinct subcommunities
  • meta_gamma() : metacommunity similarity-sensitive diversity

Phylogenetic diversity

Phylogenetic diversity (described here) is automatically included in the Diversity module when the Phylo package is loaded. Documentation for these diversity measures can be found here. The phylogenetics code relies on the Phylo package to generate trees to incorporate into the diversity code, and the ppropriate code will be created when both main packages are loaded:

```julia-repl julia> using Diversity, Phylo

julia> communities = [4 1; 3 2; 1 0; 0 1] / 12;

julia> nt = rand(Nonultrametric(4)) RootedTree with 4 tips, 7 nodes and 6 branches. Leaf names are tip 1, tip 2, tip 4 and tip 3

julia> metaphylo = Metacommunity(communities, PhyloBranches(nt));

julia> rawmetarho(metaphylo, [1, 2]) 2×8 DataFrame │ Row │ divtype │ measure │ q │ typelevel │ typename │ partitionlevel │ partition_name │ diversity │ │ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │ ├─────┼─────────────────────┼─────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ │ 1 │ Phylogenetic Branch │ RawRho │ 1 │ types │ │ metacommunity │ │ 1.7787 │ │ 2 │ Phylogenetic Branch │ RawRho │ 2 │ types │ │ metacommunity │ │ 1.66749 │ ```

The package also provides some other sub-modules for related measures:

Diversity.Ecology

Many existing ecological diversity measures can be derived from our diversity measures, and so we provide them in the Diversity.Ecology submodule along with generalised versions of them that relate to our general measures of alpha, beta and gamma diversity at subcommunity and metacommunity levels. The generalisations of species richness, Shannon entropy and Simpson's index are the only standard measures we are aware of whose subcommunity components sum directly to the corresponding metacommunity measure (although note that Simpson's index decreases for increased diversity, so small components are more diverse). Documentation for these diversity measures can be found here.

Diversity.Hill

Hill numbers are found in the Diversity.Hill sub-module. Documentation for these diversity measures can be found here.

Diversity.Jost

Lou Jost's diversity measures are found in the Diversity.Jost sub-module. Documentation for these diversity measures is here.

Documentation

Documentation is generated by the Base documentation in Julia and online via the Documenter package.

Using the docs

Accessing the documentation in Julia is easy:

```julia using Diversity

Returns any documentation for the subdiv() function

?subdiv ```

The documentation is also available online.

Latest release

The online documentation for the current stable release is here.

Development branch

The online documentation for the latest dev (unreleased) branch is here.

Owner

  • Name: EcoJulia
  • Login: EcoJulia
  • Kind: organization

Citation (CITATION.bib)

@article{Diversity.jl-2016,
  author        = {Reeve, Richard and Leinster, Tom and Cobbold, Christina A and
                   Thompson, Jill and Brummitt, Neil A and Mitchell, Sonia N and
		   Matthews, Louise},
  title         = {How to partition diversity},
  journal       = {ArXiv e-prints},
  archivePrefix = "arXiv",
  eprint        = {1404.6520},
  eprinttype    = {arxiv},
  primaryClass  = "q-bio.QM",
  keywords      = {Quantitative Biology - Quantitative Methods},
  year          = 2016,
  month         = dec
}

@phdthesis{Diversity.jl-2019,
  author        = {Mitchell, Sonia N},
  title         = {The measurement, dynamics, and interpretation of biological diversity},
  school        = {University of Glasgow},
  year          = 2019,
  address       = {Glasgow, UK}
}

CodeMeta (codemeta.json)

{
  "@context": "https://w3id.org/codemeta/3.0",
  "type": "SoftwareSourceCode",
  "applicationCategory": "ecology",
  "author": [
    {
      "type": "Person",
      "givenName": "Richard",
      "familyName": "Reeve",
      "email": "richard.reeve@glasgow.ac.uk",
      "id": "https://orcid.org/0000-0003-2589-8091",
      "affiliation": [
        {
          "type": "Organization",
          "name": "University of Glasgow",
          "identifier": "https://ror.org/00vtgdb53"
        }
      ]
    },
    {
      "type": "Person",
      "givenName": "Claire",
      "familyName": "Harris",
      "id": "https://orcid.org/0000-0003-0852-2340",
      "affiliation": [
        {
          "type": "Organization",
          "name": "Biomathematics and Statistics Scotland",
          "identifier": "https://ror.org/03jwrz939"
        }
      ]
    }
  ],
  "codeRepository": "https://github.com/EcoJulia/Diversity.jl",
  "dateCreated": "2014-08-31",
  "dateModified": "2024-07-21",
  "datePublished": "2018-08-16",
  "description": "Julia package for measuring diversity",
  "downloadUrl": "https://github.com/EcoJulia/Diversity.jl/archive/refs/tags/v0.5.15.tar.gz",
  "identifier": "10.5281/zenodo.597610",
  "keywords": [
    "EcoJulia",
    "biodiversity",
    "diversity",
    "diversity measurement",
    "ecology",
    "julia",
    "partitioning diversity",
    "phylogenetic diversity"
  ],
  "license": "https://spdx.org/licenses/BSD-2-Clause",
  "name": "Diversity.jl",
  "operatingSystem": [
    "Linux",
    "Windows",
    "macOS"
  ],
  "programmingLanguage": "julia",
  "version": "v0.5.15",
  "codemeta:contIntegration": {
    "id": "https://github.com/EcoJulia/Diversity.jl/actions/workflows/testing.yaml"
  },
  "continuousIntegration": "https://github.com/EcoJulia/Diversity.jl/actions/workflows/testing.yaml",
  "developmentStatus": "active",
  "issueTracker": "https://github.com/EcoJulia/Diversity.jl/issues",
  "referencePublication": "https://arxiv.org/abs/1404.6520",
  "readme": "https://github.com/EcoJulia/Diversity.jl/blob/dev/README.md",
  "buildInstructions": "https://github.com/EcoJulia/Diversity.jl/blob/dev/README.md"
}

GitHub Events

Total
  • Issue comment event: 1
  • Pull request event: 1
  • Create event: 1
Last Year
  • Issue comment event: 1
  • Pull request event: 1
  • Create event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 814
  • Total Committers: 10
  • Avg Commits per committer: 81.4
  • Development Distribution Score (DDS): 0.154
Past Year
  • Commits: 85
  • Committers: 2
  • Avg Commits per committer: 42.5
  • Development Distribution Score (DDS): 0.012
Top Committers
Name Email Commits
Richard Reeve g****t@r****t 689
richardreeve r****e@g****k 90
Isaac Peetoom Heida i****a@g****m 12
Tony Kelman t****y@k****t 9
Claire Harris c****s@b****k 7
Michael Krabbe Borregaard m****d@s****k 2
github-actions[bot] 4****] 2
Michael Hatherly m****y@g****m 1
Elliot Saba s****t@g****m 1
dependabot[bot] 4****] 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 19
  • Total pull requests: 34
  • Average time to close issues: 7 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 6
  • Total pull request authors: 11
  • Average comments per issue: 4.95
  • Average comments per pull request: 4.09
  • Merged pull requests: 30
  • Bot issues: 0
  • Bot pull requests: 4
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • richardreeve (13)
  • PeetoomHeida (2)
  • mkborregaard (1)
  • peter1000 (1)
  • kescobo (1)
  • JuliaTagBot (1)
Pull Request Authors
  • richardreeve (22)
  • dependabot[bot] (4)
  • github-actions[bot] (2)
  • tkelman (2)
  • mkborregaard (1)
  • claireh93 (1)
  • PeetoomHeida (1)
  • soniamitchell (1)
  • MichaelHatherly (1)
  • staticfloat (1)
  • EvoArt (1)
Top Labels
Issue Labels
enhancement (4) testing (1) bug (1)
Pull Request Labels
dependencies (4) enhancement (2) API (1) testing (1)

Packages

  • Total packages: 3
  • Total downloads:
    • julia 1 total
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 4
    (may contain duplicates)
  • Total versions: 95
proxy.golang.org: github.com/ecojulia/diversity.jl
  • Versions: 38
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/EcoJulia/Diversity.jl
  • Versions: 38
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
juliahub.com: Diversity

Julia package for diversity measurement

  • Versions: 19
  • Dependent Packages: 1
  • Dependent Repositories: 4
  • Downloads: 1 Total
Rankings
Dependent repos count: 5.6%
Forks count: 14.5%
Average: 15.2%
Stargazers count: 18.9%
Dependent packages count: 21.6%
Last synced: 6 months ago

Dependencies

.github/workflows/CompatHelper.yaml actions
  • julia-actions/setup-julia latest composite
.github/workflows/TagBot.yaml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/docs.yaml actions
  • actions/checkout v2 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/nightly.yaml actions
  • actions/checkout v2 composite
  • julia-actions/julia-buildpkg latest composite
  • julia-actions/julia-runtest latest composite
  • julia-actions/setup-julia v1 composite
.github/workflows/testing.yaml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • coverallsapp/github-action master composite
  • julia-actions/julia-buildpkg master composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest master composite
  • julia-actions/setup-julia v1 composite
  • r-lib/actions/setup-r master composite
.github/workflows/doc-cleanup.yaml actions
  • actions/checkout v2 composite