-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fixed some bugs (due to inconsistencies during migration) and typos in CINEMA-OT #413
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #413 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 40 40
Lines 4887 4890 +3
=====================================
- Misses 4887 4890 +3
|
@@ -346,7 +346,7 @@ def get_dim( | |||
sk.fit(vm) | |||
wm = np.dot(np.dot(np.sqrt(sk._D1), vm), np.sqrt(sk._D2)) | |||
u, s, vt = np.linalg.svd(wm) | |||
dim = np.min(sum(s > (np.sqrt(data.shape[0]) + np.sqrt(data.shape[1]))), adata.obsm[use_rep].shape[1]) | |||
dim = min(sum(s > (np.sqrt(data.shape[0]) + np.sqrt(data.shape[1]))), adata.obsm[use_rep].shape[1]) |
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.
Hi, thank you so much for taking another look at the code!
I'm still unsure about the functionality of this code line. At least with the example I'm using, I get an error because (s > (np.sqrt(data.shape[0]) + np.sqrt(data.shape[1])))
returns a boolean, but sum
expects an iterable. It's possible that I'm not testing it with a suitable example - in that case, maybe you could provide me with one.
Many thanks in advance!
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.
s is a vector and (s > (np.sqrt(data.shape[0]) + np.sqrt(data.shape[1])) returns a boolean array. sum can work on that boolean array. Not sure what is the problem there... Did you set s as an array?
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.
Oh, I indeed didn't realize s is a vector - sorry, my bad! The method works for me too now.
In my opinion, we could merge the changes then. @Zethson, could you please have a final look?
@@ -327,7 +327,7 @@ def get_dim( | |||
c: float = 0.5, | |||
use_rep: str = "X_pca", | |||
): | |||
"""Estimating the rank of the count matrix. Always use adata.raw.X. | |||
"""Estimating the rank of the count matrix. Always use adata.raw.X. Make sure it is the raw count matrix. |
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.
This can be checked with https://github.com/theislab/pertpy/blob/main/pertpy/tools/_distances/_distances.py#L677
We could consider checking for this and then throwing an error
No description provided.