Usage
write_qview_xlsx(
qv,
path,
template = NULL,
overwrite = FALSE,
call = rlang::caller_env()
)
write_qview_csv(
qv,
path,
template = NULL,
call = rlang::caller_env(),
overwrite = FALSE
)
write_qview_rds(qv, path, overwrite = FALSE, call = rlang::caller_env())
qview_to_xlsx(
qv,
path,
template = NULL,
overwrite = FALSE,
call = rlang::caller_env()
)
qview_to_csv_dir(
qv,
dir,
template = NULL,
call = rlang::caller_env(),
overwrite = FALSE
)Arguments
- qv
A
qviewobject fromread_qview().- path
Output path. For
write_qview_xlsx()/write_qview_rds()this is a single file path; forwrite_qview_csv()it is the output directory (created if it does not exist).- template
Optional plate-template tibble (from
read_qview_template()) to include as an extra sheet / file.- overwrite
Logical. If
FALSE(the default), an existing file or non-empty CSV directory triggers an error. An existing empty CSV directory is allowed. WithTRUE, CSV replacement accepts only the managed table filenames listed below; unrelated entries, links, and non-regular files are refused. Tables absent from the new object are removed only during this explicit replacement.- call
The execution environment of the calling function. Used for error reporting; experts only.
- dir
Deprecated alias for
pathaccepted byqview_to_csv_dir(). Usepathinstead.
Details
Three writers, one for each common destination. All return the input
qv invisibly so they compose with the pipe.
write_qview_xlsx()– one sheet per parsed table.write_qview_csv()– one CSV per parsed table inside a directory.write_qview_rds()– a single.rdscontaining the fullqviewobject (lossless, the only round-trippable format).
Tables are checked and written into a private staging directory beside the destination before publication. An existing destination is moved to a backup during replacement and restored if publication fails. If that restoration fails, the error names the retained backup. This is not a crash-atomic transaction: process termination, filesystem failure, or concurrent readers/writers can observe an absent destination or leave recovery files. Concurrent writers are not synchronized.
Replacement copies and verifies the existing filesystem permission mode
before publication, including the CSV directory and each managed CSV file
present in both bundles. A new CSV directory is created with mode 0700.
Mode support depends on the operating system and filesystem; ownership
and access-control lists (ACLs) are not copied by these writers.
CSV bundles contain only non-empty tables named metadata, analytes,
well_groups, plate_layout, pixel_intensities, summary_statistics,
concentrations, curve_fit, manifest, segments, and optional
template, each with a .csv suffix. Use a dedicated directory.
CSV and XLSX require one-dimensional atomic columns; RDS retains the
full object, including additional fields and list columns.
Examples
path <- system.file("extdata", "example.Q-View", package = "qviewparsR")
qv <- read_qview(path, verbose = FALSE)
out <- tempfile()
dir.create(out)
qv |>
write_qview_rds(file.path(out, "plate.rds")) |>
write_qview_csv(file.path(out, "plate_csv"))
list.files(out, recursive = TRUE)
#> [1] "plate.rds" "plate_csv/analytes.csv"
#> [3] "plate_csv/concentrations.csv" "plate_csv/curve_fit.csv"
#> [5] "plate_csv/manifest.csv" "plate_csv/metadata.csv"
#> [7] "plate_csv/pixel_intensities.csv" "plate_csv/plate_layout.csv"
#> [9] "plate_csv/segments.csv" "plate_csv/well_groups.csv"