Prepare quant files for tximport

prepareTximportFiles(
  files,
  makeNames = c("makeNames", "snakeCase", "camelCase"),
  exists = TRUE
)

Arguments

files

character. Quant file paths (e.g. "quant.sf" for salmon, "abundance.h5" for kallisto). See tximport() for details.

makeNames

character(1). Syntactic name function to apply on sample names. Uses match.arg() internally. See basejump toolkit for details.

exists

logical(1). Check if requested input exists on disk. Runs realpath() internally.

Value

character. Return quant file paths, with valid sample names automatically applied.

Details

Runs the following internal comments:

  1. Extract sample directory name from quant file using dirname() and basename().

  2. Autopad zeros, if necessary, via autopadZeros().

  3. Sanitizes names with snakeCase().

  4. Sorts files alphabetically.

Note

Updated 2019-10-09.

Examples

files <- c( file.path("salmon", "1-sample-A", "quant.sf"), file.path("salmon", "2-sample-B", "quant.sf") ) print(files)
#> [1] "salmon/1-sample-A/quant.sf" "salmon/2-sample-B/quant.sf"
files <- prepareTximportFiles(files, makeNames = "snakeCase", exists = FALSE) print(files)
#> x1_sample_a x2_sample_b #> "salmon/1-sample-A/quant.sf" "salmon/2-sample-B/quant.sf"