[BioC] suppressing reduce() function when applying set operations to GRanges

Bill Gibb BGibb at genomichealth.com
Mon Feb 11 00:00:23 CET 2013


Hello,

I noticed that when applying set operations to GRanges objects, the returned range is reduced (by default), e.g.

	r1 <- GRanges(seqnames=c(1,1,1), ranges=IRanges(start=c(1,3,5), end=c(1,3,5)), strand='*')
	length(r1)
	r2 <- GRanges(seqnames=c(1,1,1), ranges=IRanges(start=c(1,3,4), end=c(1,3,4)), strand='*')
	length(r2)
	r3 <- union(r1,r2)
	length(r3)
	sum(width(ranges(r3)))

Both r1 and r2 have length 3, whereas r3 has length 2, due to the implicit reduce applied to the result of union(). I can see that reducing the ranges would normally be desired when applying set operations, however there are occasions when one might want to keep a list of singleton ranges (e.g. when sub-sampling at the genomic coordinate level). Is there a way to suppress the reduce() operation when applying set operations to GRanges? Something like union(r1, r2, reduce.ranges=FALSE) would be nice.

I also tried:

	resize(r3,width=1)

however it appears to simply truncate multi-base sequences.

Thank you.

Bill Gibb
Genomic Health, Inc.
Redwood City, CA

______________________________________________________________________
The contents of this electronic message, including any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain confidential information. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this message or any attachment is strictly prohibited. If you have received this transmission in error, please send an e-mail to postmaster at genomichealth.com and delete this message, along with any attachments, from your computer.



More information about the Bioconductor mailing list