SingleCellExperiment convenience function for metadata+expression?
2
0
Entering edit mode
@300a71cc
Last seen 28 days ago
Australia

Hi,

Just wondering if there is a convenience function somewhere in the SCE/SFE/SPE/SE object that allows for pulling out feilds from metadata + expression + reduced dimension coordinates all in one command? ie. For when I want to plot a custom umap with gene expression split by sample group, but with more control than the plot_UMAP function typically allows.

Essentially the direct bioconductor equivalent of Seurat's FetchData() (I wasted ages doing that with custom functions before I realised that was inbuilt!)

I know how to build such a table myself, but since its a common pattern I'm wondering if there's a shortcut?

I imagine it would look like this?

get_table_of_data(sce,
     from_metadata=c('timepoint','individual','cluster'),
    from_reddim=list(UMAP='UMAP_1', 'UMAP_2'), 
    from_assay=list(counts=c('CD63','Hba1'))
)

I couldn't see anything in the reference docs, but I'm not sure I'm looking in the right place! Thanks.

SpatialExperiment SingleCellExperiment SpatialFeatureExperiment • 305 views
ADD COMMENT
2
Entering edit mode
@stefanomangiola-6873
Last seen 4 hours ago
Australia

This question was mentioned in the #tidiness_in_bioc Bioconductor slack channel. I try to give a tidyomic solution

library(tidySingleCellExperiment)

sce |>
   join_features(c('CD63','Hba1'))

This can be directly piped to ggplot or directly converted to tibble

... |> ggplot()
... |> as_tibble()
ADD COMMENT
1
Entering edit mode
Peter Hickey ▴ 750
@petehaitch
Last seen 5 weeks ago
WEHI, Melbourne, Australia

Hi Sarah,

scuttle::makePerCellDF() / scuttle::makePerFeatureDF() and scater::ggcells() / scater::ggfeatures(), which build upon the former, will give you what I think you want for SE and SCE. scuttle/scater were designed for single-cell rather than spatial data, but quick testing shows that they may be able to give you the non-spatial components of an _SPE_ and _SFE_. Perhaps you can use these as a starting point or some of the SPE and SPF authors can chime in: dario.righelli, helucro, davide risso, Lukas Weber, lambda

Cheers, Pete

ADD COMMENT

Login before adding your answer.

Traffic: 1125 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6