Bioconductor / GenomicRanges

Representation and manipulation of genomic intervals
https://bioconductor.org/packages/GenomicRanges
41 stars 17 forks source link

inner and outer mcols for GRangesFactor #30

Open LTLA opened 5 years ago

LTLA commented 5 years ago

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:

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!).

LTLA commented 4 years ago

Any guidance on what to do here?