R/io_metadata_read.R
read_metadata.Rd
This function loads a metadata table from either a file path or a data frame, validates the presence of a column with repertoire file paths, and converts all file paths to absolute paths. It is used to support flexible pipelines for loading bulk or single-cell immune repertoire data across samples.
If the input is a file path, the function attempts to read it with readr::read_delim
.
If the input is a data frame, it checks whether file paths are absolute;
relative paths are only allowed when metadata is loaded from a file.
It warns the user if many of the files listed in the metadata table are missing, and stops execution if none of the files exist.
The column with file paths is normalized and renamed to match the internal filename schema.
read_metadata(metadata, filename_col = "File", delim = "\t", ...)
A metadata table. Can be either:
a data frame with metadata,
or a path to a text/TSV/CSV file that can be read with readr::read_delim
.
A string specifying the name of the column in the metadata table
that contains paths to repertoire files. Defaults to "File"
.
Delimiter used to read the metadata file (if a path is provided). Defaults to "\t"
.
Additional arguments passed to readr::read_delim()
when reading metadata from a file.
A validated and updated metadata data frame with absolute file paths,
and an additional column renamed according to IMD_GLOBALS$schema$filename
.