Confused about IRanges::nearest, precede, follow functions/docs.
1
0
Entering edit mode
@steve-lianoglou-2771
Last seen 14 months ago
United States
Hi, 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) locale: [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 Thanks, -steve -- 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
Cancer Cancer • 1.0k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States
Thanks Steve. Yes, the docs had it backwards. It was already fixed in devel; I just pushed it back to release. Sorry that this consumed your time. Michael On Tue, Dec 28, 2010 at 9:28 AM, Steve Lianoglou < mailinglist.honeypot@gmail.com> wrote: > Hi, > > 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) > > locale: > [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 > > Thanks, > -steve > > -- > 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<http: cbio.mskc="" c.org="" %7elianos="" contact=""> > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Thanks for the update. -steve On Wed, Dec 29, 2010 at 6:50 PM, Michael Lawrence <lawrence.michael at="" gene.com=""> wrote: > Thanks Steve. Yes, the docs had it backwards. It was already fixed in devel; > I just pushed it back to release. Sorry that this consumed your time. > > Michael > > On Tue, Dec 28, 2010 at 9:28 AM, Steve Lianoglou > <mailinglist.honeypot at="" gmail.com=""> wrote: >> >> Hi, >> >> 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) >> >> locale: >> [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 >> >> Thanks, >> -steve >> >> -- >> 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 >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor > > -- 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
ADD REPLY

Login before adding your answer.

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