Skip to contents

Reads more than one column of the RSEM files (for example the expected count, the TPM and the effective length) into tables with the same genes and samples. The values that differential expression tools need together are in one object, and the files are checked once for the same genes in the same order, as in rsem_read(), which does the reading for each value.

Usage

rsem_import(
  data = "data",
  metadata = "metadata.csv",
  assays = c("count", "tpm", "length"),
  species = NULL,
  level = "gene",
  id = "original",
  sample_from = "filename",
  validate_reference = TRUE,
  allow_reorder = FALSE,
  annotation = NULL
)

Arguments

data

Directory that contains the RSEM files.

metadata

Path to the metadata CSV, or NULL to find the files in data (see Input).

assays

One or more of the expr values of rsem_read(); the default is the expected count, the TPM and the effective length.

species

"human" or "mouse". Required with id = "symbol"; the function stops if the gene IDs are of the other species. Not used with id = "original", which works for any organism.

level

"gene" (*.genes.results, the default) or "isoform" (*.isoforms.results).

id

"original" (the default, the gene IDs of the files), "symbol" or "annotation" as in rsem_read(). Unlike there, the default is the original IDs, because the next step is usually a tool that needs one row per RSEM gene.

sample_from

With metadata = NULL: "filename" (the default) or "parent_dir".

validate_reference

Check that every file lists the same transcripts for each gene (the column transcript_id(s)), as set; files made with different references stop the function. Default TRUE; skipped when the column is missing.

allow_reorder

Accept files that have the same IDs in a different order, and put them in the order of the first file. Default FALSE: a different order stops the function, because it usually means the files do not belong together.

annotation

With id = "annotation": a GTF file or a data frame with the columns gene_id and gene_name, as in rsem_biotype_profile(); for a RefSeq GFF3 reference, the GTF that rsem-prepare-reference writes.

Value

A list of class rsem_assays with one table per assay, named as in assays. Every table has the same row and column names, and the attributes of rsem_read() ("gene_ids", "zero_length", "tx2gene") are carried on the list.

Examples

if (FALSE) { # \dontrun{
a <- rsem_import("rsem", assays = c("count", "tpm", "length"))
txi <- rsem_as_tximport(a)
# dds <- DESeq2::DESeqDataSetFromTximport(txi, colData = samples, design = ~ group)
} # }