ImmunData 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_receptor

A 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_repertoire

A 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

receptors

Accessor for the dynamically-created table with receptors.

annotations

Accessor for the annotation-level table (.annotations).

repertoires

Get 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

schema

A character vector specifying the receptor schema (e.g., aggregate fields, ID columns).

annotations

A cell/barcode-level dataset mapping barcodes to receptor rows.

repertoires

A repertoire table, created inside the body of agg_repertoires.


Method clone()

The objects of this class are cloneable with this method.

Usage

ImmunData$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.