Question: Gviz: decreasing tick resolution
0
5 months ago by

Hi everyone!

I'm currently mapping out a genomic locus with Gviz, and I'm running into an issue in one of my sub-figures where the Genome Axis Track tick labels are mashing into each other:

It seems to have automatically decided to show ticks every 1kb due to the relatively short range being plotted (~5kb), but in order to prevent the labels overlapping it would be good if I could specify to only plot them every 2kb or similar.

The only graphical option I can find relating to tick resolution is littleticks, which does the opposite of what I want. Is there any way to reduce the tick resolution rather than increasing it? If not, can anyone suggest a good alternative solution? I don't really want to alternate the tick labels above and below the axis unless there's no alternative, as that will interfere with some other annotations I want to add later.

Thanks!

Will

gviz gviz-package • 164 views
modified 5 months ago by Robert Ivanek590 • written 5 months ago by willbradshaw0
2
5 months ago by
Robert Ivanek590
Switzerland
Robert Ivanek590 wrote:

Hi Will,

I added new parameter called ticksAt for GenomeAxisTrack. It will be available in developmental version of Gviz (1.27.5) (Bioc 3.9)

Best

Robert

Hi Robert,

Thanks for the quick and helpful answer; great to know this will be available soon! Just to check (I'm not used to working with dev versions), since this is in Bioc 3.9 and R 3.6 isn't released yet, I'll need to set up r-devel to use it, right?

Thanks again,

Will

Yes, that is correct.

I think that installing devel version of R and all the packages might be an overkill, especially for one figure. If you do not mind to use a dirty hack you can also install the devel version of Gviz in current release version of R (assuming all dependencies for release version of Gviz are met). You need to wait 1-2 days until the new version is available (currently only 1.27.4). Keep in mind that this is a quick and dirty hack, which stops updating Gviz in your current installation. So do not forget to reinstall the release version afterwards.

install.packages("http://bioconductor.org/packages/devel/bioc/src/contrib/Gviz_1.27.5.tar.gz", repos=NULL)

That sounds ideal, thanks! :-)

Hi Robert,

I just installed Gviz 1.27.5 and then realised I didn't actually ask how to use the new parameter to do what I want. Whoops.

I tried adding ticksAt = 2000 and ticksAt=seq(0, <end>, 2000) to my GenomeAxisTrack call and it didn't seem to make any difference. Could you give me a quick example of how to use it?

Will

You need to specify the positions of tick marks, i.e. seq(280e3, 320e3, 40e3). Complete example:

library(Gviz)
axisTrack <- GenomeAxisTrack()
plotTracks(axisTrack, from=270e3, to=330e3)


with ticksAt parameter:

plotTracks(axisTrack, from=270e3, to=330e3, ticksAt=seq(280e3, 320e3, 40e3))


Hi Robert,

I was checking over my figures again just now and noticed that the tick labels are back to the overlapping state they were in before. Checking my R script it seems like the ticksAt argument has stopped working; changing the values to the argument in plotTracks doesn't seem to have any effect on tick placement.

Have there been changes to the way this is implemented since we talked in January? I'm using Gviz 1.27.6.

Thanks, Will

Hi Will, It works for me. Can you post your code? Best, Robert