[BioC] RE: Errors with -Inf

Gordon K Smyth smyth at wehi.EDU.AU
Sat Sep 18 01:43:39 CEST 2004


> Hi
>
> This is obviously a wider problem, I think, than simply within limma,
> where I found it.
>
> The command:
>
>> imageplot(log2(RG$Rb[,8]), RG$printer, low="white", high="red")
>
> Produces the error:
>
> Error in image.default(0:(gr * sr), 0:(gc * sc), z, zlim = zlim, col =
> col,  :
>         invalid z limits
>
> All my other arrays work fine.  The only difference here is that in
> array 8, some of the values for Rb are zero.
>
>> summary(RG$Rb[,8])
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>    0.00   37.00   39.00   39.48   42.00   76.00
>
> So therefore:
>
>> summary(log2(RG$Rb[,8]))
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>    -Inf   5.209   5.285    -Inf   5.392   6.248
>
> R calculates my average log2(Rb) as being -Inf, which I'm guessing is
> whats screwing up the imageplot() function.

Well yes.  The error message certainly could be more informative but, leaving that aside, the
problem is not with the imageplot() function but with the fact that you have computed the log of
zero and then passed an infinite value to imageplot().  What do you expect an image plot to do
when it gets an infinite value?

> So, um, any ideas what to do about this?  Estimates of background that
> are zero must be pretty rare, but that's the data I have and I don't see
> that it is necessarily invalid....

You could use a transformation that doesn't give infinite values, e.g.,

imageplot( RG$Rb[,8]^0.1 , RG$printer)

or else you could tell the imageplot() function that it doesn't need to represent the entire data
range:

zlim <- quantile(RG$Rb[,8],c(0.5,0.95))
imageplot( RG$Rb[,8], RG$printer, zlim=zlim)


Gordon

> Thanks
> Mick



More information about the Bioconductor mailing list