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.
#>  The deprecated feature was likely used in the immunarch package.
#>   Please report the issue at <https://github.com/immunomind/immunarch/issues>.
#> Warning: The `path` argument of `write_lines()` is deprecated as of readr 1.4.0.
#>  Please use the `file` argument instead.
#>  The deprecated feature was likely used in the immunarch package.
#>   Please report the issue at <https://github.com/immunomind/immunarch/issues>.
# Load it and check if it is the same
new_immdata <- repLoad(dirpath)
#> 
#> == Step 1/3: loading repertoire files... ==
#> Processing "/tmp/RtmpIkoDoX" ...
#>   -- [1/29] Parsing "/tmp/RtmpIkoDoX/A2-i129.tsv.gz" -- 
#> immunarch
#>   -- [2/29] Parsing "/tmp/RtmpIkoDoX/A2-i131.tsv.gz" -- 
#> immunarch
#>   -- [3/29] Parsing "/tmp/RtmpIkoDoX/A2-i132.tsv.gz" -- 
#> immunarch
#>   -- [4/29] Parsing "/tmp/RtmpIkoDoX/A2-i133.tsv.gz" -- 
#> immunarch
#>   -- [5/29] Parsing "/tmp/RtmpIkoDoX/A4-i191.tsv.gz" -- 
#> immunarch
#>   -- [6/29] Parsing "/tmp/RtmpIkoDoX/A4-i192.tsv.gz" -- 
#> immunarch
#>   -- [7/29] Parsing "/tmp/RtmpIkoDoX/MS1.tsv.gz" -- 
#> immunarch
#>   -- [8/29] Parsing "/tmp/RtmpIkoDoX/MS2.tsv.gz" -- 
#> immunarch
#>   -- [9/29] Parsing "/tmp/RtmpIkoDoX/MS3.tsv.gz" -- 
#> immunarch
#>   -- [10/29] Parsing "/tmp/RtmpIkoDoX/MS4.tsv.gz" -- 
#> immunarch
#>   -- [11/29] Parsing "/tmp/RtmpIkoDoX/MS5.tsv.gz" -- 
#> immunarch
#>   -- [12/29] Parsing "/tmp/RtmpIkoDoX/MS6.tsv.gz" -- 
#> immunarch
#>   -- [13/29] Parsing "/tmp/RtmpIkoDoX/clustal128a955ada4d39.dnd" -- 
#> unsupported format, skipping
#>   -- [14/29] Parsing "/tmp/RtmpIkoDoX/clustal128a9573356237.dnd" -- 
#> unsupported format, skipping
#>   -- [15/29] Parsing "/tmp/RtmpIkoDoX/clustal128a965ada4d39.dnd" -- 
#> unsupported format, skipping
#>   -- [16/29] Parsing "/tmp/RtmpIkoDoX/clustal128a9673356237.dnd" -- 
#> unsupported format, skipping
#>   -- [17/29] Parsing "/tmp/RtmpIkoDoX/clustal128c6e32ab5009.dnd" -- 
#> unsupported format, skipping
#>   -- [18/29] Parsing "/tmp/RtmpIkoDoX/clustal128c6e73356237.dnd" -- 
#> unsupported format, skipping
#>   -- [19/29] Parsing "/tmp/RtmpIkoDoX/clustal128c6f32ab5009.dnd" -- 
#> unsupported format, skipping
#>   -- [20/29] Parsing "/tmp/RtmpIkoDoX/clustal128c6f73356237.dnd" -- 
#> unsupported format, skipping
#>   -- [21/29] Parsing "/tmp/RtmpIkoDoX/file126a5511297ec8" -- 
#> unsupported format, skipping
#>   -- [22/29] Parsing "/tmp/RtmpIkoDoX/file126a552052e7e1" -- 
#> unsupported format, skipping
#>   -- [23/29] Parsing "/tmp/RtmpIkoDoX/file126a5548f821de" -- 
#> unsupported format, skipping
#>   -- [24/29] Parsing "/tmp/RtmpIkoDoX/file126a5558ac10ac" -- 
#> unsupported format, skipping
#>   -- [25/29] Parsing "/tmp/RtmpIkoDoX/file126a555de1e223" -- 
#> unsupported format, skipping
#>   -- [26/29] Parsing "/tmp/RtmpIkoDoX/file126a556230dec0" -- 
#> unsupported format, skipping
#>   -- [27/29] Parsing "/tmp/RtmpIkoDoX/file126a5564952c1a" -- 
#> unsupported format, skipping
#>   -- [28/29] Parsing "/tmp/RtmpIkoDoX/file126a5565067f36" -- 
#> unsupported format, skipping
#>   -- [29/29] Parsing "/tmp/RtmpIkoDoX/metadata.txt" -- 
#> metadata
#> Processing "/tmp/RtmpIkoDoX/downlit" ...
#>   -- [1/13] Parsing "/tmp/RtmpIkoDoX/downlit/MASS" -- 
#> unsupported format, skipping
#>   -- [2/13] Parsing "/tmp/RtmpIkoDoX/downlit/Rtsne" -- 
#> unsupported format, skipping
#>   -- [3/13] Parsing "/tmp/RtmpIkoDoX/downlit/base" -- 
#> unsupported format, skipping
#>   -- [4/13] Parsing "/tmp/RtmpIkoDoX/downlit/data.table" -- 
#> unsupported format, skipping
#>   -- [5/13] Parsing "/tmp/RtmpIkoDoX/downlit/devtools" -- 
#> unsupported format, skipping
#>   -- [6/13] Parsing "/tmp/RtmpIkoDoX/downlit/dplyr" -- 
#> unsupported format, skipping
#>   -- [7/13] Parsing "/tmp/RtmpIkoDoX/downlit/factoextra" -- 
#> unsupported format, skipping
#>   -- [8/13] Parsing "/tmp/RtmpIkoDoX/downlit/fpc" -- 
#> unsupported format, skipping
#>   -- [9/13] Parsing "/tmp/RtmpIkoDoX/downlit/magrittr" -- 
#> unsupported format, skipping
#>   -- [10/13] Parsing "/tmp/RtmpIkoDoX/downlit/pkgload" -- 
#> unsupported format, skipping
#>   -- [11/13] Parsing "/tmp/RtmpIkoDoX/downlit/remotes" -- 
#> unsupported format, skipping
#>   -- [12/13] Parsing "/tmp/RtmpIkoDoX/downlit/stats" -- 
#> unsupported format, skipping
#>   -- [13/13] Parsing "/tmp/RtmpIkoDoX/downlit/utils" -- 
#> unsupported format, skipping
#> 
#> == Step 2/3: checking metadata files and merging files... ==
#> Processing "/tmp/RtmpIkoDoX" ...
#>   -- Everything is OK!
#> Processing "/tmp/RtmpIkoDoX/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)