Nicolas,
Michael is out globetrotting so I have taken up your suggestion for
adding "start<-", "end<-", and "width<-" methods for RangedData and
RangesList objects. You can find these new methods in a recent svn BioC
2.5 (devel) check-in to IRanges version 1.3.34, which should be
available 24 hours from now from bioconductor.org. These methods accept
either an appropriately formed integer vector that will be split by
space(x) or an IntegerList object of the same makeup as x. There is also
an optimization when the RangesList is of subclass
CompressedIRangesList. Here is some example code using this new
functionality:
> suppressMessages(library(IRanges))
> ranges1 <- IRanges(start=c(1,2,3), end=c(5,2,8))
> ranges2 <- IRanges(start=c(15,45,20,1), end=c(15,100,80,5))
> rangeslist <- IRangesList(one = ranges1, two = ranges2)
> rangeddata <- RangedData(c(ranges1, ranges2), X = rnorm(7),
+ space = rep(c("one", "two"), elementLengths(rangeslist)))
> start(rangeslist)
[1] 1 2 3 15 45 20 1
> start(rangeslist) <- 1L
> start(rangeslist)
[1] 1 1 1 1 1 1 1
> width(rangeddata)
[1] 5 1 6 1 56 61 5
> width(rangeddata) <- seq_len(nrow(rangeddata))
> width(rangeddata)
[1] 1 2 3 4 5 6 7
> sessionInfo()
R version 2.10.0 Under development (unstable) (2009-06-28 r48863)
i386-apple-darwin9.7.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] IRanges_1.3.34
Patrick
Nicolas Delhomme wrote:
Hello Michael, everybody,
I had a need for the "start" and "width" replacement methods for
objects of type RangedData and RangesList. I've attached the method
below for two reasons:
1) I'd like to have them checked by an expert eye (not that I end up
messing up my analyses...)
2) depending on 1), they might actually be worthy for others :-)
setReplaceMethod("start","RangesList",function(x,check=TRUE,value){
values <- split(value,space(x))
for(i in seq(along=x)){
start(x[[i]]) <- values[[i]]
}
x
})
setReplaceMethod("start","RangedData",function(x,check=TRUE,value){
start(ranges(x))<-value
return(x)
})
setReplaceMethod("width","RangesList",function(x,check=TRUE,value){
values <- split(value,space(x))
for(i in seq(along=x)){
width(x[[i]]) <- values[[i]]
}
x
})
setReplaceMethod("width","RangedData",function(x,check=TRUE,value){
width(ranges(x))<-value
return(x)
})
Best,
Nico
---------------------------------------------------------------
Nicolas Delhomme
High Throughput Functional Genomics Center
European Molecular Biology Laboratory
Tel: +49 6221 387 8426
Email: [email protected]
Meyerhofstrasse 1 - Postfach 10.2209
69102 Heidelberg, Germany
_______________________________________________
Bioc-sig-sequencing mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
_______________________________________________
Bioc-sig-sequencing mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing