A TxTrack displays transcripts and their stucture (exons, coding sequence) along genomic coordinate. It can be constructed from either a TxDb object by TxTrackFromTxDb or a GRanges object by TxTrackFromGRanges.

For the constructing method from GRanges, two necessary meta-columns (“type”, “tx_id”) of the GRanges are required. The “tx_id” indicates grouping, and the “type” can be “exon” or “cds” by which ranges of “cds” will be filled with color. This method can be used together with biovizBase::crunch to fetch gene model in a certain region or of a certain gene from TxDb or EnsDb.

The constructed track may be further modified to adjust color, tooltip, display labels, etc.

Similar to the relationship between GeneTrack and FeatureTrack, when the display method of TxTrack applied to genomic feature that may have gaps on genomic coordinate, e.g. RNA-related features that are mapped to genomic coordinate, it is called GroupFeatureTrack. It can be constructed from a GRangesList object by GroupFeatureTrack function, assuming ranges in each group are on the same strand and do not overlap.

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

## Transcript Track From TxDb

txtrack <- TnT::TxTrackFromTxDb(txdb, height = 400)
TnTGenome(txtrack, view.range = GRanges("chr17", IRanges(41190000, 41290000)))
## Warning in readLines(con): incomplete final line found on '/home/jialin/R/
## x86_64-suse-linux-gnu-library/3.4/TnT/htmlwidgets/trackWidget.yaml'