ImmunData: A Unified Structure for Immune Receptor Repertoire Data
Source:R/core_immundata.R
ImmunData.RdImmunData is an abstract R6 class for managing and transforming immune receptor repertoire data.
It supports flexible backends (e.g., Arrow, DuckDB, dbplyr) and lazy evaluation,
and provides tools for filtering, aggregation, and receptor-to-repertoire mapping.
Public fields
schema_receptorA named list describing how to interpret receptor-level data. This includes the fields used for aggregation (e.g.,
CDR3,V_gene,J_gene), and optionally unique identifiers for each receptor row. Used to ensure consistency across processing steps.schema_repertoireA named list defining how barcodes or annotations should be grouped into repertoires. This may include sample-level metadata (e.g.,
sample_id,donor_id) used to define unique repertoires.
Active bindings
receptorsAccessor for the dynamically-created table with receptors.
annotationsAccessor for the annotation-level table (
.annotations).repertoiresGet a vector of repertoire names after data aggregation with
agg_repertoires()
Methods
Method new()
Creates a new ImmunData object.
This constructor expects receptor-level and barcode-level data,
along with a receptor schema defining aggregation and identity fields.
Usage
ImmunData$new(schema, annotations, repertoires = NULL)Arguments
schemaA character vector specifying the receptor schema (e.g., aggregate fields, ID columns).
annotationsA cell/barcode-level dataset mapping barcodes to receptor rows.
repertoiresA repertoire table, created inside the body of agg_repertoires.