Last data update: 2014.03.03

R: Utility functions
getGeneRegionTrackForGvizR Documentation

Utility functions

Description

Utility functions integrating EnsDb objects with other Bioconductor packages.

Usage


## S4 method for signature 'EnsDb'
getGeneRegionTrackForGviz(x, filter=list(),
                                            chromosome=NULL,
                                            start=NULL, end=NULL,
                                            featureIs="gene_biotype")

Arguments

(In alphabetic order)

chromosome

For getGeneRegionTrackForGviz: optional chromosome name to restrict the returned entry to a specific chromosome.

end

For getGeneRegionTrackForGviz: optional chromosomal end coordinate specifying, together with start, the chromosomal region from which features should be retrieved.

featureIs

For getGeneRegionTrackForGviz: whether the gene ("gene_biotype") or the transcript biotype ("tx_biotype") should be returned in column "feature".

filter

A filter object extending BasicFilter or a list of such object(s) to select specific entries from the database (see examples below).

start

For getGeneRegionTrackForGviz: optional chromosomal start coordinate specifying, together with end, the chromosomal region from which features should be retrieved.

x

For toSAF a GRangesList object. For all other methods an EnsDb instance.

Value

For getGeneRegionTrackForGviz: see method description above.

Methods and Functions

getGeneRegionTrackForGviz

Retrieve a GRanges object with transcript features from the EnsDb that can be used directly in the Gviz package to create a GeneRegionTrack. Using the filter, chromosome, start and end arguments it is possible to fetch specific features (e.g. lincRNAs) from the database.

If chromosome, start and end is provided the function internally first retrieves all transcripts that have an exon or an intron in the specified chromosomal region and subsequently fetch all of these transcripts. This ensures that all transcripts of the region are returned, even those that have only an intron in the region.

The function returns a GRanges object with additional annotation columns "feature", "gene", "exon", "exon_rank", "trancript", "symbol" specifying the feature type (either gene or transcript biotype), the (Ensembl) gene ID, the exon ID, the rank/index of the exon in the transcript, the transcript ID and the gene symbol/name.

Author(s)

Johannes Rainer

See Also

BasicFilter transcripts

Examples


library(EnsDb.Hsapiens.v75)
edb <- EnsDb.Hsapiens.v75
######   getGeneRegionTrackForGviz
##
## Get all genes encoded on chromosome Y in the specifyed region.
AllY <- getGeneRegionTrackForGviz(edb, chromosome="Y", start=5000000,
                                  end=7000000)
## We could plot this now using plotTracks(GeneRegionTrack(AllY))

## We can also use filters to further restrict the query to e.g.
## all lincRNA genes encoded in that region.
lincsY <- getGeneRegionTrackForGviz(edb, chromosome="Y", start=5000000,
                                    end=7000000,
                                    filter=GenebiotypeFilter("lincRNA"))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ensembldb)
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: GenomicRanges
Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ensembldb/EnsDb-utils.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getGeneRegionTrackForGviz
> ### Title: Utility functions
> ### Aliases: getGeneRegionTrackForGviz
> ###   getGeneRegionTrackForGviz,EnsDb-method
> ### Keywords: classes
> 
> ### ** Examples
> 
> 
> library(EnsDb.Hsapiens.v75)
> edb <- EnsDb.Hsapiens.v75
> ######   getGeneRegionTrackForGviz
> ##
> ## Get all genes encoded on chromosome Y in the specifyed region.
> AllY <- getGeneRegionTrackForGviz(edb, chromosome="Y", start=5000000,
+                                   end=7000000)
> ## We could plot this now using plotTracks(GeneRegionTrack(AllY))
> 
> ## We can also use filters to further restrict the query to e.g.
> ## all lincRNA genes encoded in that region.
> lincsY <- getGeneRegionTrackForGviz(edb, chromosome="Y", start=5000000,
+                                     end=7000000,
+                                     filter=GenebiotypeFilter("lincRNA"))
Warning messages:
1: In getUTRsByTranscript(x = x, what = "five", columns = columns,  :
  No fiveUTR found!
2: In getUTRsByTranscript(x = x, what = "three", columns = columns,  :
  No threeUTR found!
3: In .local(x, by, ...) : No cds found!
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>