diff --git a/.gitignore b/.gitignore index 98b18d1b..025b3030 100644 --- a/.gitignore +++ b/.gitignore @@ -156,5 +156,7 @@ lightning_logs/* node_modules +# lamindb test.ipynb test-perturbation +test-bug diff --git a/docs/usage/usage.md b/docs/usage/usage.md index cc8b3420..228e4b0f 100644 --- a/docs/usage/usage.md +++ b/docs/usage/usage.md @@ -26,6 +26,7 @@ harmonized names and be loadable as MuData objects. .. autosummary:: :toctree: data + data.PerturbationCurator data.adamson_2016_pilot data.adamson_2016_upr_epistasis data.adamson_2016_upr_perturb_seq diff --git a/pertpy/data/_perturbation_validator.py b/pertpy/data/_perturbation_validator.py index 4eb983d1..6024334a 100644 --- a/pertpy/data/_perturbation_validator.py +++ b/pertpy/data/_perturbation_validator.py @@ -2,8 +2,6 @@ import anndata as ad import pandas as pd -from django.core.exceptions import ImproperlyConfigured -from lamin_utils import logger class _PerturbationValidatorUnavailable: @@ -15,25 +13,31 @@ def __init__(self): import bionty as bt import wetlab as wl from cellxgene_lamin import CellxGeneFields, Curate + from django.core.exceptions import ImproperlyConfigured + from lamin_utils import logger from lamindb_setup.core.types import UPathStr from lnschema_core import Record from lnschema_core.types import FieldAttr pt_defaults = CellxGeneFields.OBS_FIELD_DEFAULTS | { - "genetic_treatments": pd.NA, - "compound_treatments": pd.NA, - "environmental_treatments": pd.NA, - "combination_treatments": pd.NA, + "cell_line": "unknown", + "genetic_treatments": "", + "compound_treatments": "", + "environmental_treatments": "", + "combination_treatments": "", } pt_categoricals = CellxGeneFields.OBS_FIELDS | { + "cell_line": bt.CellLine.name, "genetic_treatments": wl.GeneticTreatment.name, - "compound_treatments": wl.CombinationTreatment.name, + "compound_treatments": wl.CompoundTreatment.name, "environmental_treatments": wl.EnvironmentalTreatment.name, "combination_treatments": wl.CombinationTreatment.name, } pt_sources: dict[str, Record] = { + "depmap_id": bt.Source.filter(name="depmap").one(), + "cell_line": bt.Source.filter(name="depmap").one(), # "compound_treatments": bt.Source.filter(entity="Drug", name="chebi").first() } diff --git a/pyproject.toml b/pyproject.toml index 7612a826..3d631c64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,6 +84,7 @@ dev = [ validator = [ "cellxgene-lamin", "wetlab", + "findrefs" ] doc = [ "docutils>=0.8,!=0.18.*,!=0.19.*",