-
Notifications
You must be signed in to change notification settings - Fork 41
Fix sparse matrix check and optimize index handling #346
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| if scipy.issparse(adata.X): | ||
| if scipy.sparse.issparse(adata.X): | ||
| df = pd.DataFrame(adata.X.toarray(), columns=adata.var_names) |
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 you please confirm the version requirement for scipy? does it match up with the one stated in the requirements.txt file?
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 have confirmed that the requirements are met. scipy.sparse.issparse is supported in v1.0.0(https://github.com/scipy/scipy/blob/11509c4a98edded6c59423ac44ca1b7f28fba1fd/scipy/sparse/base.py#L1231)
| _spatial = np.array(df2.index.to_list()) | ||
| _idx = [str(i[0]) + "_" + str(i[1]) for i in df2.index.to_list()] | ||
| df2.index = _idx | ||
|
|
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.
note that f2.index.to_list() may be a tuple (for x/y dimensions). what you have assumes the index is just a numeric value
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.
The index is come from the spatial information so it's the numeric value
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.
hmm, it should not be a couple of x, y coordinates?
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 misunderstood. It is a list composed of tuples (x, y), but the code here can convert it into an array with shape (n, 2).
Fig bug #345