[BioC] Confused about IRanges::nearest, precede, follow functions/docs.

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Dec 28 18:28:37 CET 2010


I think the holiday-over-eating is affecting my reading comprehension
skills. I'm having problems groking the documentation/functionality of
(for instance) precede, as it seems to return an integer vector that's
"backwards to" the documentation.

For instance, for `precede(x, subject)`, the docs say:

  precede returns an integer vector of the index of range in subject
  that ends before and closest to the start of each range in x. Note
  that any overlapping ranges are excluded. NA is returned when there
  are no qualifying ranges in subject.

I am expecting an integer vector that is as long as x that indexes
*into* the subject ranges. I'm getting that, but I also expect that
the i'th value of the returned integer vector should be the index into
`subject` that is closest to and precedes the i'th range in x.

Using the second example from the docs, we don't get this at all ...
in fact we get something of the opposite:

  query <- IRanges(c(1, 3, 9), c(3, 7, 10))
  subject <- IRanges(c(3, 2, 10), c(3, 13, 12))

  p <- precede(query, subject) # c(3L, 3L, NA)

The way I'm reading the docs, shouldn't p[1] indicate that
subject[p[1]] "ends before and [is] closest to" query[1]? The returned
vector is rather telling me that query[1] precedes subject[p[1]].

So, shouldn't the docs read something more like "precede returns an
integer vector of the index into the range of `subject` that
immediately follows the corresponding range in x (the query) ...
overlaps ignored, etc." Or something similar, no?

R> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] IRanges_1.8.7

loaded via a namespace (and not attached):
[1] tools_2.12.1


Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

More information about the Bioconductor mailing list