Finding duplicated entries in GRangesList
0
0
Entering edit mode
Marco • 0
@dc86b518
Last seen 11 days ago
United States

Hi, I am trying to remove duplicated entries in a set of GRangesList. Not sure what happened but I am pretty sure that I used to use the duplicated() or unique() function for removing duplicates but now it's not working. Could someone advise on alternatives?

This is an example that is not producing the expected value

library(GenomicRanges)

# Create a sample GRangesList with some duplicated GRanges objects
gr1 <- GRanges(seqnames = "chr1", ranges = IRanges(c(1,30), c(10,50)), strand = "+")
gr2 <- GRanges(seqnames = "chr2", ranges = IRanges(c(20,60), c(30,100)), strand = "-")
gr3 <- GRanges(seqnames = "chr1", ranges = IRanges(c(1,20), c(10,30)), strand = "+") 

my_grl <- GRangesList(gr1, gr2, gr3, gr1) # Duplicating gr1

duplicated(my_grl)
#LogicalList of length 4
#[[1]] FALSE FALSE
#[[2]] FALSE FALSE
#[[3]] FALSE FALSE
#[[4]] FALSE FALSE

length(my_grl) == length(unique(my_grl))
#[1] TRUE

Thanks

GenomicRanges • 94 views
ADD COMMENT

Login before adding your answer.

Traffic: 1281 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6