Joins a cohort's (or a validate_manifest() result's) sample_map and
subject_tbl back into one long-format manifest and writes it to a CSV,
TSV, or other delimited file.
Arguments
- x
A Cohort object, or the list returned by
validate_manifest()orread_manifest()(anything withsubject_tblandsample_map).- path
Output file path. The delimiter is chosen from the extension unless
delimis given.- delim
Optional character scalar overriding delimiter detection.
Details
Columns are ordered subject_id, then the other subject-level columns,
then the sample-level columns (assay, sample_id, role, and any
extra ones). A missing value is written as an empty field.
Examples
manifest <- data.frame(
subject_id = "R1",
species = "rat",
assay = "wes",
sample_id = "T1",
role = "tumor",
stringsAsFactors = FALSE
)
parsed <- validate_manifest(manifest)
out <- tempfile(fileext = ".csv")
write_manifest(parsed, out)
readLines(out)
#> [1] "subject_id,species,assay,sample_id,role"
#> [2] "R1,rat,wes,T1,tumor"