On Mon, Sep 2, 2013 at 12:38 AM, Julian Gehring <julian.gehring@embl.de>wrote:

> Hi,
>
> It seems to me that constructing a 'GRangesList' object containing
> 'GRanges' with metadata does not keep the metadata.  As an example:
>
> * Example 1
>
> library(GenomicRanges)
> gr = GRanges()
> metadata(gr) = list(a = "1")
> metadata(gr) ## the metadata was stored
> grl = GRangesList(gr, gr) ## put it in a 'GRangesList
> metadata(grl[[1]]) ## no metadata anymore
>
>
> Also, concaternating 'GRangesList's seem to keep them:
>
> Example 2:
>
> grl = GRangesList(gr, gr)
> metadata(grl) = list(b = "2")
> metadata(grl) ## it's there
> grlc = c(grl, grl)
> metadata(grlc) ## now it's gone
>
>

This second case is exactly what happens to the individual GRanges that
constitute the list. They are concatenated to form a single GRanges, which
is stored along side a partitioning that defines the individual elements.
There is no longer two separate GRanges objects, so there is no easy way to
keep the metadata around. It's unfortunate that an implementation detail is
exposed in this way, but it would take some effort to support this feature.
This is a property of all CompressedList derivatives. What's the use case?

Michael


> The second case would be hard to handle in a general way since it is not
> clear how to combine different metadata list.  However, the first case
> looks not like a expected behavior.
>
> Best wishes
> Julian
>
> ______________________________**_________________
> Bioc-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/bioc-devel<https://stat.ethz.ch/mailman/listinfo/bioc-devel>
>

	[[alternative HTML version deleted]]

