-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add native reader support for AnnData v0.8.0
- Loading branch information
Showing
7 changed files
with
238 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,12 @@ Authors@R: | |
family = "Lun", | ||
role = c("aut"), | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0002-3564-4813")) | ||
comment = c(ORCID = "0000-0002-3564-4813")), | ||
person(given = "Jack", | ||
family = "Kamm", | ||
role = c("ctb"), | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0003-2412-756X")) | ||
) | ||
Description: | ||
Provides methods to convert between Python AnnData objects and | ||
|
@@ -63,7 +68,7 @@ BugReports: https://github.com/theislab/zellkonverter/issues | |
Encoding: UTF-8 | ||
LazyData: true | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.1 | ||
RoxygenNote: 7.2.3 | ||
Language: en-GB | ||
StagedInstall: no | ||
VignetteBuilder: knitr |
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
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This script was used to create the `krumsiek11_augmented_v0-8.h5ad` | ||
# file. It adds some extra data to the previous `krumsiek11.h5ad` | ||
# dataset to cover some additional cases for testing (NAs, booleans, | ||
# etc). The data was saved in AnnData=0.8.0 format. | ||
# | ||
# Key package versions: | ||
# - anndata=0.8.0 | ||
# - h5py=3.8.0 | ||
# - hdf5=1.14.0 | ||
# - numpy=1.23.5 | ||
# - pandas=1.5.3 | ||
# - python=3.9.16 | ||
# - scanpy=1.9.2 | ||
|
||
import numpy as np | ||
import pandas as pd | ||
import anndata as ad | ||
|
||
adata = ad.read_h5ad("krumsiek11.h5ad") | ||
|
||
# add string column to rowData/var. Make the entries unique so it's | ||
# saved as str instead of factor | ||
adata.var["dummy_str"] = [f"row{i}" for i in range(adata.shape[1])] | ||
|
||
# add float column to colData/obs | ||
adata.obs["dummy_num"] = 42.42 | ||
|
||
# float column with NA | ||
adata.obs["dummy_num2"] = adata.obs["dummy_num"] | ||
adata.obs["dummy_num2"][0] = float("nan") | ||
|
||
# int column | ||
adata.obs["dummy_int"] = np.arange(adata.shape[0]) | ||
|
||
# int column with NA | ||
adata.obs["dummy_int2"] = pd.array([None] + [42] * (adata.shape[0] - 1)) | ||
|
||
# bool column | ||
adata.obs["dummy_bool"] = True | ||
adata.obs["dummy_bool"][0] = False | ||
|
||
# bool column with NA | ||
adata.obs["dummy_bool2"] = pd.array([False, None] + [True] * (adata.shape[0] - 2)) | ||
|
||
# also add some entries to the metadata/uns | ||
adata.uns["dummy_category"] = pd.array(["a", "b", None], dtype="category") | ||
|
||
adata.uns["dummy_bool"] = [True, True, False] | ||
adata.uns["dummy_bool2"] = pd.array([True, False, None]) | ||
|
||
adata.uns["dummy_int"] = [1,2,3] | ||
adata.uns["dummy_int2"] = pd.array([1,2,None]) | ||
|
||
adata.write("krumsiek11_augmented_v0-8.h5ad") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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