addGeneLengths: Add gene lengths

Description Usage Arguments Details Value Examples

Description

Add gene lengths to an SingleCellExperiment object

Usage

1
2
addGeneLengths(sce, method = c("generate", "sample"), loc = 7.9,
  scale = 0.7, lengths = NULL)

Arguments

sce

SingleCellExperiment to add gene lengths to.

method

Method to use for creating lengths.

loc

Location parameter for the generate method.

scale

Scale parameter for the generate method.

lengths

Vector of lengths for the sample method.

Details

This function adds simulated gene lengths to the rowData slot of a SingleCellExperiment object that can be used for calculating length normalised expression values such as TPM or FPKM. The generate method simulates lengths using a (rounded) log-normal distribution, with the default loc and scale parameters based on human protein-coding genes. Alternatively the sample method can be used which randomly samples lengths (with replacement) from a supplied vector.

Value

SingleCellExperiment with added gene lengths

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Default generate method
sce <- simpleSimulate()
sce <- addGeneLengths(sce)
head(rowData(sce))
# Sample method (human coding genes)
## Not run: 
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(GenomicFeatures)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
tx.lens <- transcriptLengths(txdb, with.cds_len = TRUE)
tx.lens <- tx.lens[tx.lens$cds_len > 0, ]
gene.lens <- max(splitAsList(tx.lens$tx_len, tx.lens$gene_id))
sce <- addGeneLengths(sce, method = "sample", lengths = gene.lens)

## End(Not run)

Granoia/splatter-mod documentation built on May 28, 2019, 12:31 a.m.