getRPKM: Compute an RPKM matrix based on a RangedSummarizedExperiment...

View source: R/getRPKM.R

getRPKMR Documentation

Compute an RPKM matrix based on a RangedSummarizedExperiment object

Description

For some analyses you might be interested in transforming the counts into RPKMs which you can do with this function.

Usage

getRPKM(rse, length_var = "bp_length", mapped_var = NULL)

Arguments

rse

A RangedSummarizedExperiment-class object as downloaded with download_study.

length_var

A length 1 character vector with the column name from rowData(rse) that has the coding length. For gene level objects from recount this is bp_length. If NULL, then it will use width(rowRanges(rse)) which should be used for exon RSEs.

mapped_var

A length 1 character vector with the column name from colData(rse) that has the number of reads mapped. For recount RSE object this would be mapped_read_count. If NULL (default) then it will use the column sums of the counts matrix. The results are different because not all mapped reads are mapped to exonic segments of the genome.

Details

For gene RSE objects, you will want to specify the length_var because otherwise you will be adjusting for the total gene length instead of the total exonic sequence length of the gene.

Value

A matrix with the RPKM values.

Author(s)

Andrew Jaffe, Leonardo Collado-Torres

See Also

scale_counts

Examples


## get RPKM matrix
rpkm <- getRPKM(rse_gene_SRP009615)

## You can also get an RPKM matrix after running scale_counts()
## with similar RPKM values
rpkm2 <- getRPKM(scale_counts(rse_gene_SRP009615))
rpkm3 <- getRPKM(scale_counts(rse_gene_SRP009615, by = "mapped_reads"))

summary(rpkm - rpkm2)
summary(rpkm - rpkm3)
summary(rpkm2 - rpkm3)

leekgroup/recount documentation built on May 24, 2024, 11:19 a.m.