lamindb 1.5.2__py3-none-any.whl → 1.6a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lamindb/__init__.py +24 -6
- lamindb/_finish.py +5 -5
- lamindb/_tracked.py +1 -1
- lamindb/_view.py +4 -4
- lamindb/core/_context.py +32 -6
- lamindb/core/_settings.py +1 -1
- lamindb/core/datasets/mini_immuno.py +8 -0
- lamindb/core/loaders.py +1 -1
- lamindb/core/storage/_anndata_accessor.py +9 -9
- lamindb/core/storage/_valid_suffixes.py +1 -0
- lamindb/core/storage/_zarr.py +32 -107
- lamindb/curators/__init__.py +19 -2
- lamindb/curators/_cellxgene_schemas/__init__.py +3 -3
- lamindb/curators/_legacy.py +15 -19
- lamindb/curators/core.py +247 -80
- lamindb/errors.py +2 -2
- lamindb/migrations/0069_squashed.py +8 -8
- lamindb/migrations/0071_lamindbv1_migrate_schema.py +3 -3
- lamindb/migrations/0073_merge_ourprojects.py +7 -7
- lamindb/migrations/0075_lamindbv1_part5.py +1 -1
- lamindb/migrations/0077_lamindbv1_part6b.py +3 -3
- lamindb/migrations/0080_polish_lamindbv1.py +2 -2
- lamindb/migrations/0088_schema_components.py +1 -1
- lamindb/migrations/0090_runproject_project_runs.py +2 -2
- lamindb/migrations/0091_alter_featurevalue_options_alter_space_options_and_more.py +1 -1
- lamindb/migrations/0094_writeloglock_writelogmigrationstate_and_more.py +84 -0
- lamindb/migrations/0095_remove_rundata_flextable.py +155 -0
- lamindb/migrations/0096_remove_artifact__param_values_and_more.py +266 -0
- lamindb/migrations/0097_remove_schemaparam_param_remove_paramvalue_param_and_more.py +27 -0
- lamindb/migrations/0098_alter_feature_type_alter_project_type_and_more.py +656 -0
- lamindb/migrations/0099_alter_writelog_seqno.py +22 -0
- lamindb/migrations/0100_branch_alter_artifact__branch_code_and_more.py +102 -0
- lamindb/migrations/0101_alter_artifact_hash_alter_feature_name_and_more.py +444 -0
- lamindb/migrations/0102_remove_writelog_branch_code_and_more.py +72 -0
- lamindb/migrations/0103_remove_writelog_migration_state_and_more.py +46 -0
- lamindb/migrations/{0090_squashed.py → 0103_squashed.py} +1013 -1009
- lamindb/models/__init__.py +35 -18
- lamindb/models/_describe.py +4 -4
- lamindb/models/_django.py +38 -4
- lamindb/models/_feature_manager.py +66 -123
- lamindb/models/_from_values.py +13 -13
- lamindb/models/_label_manager.py +8 -6
- lamindb/models/_relations.py +7 -7
- lamindb/models/artifact.py +166 -156
- lamindb/models/can_curate.py +25 -25
- lamindb/models/collection.py +48 -18
- lamindb/models/core.py +3 -3
- lamindb/models/feature.py +88 -60
- lamindb/models/has_parents.py +17 -17
- lamindb/models/project.py +52 -24
- lamindb/models/query_manager.py +5 -5
- lamindb/models/query_set.py +61 -37
- lamindb/models/record.py +158 -1583
- lamindb/models/run.py +39 -176
- lamindb/models/save.py +6 -6
- lamindb/models/schema.py +33 -44
- lamindb/models/sqlrecord.py +1743 -0
- lamindb/models/transform.py +17 -33
- lamindb/models/ulabel.py +21 -15
- {lamindb-1.5.2.dist-info → lamindb-1.6a2.dist-info}/METADATA +7 -11
- lamindb-1.6a2.dist-info/RECORD +118 -0
- lamindb/core/storage/_anndata_sizes.py +0 -41
- lamindb/models/flextable.py +0 -163
- lamindb-1.5.2.dist-info/RECORD +0 -109
- {lamindb-1.5.2.dist-info → lamindb-1.6a2.dist-info}/LICENSE +0 -0
- {lamindb-1.5.2.dist-info → lamindb-1.6a2.dist-info}/WHEEL +0 -0
lamindb/curators/_legacy.py
CHANGED
@@ -11,11 +11,7 @@ from lamindb_setup.core import deprecated
|
|
11
11
|
from lamindb_setup.core.upath import UPath
|
12
12
|
|
13
13
|
from lamindb.core._compat import is_package_installed
|
14
|
-
from lamindb.models.artifact import
|
15
|
-
data_is_anndata,
|
16
|
-
data_is_mudata,
|
17
|
-
data_is_spatialdata,
|
18
|
-
)
|
14
|
+
from lamindb.models.artifact import data_is_scversedatastructure
|
19
15
|
|
20
16
|
from ..errors import InvalidArgument
|
21
17
|
|
@@ -24,12 +20,12 @@ if TYPE_CHECKING:
|
|
24
20
|
from mudata import MuData
|
25
21
|
from spatialdata import SpatialData
|
26
22
|
|
27
|
-
from lamindb.models import
|
23
|
+
from lamindb.models import SQLRecord
|
28
24
|
from lamindb.base.types import FieldAttr # noqa
|
29
25
|
from lamindb.models import (
|
30
26
|
Artifact,
|
31
27
|
Feature,
|
32
|
-
|
28
|
+
SQLRecord,
|
33
29
|
Run,
|
34
30
|
Schema,
|
35
31
|
)
|
@@ -153,7 +149,7 @@ class CatManager:
|
|
153
149
|
revises=revises,
|
154
150
|
run=run,
|
155
151
|
)
|
156
|
-
elif
|
152
|
+
elif data_is_scversedatastructure(self._dataset, "MuData"):
|
157
153
|
artifact = Artifact.from_mudata(
|
158
154
|
self._dataset,
|
159
155
|
key=key,
|
@@ -161,7 +157,7 @@ class CatManager:
|
|
161
157
|
revises=revises,
|
162
158
|
run=run,
|
163
159
|
)
|
164
|
-
elif
|
160
|
+
elif data_is_scversedatastructure(self._dataset, "SpatialData"):
|
165
161
|
artifact = Artifact.from_spatialdata(
|
166
162
|
self._dataset,
|
167
163
|
key=key,
|
@@ -192,7 +188,7 @@ class DataFrameCatManager(CatManager):
|
|
192
188
|
columns_field: FieldAttr = Feature.name,
|
193
189
|
columns_names: Iterable[str] | None = None,
|
194
190
|
categoricals: dict[str, FieldAttr] | None = None,
|
195
|
-
sources: dict[str,
|
191
|
+
sources: dict[str, SQLRecord] | None = None,
|
196
192
|
index: Feature | None = None,
|
197
193
|
) -> None:
|
198
194
|
self._non_validated = None
|
@@ -331,14 +327,14 @@ class AnnDataCatManager(CatManager):
|
|
331
327
|
var_index: FieldAttr | None = None,
|
332
328
|
categoricals: dict[str, FieldAttr] | None = None,
|
333
329
|
obs_columns: FieldAttr = Feature.name,
|
334
|
-
sources: dict[str,
|
330
|
+
sources: dict[str, SQLRecord] | None = None,
|
335
331
|
) -> None:
|
336
332
|
if isinstance(var_index, str):
|
337
333
|
raise TypeError(
|
338
334
|
"var_index parameter has to be a field, e.g. Gene.ensembl_gene_id"
|
339
335
|
)
|
340
336
|
|
341
|
-
if not
|
337
|
+
if not data_is_scversedatastructure(data, "AnnData"):
|
342
338
|
raise TypeError("data has to be an AnnData object")
|
343
339
|
|
344
340
|
if "symbol" in str(var_index):
|
@@ -473,7 +469,7 @@ class MuDataCatManager(CatManager):
|
|
473
469
|
mdata: MuData | Artifact,
|
474
470
|
var_index: dict[str, FieldAttr] | None = None,
|
475
471
|
categoricals: dict[str, FieldAttr] | None = None,
|
476
|
-
sources: dict[str,
|
472
|
+
sources: dict[str, SQLRecord] | None = None,
|
477
473
|
) -> None:
|
478
474
|
super().__init__(
|
479
475
|
dataset=mdata,
|
@@ -665,7 +661,7 @@ class SpatialDataCatManager(CatManager):
|
|
665
661
|
sdata: Any,
|
666
662
|
var_index: dict[str, FieldAttr],
|
667
663
|
categoricals: dict[str, dict[str, FieldAttr]] | None = None,
|
668
|
-
sources: dict[str, dict[str,
|
664
|
+
sources: dict[str, dict[str, SQLRecord]] | None = None,
|
669
665
|
*,
|
670
666
|
sample_metadata_key: str | None = "sample",
|
671
667
|
) -> None:
|
@@ -937,7 +933,7 @@ class TiledbsomaCatManager(CatManager):
|
|
937
933
|
var_index: dict[str, tuple[str, FieldAttr]],
|
938
934
|
categoricals: dict[str, FieldAttr] | None = None,
|
939
935
|
obs_columns: FieldAttr = Feature.name,
|
940
|
-
sources: dict[str,
|
936
|
+
sources: dict[str, SQLRecord] | None = None,
|
941
937
|
):
|
942
938
|
self._obs_fields = categoricals or {}
|
943
939
|
self._var_fields = var_index
|
@@ -1342,7 +1338,7 @@ class CellxGeneAnnDataCatManager(AnnDataCatManager):
|
|
1342
1338
|
*,
|
1343
1339
|
schema_version: Literal["4.0.0", "5.0.0", "5.1.0", "5.2.0"] = "5.2.0",
|
1344
1340
|
defaults: dict[str, str] = None,
|
1345
|
-
extra_sources: dict[str,
|
1341
|
+
extra_sources: dict[str, SQLRecord] = None,
|
1346
1342
|
) -> None:
|
1347
1343
|
"""CELLxGENE schema curator.
|
1348
1344
|
|
@@ -1972,7 +1968,7 @@ def from_anndata(
|
|
1972
1968
|
categoricals: dict[str, FieldAttr] | None = None,
|
1973
1969
|
obs_columns: FieldAttr = Feature.name,
|
1974
1970
|
organism: str | None = None,
|
1975
|
-
sources: dict[str,
|
1971
|
+
sources: dict[str, SQLRecord] | None = None,
|
1976
1972
|
) -> AnnDataCatManager:
|
1977
1973
|
if organism is not None:
|
1978
1974
|
logger.warning("organism is ignored, define it on the dtype level")
|
@@ -2012,7 +2008,7 @@ def from_tiledbsoma(
|
|
2012
2008
|
categoricals: dict[str, FieldAttr] | None = None,
|
2013
2009
|
obs_columns: FieldAttr = Feature.name,
|
2014
2010
|
organism: str | None = None,
|
2015
|
-
sources: dict[str,
|
2011
|
+
sources: dict[str, SQLRecord] | None = None,
|
2016
2012
|
) -> TiledbsomaCatManager:
|
2017
2013
|
if organism is not None:
|
2018
2014
|
logger.warning("organism is ignored, define it on the dtype level")
|
@@ -2032,7 +2028,7 @@ def from_spatialdata(
|
|
2032
2028
|
var_index: dict[str, FieldAttr],
|
2033
2029
|
categoricals: dict[str, dict[str, FieldAttr]] | None = None,
|
2034
2030
|
organism: str | None = None,
|
2035
|
-
sources: dict[str, dict[str,
|
2031
|
+
sources: dict[str, dict[str, SQLRecord]] | None = None,
|
2036
2032
|
*,
|
2037
2033
|
sample_metadata_key: str = "sample",
|
2038
2034
|
):
|