[BioC] IRanges

Arun [guest] guest at bioconductor.org
Sat Jul 5 11:53:06 CEST 2014


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.



More information about the Bioconductor mailing list