Gene Track and Feature Track

This page describes how to construct a GeneTrack/FeatureTrack from TxDb or GRanges.

suppressPackageStartupMessages({
    library(TnT)
    library(GenomicFeatures)
    library(TxDb.Hsapiens.UCSC.hg19.knownGene)
    library(EnsDb.Hsapiens.v75)
})

Gene Track From TxDb

A GeneTrack can be easily constructed from a TxDb.

txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
gtrack <- TnT::GeneTrackFromTxDb(txdb)
gtrack

To show the track, put the track into a TnTBoard or TnTGenome, optionally specifing the view range with a GRanges object.

TnTGenome(gtrack, view.range = GRanges("chr13", IRanges(32889617, 32973809)) * 0.7)



Feature Track

Feature Track Showing Genes

FeatureTrack is an alias of GeneTrack, in the sense that this display method can be applied to general overlapping genomic features.

Function FeatureTrack can construct a GeneTrack/FeatureTrack from a GRanges object, and gives you more control of the display (i.e. color, feature labels, tooltip).

For example, we first extract the genes as a GRanges object from a EnsDb.

gene <- genes(EnsDb.Hsapiens.v75)
head(gene)

Then we construct the GeneTrack using this GRanges object with FeatureTrack, specifing our custom feature labels, feature colors and tooltips. Finally show the track with TnTGenome.

ensGeneTrack <- TnT::FeatureTrack(gene, tooltip = as.data.frame(gene),
                       names = paste(gene$symbol, " (", gene$gene_biotype, ")", sep = ""),
                       color = TnT::mapcol(gene$gene_biotype, palette.fun = grDevices::rainbow))
TnTGenome(ensGeneTrack, view.range = gene[gene$symbol == "BRCA2"][1] * .7)



Feature Track Showing Alignment

TODO




Session Info

sessionInfo()


Try the TnT package in your browser

Any scripts or data that you put into this service are public.

TnT documentation built on Nov. 8, 2020, 8:11 p.m.