[BioC] Bug when running Gviz::GenomeAxisTrack and highlighting region in axis

Hahne, Florian florian.hahne at novartis.com
Mon May 13 14:08:51 CEST 2013


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]]
>



More information about the Bioconductor mailing list