Entering edit mode
Fahim Md
▴
250
@fahim-md-4018
Last seen 10.4 years ago
Hi
Is it possible to filter ranges by imposing condition on name field.
I am
using the IRanges vignette example below:
Require(IRanges)
ir1 <- IRanges(start = 1:10, width = 10:1)
ir2 <- IRanges(start = 1:10, end = 11)
ir3 <- IRanges(end = 11, width = 10:1)
identical(ir1, ir2) & identical(ir2, ir3)
ir <- IRanges(c(1, 8, 14, 15, 19, 34, 40),
width = c(12, 6, 6, 15, 6, 2, 7))
values <- rnorm(length(ir))
rd <- RangedData(ir, name = letters[seq_len(length(ir))], values)
rd
1> rd
RangedData with 7 rows and 2 value columns across 1 space
space ranges | name values
<character> <iranges> | <character> <numeric>
1 1 [ 1, 12] | a -0.8204717
2 1 [ 8, 13] | b -0.2419617
3 1 [14, 19] | c -0.7747140
4 1 [15, 29] | d -0.1103875
5 1 [19, 24] | e -0.2945884
6 1 [34, 35] | f 1.8082479
7 1 [40, 46] | g -0.1854162
I have another list *toFind*:
toFind = c ('a', 'c', 'd', 'f')
Is it possible to find the correponding ranges? The output in this
case
would be
1> output
RangedData with 4 rows and 2 value columns across 1 space
space ranges | name values
<character> <iranges> | <character> <numeric>
1 1 [ 1, 12] | a -0.8204717
2 1 [14, 19] | c -0.7747140
3 1 [15, 29] | d -0.1103875
4 1 [34, 35] | f 1.8082479
Thanks a lot.
Fahim
--
Fahim Mohammad
Bioinforformatics Lab
University of Louisville
Louisville, KY, USA
Ph: +1-502-409-1167
[[alternative HTML version deleted]]