countAllelesPerYear: Count alleles per year

View source: R/func__geoTempAnalyser__countAllelesPerYear.R

countAllelesPerYearR Documentation

Count alleles per year

Description

Count alleles per year

Usage

countAllelesPerYear(
  alleles = NULL,
  sam,
  mapping,
  apam,
  nul_count = NA,
  nul_freq = NA,
  combine = NULL
)

Arguments

alleles

A character vector of allele names.

sam

A data frame of sample information. Required columns: Strain, Country, Year_low and Year_up.

mapping

A data frame in the output of lmm or findPhysLink.

apam

Allelic presence-absence matrix.

nul_count

A value for zero counts. It can be zero definitely, but setting it to NA makes it easier to draw a heat map.

nul_freq

A value for zero frequency.

combine

A named list defining periods when counts of each allele are added up to make a new count. Each element in this list is an integer vector of years. For example, combine = list("1985-2005" = c(1985, 1986, 1988, 2005)). The vector must not contain a single element.

Value

A list of three elements: count, freq, n (number of strains per year), w (weighted counts per strain) and mapping. When combine is a list, another two elements called comb_count, comb_freq and period are included.

Author(s)

Yu Wan (wanyuac@126.com)

Examples

a_yr <- countAllelesPerYear(alleles = nwk$V$allele, sam = sam, mapping = assoc$mapping,
                            apam = assoc$alleles$A, nul = -30)


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