I'm using GenomicRanges to find which transcripts from one experiment overlap with those coming from other one.
head(to_ranges1)
knowngene chr strand Start Gene
1 uc001aaa.3 chr1 + 9873 16409 DDX11L1
2 uc001aac.4 chr1 - 12361 31370 WASH7P
3 uc001aae.4 chr1 - 12361 21759 WASH7P
library(GenomicRanges)
object_one<-with(to_ranges, GRanges(chr, IRanges(Start,End),
strand,names=knowngene,Gene=Gene)
object_two<-with(to_ranges, GRanges(chr, IRanges(Start,End),
strand,names=knowngene, Gene=Gene))
mm<-findOverlaps(object_one,object_two)
solution <- data.frame(as.data.frame(object_one[as.matrix(mm)[,1],]),
as.data.frame(object_two[as.matrix(mm)[,2],]))
What I am trying to find is the WIDTH of the overlapped segment between the hits in the solution data frame, however the only width I could get is the related to the original transcripts before the overlapping procedure.
Could you help me pleas?