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

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/getRPKM.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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)

recount documentation built on Dec. 20, 2020, 2:01 a.m.