Gviz: decreasing tick resolution
1
0
Entering edit mode
@willbradshaw-19193
Last seen 5.2 years ago

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 • 2.2k views
ADD COMMENT
2
Entering edit mode
Robert Ivanek ▴ 750
@robert-ivanek-5892
Last seen 11 months ago
Switzerland

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

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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)
ADD REPLY
0
Entering edit mode

That sounds ideal, thanks! :-)

ADD REPLY
0
Entering edit mode

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?

Thanks again for your help!

Will

ADD REPLY
0
Entering edit mode

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))
ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Hi Robert, Strange, I restarted everything and it seems to work now. Sorry for wasting your time! Will

ADD REPLY

Login before adding your answer.

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