countOverlaps within Mode Counting
1
0
Entering edit mode
@valerie-obenchain-4275
Last seen 2.3 years ago
United States
Hi Dario, I'm not sure I understand your question. Are you after a summary by gene of the number of reads that fall 'within' each gene? > genes <- GRanges("chr1", IRanges(c( 1, 19), c(10, 30))) > reads <- GRanges("chr1", IRanges(c(2, 20, 22), width=5)) > fo <- findOverlaps(reads, genes, type="within") > as.matrix(fo) queryHits subjectHits [1,] 1 1 [2,] 2 2 [3,] 3 2 > split(queryHits(fo), subjectHits(fo)) $`1` [1] 1 $`2` [1] 2 3 Do you really want to know if a gene falls 'within' a short read or are you asking if that is a reasonable use case? Valerie On 02/29/2012 04:00 AM, Dario Strbenac wrote: > When using countOverlaps, it makes counts for each query range, using the subjects. I find the definition of the type = "within" setting non-intuitive. It only counts a subject range if it has a query within it. But since countOverlaps gives one count per query, it seems natural to have gene coordinates as the query object, and short read coordinates as the subject coordinates. Then, using "within" is equivalent to asking how many times each gene is wholly within a short read. Is this a meaningful calculation for other use cases than the one I have made ? Could it be extended to work for the genes and reads scenario ? > > -------------------------------------- > Dario Strbenac > Research Assistant > Cancer Epigenetics > Garvan Institute of Medical Research > Darlinghurst NSW 2010 > Australia > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
Cancer Cancer • 792 views
ADD COMMENT
0
Entering edit mode
Dario Strbenac ★ 1.5k
@dario-strbenac-5916
Last seen 2 hours ago
Australia
Hi, Yes, the question was how many reads fall totally inside each gene. Your example shows what I was trying to do, but I was trying to do it in one line with countOverlaps, which doesn't seem possible with the current semantics of the Within mode, since it groups by the query ranges, but the query ranges have to be inside the subject ranges. It's quite simple, as you show, to do it by summarizing the overlap result, so I suppose it's not needed.
ADD COMMENT

Login before adding your answer.

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