calcAllelicDiveristyPerCountry: Allelic diversity per country or any kind of regions

View source: R/func__geoTempAnalyser__calcAllelicDiversityPerCountry.R

calcAllelicDiveristyPerCountryR Documentation

Allelic diversity per country or any kind of regions

Description

Calculate Simpson's or Shannon's diversity index for alleles per country or any other kind of geographic regions. Each strain must belong to only a single country.

Usage

calcAllelicDiveristyPerCountry(
  sam,
  pam,
  alleles = NULL,
  countries = NULL,
  method = "simpson",
  shannon_base = exp(1)
)

Arguments

sam

A data frame whose first and second columns are strain and country names, respectively.

pam

A binary allelic presence-absence matrix, where row names are strain names and column names are allele names.

alleles

A character vector specifying alleles to be analysed. Keep NULL to include all alleles in pam.

countries

A character vector specifying countries to be considered. Keep NULL to include all countries in pam.

method

A character argument of either "simpson" or "shannon".

shannon_base

The base for Shannon's diversity index. It is not used for Simpson's diveristy index. Default: exp(1).

Value

A list of four elements: c: a matrix of n(countries) by n(alleles) for allele counts per country; d: a named numeric vector of diversity indices. p: the final allelic presence-absence matrix on which the diversity indices are computed. s: isolation information of the final set of strains.

Author(s)

Yu Wan (wanyuac@126.com)


wanyuac/GeneMates documentation built on Aug. 12, 2022, 7:37 a.m.