Sometimes I have a GRangeList object and I want to modify the mcols of the underlying GRanges object. The only way I know to do this is to do something like:
grl@unlistData$newColumn <- newValue
But that unfortunately breaks the GRangesList abstraction by directly accessing the slot. Is there any way to do this without resorting to slot access?
(To be clear, I'm aware that the GRangesList also has its own separate set of mcols, and those are not what I'm trying to access.)
The
level="within"
trick is exactly what I was looking for. I don't know if we really need a shortcut for this pattern, since it doesn't come up that often. As long as there's a way to do it at all without breaking abstraction, I'm satisfied.As of today, I do not manage to reproduce the examples above. After running
example("GRangesList")
to create agrl
object with "score" and "GC" mcols, here is what I get: