Question: R_Granges_adding merged Metadata columns
0
gravatar for me.saichi
20 months ago by
me.saichi0
me.saichi0 wrote:

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 • 288 views
ADD COMMENTlink written 20 months ago by me.saichi0

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

ADD REPLYlink modified 19 months ago • written 19 months ago by Marcel Ramos ♦♦ 410
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 296 users visited in the last hour