Bug when running Gviz::GenomeAxisTrack and highlighting region in axis
2
0
Entering edit mode
@alvaro-j-gonzalez-5813
Last seen 10.2 years ago
Dear Gviz users/developers, The package is throwing an error when I try to highlight certain regions in the axis. The error is easily replicable: > plotTracks(GenomeAxisTrack(range = IRanges(start = 25000, end = 25100)), from = 1, to = 50000) No problem with that. You get your genome axis from 1 to 50,000, and a highlighted small region around the middle. The error is thrown when the highlighted small region is close to the borders: Towards the left border: > plotTracks(GenomeAxisTrack(range = IRanges(start = 1, end = 100)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values > plotTracks(GenomeAxisTrack(range = IRanges(start = 101, end = 200)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values Towards the right border: > plotTracks(GenomeAxisTrack(range = IRanges(start = 49901, end = 50000)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values > plotTracks(GenomeAxisTrack(range = IRanges(start = 49801, end = 49900)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values However, there's a moment when the highlighted region gets away enough from the border that the error is avoided: > plotTracks(GenomeAxisTrack(range = IRanges(start = 501, end = 600)), from = 1, to = 50000) > plotTracks(GenomeAxisTrack(range = IRanges(start = 49401, end = 49500)), from = 1, to = 50000) Those two run like a breeze. Interestingly, one can also avoid the error by making the highlighted range wider: > plotTracks(GenomeAxisTrack(range = IRanges(start = 1, end = 1000)), from = 1, to = 50000) > plotTracks(GenomeAxisTrack(range = IRanges(start = 49001, end = 50000)), from = 1, to = 50000) Not a problem with those. Ideas? Thanks a lot, Alvaro J. Gonzalez, PhD Computational Biology Memorial Sloan-Kettering Cancer Center New York, NY [[alternative HTML version deleted]]
Cancer Gviz Cancer Gviz • 1.1k views
ADD COMMENT
0
Entering edit mode
@alvaro-j-gonzalez-5813
Last seen 10.2 years ago
Sorry that in the original post (below) I forgot to include the session info. Here it is: > sessionInfo() R version 3.0.0 (2013-04-03) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] parallel grid stats graphics grDevices utils datasets [8] methods base other attached packages: [1] GenomicFeatures_1.12.1 org.Hs.eg.db_2.9.0 RSQLite_0.11.3 [4] DBI_0.2-6 AnnotationDbi_1.22.3 Biobase_2.20.0 [7] Rsubread_1.10.2 Rsamtools_1.12.2 Biostrings_2.28.0 [10] ggplot2_0.9.3.1 GenomicRanges_1.12.2 IRanges_1.18.0 [13] BiocGenerics_0.6.0 data.table_1.8.8 Gviz_1.4.1 loaded via a namespace (and not attached): [1] annotate_1.38.0 biomaRt_2.16.0 biovizBase_1.8.0 bitops_1.0-5 [5] BSgenome_1.28.0 cluster_1.14.4 colorspace_1.2-2 DESeq_1.12.0 [9] dichromat_2.0-0 digest_0.6.3 genefilter_1.42.0 geneplotter_1.38.0 [13] gtable_0.1.2 Hmisc_3.10-1 labeling_0.1 lattice_0.20-15 [17] MASS_7.3-26 munsell_0.4 plyr_1.8 proto_0.3-10 [21] RColorBrewer_1.0-5 RCurl_1.95-4.1 reshape2_1.2.2 rtracklayer_1.20.1 [25] scales_0.2.3 splines_3.0.0 stats4_3.0.0 stringr_0.6.2 [29] survival_2.37-4 tools_3.0.0 XML_3.95-0.2 xtable_1.7-1 [33] zlibbioc_1.6.0 #### original message #### *Dear Gviz users/developers, The package is throwing an error when I try to highlight certain regions in the axis. The error is easily replicable: > plotTracks(GenomeAxisTrack(range = IRanges(start = 25000, end = 25100)), from = 1, to = 50000) No problem with that. You get your genome axis from 1 to 50,000, and a highlighted small region around the middle. The error is thrown when the highlighted small region is close to the borders: Towards the left border: > plotTracks(GenomeAxisTrack(range = IRanges(start = 1, end = 100)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values > plotTracks(GenomeAxisTrack(range = IRanges(start = 101, end = 200)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values Towards the right border: > plotTracks(GenomeAxisTrack(range = IRanges(start = 49901, end = 50000)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values > plotTracks(GenomeAxisTrack(range = IRanges(start = 49801, end = 49900)), from = 1, to = 50000) Error in validObject(x) : invalid class “IRanges” object: 'widths(x)' cannot contain negative values However, there's a moment when the highlighted region gets away enough from the border that the error is avoided: > plotTracks(GenomeAxisTrack(range = IRanges(start = 501, end = 600)), from = 1, to = 50000) > plotTracks(GenomeAxisTrack(range = IRanges(start = 49401, end = 49500)), from = 1, to = 50000) Those two run like a breeze. Interestingly, one can also avoid the error by making the highlighted range wider: > plotTracks(GenomeAxisTrack(range = IRanges(start = 1, end = 1000)), from = 1, to = 50000) > plotTracks(GenomeAxisTrack(range = IRanges(start = 49001, end = 50000)), from = 1, to = 50000) Not a problem with those. Ideas? Thanks a lot, Alvaro J. Gonzalez, PhD Computational Biology Memorial Sloan-Kettering Cancer Center New York, NY* [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 6.2 years ago
Switzerland
Hi Alvaro, thanks for reporting this. I took a look at the code and found the issue. As you correctly pointed out this only happens when the range on the axis is very close to the borders, and not particularly wide. The problem is that for display reasons we need to add a little bit of padding to the margins of the range by gently clipping the extremes, which is usually not a big deal. In your example however the whole range on the axis is in the region that is being clipped, hence the error. The fix is simple, however you will not see this very small range at the extremes displayed anymore. The following example should make this a bit clearer: plotTracks(list(GenomeAxisTrack(range = IRanges(start = 1, end = 100)), AnnotationTrack(start=1, end=200, chr=1)), from =1, to = 50000, grid=T, v=50, col.grid="lightgray") You may notice that the axis only starts somewhere close to the end of the item in the AnnotationTrack. Alas, we can't draw any ranges in it. A fix will be available soon in both the devel and the release version once it has passed the build system (1.4.2 or 1.5.3) Cheers, Florian Florian Hahne Novartis Institute For Biomedical Research Translational Sciences / Preclinical Safety / PCS Informatics Expert Data Integration and Modeling Bioinformatics CHBS, WKL-135.2.26 Novartis Institute For Biomedical Research, Werk Klybeck Klybeckstrasse 141 CH-4057 Basel Switzerland Phone: +41 61 6967127 Email : florian.hahne at novartis.com On 5/8/13 6:01 PM, "Alvaro J. Gonzalez" <alvaro.gonzalez4 at="" gmail.com=""> wrote: >Dear Gviz users/developers, > >The package is throwing an error when I try to highlight certain regions >in >the axis. The error is easily replicable: > >> plotTracks(GenomeAxisTrack(range = IRanges(start = 25000, end = 25100)), >from = 1, to = 50000) > >No problem with that. You get your genome axis from 1 to 50,000, and a >highlighted small region around the middle. > >The error is thrown when the highlighted small region is close to the >borders: > >Towards the left border: >> plotTracks(GenomeAxisTrack(range = IRanges(start = 1, end = 100)), from >>= >1, to = 50000) >Error in validObject(x) : > invalid class ?IRanges? object: 'widths(x)' cannot contain negative >values >> plotTracks(GenomeAxisTrack(range = IRanges(start = 101, end = 200)), >>from >= 1, to = 50000) >Error in validObject(x) : > invalid class ?IRanges? object: 'widths(x)' cannot contain negative >values > >Towards the right border: >> plotTracks(GenomeAxisTrack(range = IRanges(start = 49901, end = 50000)), >from = 1, to = 50000) >Error in validObject(x) : > invalid class ?IRanges? object: 'widths(x)' cannot contain negative >values >> plotTracks(GenomeAxisTrack(range = IRanges(start = 49801, end = 49900)), >from = 1, to = 50000) >Error in validObject(x) : > invalid class ?IRanges? object: 'widths(x)' cannot contain negative >values > >However, there's a moment when the highlighted region gets away enough >from >the border that the error is avoided: > >> plotTracks(GenomeAxisTrack(range = IRanges(start = 501, end = 600)), >>from >= 1, to = 50000) >> plotTracks(GenomeAxisTrack(range = IRanges(start = 49401, end = 49500)), >from = 1, to = 50000) > >Those two run like a breeze. > >Interestingly, one can also avoid the error by making the highlighted >range >wider: > >> plotTracks(GenomeAxisTrack(range = IRanges(start = 1, end = 1000)), from >= 1, to = 50000) >> plotTracks(GenomeAxisTrack(range = IRanges(start = 49001, end = 50000)), >from = 1, to = 50000) > >Not a problem with those. > >Ideas? > >Thanks a lot, > >Alvaro J. Gonzalez, PhD >Computational Biology >Memorial Sloan-Kettering Cancer Center >New York, NY > > [[alternative HTML version deleted]] >
ADD COMMENT

Login before adding your answer.

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