[BioC] reducing RangedData
Janet Young
jayoung at fhcrc.org
Thu Jan 21 00:37:39 CET 2010
Hi Patrick,
I second Robert's thanks - reduce on RangedData is really useful.
I have an additional suggestion (you might already be on the case with this
one). I was trying to reduce a RangedData object that didn't have any
strand/score/name, and kept getting an error
(Error in endoapply(x[, by], FUN) : 'FUN' did not produce an endomorphism).
I got around that by just adding a fake name (or strand or whatever) that is
identical for all objects.
It would be even nicer if reduce could handle bare bones RangedData objects
without needing this workaround.
Here is some code to show you what I mean, following your example:
suppressMessages(library(IRanges))
sta <- c(1, 2, 5, 6, 2, 3, 4, 5)
end <- c(3, 4, 5, 7, 2, 4, 6, 7)
str <- rep(c("+", "+", "-", "-"), 2)
chr <- rep(c("chr1", "chr2"), each = 4)
rd <- RangedData(IRanges(start=sta, end=end), strand=str, space=chr)
reduce(rd) ####works fine
rd2 <- RangedData(IRanges(start=sta, end=end), space=chr)
reduce(rd2)
####Error in endoapply(x[, by], FUN) : 'FUN' did not produce an endomorphism
rd3 <- RangedData(IRanges(start=sta, end=end), fakename=rep("hello",8),space=chr)
reduce(rd3) ####works fine
thanks very much,
Janet Young
More information about the Bioconductor
mailing list