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

Fixed some bugs (due to inconsistencies during migration) and typos in CINEMA-OT #413

Merged
merged 3 commits into from
Oct 31, 2023

Conversation

MingzeDong
Copy link
Contributor

@MingzeDong MingzeDong commented Oct 26, 2023

No description provided.

@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

Merging #413 (9d71b9e) into main (d3c0db3) will not change coverage.
The diff coverage is 0.00%.

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     
Files Coverage Δ
pertpy/tools/_cinemaot.py 0.00% <0.00%> (ø)

@@ -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])
Copy link
Collaborator

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!

Copy link
Contributor Author

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?

Copy link
Collaborator

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.
Copy link
Member

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

@Zethson Zethson merged commit acb75ca into scverse:main Oct 31, 2023
6 of 8 checks passed
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

Successfully merging this pull request may close these issues.

3 participants