[BioC] GViz - successes and a few hopes

Hahne, Florian florian.hahne at novartis.com
Tue Aug 13 10:07:44 CEST 2013

Hi Malcolm,
good to hear that Gviz is useful for you. See below for more.

On 8/4/13 10:53 AM, "Cook, Malcolm" <MEC at stowers.org> wrote:

>I am trying to employ GViz in preparation of figures to accompany a
>manuscript in which we characterize the effect a protein knock-down has
>on a particular histone modification profile across selected genes.
>I find your vignette very well written and helpful in my aims.
>Is it possible to plot multiple bigwigs on a single track, with distinct
>colors and alpha blending.  I am successfully using the streaming import
>on bigwig files to load histone occupancy profiles on demand.  Great!

Currently there isn't. What is happening behind the scenes for a bigwig
file is that the necessary data for the requested genomic region is
extracted and the results are turned into a DataTrack object. From this
point on, the generic DataTrack plotting method takes over. While
DataTrack objects do support multiple samples as well as the use of alpha
blending, the problem really is that bigwig files can only contain data
for a single sample. This is the only reason why we have this one file <->
one track limitation.

>I would like to be able to overplot two of these bigwigs on a single
>track, with distinct colors and alpha blending.  is there a backdoor way
>of accomplishing this?

Of course you could skip the automatic part that streams the bigwig data
directly into a DataTrack and rebuild this part according to you own
needs. All it takes is wrapper function that takes in the plotting
coordinates and maybe a list of bigwig files that you want to merge. This
function would than dynamically extract the data from the file, build a
single DataTrack object containing multiple samples and finally plot this
object using plotTracks. Obviously this would involve a bit of work but it
shouldn't be too bad. One thing to keep in mind is that a multi sample
DataTrack can only define a single set of coordinates, which may not be
the case in your different bigwig files. So you may need to do a bit of
interpolation, or take the union of all coordinates from all bigwig files.

>You documentation says that passing  add=TRUE to plotTracks is needed to
>add the plot to existing canvas without re-initializing.  I am writing
>multiple .png files in an apply, and find that without add=TRUE the
>chromosome that I am passing i successive calls is not being respected.
>So, in my hands, add=TRUE is required even though there is no issue of
>reinitializing or not.

I am afraid I can't follow you on this one. Maybe a short reproducible
code example would help. I assume that you are calling plotTracks in each
iteration of your apply function, together with the opening and closing of
a fresh png device. In this case it should't really matter whether you use
add=true or add=false. The only purpose of this parameter is to skip
calling the grid equivalent of plot.new() before starting the actual
plotting operation. This should have no effect at all on the selected
chromosome. maybe an example will prove me wrong :-)

>It appears that shape = 'smallArrow' is not respected by GeneRegionTrack
>and rect is used regardless.

I can't reproduce this on my end. As a matter of fact, the default shape
for this class is smallArrow, and I see this respected for instance when
running the examples from the class' man page. Maybe the strand
information of your object is all '*'? In this cases there will be no
directional informations, alas, no arrows. Or did you set the stacking to
'dense'? This may also cause the directional information to be lost when
several elements have to be merged. Again, a reproducible example would

>Finally, are there any ways to annotate tracks further with text, shaded
>boxes, horizontal/vertical lines?

You can do horizontal lines using the 'baseline' parameter, at least for
DataTrack objects. All other annotations are currently not supported, but
very high up on my to do list.

>Thanks for a very clear vignette with lots of great examples.
>~ malcolm_cook at stowers.org / Shilatifard Lab / Compuational Biology
>PS Is there a preferred way for hearing issues like this, or is email to
>bioc list the best for you?

More information about the Bioconductor mailing list