[Bioc-devel] A question on IRanges package
On 04/03/2014 04:42 PM, Michael Lawrence wrote:
I'll look at the code. As far as tracking line numbers, no, because the code is bundled into a package -- there are no files anymore. In principle, that could be improved, but as far as I know, it hasn't been. If you're
I think there's an option, set in .Rprofile or as an environment variable
described in ?options,
options(keep.source.pkgs=TRUE)
that annotates the source of installed packages with line numbers, e.g., after
doing this and then installing GenomicRanges (on my own version)
> library(GenomicRanges)
> findOverlaps(GRanges(), GRanges(), type="o")
Error in match.arg(type) :
'arg' should be one of "any", "start", "end", "within", "equal"
> traceback()
5: stop(gettextf("'arg' should be one of %s", paste(dQuote(choices),
collapse = ", ")), domain = NA)
4: match.arg(type) at findOverlaps-methods.R#63
3: .local(query, subject, maxgap, minoverlap, type, select, ...)
2: findOverlaps(GRanges(), GRanges(), type = "o")
1: findOverlaps(GRanges(), GRanges(), type = "o")
I'm not really sure which lines are annotated with source information.
Martin
trying to figure out dispatch behavior, things like
selectMethod(findOverlaps, c("GRanges, "GRanges")) and trace(findOverlaps,
browser, sig=c("GRanges", "GRanges")) are your friend.
Michael
On Thu, Apr 3, 2014 at 4:22 PM, Yuan Luo <yuan.hypnos.luo at gmail.com> wrote:
At the moment I am using the package to tweak some design on interval tree algorithm, and much of my efforts are hack. So does the code suggest to you what I am doing wrong to get the match.arg failing error? Also, when you were developing the package, how do you tell the traceback to show line numbers and file names. My googling seems to suggest it's hard to do so in R, but I figured gurus may see better. Best, Yuan On Thu, Apr 3, 2014 at 6:05 PM, Michael Lawrence < lawrence.michael at gene.com> wrote:
It looks like the only hits this will filter out are cases where the start of the query (X) is equal to the end of the subject (Y), but it seems like the "o" operation is different -- it requires that X start before Y starts and end before Y ends. We could add these relations to IRanges, but maybe findOverlaps is not the right place. Instead, we could have an %o% operator, plus operators for the rest of the algebra. But maybe it would help to hear your use case. Michael On Thu, Apr 3, 2014 at 1:13 PM, Yuan Luo <yuan.hypnos.luo at gmail.com>wrote:
Hi Michael, Thanks for your reply! I covered setGeneric as well, attached is the modified code. My change is pretty simple, I want to support the o relation in Allen's Interval algebra (http://en.wikipedia.org/wiki/Allen's_interval_algebra) So I added one more filter option } else if (type == "o") { m <- m[start(query)[m[,1L]] < end(subject)[m[,2L]], , drop=FALSE] } From the stack trace, I suspect the method definition setMethod("findOverlaps", c("RangesList", "IntervalForest"), is not called upon, and the error happens before that, but since the stack trace doesn't tell me in which file and which line each frame is, I am a bit clueless. Is there anyway to reveal that information? Best, Yuan On Thu, Apr 3, 2014 at 3:57 PM, Michael Lawrence < lawrence.michael at gene.com> wrote:
On Thu, Apr 3, 2014 at 11:33 AM, Yuan Luo <yuan.hypnos.luo at gmail.com>wrote:
Hi All,
Sorry for possible spam, but I am trying to customize IRanges package
locally. For what I am doing, I introduced another option to type
parameters to the findOverlaps method. In the file
findOverlaps-methods.R,
I modified every instance of
type = c("any", "start", "end", "within", "equal"),
into
type = c("any", "start", "end", "within", "equal", "o"),
I'm curious as to what "o" is supposed to do and wonder whether you really need to be making this modification. Tough to help without seeing any of your code. Probably, you just missed one, maybe the generic itself? Michael
But when I call h = findOverlaps(varanges, rna_tree, type="o") I got the error
h = findOverlaps(varanges, rna_tree, type="o")
Error in match.arg(type) : 'arg' should be one of "any", "start", "end", "within", "equal" with the following traceback information
traceback()
5: stop(gettextf("'arg' should be one of %s", paste(dQuote(choices),
collapse = ", ")), domain = NA)
4: match.arg(type)
3: .local(query, subject, maxgap, minoverlap, type, select, ...)
2: findOverlaps(varanges, rna_tree, type = "o")
1: findOverlaps(varanges, rna_tree, type = "o")
Is there any place that I missed where there is a default type vector
specification?
Also, how do you guys get R to display filename and line numbers for
the
methods in the traceback stack?
Best,
Yuan
[[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
[[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793