% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/label_format.R
\name{linf.feature.labels}
\alias{linf.feature.labels}
\title{Format feature labels for dominant-feature assignments and dCSTs}
\usage{
linf.feature.labels(
  feature.ids,
  taxonomy,
  abbreviations = NULL,
  aliases = NULL,
  duplicate.index = c("global", "within_taxon", "none"),
  fallback.to.id = TRUE
)
}
\arguments{
\item{feature.ids}{Character vector of stable feature identifiers.}

\item{taxonomy}{Character vector of taxonomy strings, same length as
\code{feature.ids}.}

\item{abbreviations}{Optional named character vector mapping genus tokens to
display abbreviations, for example \code{c(Lactobacillus = "L.")}.}

\item{aliases}{Optional named character vector mapping full taxonomy strings
to alternate labels, for example \code{c("Ca. Lachnocurva vaginae" = "BVAB1")}.}

\item{duplicate.index}{One of \code{"global"}, \code{"within_taxon"}, or
\code{"none"}. Controls how duplicate display taxa are disambiguated.}

\item{fallback.to.id}{Logical. If \code{TRUE}, missing taxonomy values fall
back to the feature ID.}
}
\value{
Character vector of unique display labels.
}
\description{
Builds unique display labels from stable feature IDs and taxonomy strings.
This is useful when dCST computation should operate on stable internal feature
identifiers (for example \code{asv_4}) while reports and figures should use
human-readable labels such as \verb{L. iners 4}.

Underscores in taxonomy strings are converted to spaces before abbreviation
and aliasing. If multiple features share the same display taxon, an index can
be appended either from the global feature ID (for example \code{asv_4 -> 4}) or
by within-taxon order.
}
\examples{
ids <- c("asv_1", "asv_4", "asv_5", "asv_6")
tax <- c(
  "Lactobacillus iners",
  "Lactobacillus iners",
  "Megasphaera lornae",
  "Ca_Lachnocurva_vaginae"
)
abbr <- c(
  Lactobacillus = "L.",
  Gardnerella = "Gard.",
  Megasphaera = "Mega."
)
aliases <- c(
  "Ca. Lachnocurva vaginae" = "BVAB1",
  "Ca_Lachnocurva_vaginae" = "BVAB1"
)
linf.feature.labels(ids, tax, abbreviations = abbr, aliases = aliases)
}
