Gviz: plotting multiple data tracks with the same y-axis limit using Gviz
0
0
Entering edit mode
@mthabisi-moyo-9721
Last seen 8 weeks ago
United States

I am using Gviz to plot H3K27Ac and RNAPII ChIP-seq data for two experimental conditions, Wt and KO:

WT_H3K27Ac <- DataTrack(range = '/path/to/WT-H3K27Ac.bw', type = "histogram", window = -1, name = "WT H3K27Ac", genome = "GRCh38", col.histogram = "black", fill.histogram = "black")
KO_H3K27Ac <- DataTrack(range ='/path/to/KO-H3K27Ac.bw', type = "histogram", window = -1, name = "KO H3K27Ac", genome = "GRCh38", col.histogram = "red", fill.histogram = "red")
WT_RNAPII <- DataTrack(range = '/path/to/WT-RNAPII.bw', type = "histogram", window = -1, name = "WT RNAPII", genome = "GRCh38", col.histogram = "blue", fill.histogram = "blue")
KO_RNAPII <- DataTrack(range = '/path/to/KO-RNAPII.bw', type = "histogram", window = -1, name = "KO RNAPII", genome = "GRCh38", col.histogram = "orange", fill.histogram = "orange")
plotTracks(list(WT_H3K27Ac, KO_H3K27Ac), chromosome = 1, from = 9.3e5, to = 9.5e5, title.width = 1.3)


This plots the two H3K27Ac tracks with different y-axis limits, with WT-H3K27Ac having a max y-value of 3 and KO-H3K27Ac with a max y-value of 2. I can correct this with the 'ylim' parameter:


plotTracks(list(WT_H3K27Ac, KO_H3K27Ac), chromosome = 1, from = 9.3e5, to = 9.5e5, title.width = 1.3, ylim = c(0,3))

This is great until I want to include the RNAPII tracks, which have different y-axis limits from H3K27Ac. For these, ylim would be set to 6, which would result in 50% of the space in H3K27Ac tracks being whitespace. Is there a solution that allows for the control of ylim for individual tracks when plotting? i.e something like:


plotTracks(list(WT_H3K27Ac, KO_H3K27Ac, WT_RNAPII, KO_RNAPII), chromosome = 1, from = 9.3e5, to = 9.5e5, title.width = 1.3, ymax = c(3,3,6,6))

where ymax = c(3,3,6,6) would specify the y-axis limit for each element in plotTracks(list()). I know this is not an option in Gviz, I am just trying to represent what I am trying to achieve. An option I considered would be to specify ylim when constructing the DataTrack():

WT_H3K27Ac <- DataTrack(range = '/path/to/WT-H3K27Ac.bw', type = "histogram", window = -1, name = "WT H3K27Ac", genome = "GRCh38", col.histogram = "black", fill.histogram = "black", ylim=c(0,3))
KO_H3K27Ac <- DataTrack(range ='/path/to/KO-H3K27Ac.bw', type = "histogram", window = -1, name = "KO H3K27Ac", genome = "GRCh38", col.histogram = "red", fill.histogram = "red", ylim=c(0,3))

This solution is not ideal as I would have to re-make the data track for different coordinates where the ylim is different. What would be ideal is to be able to adjust the ylim for each track on the fly whilst plotting or have it group autoscale for whatever tracks you decide to group (similar functionality to the Broad Institute's IGV group autoscale function).

I have also read the Gviz manual, specifically the part dealing with data grouping (pg22) and this approach would be inefficient as I would have to load the BigWig as a Granges object which would take up a lot of memory as well as a lot of time to merge the individual Granges (unless there is a way to import multiple BigWigs as a single Granges object with multiple metadata columns representing each BigWig's scores?). 

Importing the BigWigs directly using DataTrack() actually works really well and I would prefer a solution that allows me the memory savings that using the DataTrack() approach provides.

I took a look at some of the previous questions that tackle y-axis limits in Gviz and none seems to solve this problem. Any suggestions would be great.

Thanks!

 

 

 

Gviz gviz-package • 2.3k views
ADD COMMENT

Login before adding your answer.

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