Skip to contents

Creates unique labels for local maxima and minima in a Morse-Smale complex by concatenating two-letter shortcuts of the most abundant taxa. The function ensures uniqueness of labels by iteratively including additional taxa if needed.

Usage

create.lmin.lmax.labels(
  MS.res,
  state.space,
  taxonomy,
  freq.thld = 100,
  min.relAb.thld = 0.05
)

Arguments

MS.res

A list containing Morse-Smale complex results with component MS_cx

state.space

Matrix of ASV counts/abundances with samples as columns and ASVs as rows

taxonomy

Taxonomy information for ASVs

freq.thld

Threshold for frequency filtering (default: 100)

min.relAb.thld

Minimum relative abundance threshold for including taxa in labels (default: 0.05)

Value

A list with four components:

lmax.labels

Named character vector of local maxima labels

lmin.labels

Named character vector of local minima labels

lmax.profiles

Named list of relative abundance profiles for local maxima, where names are point indices and each profile is a matrix with taxa in rows and two columns: species names and their relative abundances

lmin.profiles

Named list of relative abundance profiles for local minima, where names are point indices and each profile is a matrix with taxa in rows and two columns: species names and their relative abundances

Details

The function processes both local maxima and minima, creating unique labels by:

  1. Filtering points by frequency threshold

  2. For each point, identifying taxa above the relative abundance threshold

  3. Creating initial labels using two-letter shortcuts

  4. Ensuring uniqueness by incorporating additional taxa if needed

Examples

if (FALSE) { # \dontrun{
labels <- create.lmin.lmax.labels(MS.res, state.space, taxonomy,
                                  freq.thld = 100, min.relAb.thld = 0.05)
print(labels$lmax.labels)
print(labels$lmin.labels)
} # }