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

🚚 Move PertCurator from wetlab here and add CellxGene Curator test #2408

Merged
merged 9 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
filters: |
curator:
- 'lamindb/curators/**'
- 'tests/curators/test_curator.py'
- 'tests/curators/**'

- id: set-matrix
shell: bash
Expand Down
7 changes: 6 additions & 1 deletion lamindb/core/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@
schmidt22_perturbseq,
)
from ._fake import fake_bio_notebook_titles
from ._small import anndata_with_obs, small_dataset1, small_dataset2
from ._small import (
anndata_with_obs,
small_dataset1,
small_dataset2,
small_dataset3_cellxgene,
)
33 changes: 33 additions & 0 deletions lamindb/core/datasets/_small.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,39 @@ def small_dataset2(
return dataset_ad


def small_dataset3_cellxgene(
otype: Literal["DataFrame", "AnnData"] = "AnnData",
) -> tuple[pd.DataFrame, dict[str, Any]] | ad.AnnData:
# TODO: consider other ids for other organisms
# "ENSMUSG00002076988"
var_ids = ["invalid_ensembl_id", "ENSG00000000419", "ENSG00000139618"]
dataset_dict = {
var_ids[0]: [2, 3, 3],
var_ids[1]: [3, 4, 5],
var_ids[2]: [4, 2, 3],
"disease_ontology_term_id": ["MONDO:0004975", "MONDO:0004980", "MONDO:0004980"],
"organism": ["human", "human", "human"],
"sex_ontology_term_id": ["PATO:0000384", "PATO:0000384", "PATO:0000384"],
"sex": ["unkown", "unkown", "unkown"],
"tissue": ["lungg", "lungg", "heart"],
"donor": ["-1", "1", "2"],
}
dataset_df = pd.DataFrame(
dataset_dict,
index=["barcode1", "barcode2", "barcode3"],
)
dataset_df["tissue"] = dataset_df["tissue"].astype("category")
ad.AnnData(
dataset_df[var_ids],
obs=dataset_df[[key for key in dataset_dict if key not in var_ids]],
)
if format == "df":
return dataset_df
else:
dataset_ad = ad.AnnData(dataset_df.iloc[:, :3], obs=dataset_df.iloc[:, 3:])
return dataset_ad


def anndata_with_obs() -> ad.AnnData:
"""Create a mini anndata with cell_type, disease and tissue."""
import anndata as ad
Expand Down
Loading