Skip to content

Commit

Permalink
🚚 Rename validation.Validator to Validator.from_df
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyosun committed Mar 26, 2024
1 parent 603b31e commit 64b09ff
Show file tree
Hide file tree
Showing 13 changed files with 1,219 additions and 1,240 deletions.
9 changes: 3 additions & 6 deletions docs/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,7 @@
"metadata": {},
"outputs": [],
"source": [
"from lamindb.validation import Validator\n",
"\n",
"validator = Validator(\n",
"validator = ln.Validate.from_df(\n",
" df, \n",
" fields={\"perturbation\": ln.ULabel.name}, # validate categories in the perturbation column\n",
" feature_field=ln.Feature.name, # validate features using the Feature registry\n",
Expand Down Expand Up @@ -505,11 +503,10 @@
"outputs": [],
"source": [
"import anndata as ad\n",
"from lamindb.validation import AnnDataValidator\n",
"\n",
"adata = ad.AnnData(df[[\"CD8A\", \"CD4\", \"CD14\"]], obs=df[[\"perturbation\"]])\n",
"\n",
"validator = AnnDataValidator(adata, \n",
"validator = ln.Validate.from_anndata(adata, \n",
" obs_fields={\"perturbation\": ln.ULabel.name}, \n",
" var_field=bt.Gene.symbol, # note that we are using the Gene registry\n",
" organism=\"human\") # specify the organism for the Gene registry\n",
Expand Down Expand Up @@ -623,7 +620,7 @@
"adata = ad.AnnData(df[[\"CD8A\", \"CD4\", \"CD38\"]], obs=df[[\"perturbation\"]])\n",
"\n",
"# Validate, annotate and register a new artifact\n",
"validator = AnnDataValidator(adata, \n",
"validator = ln.Validate.from_anndata(adata, \n",
" obs_fields={\"perturbation\": ln.ULabel.name}, \n",
" var_field=bt.Gene.symbol, \n",
" organism=\"human\")\n",
Expand Down
4 changes: 3 additions & 1 deletion lamindb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
.. autosummary::
:toctree: .
validation
Validate
settings
setup
UPath
Expand Down Expand Up @@ -72,6 +72,7 @@ def __getattr__(name):

from . import (
_artifact,
_can_validate,
_collection,
_feature,
_feature_set,
Expand All @@ -89,6 +90,7 @@ def __getattr__(name):
dev = core # backward compat
from ._finish import finish
from ._save import save
from ._validate import Validate
from ._view import view
from .core._run_context import run_context as _run_context
from .core._settings import settings
Expand Down
Loading

0 comments on commit 64b09ff

Please sign in to comment.