0
0
Entering edit mode
me.saichi • 0
@mesaichi-15345
Last seen 4.2 years ago

Hello,

I am working on a g range object, and I would like to add a meta data column which contains the names (variant accessions) of variants which have already been merged by overlap.

Thank you very Much for your help.

Melissa S

Msc Bioinformatics (Paris Diderot)

granges findoverlaps • 509 views
0
Entering edit mode

Hi Melissa,

Without a reproducible example, there is not much specific help that fellow Bioconductor users can provide.

If you have the ranges of those variants that have been merged, you can use findOverlaps to find the overlapping ranges in the original GRanges that correspond to those variant accessions. You can then create a vector of variant accessions with NA values for those that do not overlap and add the vector to the mcols of the original GRanges (if that is what you intend to do). See below for adding a column to mcols.

library(GenomicRanges)
example(GRanges)
mcols(gr)
mcols(gr) <- DataFrame(mcols(gr), score2 = rnorm(10))


Similarly, you can also do:

mcols(gr)\$score3 <- rnorm(10)


Regards, Marcel