Question: GenomicInteractions package read in meta data file
gravatar for tangming2005
2.8 years ago by
United States
tangming200590 wrote:

Hi there,

I am using GenomicInteractions package to read in the bedpe file.

There are several columns for meta data and I did not find a way to add them.

if I use:

mydata<- makeGenomicInteractionsFromFile("my.bedpe" , 
                                experiment_name="my test", 

meta<- read.table("my.bedpe")

meta<- meta[, 11:13]

mcols(mydata)<- meta

it throws me an error:

Error in `elementMetadata<-`(x, ..., value = value) : 
  replacement 'elementMetadata' value must be a DataTable object or NULL

But I can add the meta to a GRange object without problem:

gr<- anchorOne(mydata)

mcols(gr)<- meta

Thanks and happy new year!



ADD COMMENTlink modified 2.8 years ago by Malcolm Perry40 • written 2.8 years ago by tangming200590
gravatar for Malcolm Perry
2.8 years ago by
London, UK
Malcolm Perry40 wrote:

At first I was surprised by this question, since we do not use data.table to import bedpe files in our package. It turns out the answer is hiding in the way S4Vectors handles metadata.

The quick solution is to give mcols what it wants, which in this case in a DataFrame:

mcols(mydata) <- DataFrame(meta)

GenomicInteractions is based around the "Vector"<font face="monospace"> c</font>lass from the S4Vectors core package, which is where all of the mcols functionality is handled. Bioconductor-developed classes store metadata in a DataFrame object, which is a bioconductor-specific class based around DataTable. The GRanges mcols methods appears to perform this conversion implicitly. I am not sure why the mcols(granges) method is different from the mcols(GenomicInteractions) method, I will email the development list about it.

This will probably be fixed in the next version of GenomicInteractions, because we will use InteractionSet underneath our class which will change a lot of implementation details, although this also uses Vector so the fix might have to be upstream.

Hope that helps,


ADD COMMENTlink written 2.8 years ago by Malcolm Perry40
Thanks, I figured it out by myself  and indeed DataFrame(meta) works.

Just a side note, I saw some discussion on implementing the bedpe format in rtracklyer package

It would be very useful for me to handle structural variants data.



ADD REPLYlink written 2.8 years ago by tangming200590

This is now fixed thanks to Herve.

ADD REPLYlink modified 2.8 years ago • written 2.8 years ago by Malcolm Perry40

That will hopefully be in the next release of Bioconductor.


ADD REPLYlink written 2.8 years ago by Malcolm Perry40

It's fixed in release (BioC 3.2) and devel (BioC 3.3). The fix is in S4Vectors release (0.8.6) and devel (0.9.16).  If everything goes well with the build system, both versions should become available via biocLite() in the next 24 hours.



ADD REPLYlink written 2.8 years ago by Hervé Pagès ♦♦ 13k
Please log in to add an answer.


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