reducing RangedData
1
0
Entering edit mode
Janet Young ▴ 740
@janet-young-2360
Last seen 5.1 years ago
Fred Hutchinson Cancer Research Center,…
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
• 910 views
ADD COMMENT
0
Entering edit mode
Patrick Aboyoun ★ 1.6k
@patrick-aboyoun-6734
Last seen 10.2 years ago
United States
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 >
ADD COMMENT

Login before adding your answer.

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