load_star_counts: Load counts from multiple STAR tab-delimited reports

View source: R/load_tsv_counts.R

load_star_countsR Documentation

Load counts from multiple STAR tab-delimited reports

Description

This returns a dataframe where the rows are genes/loci and columns are samples. If files is a named vector, the names are used as sample names; otherwise sample names can be provided by colnames. If not provided, unique strings will be extracted from the report filenames.

Usage

load_star_counts(
  files,
  colnames = names(files),
  stranded = c("unstranded", "read1", "read2")
)

Arguments

files

A character vector with paths to the reports.

colnames

Output column names. If files is a named vector, the names will be used as column names. Otherwise finds a unique string from the report filenames.

stranded

Strandedness of data. Use 'unstranded' for unstranded data, 'read1' if the first read aligns to the RNA, and 'read2' if the second read aligns to the RNA. dUTP-based methods should use 'read2'.

Value

A dataframe where the rows are genes/loci and the columns are samples (when each report corresponds to one sample).

Examples

ddir <- system.file("extdata", package="scopetools")
tsv_files <- Sys.glob(file.path(ddir, '*.ReadsPerGene.out.tab'))

gene_counts <- load_star_counts(tsv_files)

nixonlab/scopetools documentation built on Sept. 30, 2022, 11:15 a.m.