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

Why does the highest expression plotted with most negative density? Disagreement between FeaturePlot vs plot_density #17

Open
denvercal1234GitHub opened this issue Mar 18, 2022 · 7 comments

Comments

@denvercal1234GitHub
Copy link

Hi there,

Thanks for a great tool.

I plot the joint density of a vector of genes that were scored using AddModuleScore.

When I plotted this score for each cell using FeaturePlot and plot_density. The results are entirely opposite of each other. Would you mind helping me to correct this?

Thank you again.
With FeaturePlot:
Screen Shot 2022-03-18 at 11 51 56 PM

With plot_density:

Screen Shot 2022-03-18 at 11 52 32 PM

@denvercal1234GitHub denvercal1234GitHub changed the title Why does the highest expression plotted with most negative density? Why does the highest expression plotted with most negative density? Disagreement between FeaturePlot vs plot_density Mar 18, 2022
@p-gueguen
Copy link

Hello, I'm not a developer but you can find a workaround by specifying the kernel density method to method = "wkde". Hope that helps!

@gabsax
Copy link

gabsax commented Apr 5, 2024

Hi @denvercal1234GitHub did you solve the issue? I have the same problem

@mschilli87
Copy link

@gabsax: Have you tried @p-gueguen's suggestion of setting method = "wkde"? It works for me.

@gabsax
Copy link

gabsax commented Apr 5, 2024

Hi @mschili87, it partially solve the problem but the result it's not accurate. But I found it works better if in addition to setting method = "wkde" I also transform the data:

obj$signature <- round((obj$signature + abs(min(obj$signature))) * 100)

@mschilli87
Copy link

@gabsax:

...but the result it's not accurate.

Could you elaborate?

@gabsax
Copy link

gabsax commented Apr 5, 2024

Featureplot
Nebulosa1
Nebulosa2

You can view the plots in the attachment. The Featureplot accurately shows the cells expressing the signature. When visualizing the signature with Nebulosa by simply adding the argument method = "wkde", there are still some cells that shouldn't express it (Nebulosa 1 in the red circle). However, if you transform the data as I showed earlier, you can obtain a Nebulosa plot very comparable to the Featureplot (Nebulosa 2).

@mschilli87
Copy link

Interesting example. I guess it's the negative values that create the difference. So there are lots of cells expressing the feature but those are balanced out by a lot of others that do not express it at all. 🤔
@joseah: Any thoughts on this?

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

4 participants