Fwd: findOverlaps with strand info
0
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.9 years ago
United States
---------- Forwarded message ---------- From: Michael Lawrence <michafla@gene.com> Date: Thu, Feb 2, 2012 at 4:14 PM Subject: Re: [BioC] findOverlaps with strand info To: "Cook, Malcolm" <mec@stowers.org> Cc: Michael Lawrence <lawrence.michael@gene.com> On Thu, Feb 2, 2012 at 4:11 PM, Cook, Malcolm <mec@stowers.org> wrote: > > > On 2/2/12 5:57 PM, "Michael Lawrence" <lawrence.michael@gene.com> wrote: > > >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"]])). > > pintersect will complain about strand incompatibility, so I think this is > not quite right.... > > Sorry, just use ranges(x) there instead of 'x'. > > > > >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.ethz.ch > >>/mailman/listinfo/bioconductor> > >> Search the archives: http://news.gmane.org/gmane.** > >> > >>science.biology.informatics.**conductor< > http://news.gmane.org/gmane.scien > >>ce.biology.informatics.conductor> > >> > > > > [[alternative HTML version deleted]] > > > >_______________________________________________ > >Bioconductor mailing list > >Bioconductor@r-project.org > >https://stat.ethz.ch/mailman/listinfo/bioconductor > >Search the archives: > >http://news.gmane.org/gmane.science.biology.informatics.conductor > > [[alternative HTML version deleted]]
• 612 views
ADD COMMENT

Login before adding your answer.

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