SingleR-inc / SingleR

Clone of the Bioconductor repository for the SingleR package.
https://bioconductor.org/packages/devel/bioc/html/SingleR.html
GNU General Public License v3.0
177 stars 19 forks source link

Viewing the classification genes #234

Closed antoine4ucsd closed 1 year ago

antoine4ucsd commented 1 year ago

Hello is there a simple way to view the genes that were used to classify/annotate the cells Garnett package has a function get_feature_genes that seems interesting. is there an equivalent in SingleR? https://cole-trapnell-lab.github.io/garnett/docs/#2-classifying-your-cells

feature_genes <- get_feature_genes(pbmc_classifier,
                                   node = "root",
                                   db = org.Hs.eg.db)
head(feature_genes)

#                B cells       T cells      Unknown
#(Intercept) -6.51829349  2.6403157858  3.877977704
#CD74         0.04660324 -0.0529185035  0.006315261
#MS4A1        2.42667982 -2.2194139450 -0.207265871
#CD19         4.33990156 -2.4210500042 -1.918851560
#CD79A        1.09667783 -0.7008461805 -0.395831654
#IGLL5       -0.00103241 -0.0001045559  0.001136966

thank you!

LTLA commented 1 year ago

Should be somewhere in the metadata(<DataFrame>) of the DataFrame returned by SingleR(). Can't remember the exact name, though. Maybe it's metadata(<DataFrame>)$markers.

antoine4ucsd commented 1 year ago

checking now. thank you

antoine4ucsd commented 1 year ago

I confirm! thank you so much

antoine4ucsd commented 1 year ago

metadata(DATAFRAME)$de.genes

antoine4ucsd commented 1 year ago

sorry this is not exactly it it shows all DE genes between all cell types. I am looking for the genes that are classifying each cell type...

j-andrews7 commented 1 year ago

See the appropriate section of the book:

all.markers <- metadata(pred.grun)$de.genes
beta.markers <- unique(unlist(all.markers$beta))
antoine4ucsd commented 1 year ago

thank you (again)