Obtain the specific range that overlap
1
0
Entering edit mode
julrodr80 ▴ 30
@julrodr80-11991
Last seen 7.1 years ago

 


 

I have two dataframes: cnv_1

chr     start   end
3   62860387    63000898
12  31296219    31406907
14  39762575    39769146
19  43372386    43519442
19  56419263    56572829

cnv_2

chr     start   end
6   30994163    30995078
19  43403531    44608011
18  1731154 1833682
3   46985863    47164711

with aprox 150000 entries each. I would like to know which fragments of cnv_1overlap in any way with cnv_2, and -this is the most important for me- to obtain the specific region that overlap. For example, doing that to the data.frames of the example, to obtain:

chr     start   end
19  43403531 43519442

thank you very much

overlap genomicranges range • 1.5k views
ADD COMMENT
1
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States

First make them GRanges,

cnv_gr_1 <- GRanges(cnv_1)
cnv_gr_2 <- GRanges(cnv_2)

And then find overlaps and the intersecting part of each overlapping pair:

pintersect(findOverlapPairs(cnv_gr_1, cnv_gr_2))

 

ADD COMMENT
0
Entering edit mode

I don't know why but... 

findOverlapPairs()
Error: could not find function "findOverlapPairs"

ADD REPLY
0
Entering edit mode

You'll need to update your Biocondutor.

ADD REPLY
0
Entering edit mode

I have this problem

Error: Bioconductor version 3.2 cannot be upgraded with R version 3.2.3

It's very frustrating, is the only function that does't work.

ADD REPLY
0
Entering edit mode

You'd need to update your R, and then your Bioconductor installation (in that order). It'll always help if you post your `sessionInfo()` along with your post, that way everyone knows exactly what platform and what versions of package you have installed. 

If you want a copy of all the packages you have installed in your current R, to carry over to the new installation of R, you can do something like this in R,

write.csv(rownames(installed.packages()),file="rpacks.txt")

These can be installed in an R script (on a new R installation) or interactively with,

library(BiocInstaller)

lst <- unlist(read.csv("rpacks.txt"))

lapply(as.character(lst), biocLite, ask=FALSE)

Also, please take a look at the documentation for this,

http://bioconductor.org/install/

ADD REPLY

Login before adding your answer.

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