Entering edit mode
Fahim Md
▴
250
@fahim-md-4018
Last seen 10.3 years ago
Hi
In the following example, I am trying to use 'reduce()' function to
reduce
the genomic intervals and find intervals corresponding to 'Gene'. It
is
behaving as it is desired. However the output of the reduce just give
the
intervals (I am losing the 'Gene' metadata).
Is there a way to retain 'Gene' metadata.
> gr <- GRanges(+ seqnames = Rle(c("chr1",
"chr2", "chr2"), c(6, 2,2)), + ranges =
IRanges(c(1:6, 1:2, 10:11) , end = c(7:12, 5,9, 18:19 )), +
strand = Rle(strand(c("-", "+", "-", "*")),c(3, 3, 2,2)), +
transcript = head(letters, 10),+ Gene =
c(rep("xxx",3), rep("yyy",3), rep("zzz",2), rep("www",2)) +
)> grGRanges with 10 ranges and 2 elementMetadata values:
seqnames ranges strand | transcript Gene
<rle> <iranges> <rle> | <character> <character>
[1] chr1 [ 1, 7] - | a xxx
[2] chr1 [ 2, 8] - | b xxx
[3] chr1 [ 3, 9] - | c xxx
[4] chr1 [ 4, 10] + | d yyy
[5] chr1 [ 5, 11] + | e yyy
[6] chr1 [ 6, 12] + | f yyy
[7] chr2 [ 1, 5] - | g zzz
[8] chr2 [ 2, 9] - | h zzz
[9] chr2 [10, 18] * | i www
[10] chr2 [11, 19] * | j www
---
seqlengths:
chr1 chr2
NA NA> x = reduce(gr)> xGRanges with 4 ranges and 0
elementMetadata values:
seqnames ranges strand
<rle> <iranges> <rle>
[1] chr1 [ 4, 12] +
[2] chr1 [ 1, 9] -
[3] chr2 [ 1, 9] -
[4] chr2 [10, 19] *
---
seqlengths:
chr1 chr2
NA NA
>
Thanks
Fahim
--
-------------------------------
Fahim Mohammad
Bioinforformatics Lab
University of Louisville
Louisville, KY, USA
[[alternative HTML version deleted]]