问题
I am new to the IRanges package and am having trouble getting the end value of an IRange. I am able to get the start and width values with no problem, which has me a bit baffled, and my case/spelling of end match the header line. Has anyone else run into this or can please spot what I am doing wrong? Thanks and it is much appreciated!
library(IRanges)
> test=IRanges(100645,100664)
> test
IRanges of length 1
start end width
[1] 100645 100664 20
> test@start
[1] 100645
> test@width
[1] 20
> test@end
Error: no slot of name "end" for this object of class "IRanges"
回答1:
The easiest manner to access the fields of an IRange object is using the helper functions: start()
,end()
and width()
. These will return a vector with all the elements of the corresponding column.
回答2:
No experience with the package, but based on ?"class:Ranges"
:
end(test$ranges[1])
It would also help in the future to provide reproducible sample data.
来源:https://stackoverflow.com/questions/9746637/cant-get-end-value-of-an-irange-in-r-bioconductor