Gviz highlighted regions displaying behind main plot
3
1
Entering edit mode
@malcolm-perry-6958
Last seen 2.9 years ago
Cambridge

Hi, I'm having issues with Gviz plotting the highlights behind the data tracks:

 

A plot of approximately 2Mb around the SOX2 gene

 

The code used to produce the image:

library(Gviz)
library(GenomicRanges)

bigwig = "HCNE_density_hg19_mm10.bigWig"

region = GRanges("chr3", IRanges(180436331, 182390735))
gene = GRanges("chr3", IRanges(181661924, 181764436)) # 100kb around SOX2

itrack = IdeogramTrack(genome="hg19")
gtrack = GenomeAxisTrack(genome="hg19")
cnetrack = DataTrack(range = bigwig, genome = "hg19", type = "horiz", name = "Mouse HCNEs")
genetrack = UcscTrack(genome="hg19", chromosome=seqnames(region), track="refGene", from=start(region), to=end(region),
                      trackType="GeneRegionTrack", rstarts="exonStarts", rends="exonEnds",
                      gene="name2", symbol="name2", transcript="name", collapseTranscripts="longest")

hltrack = HighlightTrack(trackList=list(cnetrack, genetrack), gene, genome="hg19")

png("testplot.png", width=20, height=8, units="in", res=200)
plot = plotTracks(list(itrack, gtrack, hltrack), col=NULL, transcriptAnnotation = "symbol", from=start(region), to=end(region), chromosome=as.character(seqnames(region)), main="SOX2")
dev.off()

 

This was produced using R 3.1.1 with all dependencies fully up to date.

gviz software error • 2.8k views
ADD COMMENT
3
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.5 years ago
Switzerland

Hi Malcolm,

I finally found some minutes to take a look at this. My initial idea was to have the HighlightTrack region in the background with some filling color, but obviously that breaks when a lot of content gets drawn on the actual track elements. In version 1.10.3 which should be available in the next couple of days I have added the 'inBackground" display parameter to the HighlightTrack class. If set to FALSE, the box will be drawn in the foreground instead. 

In order for this to make sense you probably want to play with the transparency (display parameter 'alpha'), or not use filling for the highlight boxes (i.e., display parameter 'fill' = NA)

Hope that helps,

Florian

ADD COMMENT
0
Entering edit mode

Thanks Florian, this sounds ideal. I see the package has passed checks and is now available to download, I'll give it a try.

ADD REPLY
1
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.5 years ago
Switzerland

Hi Malcolm,

thanks for reporting this issue. I will take a closer look and get back with a fix soon.

Florian

ADD COMMENT
1
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.5 years ago
Switzerland

So in your example, something like:

hltrack = HighlightTrack(trackList=list(cnetrack, genetrack), gene, genome="hg19", inBackground=FALSE, fill=NA) 
plot = plotTracks(list(itrack, gtrack, hltrack), col=NULL, transcriptAnnotation = "symbol", from=start(region), to=end(region), chromosome=as.character(seqnames(region)), main="SOX2")

Or on a device that supports transparency:

hltrack = HighlightTrack(trackList=list(cnetrack, genetrack), gene, genome="hg19", inBackground=FALSE, alpha=0.3) 
plot = plotTracks(list(itrack, gtrack, hltrack), col=NULL, transcriptAnnotation = "symbol", from=start(region), to=end(region), chromosome=as.character(seqnames(region)), main="SOX2")
ADD COMMENT

Login before adding your answer.

Traffic: 880 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