Hi there, I have a GRanges object that I wanna merge duplicate ranges and append counts as a metadata columns. I know similar thing can be easily done using uniq -c
, but I want do it in R/Bioconductor. Is there any suggestion?
>orginalGRanges
GRanges with 6 ranges and 0 metadata columns: seqnames ranges strand <Rle> <IRanges> <Rle> [1] Chr1 [2, 24] + [2] Chr1 [2, 25] + [3] Chr1 [2, 25] + [4] Chr1 [4, 25] + [5] Chr1 [5, 25] + [6] Chr1 [6, 21] + --- seqlengths: Chr1 NA
>expectedGRanges
GRanges with 5 ranges and 1 metadata column: seqnames ranges strand | hits <Rle> <IRanges> <Rle> | <numeric> [1] Chr1 [2, 24] + | 1 [2] Chr1 [2, 25] + | 2 [3] Chr1 [4, 25] + | 1 [4] Chr1 [5, 25] + | 1 [5] Chr1 [6, 21] + | 1 --- seqlengths: Chr1 NA