Entering edit mode
arne.mueller@novartis.com
▴
200
@arnemuellernovartiscom-2205
Last seen 9.1 years ago
Switzerland
Dear All,
may I ask a basic question about the GRanges package. It seems that
the
functions seqselect and window treat start/end as indexes in the
GRanges
object rather that he actually start/end positions. Is there a method
with
which I can extract a sub-range from an GRanges object based on
genomic
coordinates rather than indexes?
> gr = GRanges(seqnames="A", ranges=IRanges(start=c(10, 100),
end=c(20,
200)))
> gr
GRanges with 2 ranges and 0 elementMetadata values
seqnames ranges strand |
<rle> <iranges> <rle> |
[1] A [ 10, 20] * |
[2] A [100, 200] * |
seqlengths
A
NA
>
> window(gr, start=12, end=98)
Error in solveWindowSEW(length(x), start, end, width) :
Invalid sequence coordinates.
Please make sure the supplied 'start', 'end' and 'width' arguments
are defining a region that is within the limits of the sequence.
> window(gr, start=1, end=2)
GRanges with 2 ranges and 0 elementMetadata values
seqnames ranges strand |
<rle> <iranges> <rle> |
[1] A [ 10, 20] * |
[2] A [100, 200] * |
seqlengths
A
NA
> window(gr, start=9, end=40)
Error in solveWindowSEW(length(x), start, end, width) :
Invalid sequence coordinates.
Please make sure the supplied 'start', 'end' and 'width' arguments
are defining a region that is within the limits of the sequence.
...
> sessionInfo()
R version 2.13.0 Under development (unstable) (2010-10-31 r53501)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] GenomicRanges_1.1.38 IRanges_1.9.3
loaded via a namespace (and not attached):
[1] tools_2.13.0
thanks a lot for your help,
Arne
[[alternative HTML version deleted]]