inner and outer mcols for GRangesFactor
LTLA opened this issue · 1 comments
It would be desirable for GRangesFactor
to consistently transmit the information in the mcols
of its levels when providing GRanges
-like semantics. In particular:
example(GRangesFactor)
levels(grf1)$whee <- 1:6
# It would be nice to see 'whee' mentioned somewhere.
show(grf1)
# Needs ignore.mcols=TRUE to get 'whee', but then it loses 'ID'.
unfactor(grf1)
# Doesn't know any better, so just returns NULL.
grf1$whee
One of the appeals of using a GRangesFactor
in the first place is so that we can stuff loads of content into the mcols
of the levels
without inflating the overall object. While setting is easy with mcols(levels(x))<-
, we should consider ways of making it easy to do get back the "expanded" level metadata without needing the wordy levels(x)$whee[as.integer(x)]
. For example:
show
could just list the metadata fields in the levels, even if it doesn't show them.unfactor
's default could try to include both level and element-wise metadata (i.e.,mcols(x)
), throwing a warning if the latter overrides the former by name.$
could try to get the expanded level metadata ifname
does not exist in the element-wise metadata.
This whole situation is similar to the inner/outer mcols
retrieval issue for GRLs. It would probably be desirable to be consistent across these two classes - though arguably, GRLs are not a great example because the inner mcols are shown but so hard to get (what a tease!).
Any guidance on what to do here?