-
Notifications
You must be signed in to change notification settings - Fork 22
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
[FIX] Write .h5ad files #347
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- convert any "object" dtype values in obs or uns to "category" or "str" for writing to .h5ad files - current issues: 1.) Categories True/False cannot be written 2.) Non-numerical values in X have to be encoded before writing
- fixed an error that caused numerical detection to produce false positives while reading
- column with boolean values (as well as binary columns) are now casted to bool columns in obs - columns with 0 and 1 will be casted as well
Imipenem
commented
Mar 11, 2022
- fixed an error that caused dtype of X to be object despite all columns being numeric and the inital AnnData object had numerical X dtype
- writing unencoded AnnData objects to .h5ad files no longer raises an error and can be performed normally
- added tests + new test files - updated docs - pinned flake8-bandit to >=3.0.0 since this fixes the previous CI error
Zethson
reviewed
Mar 11, 2022
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.
Should be good I hope :)
Please merge development into this and fix the dependencies, please. |
Imipenem
commented
Mar 11, 2022
adata_cp = adata.copy() | ||
adata_cp.uns["ehrapy_dummy_encoding"] = True | ||
adata_cp.uns["columns_obs_only"] = list(adata_cp.obs.columns) | ||
# TODO: THIS SHOULD BE FIXED WITH PR #348, SO NO COPY SHOULD BE NEEDED THEN SINCE THE ORIGINAL WILL NOT BE MUTATED |
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.
See #348
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
docs
is updatedDescription of changes
Fix #337 and #333
Issue: Cannot write
dtype object
to .h5ad
files.Fix:
category
.boolean
though (see Unable to write categorical booleans in .obs to .h5ad scverse/anndata#724)object
dtype while reading from cacheNew feature:
.h5ad
files. (relates to Writing unencoded dataset results in error #333)Current Issues:
--> but this got added in 0.8.0 which should be released in the next few days