Skip to contents

Finds every *.genes.results file in rsem_dir, takes the sample ID from the file name (S01.genes.results -> S01), matches the files to the sample_id column of metadata, and imports the counts with tximport(type = "rsem").

Usage

read_rsem_study(
  rsem_dir,
  metadata,
  categorical = character(),
  numeric = character()
)

Arguments

rsem_dir

Directory containing *.genes.results files.

metadata

Path to TSV or CSV metadata with a sample_id column.

categorical

Optional metadata columns to force to categorical.

numeric

Optional metadata columns to force to numeric.

Value

An object of class rsemflow_study.

Details

Import stops when a file lacks the standard RSEM columns, when sample IDs do not match the metadata one-to-one, or when the files do not share an identical gene table (same IDs in the same order, without duplicates).

Metadata columns whose values all parse as numbers become numeric; the rest become factors. Use categorical/numeric to override.

Examples

ex <- system.file("extdata", "example", package = "rsemflow")
study <- read_rsem_study(file.path(ex, "data"), file.path(ex, "metadata.tsv"))
study
#> <rsemflow_study>
#>   samples:  6
#>   genes:    200
#>   metadata: condition, batch, age
#>   created:  2026-10-06 00:37:14 UTC (rsemflow 0.1.1)