Hello!
I have a set of genome-wide interactions (gi1
). I then subset these interactions to one chromosome and used the anchors to generate new interactions (gi2
). My problem now is I want to see which of the new interactions I made were in the original genome-wide set, but since gi1
contains regions from all chromosomes, it has many more ranges than gi2
, and R Studio crashes when I try to compare the 2 sets.
Through some testing, I have realized that when 2 GInteractions objects have different ranges in their regions, using either gi1 %in% gi2
or findOverlaps(gi1, gi2)
crashes my RStudio session with the "R Session Aborted. R encountered a fatal error." popup.
Here is a simple example that causes the error:
library(InteractionSet)
## Setup modified from the example constructor for GInteractions
# Create first GInteractions object
N <- 30
all.starts <- sample(1000, N)
all.ends <- all.starts + round(runif(N, 5, 20))
all.regions <- GRanges(rep(c("chrA", "chrB"), c(N-10, 10)), IRanges(all.starts, all.ends))
Np <- 20
all.anchor1 <- sample(N, Np)
all.anchor2 <- sample(N, Np)
gi1 <- GInteractions(all.anchor1, all.anchor2, all.regions)
# re-sample to get new ranges
all.starts <- sample(1000, N)
all.ends <- all.starts + round(runif(N, 5, 20))
all.regions <- GRanges(rep(c("chrA", "chrB"), c(N-10, 10)), IRanges(all.starts, all.ends))
all.anchor1 <- sample(N, Np)
all.anchor2 <- sample(N, Np)
gi2 <- GInteractions(all.anchor1, all.anchor2, all.regions)
## Compare interactions
## This line crashes my RStudio session
gi1 %in% gi2
## Alternatively, this line also crashes my RStudio session
findOverlaps(gi1, gi2)
I've run this simple example just using R on the command line and got the following traceback:
*** caught bus error ***
address 0x100000cfeedfacf, cause 'invalid alignment'
Traceback:
1: .paired_overlap_finder2(query, subject, select = select, maxgap = maxgap, minoverlap = minoverlap, type = type, ignore.strand = ignore.strand, ..., use.region = use.region)
2: .local(query, subject, maxgap, minoverlap, type, select, ...)
3: findOverlaps(x, table, type = "equal", select = "first", use.region = "same")
4: findOverlaps(x, table, type = "equal", select = "first", use.region = "same")
5: match(x, table, nomatch = 0L)
6: match(x, table, nomatch = 0L)
7: gi1 %in% gi2
8: gi1 %in% gi2
My session info:
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] InteractionSet_1.30.0 SummarizedExperiment_1.32.0
[3] Biobase_2.62.0 MatrixGenerics_1.14.0
[5] matrixStats_1.2.0 GenomicRanges_1.54.1
[7] GenomeInfoDb_1.38.5 IRanges_2.36.0
[9] S4Vectors_0.40.2 BiocGenerics_0.48.1
loaded via a namespace (and not attached):
[1] SparseArray_1.2.3 zlibbioc_1.48.0 Matrix_1.6-5
[4] lattice_0.22-5 abind_1.4-5 GenomeInfoDbData_1.2.11
[7] S4Arrays_1.2.0 XVector_0.42.0 RCurl_1.98-1.14
[10] bitops_1.0-7 grid_4.3.2 DelayedArray_0.28.0
[13] compiler_4.3.2 tools_4.3.2 Rcpp_1.0.12
[16] crayon_1.5.2
Any help/advice would be appreciated!
More info: This seems to be a problem only on 4.3.2. This code works fine on 4.3.2 with the same package version of InteractionSet. I know there is also a platform difference (mac vs linux), so if anyone else is willing to test the example and let me know if it works for you, that would be helpful too! Thanks!
Session info where the code works: