matchMetadataToFiles: Match user metadata to file names used for tximport

View source: R/matchMetadataToFiles.R

matchMetadataToFilesR Documentation

Match user metadata to file names used for tximport

Description

Match user metadata to file names used for tximport

Usage

matchMetadataToFiles(metadata, files)

Arguments

metadata

data.frame. User-defined metadata. The function assumes that sample identifiers are defined in the first metadata column.

files

character. Quant file paths passed to tximport::tximport(). Sanitize return from prepareTximportFiles() is recommended.

Value

data.frame. Modified metadata frame, with updated sample identifiers in slotted in first column. Original values are stashed in "originalSampleId".

Note

Updated 2021-06-28.

Examples

metadata <- data.frame(
    "sampleId" = paste(
        seq_len(4L), "sample", LETTERS[seq_len(4L)],
        sep = "_"
    ),
    "condition" = rep(LETTERS[seq_len(2L)], times = 2L)
)
files <- file.path(
    "salmon",
    paste(seq_len(4L), "sample", LETTERS[seq_len(4L)], sep = "-"),
    "quant.sf"
)
## The function will match regardless of row order in user metadata.
files <- rev(files)
print(metadata)
print(files)
matchMetadataToFiles(metadata = metadata, files = files)

steinbaugh/DESeqAnalysis documentation built on June 25, 2022, 7:29 a.m.