Assembles the names and files columns that tximeta::tximeta()
requires, checks that every quantification file is actually on disk, and
fails early with the offending sample names rather than part-way through an
import.
Arguments
- quant_dir
Directory holding one subdirectory per sample.
- sample_info
A data frame with one row per sample: the column named by
name_col, plus any experimental covariates you want available to the design formula.- name_col
Name of the column in
sample_infoholding the sample or run identifiers. Defaults to"names".
Value
sample_info with names and files columns added, ready to pass
to tximeta::tximeta().
Examples
# a throwaway quantification directory
qd <- file.path(tempdir(), "quants")
dir.create(file.path(qd, "S1"), recursive = TRUE, showWarnings = FALSE)
dir.create(file.path(qd, "S2"), recursive = TRUE, showWarnings = FALSE)
writeLines("placeholder", file.path(qd, "S1", "quant.sf"))
writeLines("placeholder", file.path(qd, "S2", "quant.sf"))
info <- data.frame(run = c("S1", "S2"), dex = c("untrt", "trt"))
build_coldata(qd, info, name_col = "run")
#> run dex names files
#> 1 S1 untrt S1 /tmp/Rtmp76z1fz/quants/S1/quant.sf
#> 2 S2 trt S2 /tmp/Rtmp76z1fz/quants/S2/quant.sf