findOverlaps with strand info
1
0
Entering edit mode
stubben ▴ 80
@stubben-4185
Last seen 10.3 years ago
Does anyone know how to add strands and number of overlapping bases to the findOverlaps output? For example, given these locations x <- GRanges( "chr", IRanges( c(3,11,17,25,28), c(9,18,24,31,35)) , c("-", "+", "+","-","+" )) and the findOverlaps output... y<- as.matrix(findOverlaps(ranges(x), ignoreSelf=TRUE, ignoreRedundant=TRUE)) y query subject [1,] 2 3 [2,] 4 5 I'd like to add the query and subject strands and number of overlapping bases query subject strands overlap 2 3 ++ 2 4 5 -+ 4 Thanks, Chris Stubben -- Los Alamos National Lab BioScience Division MS M888 Los Alamos, NM 87545
• 1.0k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States
On Thu, Feb 2, 2012 at 2:12 PM, Chris Stubben <stubben@lanl.gov> wrote: > Does anyone know how to add strands and number of overlapping bases to the > findOverlaps output? For example, given these locations > > x <- GRanges( "chr", > IRanges( c(3,11,17,25,28), c(9,18,24,31,35)) , > c("-", "+", "+","-","+" )) > > and the findOverlaps output... > > y<- as.matrix(findOverlaps(ranges(**x), ignoreSelf=TRUE, > ignoreRedundant=TRUE)) > y > query subject > [1,] 2 3 > [2,] 4 5 > > I'd like to add the query and subject strands and number of overlapping > bases > > query subject strands overlap > 2 3 ++ 2 > 4 5 -+ 4 > > The query and subject columns index into the original ranges, so just index into their strand() to get the strands, i.e., strand(x)[y[,"query"]. You can then paste() that together. To get the amount of overlap, use width(pintersect(x[y[,"query"]], x[y[,"subject"]])). I'm assuming you know how to combine the match matrix with other fields into a data.frame. Btw, in devel we have made RangesMatching contain Vector so it supports element metadata. This would be a good use case. Michael > Thanks, > Chris Stubben > > > > -- > Los Alamos National Lab > BioScience Division > MS M888 > Los Alamos, NM 87545 > > ______________________________**_________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > Search the archives: http://news.gmane.org/gmane.** > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

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