repSave: Save immune repertoires to the disk

View source: R/io.R

repSaveR Documentation

Save immune repertoires to the disk

Description

The repSave function is deigned to save your data to the disk in desirable format. Currently supports "immunarch" and "vdjtools" file formats.

Usage

repSave(.data, .path, .format = c("immunarch", "vdjtools"), .compress = TRUE)

Arguments

.data

An R dataframe, a list of R dataframes or a list with data and meta where first element is a list of dataframes and the latter is a dataframe with metadata.

.path

A string with the path to the output directory. It should include file name if a single dataframe is provided to .data argument.

.format

A string with desirable format specification. Current options are "immunarch" and "vdjtools".

.compress

A boolean value. Defines whether the output will be compressed or not.

Details

It is not necessary to create directories beforehand. If the provided directory does not exist it will be created automatically.

Value

No return value.

Examples

data(immdata)
# Reduce data to save time on examples
immdata$data <- purrr::map(immdata$data, ~ .x %>% head(10))
dirpath <- tempdir()
# Save the list of repertoires
repSave(immdata, dirpath)
# Load it and check if it is the same
new_immdata <- repLoad(dirpath)
# sum(immdata$data[[1]] != new_immdata$data[[1]], na.rm = TRUE)
# sum(immdata$data[[2]] != new_immdata$data[[2]], na.rm = TRUE)
# sum(immdata$meta != new_immdata$meta, na.rm = TRUE)

immunomind/immunarch documentation built on March 20, 2024, 12:01 p.m.