Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inner and outer mcols for GRangesFactor #30

Open
LTLA opened this issue Jun 23, 2019 · 1 comment
Open

inner and outer mcols for GRangesFactor #30

LTLA opened this issue Jun 23, 2019 · 1 comment

Comments

@LTLA
Copy link

LTLA commented Jun 23, 2019

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

@LTLA
Copy link
Author

LTLA commented Sep 4, 2019

Any guidance on what to do here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant