Usage of Gviz's GeneRegionTrack
1
0
Entering edit mode
rubi ▴ 110
@rubi-6462
Last seen 5.7 years ago

Hi,

I posted a question regarding using Gviz's GeneRegionTrack on http://stackoverflow.com/questions/41421785/customizing-gvizs-plottracks-function but since Gviz is not a keyword I'm posting this here as well.

 

Hope this is acceptable.

 

gviz • 3.2k views
ADD COMMENT
1
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.6 years ago
Switzerland

I think that there are a bunch of things in this worth commenting:

First of all, Gviz supports GTF files straight out of the box. Rather than importing those and trying to manipulate the ranges, you could simply provide the path to the file. Indeed there is a bunch of additional stuff in that annotation file, and you may want to clean this up prior to plotting:

options(ucscChromosomeNames=FALSE)
gm <- GeneRegionTrack("~/Downloads/gencode.v25.chr_patch_hapl_scaff.annotation.gtf", chromosome="chr12")
gm <- gm[gene(gm) == "ENSG00000161791.13" & feature(gm) %in% c("CDS", "UTR")]

You will also need to tell Gviz which of the regions are now UTRs by providing the thinBoxFeature display parameter:

plotTracks(gm, thinBoxFeature="UTR")

The reason why you do not see all UTR regions in your plot has to do with the limited horizontal space and the somewhat erratic behaviour of collapsing. If you would provide a somewhat wider plotting device, or turn of collapsing altogether you should get the desired result:

plotTracks(gm, thinBoxFeature="UTR", collapse=FALSE)

Hope that help,

Florian

PS: instead of loading your gene models from a GTF file, why don't you make use of the TxDB packages in Bioconductor, or load the gene model data from UCSC (using the UcscTrack class, they also give you the Gencode annotations) or from Ensembl (using the BiomartGeneRegionTrack class).   

bmTrack <- as(BiomartGeneRegionTrack(genome="hg38", symbol="FMNL3"), "GeneRegionTrack")
bmTrack <- bmTrack[symbol(bmTrack) == "FMNL3"]
seqlevels(ranges(bmTrack)) <- "chr12"
chromosome(bmTrack) <- "chr12"
plotTracks(list(GenomeAxisTrack(), gm, bmTrack), thinBoxFeature=c(Gviz:::.THIN_BOX_FEATURES, "UTR"), collapse=FALSE, transcriptAnnotation="symbol", chromosme=12)

 

ADD COMMENT
0
Entering edit mode

Thanks a lot.

I use a local GTF since I want this code to be generic and not all GTFs I'll be using can be found in UCSC.

 

Also, is there a way to shrink the space between the transcript tracks (and also between the transcript tracks and the IdeogramTrack?

 

ADD REPLY

Login before adding your answer.

Traffic: 891 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6