Skip to content

Convert an immunarch Object into an ImmunData Dataset

Source code

Description

The from_immunarch() function takes an immunarch object (as returned by immunarch::repLoad()), writes each repertoire to a TSV file with an added internal filename column in a specified folder, and then imports those files into an ImmunData object via read_repertoires().

Usage

from_immunarch(
  imm,
  output_folder,
  schema = c("CDR3.aa", "V.name"),
  temp_folder = file.path(tempdir(), "temp_folder")
)

Arguments

imm A list returned by immunarch::repLoad(), typically containing:
  • data: a named list of data.frames, one per repertoire.
  • meta: (optional) a data.frame of sample metadata.
output_folder Path to the output directory where the resulting ImmunData Parquet files will be stored. This directory will be created if it does not already exist.
schema Character vector of column names that together define unique receptors (for example, c(“CDR3.aa”, “V.name”, “J.name”)).
temp_folder Path to a directory where intermediate TSV files will be written. Defaults to file.path(tempdir(), “temp_folder”).

Value

An ImmunData object containing all repertoires from the input immunarch object, with data saved under output_folder.

See Also

read_repertoires(), read_immundata(), ImmunData

Examples

library("immundata")

imm <- immunarch::repLoad("/path/to/your/files")
idata <- from_immunarch(imm,
  schema = c("CDR3.aa", "V.name"),
  temp_folder = tempdir(),
  output_folder = "/path/to/immundata_out"
)