Diversity.API

The Diversity.API submodule provides the API that must be extended for new AbstractTypes, AbstractPartition and AbstractMetacommunity subtypes.

Usage

Providing additional code to extend the functionality of the system is simple:

using Diversity
using Phylo
import Diversity.API: _counttypes

function _counttypes(phy::Phylogeny)
    return phy.nancestral
end

extends Diversity.API._counttypes() (and therefore the directly accessible counttypes() interface) to handle the Phylogeny subtype of AbstractTypes.

Diversity.APIModule
Diversity.API submodule

The Diversity.API submodule should be imported if you want to create a new type, partition or metacommunity subtype. Otherwise it can be ignored.

source
Diversity.API.AbstractMetacommunityType
AbstractMetacommunity{FP <: AbstractFloat,
                      ARaw <: AbstractArray,
                      AProcessed <: AbstractMatrix{FP},
                      Sim <: AbstractTypes,
                      Part <: AbstractPartition}

AbstractMetacommunity is the abstract supertype of all metacommunity types. AbstractMetacommunity subtypes allow you to define how to partition your total metacommunity (e.g. an ecosystem) into smaller components (e.g. subcommunities), and how to assess similarity between individuals within it.

source
Diversity.API.AbstractPartitionType
AbstractPartition

Abstract supertype for all partitioning types. AbstractPartition subtypes allow you to define how to partition your total metacommunity (e.g. an ecosystem) into smaller components (e.g. subcommunities).

source
Diversity.API.AbstractTypesType
AbstractTypes

Abstract supertype for all similarity types. Its subtypes allow you to define how similarity is measured between individuals.

source
Diversity.API._calcabundanceFunction
_calcabundance(t::AbstractTypes, a::AbstractArray)

Calculates the abundance a for AbstractTypes, t (if necessary). May be implemented by each AbstractTypes subtype.

source
Diversity.API._calcordinarinessFunction
_calcordinariness(t::AbstractTypes, a::AbstractArray, scale::Real)

Calculates the ordinariness of abundance a from AbstractTypes, t. May be implemented by each AbstractTypes subtype.

source
Diversity.API._calcsimilarityFunction
_calcsimilarity(t::AbstractTypes, scale::Real)

Retrieves (and possibly calculates) a similarity matrix from t. Must be implemented by each AbstractTypes subtype.

source
Diversity.API._countsubcommunitiesFunction
_countsubcommunities(::AbstractPartition)

Returns number of subcommunities in a partition, p. May be implemented by each AbstractPartition subtype. Default is to count length of subcommunity name vector.

source
Diversity.API._counttypesFunction
_counttypes(::AbstractTypes, raw::Bool)

Returns number of types in an AbstractTypes object, t. May be implemented by each AbstractTypes subtype. raw determines whether to count the number of raw or processed types, which varies, for instance, when the types are determined by a phylogeny. Default is to count length of corresponding types name vector.

source
Diversity.API._getabundanceFunction
_getabundance(m::AbstractMetacommunity, raw::Bool)

Returns the abundances array of the metacommunity. Must be implemented by each AbstractMetacommunity subtype.

source
Diversity.API._getmetaabundanceFunction
_getmetaabundance(m::AbstractMetacommunity, raw::Bool)

Returns the metacommunity abundances of the metacommunity. May be implemented by each AbstractMetacommunity subtype.

source
Diversity.API._getmetaordinariness!Function
_getmetaordinariness!(m::AbstractMetacommunity)

Returns (and possibly calculates) the ordinariness of the metacommunity as a whole. May be implemented by each AbstractMetacommunity subtype.

source
Diversity.API._getordinariness!Function
_getordinariness!(m::AbstractMetacommunity)

Returns (and possibly calculates) the ordinariness array of the subcommunities. May be implemented by each AbstractMetacommunity subtype.

source
Diversity.API._getpartitionFunction
_getpartition(::AbstractMetacommunity)

Returns the AbstractPartition component of the metacommunity. Must be implemented by each AbstractMetacommunity subtype.

source
Diversity.API._getscaleFunction
_getscale(m::AbstractMetacommunity)

Returns a scaling factor for the metacommunity (needed for phylogenetics). Normally ignored. Must be implemented by each AbstractMetacommunity subtype.

source
Diversity.API._getsubcommunitynamesFunction
_getsubcommunitynames(p::AbstractPartition)

Returns the names of the subcommunities in the partition object. Must be implemented by each AbstractPartition subtype.

source
Diversity.API._gettypenamesFunction
_gettypenames(t::AbstractTypes, raw::Bool)

Returns the names of the types in an AbstractTypes object. Must be implemented by each AbstractTypes subtype. raw determines whether to count the number of raw or processed types, which varies, for instance, when the types are determined by a phylogeny.

source
Diversity.API._gettypesFunction
_gettypes(::AbstractMetacommunity)

Returns the AbstractTypes component of the metacommunity. Must be implemented by each AbstractMetacommunity subtype.

source
Diversity.API._getweightFunction
_getweight(m::AbstractMetacommunity)

Returns the subcommunity weights of the metacommunity. May be implemented by each AbstractMetacommunity subtype.

source
Diversity.API.floattypesFunction
floattypes(t)

This function returns a set containing the floating point types that are compatible with the Diversity-related object, t.

source
Diversity.API.mcmatchFunction
mcmatch(procm::AbstractArray, sim::AbstractTypes, part::AbstractPartition)

Checks for type and size compatibility for elements contributing to a Metacommunity

source
Diversity.API.typematchMethod
typematch(args...)

Checks whether the types of a variety of Diversity-related objects have compatible types (using floattypes()).

source