Skip to content

Annotate clonality - per-receptor labels for overabundance

Description

[Experimental]

A small family of helpers that add clonality labels to each receptor in an immundata::ImmunData object.

Available functions

  • annotate_clonality_rank() - label by rank bins within each repertoire.
  • annotate_clonality_prop() - label by proportion bins (named thresholds).

annotate_clonality_rank() - for each repertoire, receptors are ordered by within-repertoire abundance (proportion) and assigned a rank bin label.

annotate_clonality_prop() - label each receptor by proportion bin using named thresholds (matched in descending order; else "Ultra-rare").

Usage

annotate_clonality_rank(idata, bins = c(10, 30, 100, 300, 1000, 10000, 1e+05))

annotate_clonality_prop(
  idata,
  bins = c(Hyperexpanded = 0.01, Large = 0.001, Medium = 1e-04, Small = 1e-05, Rare =
    1e-06)
)

Arguments

idata An immundata::ImmunData object.
bins A named numeric vector of thresholds (e.g., c(Hyperexpanded = 1e-2, Large = 1e-3, ...)). Names become bin labels and must be non-empty. Internally sorted in descending order for assignment. Result rows follow the supplied bin order, with "Ultra-rare" last.

Value

An immundata::ImmunData whose $annotations gains:

  • clonal_rank_bin - integer-like label with the applied rank threshold (outside all thresholds -> NA).

An immundata::ImmunData whose $annotations gains:

  • clonal_prop_bin - label from names(bins) or "Ultra-rare".

See Also

  • Per-repertoire summaries: airr_clonality
  • Data container: immundata::ImmunData

Examples

library("immunarch")

idata <- get_test_idata() |> agg_repertoires("Therapy")
idata_rank <- annotate_clonality_rank(idata)
idata_prop <- annotate_clonality_prop(idata)