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

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.

Value

No return value.

Details

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

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)
#> Warning: The `path` argument of `write_tsv()` is deprecated as of readr 1.4.0.
#> Please use the `file` argument instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
#> Warning: The `path` argument of `write_lines()` is deprecated as of readr 1.4.0.
#> Please use the `file` argument instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
# Load it and check if it is the same
new_immdata <- repLoad(dirpath)
#> 
#> == Step 1/3: loading repertoire files... ==
#> Processing "/tmp/RtmpCOpgwJ" ...
#>   -- [1/27] Parsing "/tmp/RtmpCOpgwJ/A2-i129.tsv.gz" -- 
#> immunarch
#>   -- [2/27] Parsing "/tmp/RtmpCOpgwJ/A2-i131.tsv.gz" -- 
#> immunarch
#>   -- [3/27] Parsing "/tmp/RtmpCOpgwJ/A2-i132.tsv.gz" -- 
#> immunarch
#>   -- [4/27] Parsing "/tmp/RtmpCOpgwJ/A2-i133.tsv.gz" -- 
#> immunarch
#>   -- [5/27] Parsing "/tmp/RtmpCOpgwJ/A4-i191.tsv.gz" -- 
#> immunarch
#>   -- [6/27] Parsing "/tmp/RtmpCOpgwJ/A4-i192.tsv.gz" -- 
#> immunarch
#>   -- [7/27] Parsing "/tmp/RtmpCOpgwJ/MS1.tsv.gz" -- 
#> immunarch
#>   -- [8/27] Parsing "/tmp/RtmpCOpgwJ/MS2.tsv.gz" -- 
#> immunarch
#>   -- [9/27] Parsing "/tmp/RtmpCOpgwJ/MS3.tsv.gz" -- 
#> immunarch
#>   -- [10/27] Parsing "/tmp/RtmpCOpgwJ/MS4.tsv.gz" -- 
#> immunarch
#>   -- [11/27] Parsing "/tmp/RtmpCOpgwJ/MS5.tsv.gz" -- 
#> immunarch
#>   -- [12/27] Parsing "/tmp/RtmpCOpgwJ/MS6.tsv.gz" -- 
#> immunarch
#>   -- [13/27] Parsing "/tmp/RtmpCOpgwJ/clustalc9941263f910.dnd" -- 
#> unsupported format, skipping
#>   -- [14/27] Parsing "/tmp/RtmpCOpgwJ/clustalc99426f8da55.dnd" -- 
#> unsupported format, skipping
#>   -- [15/27] Parsing "/tmp/RtmpCOpgwJ/clustalc9981263f910.dnd" -- 
#> unsupported format, skipping
#>   -- [16/27] Parsing "/tmp/RtmpCOpgwJ/clustalc99826f8da55.dnd" -- 
#> unsupported format, skipping
#>   -- [17/27] Parsing "/tmp/RtmpCOpgwJ/clustalc9fd1263f910.dnd" -- 
#> unsupported format, skipping
#>   -- [18/27] Parsing "/tmp/RtmpCOpgwJ/clustalc9fd459c5c77.dnd" -- 
#> unsupported format, skipping
#>   -- [19/27] Parsing "/tmp/RtmpCOpgwJ/clustalc9fe1263f910.dnd" -- 
#> unsupported format, skipping
#>   -- [20/27] Parsing "/tmp/RtmpCOpgwJ/clustalc9fe459c5c77.dnd" -- 
#> unsupported format, skipping
#>   -- [21/27] Parsing "/tmp/RtmpCOpgwJ/filec5c817a4858b" -- 
#> unsupported format, skipping
#>   -- [22/27] Parsing "/tmp/RtmpCOpgwJ/filec5c81b5b6f60" -- 
#> unsupported format, skipping
#>   -- [23/27] Parsing "/tmp/RtmpCOpgwJ/filec5c832ec5a13" -- 
#> unsupported format, skipping
#>   -- [24/27] Parsing "/tmp/RtmpCOpgwJ/filec5c839094852" -- 
#> unsupported format, skipping
#>   -- [25/27] Parsing "/tmp/RtmpCOpgwJ/filec5c860b7fdb8" -- 
#> unsupported format, skipping
#>   -- [26/27] Parsing "/tmp/RtmpCOpgwJ/filec5c86e1240f3" -- 
#> unsupported format, skipping
#>   -- [27/27] Parsing "/tmp/RtmpCOpgwJ/metadata.txt" -- 
#> metadata
#> Processing "/tmp/RtmpCOpgwJ/downlit" ...
#>   -- [1/12] Parsing "/tmp/RtmpCOpgwJ/downlit/MASS" -- 
#> unsupported format, skipping
#>   -- [2/12] Parsing "/tmp/RtmpCOpgwJ/downlit/Rtsne" -- 
#> unsupported format, skipping
#>   -- [3/12] Parsing "/tmp/RtmpCOpgwJ/downlit/base" -- 
#> unsupported format, skipping
#>   -- [4/12] Parsing "/tmp/RtmpCOpgwJ/downlit/data.table" -- 
#> unsupported format, skipping
#>   -- [5/12] Parsing "/tmp/RtmpCOpgwJ/downlit/devtools" -- 
#> unsupported format, skipping
#>   -- [6/12] Parsing "/tmp/RtmpCOpgwJ/downlit/dplyr" -- 
#> unsupported format, skipping
#>   -- [7/12] Parsing "/tmp/RtmpCOpgwJ/downlit/factoextra" -- 
#> unsupported format, skipping
#>   -- [8/12] Parsing "/tmp/RtmpCOpgwJ/downlit/fpc" -- 
#> unsupported format, skipping
#>   -- [9/12] Parsing "/tmp/RtmpCOpgwJ/downlit/magrittr" -- 
#> unsupported format, skipping
#>   -- [10/12] Parsing "/tmp/RtmpCOpgwJ/downlit/pkgload" -- 
#> unsupported format, skipping
#>   -- [11/12] Parsing "/tmp/RtmpCOpgwJ/downlit/stats" -- 
#> unsupported format, skipping
#>   -- [12/12] Parsing "/tmp/RtmpCOpgwJ/downlit/utils" -- 
#> unsupported format, skipping
#> 
#> == Step 2/3: checking metadata files and merging files... ==
#> Processing "/tmp/RtmpCOpgwJ" ...
#>   -- Everything is OK!
#> Processing "/tmp/RtmpCOpgwJ/downlit" ...
#>   -- Metadata file not found; creating a dummy metadata...
#> Warning: Unknown or uninitialised column: `Sample`.
#> Warning: Unknown or uninitialised column: `Sample`.
#> 
#> == Step 3/3: processing paired chain data... ==
#> Done!
# 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)