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

[FEATURE REQUEST] Plot zeros in grey, nonzero using colormap #2629

Open
slinnarsson opened this issue Sep 6, 2023 · 1 comment
Open

[FEATURE REQUEST] Plot zeros in grey, nonzero using colormap #2629

slinnarsson opened this issue Sep 6, 2023 · 1 comment

Comments

@slinnarsson
Copy link

slinnarsson commented Sep 6, 2023

The difference between zero (no detection) and nonzero values is dramatic and informative in single-cell analysis. This is especially true when some clusters are all-zero whereas some other clusters have consistent but low expression. If such data is plotted using a continuous colormap, it is near-impossible to visually distinguish low expression from no expression.

I think the proper way to plot single-cell data is to first plot the zeros in light grey, then plot non-zeros using a colormap, on top. As long as point overlap is kept to a minimum (often also an issue in cellxgene), this way of plotting accurately reveals both low and no expression.

For example, consider the difference for AQP4 expression in this example of glioblasts when using grey for zeros (left) or just using the colormap (right):

image

When just using a colormap gradient, the true structure of gene expression disappears.

Finally, of course nonzero should be plotted in random order so as to avoid misleading the viewer because some cluster is plotted on top of another.

Related issue: #2624 (but I think my solution is preferable; e.g. plotting low to high would not help in the case of AQP4 above since you still can't see where the zeros are)

Plotting with zeros in grey will not work for data that's been subjected to imputation or some weird normalisation etc. where there are no zeros.

Unfortunately the clipping tool cannot be used for this, since it's global while the fraction of zeros is gene-specific. Also, there is no indication of what threshold should be used for clipping such as to make all and only the zeros grey.

@slinnarsson
Copy link
Author

If my proposal is not controversial, I would replace the lower threshold (numeric up-down widget) in the clipping tool with a checkbox ("Clip zeros"), and cells with expression above the upper percentile should be plotted using the maximum color from the colormap, not in grey.

If the old behaviour is still desired by some, I would add the checkbox but leave the lower percentile up-down widget in place. When the checkbox is checked, the lower percentile would be calculated only among non-zeros.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant