Dear all, I have two Grnage list (gr2=repeatmask.hg38 from UCSC; gr1=CpGs methylation regions from RRBS data). I want to filter out the CpGs that are in the genome repeated regions. I did it like this, do you think if it is correct?
hits <- findOverlaps(gr2, gr1)
head(hits)
Hits object with 6 hits and 0 metadata columns:
queryHits subjectHits
<integer> <integer>
[1] 2 11832
[2] 2 11833
[3] 2 11834
queryLength: 5520017 / subjectLength: 58660550
idx <- unique(subjectHits(hits))
head(idx)
[1] 11832 11833 11834 11835 11840 11841
rownames(gr1) <- gr1$ids
gr1_unique <- gr1[! ids %in% idx,]
OR
unique_gr1 <- gr1[-match(idx,gr1$ids),]
Many thnkas in advance, Rahel