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

How to change FeaturePlot expression scale to z-score transformed scale #4543

Closed
ksaunders73 opened this issue May 27, 2021 · 2 comments
Closed

Comments

@ksaunders73
Copy link

ksaunders73 commented May 27, 2021

Hello!

This may be because I do not fully understand the source code for FeaturePlot() (https://github.com/satijalab/seurat/blob/master/man/FeaturePlot.Rd), but by what I think I understand, the scale on the righthand side is in terms of relative expression of a feature to the maximum expression of that feature (to the whole dataset or to the clusters or to specified conditions if they are specified?).

Is there a way to transform this relative expression into a Z score (or some other statistic) and make the scale show these Z scores?

I am also running some code from #3521 which allows me to plot a list of genes onto a single Feature Plot:

nkfocuslist <- list(c("TFF1", "MB", "ANKRD30B",
             "LINC00173", "DSCAM-AS1", "IGHG1", "SERPINA5"))
sobj <- AddModuleScore(object = sobj, features = nkfocuslist, name = "NK_Focus_List")
FeaturePlot(object = sobj, features = "NK_Focus_List1")

image

Is there a way to make this scale a Z-score scale as well?

Hopefully this makes sense, and thank you for reading!

@yuhanH
Copy link
Collaborator

yuhanH commented May 28, 2021

Hi,
This ModuleScore looks a little wired in your plot. Have you run NormalizeData before AddModuleScore?
Since module score stores in the meta.data, you can convert it to the Z-score directly.

sobj$NK_Focus_List1 <- (sobj$NK_Focus_List1  - mean(sobj$NK_Focus_List1 )) / sd(sobj$NK_Focus_List1 )

@yuhanH yuhanH closed this as completed May 28, 2021
@ksaunders73
Copy link
Author

Hello @yuhanH ! This worked! Thanks so much for your help!! As for my data, it is a TPM matrix so I skipped the normalization step as I've seen recommended on this forum (#668) and the bioinformatics stack exchange (https://bioinformatics.stackexchange.com/questions/5115/seurat-with-normalized-count-matrix). I only ran FindVariableFeatures() (ExpMean), ScaleData() (default linear regression), and then RunPCA(), FindNeighbors(), FindClusters(), and then the RunUMAP().

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

2 participants