NathanSkene / EWCE

Expression Weighted Celltype Enrichment. See the package website for up-to-date instructions on usage.
https://nathanskene.github.io/EWCE/index.html
53 stars 25 forks source link

Enable meta-data (such as that generated by `get.celltype.table` and Brian's `plot_gene_metrics`) to be stored in the CTD #30

Closed NathanSkene closed 2 years ago

NathanSkene commented 3 years ago

Will probably break most existing functions that expect ctd[[1]] to have $specificity, so might want to adapt so ctd[[1]] has meta-data, and ctd[[2]] has the meanexp/specificity data.

Would need to cascade any changes to magma_celltyping as well

bschilder commented 2 years ago

The way i worked around this is to simply store the metadata within each level of the CTD. This can be a bit redundant for some metadata types, but if they're small enough it doesn't affect the overall size of the CTD (e.g. EWCE version, orthogene version, species). This avoids messing with the fundamental structure of CTDs in a way that would break everything else.

For larger objects like plots, it seems more economical to me to have EWCE functions recreate these rather than store them directly in the CTD. The plots themselves are sometimes as large or larger than the entire CTD. If you really want a CTD stored as a bundle with plots and such, you can always save it as a RDS object with each of these elements in a list:

out <- list(ctd=ewceData::ctd(),
plot1=plot2,
plot2=plot2)
saveRDS(out, <out_path>)