IRanges
1
0
Entering edit mode
Guest User ★ 13k
@guest-user-4897
Last seen 10.3 years ago
I'm having some difficulty understanding how the `findOverlaps` function's arguments `maxgap` and `minoverlap` work together. Here's a minimal reproducible example: require(IRanges) # 1.22.9 ir1 = IRanges(start=1L, end=7L) ir2 = IRanges(start=10L, end=15L) # Case (1) works fine: findOverlaps(ir1, ir2, maxgap=2L, minoverlap=1L) # Hits of length 0 # queryLength: 1 # subjectLength: 1 # Case (2) again works fine: findOverlaps(ir1, ir2, maxgap=3L, minoverlap=1L) # or any maxgap >= 3L # Hits of length 1 # queryLength: 1 # subjectLength: 1 # queryHits subjectHits # <integer> <integer> # 1 1 1 # Now Case (3), results in error: findOverlaps(ir1, ir2, maxgap=4L, minoverlap=2L) # or any maxgap >= 3L # Error in .Call2("solve_user_SEW0", start, end, width, PACKAGE = "IRanges") : # solving row 1: negative widths are not allowed Here's where I've trouble understanding, because none of the *input* ranges have negative widths. Question: What's happening here / why is this happening? Related question: It's not clear to me from `?findOverlaps` how this *should* be handled. The gap between [1,7] and [10,15] is 3. So, when I set `maxgap=4L`, there's a "virtual" overlap of 2 (or at least that's my naive way of going about it). If so, does this mean that for `minoverlap=2L`, the actual result should have resulted in the same answer as case (2)? Or should it be empty because even if `minoverlap=2L`, since they don't *actually overlap*, the maximum overlap it can have is 1? It'd be great to get to know your thoughts on this. Thank you. -- output of sessionInfo(): sessionInfo() # R version 3.1.0 (2014-04-10) # Platform: x86_64-apple-darwin10.8.0 (64-bit) # locale: # [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 # attached base packages: # [1] parallel stats graphics grDevices utils datasets methods base # other attached packages: # [1] IRanges_1.22.9 BiocGenerics_0.10.0 BiocInstaller_1.14.2 bit64_0.9-4 # [5] bit_1.1-12 loaded via a namespace (and not attached): [1] stats4_3.1.0 tools_3.1.0 -- Sent via the guest posting facility at bioconductor.org.
• 2.2k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 3.1 years ago
United States
On Sat, Jul 5, 2014 at 2:53 AM, Arun [guest] <guest@bioconductor.org> wrote: > I'm having some difficulty understanding how the `findOverlaps` function's > arguments `maxgap` and `minoverlap` work together. Here's a minimal > reproducible example: > > require(IRanges) # 1.22.9 > ir1 = IRanges(start=1L, end=7L) > ir2 = IRanges(start=10L, end=15L) > > # Case (1) works fine: > findOverlaps(ir1, ir2, maxgap=2L, minoverlap=1L) > # Hits of length 0 > # queryLength: 1 > # subjectLength: 1 > > # Case (2) again works fine: > findOverlaps(ir1, ir2, maxgap=3L, minoverlap=1L) # or any maxgap >= 3L > # Hits of length 1 > # queryLength: 1 > # subjectLength: 1 > # queryHits subjectHits > # <integer> <integer> > # 1 1 1 > > # Now Case (3), results in error: > findOverlaps(ir1, ir2, maxgap=4L, minoverlap=2L) # or any maxgap >= 3L > # Error in .Call2("solve_user_SEW0", start, end, width, PACKAGE = > "IRanges") : > # solving row 1: negative widths are not allowed > > Here's where I've trouble understanding, because none of the *input* > ranges have negative widths. > > This is a bug in minoverlap > 1 that is fixed in devel, 1.99.19. > Question: What's happening here / why is this happening? > > Related question: It's not clear to me from `?findOverlaps` how this > *should* be handled. The gap between [1,7] and [10,15] is 3. So, when I set > `maxgap=4L`, there's a "virtual" overlap of 2 (or at least that's my naive > way of going about it). If so, does this mean that for `minoverlap=2L`, the > actual result should have resulted in the same answer as case (2)? Or > should it be empty because even if `minoverlap=2L`, since they don't > *actually overlap*, the maximum overlap it can have is 1? > > It'd be great to get to know your thoughts on this. Thank you. > > The documentation seems to suggest your first definition: Intervals with a separation of \code{maxgap} or less and a minimum of \code{minoverlap} overlapping positions, allowing for \code{maxgap}, are considered to be overlapping. The "allowing for maxgap" phrase is a bit unclear, but the code does seem to attempt (unsuccessfully, as a separate bug) to implement your first definition. Otherwise, there is no point to specifying maxgap and minoverlap together. But either way, it is hard to figure out why one would specifiy both at once, as they counteract each other. Anyway, I think I've fixed up this behavior in IRanges 1.99.19. Hopefully I haven't broken anything. > > -- output of sessionInfo(): > > sessionInfo() > > # R version 3.1.0 (2014-04-10) > # Platform: x86_64-apple-darwin10.8.0 (64-bit) > > # locale: > # [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > # attached base packages: > # [1] parallel stats graphics grDevices utils datasets methods > base > > # other attached packages: > # [1] IRanges_1.22.9 BiocGenerics_0.10.0 BiocInstaller_1.14.2 > bit64_0.9-4 > # [5] bit_1.1-12 > > loaded via a namespace (and not attached): > [1] stats4_3.1.0 tools_3.1.0 > > > -- > Sent via the guest posting facility at bioconductor.org. > > _______________________________________________ > 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
I am handling CNV data and requiring this CNregions function:
cnv_seg=read.table(file="~/Desktop/iCluster_Plus_files/CNV.txt",header=T)
> cnv=CNregions(seg = cnv_seg, epsilon = 0, adaptive = FALSE, rmCNV = TRUE, cnv = variation.hg18.v10.nov.2010, frac.overlap = 0.5, rmSmallseg = TRUE, nProbes = 5)
Removing CNV... 
Error in .Call2("solve_user_SEW0", start, end, width, PACKAGE = "IRanges") : 
  solving row 1: negative widths are not allowed

 

The IRanges version (IRanges 1.99.19) you are mentioning is not available for download. Please help.

ADD REPLY

Login before adding your answer.

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