When dataset is a tidy data frame, the function provides a fast way to write a radiator .rad file. The function uses write_fst with a compression level of 85, that work well with RADseq dataset. When the object is a CoreArray Genomic Data Structure (GDS) file system, the function set filters (variants and samples) based on the info found in the file and close the connection with the GDS file.

Used internally in radiator and assigner and might be of interest for users.

write_rad(
  data,
  path = NULL,
  filename = NULL,
  tsv = FALSE,
  internal = FALSE,
  append = FALSE,
  col.names = TRUE,
  write.message = "standard",
  verbose = FALSE
)

Arguments

data

An object in the global environment: tidy data frame or GDS connection file

path

(optional) For tidy data frame, the path to write the data on disk. Default: path = NULL.

filename

(optional) Name of the file (when using tsv files). Default: filename = NULL.

tsv

(optinal, logical) To trigger saving using readr::write_tsv. Default: tsv = FALSE.

internal

(optional, logical) This is used inside radiator internal code and it stops from writting the file. Default: internal = FALSE.

append

(optional, logical) If FALSE, will overwrite existing file. If TRUE, will append to existing file. In both cases, if file does not exist a new file is created. Default: append = FALSE.

col.names

(optional, logical) Write columns names at the top of the file? Must be either TRUE or FALSE. Default: col.names = TRUE.

write.message

(optional, character) Print a message in the console after writting file. With write.message = NULL, nothing is printed in the console. Default: write.message = "standard". This will print message("File written: ", folder_short(filename)).

verbose

(optional, logical) verbose = TRUE to be chatty during execution. Default: verbose = FALSE.

Value

A file written in the working directory or nothing if it's a GDS connection file.

See also

Author

Thierry Gosselin thierrygosselin@icloud.com

Examples

if (FALSE) {
require(SeqArray)
radiator::write_rad(data = tidy.data, path = "data.shark.rad")
radiator::write_rad(data = gds.object)
}