tximport
imports transcript-level estimates from various
external software and optionally summarizes abundances, counts, and transcript lengths
to the gene-level (default) or outputs transcript-level matrices
(see txOut
argument).
While tximport
summarizes to the gene-level by default,
the user can also perform the import and summarization steps manually,
by specifing txOut=TRUE
and then using the function summarizeToGene
.
Note however that this is equivalent to tximport
with
txOut=FALSE
(the default).
tximport(files, type = c("none", "kallisto", "salmon", "sailfish", "rsem"), txIn = TRUE, txOut = FALSE, countsFromAbundance = c("no", "scaledTPM", "lengthScaledTPM"), tx2gene = NULL, reader = read.delim, geneIdCol, txIdCol, abundanceCol, countsCol, lengthCol, importer, collatedFiles, ignoreTxVersion = FALSE)
summarizeToGene(txi, tx2gene, ignoreTxVersion = FALSE, countsFromAbundance = c("no", "scaledTPM", "lengthScaledTPM"))
tximport
, only used by summarizeToGene
tximport
: Import tx-level quantifications and summarize
abundances, counts and lengths to gene-level (default)
or simply output tx-level matrices summarizeToGene
: Summarize tx-level matrices to gene-level
tx2gene
data.frame linking transcripts to genes (more below)
txOut=TRUE
geneIdCol
to an appropriate column in the files
See vignette('tximport')
for example code for generating a
tx2gene
data.frame from a TxDb
object.
Note that the keys
and select
functions used
to create the tx2gene
object are documented
in the man page for AnnotationDb-class objects
in the AnnotationDbi package (TxDb inherits from AnnotationDb).
For further details on generating TxDb objects from various inputs
see vignette('GenomicFeatures')
from the GenomicFeatures package.
Version support: The last known supported versions of the external quantifiers are: kallisto 0.42.4, Salmon 0.6.0, Sailfish 0.9.0, RSEM 1.2.11.
# load data for demonstrating tximport
# note that the vignette shows more examples
# including how to read in files quickly using the readr package
library(tximportData)
dir <- system.file("extdata", package="tximportData")
samples <- read.table(file.path(dir,"samples.txt"), header=TRUE)
files <- file.path(dir,"salmon", samples$run, "quant.sf")
names(files) <- paste0("sample",1:6)
# tx2gene links transcript IDs to gene IDs for summarization
tx2gene <- read.csv(file.path(dir, "tx2gene.csv"))
txi <- tximport(files, type="salmon", tx2gene=tx2gene)
Run the code above in your browser using DataLab