-
Notifications
You must be signed in to change notification settings - Fork 602
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
Gene selection plot for Pearson Residuals #2176
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2176 +/- ##
==========================================
- Coverage 71.42% 71.19% -0.23%
==========================================
Files 92 95 +3
Lines 11286 11322 +36
==========================================
Hits 8061 8061
- Misses 3225 3261 +36
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2176 +/- ##
==========================================
- Coverage 71.80% 71.64% -0.16%
==========================================
Files 97 100 +3
Lines 11522 11578 +56
==========================================
+ Hits 8273 8295 +22
- Misses 3249 3283 +34
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apologies for late reply @jlause . Few minor comments, another thing that is missing are tests but I can help with that.
import numpy as np | ||
|
||
|
||
def pearson_residuals_hvg_scatter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the scatter
suffix.
def pearson_residuals_hvg_scatter( | ||
adata: AnnData, | ||
marker_names=None, | ||
gene_name_key: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please replace to var_names
. In general, check the signature of already existing functions in order to harmonize arguments name.
x: str = 'means', | ||
y: str = 'residual_variances', | ||
hvg_key: str = 'highly_variable', | ||
kwargs_sc_pl_scatter: dict = dict(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this just be called kwargs
and in the docstrings specify that this is passed to sc.pl.scatter
. ?
def clean_helper_fields(ad): | ||
del ad.var['hvg_marker_status'] | ||
if 'hvg_marker_status_colors' in ad.uns.keys(): | ||
del ad.uns['hvg_marker_status_colors'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you elaborate what this is for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few changes
@jlause do you plan on tackling these to get this in? |
Hi @giovp @ivirshup, (also CCing @dkobak)
as we discussed at #1715 and in scverse/scanpy-tutorials#43, I prepared a function
pearson_residuals_hvg_scatter()
that wrapssc.pl.scatter()
to reproduce the "gene selection plot" from the tutorial. It can be used as a sanity check for both the HVG selection and the appropriateness of the used Pearson residual null model (as explained also in the tutorial notebook).I also added a feature to show known marker genes on the plot, change plot aesthetics and which fields are used for plotting.
Looking forward to your thoughts on this one :)
Best,
Jan
PS: I prepared this PR on an independent branch from #1715 - hope that is the correct way in this situation!