ensembldb (version 1.4.6)

lengthOf: Calculating lengths of features

Description

These methods allow to calculate the lengths of features (transcripts, genes, CDS, 3' or 5' UTRs) defined in an EnsDb object or database.

Usage

## S3 method for class 'EnsDb':
lengthOf(x, of="gene", filter=list())

Arguments

filter
list of BasicFilter instance(s) to select specific entries from the database (see examples below).
of
for lengthOf: whether the length of genes or transcripts should be retrieved from the database.
x
For lengthOf: either an EnsDb or a GRangesList object. For all other methods an EnsDb instance.

Value

  • For lengthOf: see method description above.

See Also

exonsBy transcripts transcriptLengths

Examples

Run this code
library(EnsDb.Hsapiens.v75)
edb <- EnsDb.Hsapiens.v75

#####    lengthOf
##
## length of a specific gene.
lengthOf(edb,
         filter=list(GeneidFilter("ENSG00000000003")))

## length of a transcript
lengthOf(edb, of="tx",
         filter=list(TxidFilter("ENST00000494424")))

## average length of all protein coding genes encoded on chromosomes X
## and Y
mean(lengthOf(edb, of="gene",
              filter=list(GenebiotypeFilter("protein_coding"),
                  SeqnameFilter(c("X", "Y")))))

## average length of all snoRNAs
mean(lengthOf(edb, of="gene",
              filter=list(GenebiotypeFilter("snoRNA"),
                  SeqnameFilter(c("X", "Y")))))

##### transcriptLengths
##
## Calculate the length of transcripts encoded on chromosome Y, including
## length of the CDS, 5' and 3' UTR.
##len <- transcriptLengths(edb, with.cds_len=TRUE, with.utr5_len=TRUE,
##                         with.utr3_len=TRUE, filter=SeqnameFilter("Y"))
##head(len)

Run the code above in your browser using DataLab