convertTranscriptsToGenes: Convert transcripts to genes

convertTranscriptsToGenesR Documentation

Convert transcripts to genes

Description

Convert transcripts to genes

Usage

convertTranscriptsToGenes(object, ...)

## S4 method for signature 'Matrix'
convertTranscriptsToGenes(object, tx2gene, aggregate = TRUE)

## S4 method for signature 'SummarizedExperiment'
convertTranscriptsToGenes(object)

## S4 method for signature 'character'
convertTranscriptsToGenes(object, tx2gene)

## S4 method for signature 'matrix'
convertTranscriptsToGenes(object, tx2gene, aggregate = TRUE)

Arguments

object

Object.

tx2gene

TxToGene. Transcript-to-gene mappings.

aggregate

logical(1). For objects supporting dim(), aggregate counts to gene level and collapse the matrix.

...

Additional arguments.

Value

  • character: factor. Genes in the values, transcripts in the names.

  • matrix, Matrix, SummarizedExperiment: Object containing counts collapsed to gene level by default (see aggregate argument).

Note

For objects containing a count matrix, the object rows will be collapsed to gene level using aggregate(). This applies to our SummarizedExperiment method.

Updated 2021-09-13.

See Also

  • aggregate().

Examples

data(SummarizedExperiment_transcripts, package = "AcidTest")
txse <- SummarizedExperiment_transcripts
object <- txse

t2g <- TxToGene(object)
print(t2g)
transcripts <- rownames(object)
print(transcripts)

## character ====
## Returns as factor.
x <- convertTranscriptsToGenes(transcripts, tx2gene = t2g)
print(x)
str(x)

## matrix ====
## Note that transcript IDs currently must be in the rows.
counts <- counts(object)
print(counts)
## Aggregate to gene level.
x <- convertTranscriptsToGenes(counts, tx2gene = t2g, aggregate = TRUE)
print(x)
colSums(x)
## Simply map to rownames.
x <- convertTranscriptsToGenes(counts, tx2gene = t2g, aggregate = FALSE)
print(x)
colSums(x)

## SummarizedExperiment ====
x <- convertTranscriptsToGenes(object)
print(x)

acidgenomics/r-acidexperiment documentation built on Jan. 17, 2024, 7:56 p.m.