carmonalab / ProjecTILs

Interpretation of cell states using reference single-cell maps
GNU General Public License v3.0
246 stars 28 forks source link

where to find the "functional.cluster" #42

Closed PingpingZheng closed 1 year ago

PingpingZheng commented 1 year ago

Somehow, ProjectTILs (version 3) doesn't return functional.cluster to the query after make.projection.

query_example_seurat <- make.projection(query_example_seurat, ref=ref)
plot.states.radar(query_example_seurat )
Error: Cannot find 'functional.cluster' in this Seurat object
names(query_example_seurat@meta.data)
[1] "Sample"             "Barcode"            "SampleLab"          "nCount_RNA"         "nFeature_RNA"       "cycling.score"     
[7] "cycling.score.G1_S" "cycling.score.G2_M" "anchor.score"

Has anyone encounter the same issue? Is there any way to fix it? Thank you in advance for any tips.

mass-a commented 1 year ago

Hello, you need to run cellstate.predict after make.projection to obtain the predicted cell state, e.g.:

query_projected <- make.projection(query_example_seurat, ref=ref)
query_projected <- cellstate.predict(ref=ref, query=query_projected)

More simply, you can use the Run.ProjecTILs function, which is a wrapper for the two steps above:

query_projected <- Run.ProjecTILs(query_example_seurat, ref=ref)

You can see more concrete examples in this demo or in one of the case studies.

Best -m

PingpingZheng commented 1 year ago

Thank you so much. cellstate.predict works well.