[BioC] reducing RangedData

Patrick Aboyoun paboyoun at fhcrc.org
Thu Jan 21 01:00:32 CET 2010


Janet,
I'll patch IRanges to fix this. For now you can use the workaround:

RangedData(reduce(ranges(rd2)))


Patrick



Janet Young wrote:
> 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
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list