lamindb 0.76.8__py3-none-any.whl → 0.76.9__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 +113 -113
- lamindb/_artifact.py +1205 -1205
- lamindb/_can_validate.py +579 -579
- lamindb/_collection.py +389 -387
- lamindb/_curate.py +1601 -1601
- lamindb/_feature.py +155 -155
- lamindb/_feature_set.py +242 -242
- lamindb/_filter.py +23 -23
- lamindb/_finish.py +256 -256
- lamindb/_from_values.py +382 -382
- lamindb/_is_versioned.py +40 -40
- lamindb/_parents.py +476 -476
- lamindb/_query_manager.py +125 -125
- lamindb/_query_set.py +362 -362
- lamindb/_record.py +649 -649
- lamindb/_run.py +57 -57
- lamindb/_save.py +308 -308
- lamindb/_storage.py +14 -14
- lamindb/_transform.py +127 -127
- lamindb/_ulabel.py +56 -56
- lamindb/_utils.py +9 -9
- lamindb/_view.py +72 -72
- lamindb/core/__init__.py +94 -94
- lamindb/core/_context.py +574 -574
- lamindb/core/_data.py +438 -438
- lamindb/core/_feature_manager.py +867 -867
- lamindb/core/_label_manager.py +253 -253
- lamindb/core/_mapped_collection.py +631 -597
- lamindb/core/_settings.py +187 -187
- lamindb/core/_sync_git.py +138 -138
- lamindb/core/_track_environment.py +27 -27
- lamindb/core/datasets/__init__.py +59 -59
- lamindb/core/datasets/_core.py +581 -571
- lamindb/core/datasets/_fake.py +36 -36
- lamindb/core/exceptions.py +90 -90
- lamindb/core/fields.py +12 -12
- lamindb/core/loaders.py +164 -164
- lamindb/core/schema.py +56 -56
- lamindb/core/storage/__init__.py +25 -25
- lamindb/core/storage/_anndata_accessor.py +740 -740
- lamindb/core/storage/_anndata_sizes.py +41 -41
- lamindb/core/storage/_backed_access.py +98 -98
- lamindb/core/storage/_tiledbsoma.py +204 -204
- lamindb/core/storage/_valid_suffixes.py +21 -21
- lamindb/core/storage/_zarr.py +110 -110
- lamindb/core/storage/objects.py +62 -62
- lamindb/core/storage/paths.py +172 -172
- lamindb/core/subsettings/__init__.py +12 -12
- lamindb/core/subsettings/_creation_settings.py +38 -38
- lamindb/core/subsettings/_transform_settings.py +21 -21
- lamindb/core/types.py +19 -19
- lamindb/core/versioning.py +158 -158
- lamindb/integrations/__init__.py +12 -12
- lamindb/integrations/_vitessce.py +107 -107
- lamindb/setup/__init__.py +14 -14
- lamindb/setup/core/__init__.py +4 -4
- {lamindb-0.76.8.dist-info → lamindb-0.76.9.dist-info}/LICENSE +201 -201
- {lamindb-0.76.8.dist-info → lamindb-0.76.9.dist-info}/METADATA +4 -4
- lamindb-0.76.9.dist-info/RECORD +60 -0
- {lamindb-0.76.8.dist-info → lamindb-0.76.9.dist-info}/WHEEL +1 -1
- lamindb-0.76.8.dist-info/RECORD +0 -60
lamindb/core/schema.py
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from django.db.models import ManyToManyField
|
4
|
-
from lnschema_core.models import Feature, FeatureSet, LinkORM, Record
|
5
|
-
|
6
|
-
|
7
|
-
def dict_schema_name_to_model_name(registry: type[Record]) -> dict[str, Record]:
|
8
|
-
d: dict = {
|
9
|
-
i.related_model.__get_name_with_schema__(): i.related_model
|
10
|
-
for i in registry._meta.related_objects
|
11
|
-
if i.related_name is not None
|
12
|
-
}
|
13
|
-
d.update(
|
14
|
-
{
|
15
|
-
i.related_model.__get_name_with_schema__(): i.related_model
|
16
|
-
for i in registry._meta.many_to_many
|
17
|
-
if i.name is not None
|
18
|
-
}
|
19
|
-
)
|
20
|
-
return d
|
21
|
-
|
22
|
-
|
23
|
-
def dict_related_model_to_related_name(
|
24
|
-
registry: type[Record], links: bool = False
|
25
|
-
) -> dict[str, str]:
|
26
|
-
def include(model: Record):
|
27
|
-
return not links != issubclass(model, LinkORM)
|
28
|
-
|
29
|
-
related_objects = registry._meta.related_objects + registry._meta.many_to_many
|
30
|
-
d: dict = {
|
31
|
-
record.related_model.__get_name_with_schema__(): (
|
32
|
-
record.related_name
|
33
|
-
if not isinstance(record, ManyToManyField)
|
34
|
-
else record.name
|
35
|
-
)
|
36
|
-
for record in related_objects
|
37
|
-
if (record.name is not None and include(record.related_model))
|
38
|
-
}
|
39
|
-
return d
|
40
|
-
|
41
|
-
|
42
|
-
def get_related_name(features_type: type[Record]) -> str:
|
43
|
-
candidates = [
|
44
|
-
field.related_name
|
45
|
-
for field in FeatureSet._meta.related_objects
|
46
|
-
if field.related_model == features_type
|
47
|
-
]
|
48
|
-
if not candidates:
|
49
|
-
raise ValueError(
|
50
|
-
f"Can't create feature sets from {features_type.__name__} because it's not"
|
51
|
-
" related to it!\nYou need to create a link model between FeatureSet and"
|
52
|
-
" your Record in your custom schema.\nTo do so, add a"
|
53
|
-
" line:\nfeature_sets = models.ManyToMany(FeatureSet,"
|
54
|
-
" related_name='mythings')\n"
|
55
|
-
)
|
56
|
-
return candidates[0]
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from django.db.models import ManyToManyField
|
4
|
+
from lnschema_core.models import Feature, FeatureSet, LinkORM, Record
|
5
|
+
|
6
|
+
|
7
|
+
def dict_schema_name_to_model_name(registry: type[Record]) -> dict[str, Record]:
|
8
|
+
d: dict = {
|
9
|
+
i.related_model.__get_name_with_schema__(): i.related_model
|
10
|
+
for i in registry._meta.related_objects
|
11
|
+
if i.related_name is not None
|
12
|
+
}
|
13
|
+
d.update(
|
14
|
+
{
|
15
|
+
i.related_model.__get_name_with_schema__(): i.related_model
|
16
|
+
for i in registry._meta.many_to_many
|
17
|
+
if i.name is not None
|
18
|
+
}
|
19
|
+
)
|
20
|
+
return d
|
21
|
+
|
22
|
+
|
23
|
+
def dict_related_model_to_related_name(
|
24
|
+
registry: type[Record], links: bool = False
|
25
|
+
) -> dict[str, str]:
|
26
|
+
def include(model: Record):
|
27
|
+
return not links != issubclass(model, LinkORM)
|
28
|
+
|
29
|
+
related_objects = registry._meta.related_objects + registry._meta.many_to_many
|
30
|
+
d: dict = {
|
31
|
+
record.related_model.__get_name_with_schema__(): (
|
32
|
+
record.related_name
|
33
|
+
if not isinstance(record, ManyToManyField)
|
34
|
+
else record.name
|
35
|
+
)
|
36
|
+
for record in related_objects
|
37
|
+
if (record.name is not None and include(record.related_model))
|
38
|
+
}
|
39
|
+
return d
|
40
|
+
|
41
|
+
|
42
|
+
def get_related_name(features_type: type[Record]) -> str:
|
43
|
+
candidates = [
|
44
|
+
field.related_name
|
45
|
+
for field in FeatureSet._meta.related_objects
|
46
|
+
if field.related_model == features_type
|
47
|
+
]
|
48
|
+
if not candidates:
|
49
|
+
raise ValueError(
|
50
|
+
f"Can't create feature sets from {features_type.__name__} because it's not"
|
51
|
+
" related to it!\nYou need to create a link model between FeatureSet and"
|
52
|
+
" your Record in your custom schema.\nTo do so, add a"
|
53
|
+
" line:\nfeature_sets = models.ManyToMany(FeatureSet,"
|
54
|
+
" related_name='mythings')\n"
|
55
|
+
)
|
56
|
+
return candidates[0]
|
lamindb/core/storage/__init__.py
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
"""Storage API.
|
2
|
-
|
3
|
-
Valid suffixes.
|
4
|
-
|
5
|
-
.. autosummary::
|
6
|
-
:toctree: .
|
7
|
-
|
8
|
-
VALID_SUFFIXES
|
9
|
-
|
10
|
-
Array accessors.
|
11
|
-
|
12
|
-
.. autosummary::
|
13
|
-
:toctree: .
|
14
|
-
|
15
|
-
AnnDataAccessor
|
16
|
-
BackedAccessor
|
17
|
-
"""
|
18
|
-
|
19
|
-
from lamindb_setup.core.upath import LocalPathClasses, UPath, infer_filesystem
|
20
|
-
|
21
|
-
from ._backed_access import AnnDataAccessor, BackedAccessor
|
22
|
-
from ._tiledbsoma import save_tiledbsoma_experiment
|
23
|
-
from ._valid_suffixes import VALID_SUFFIXES
|
24
|
-
from .objects import infer_suffix, write_to_disk
|
25
|
-
from .paths import delete_storage
|
1
|
+
"""Storage API.
|
2
|
+
|
3
|
+
Valid suffixes.
|
4
|
+
|
5
|
+
.. autosummary::
|
6
|
+
:toctree: .
|
7
|
+
|
8
|
+
VALID_SUFFIXES
|
9
|
+
|
10
|
+
Array accessors.
|
11
|
+
|
12
|
+
.. autosummary::
|
13
|
+
:toctree: .
|
14
|
+
|
15
|
+
AnnDataAccessor
|
16
|
+
BackedAccessor
|
17
|
+
"""
|
18
|
+
|
19
|
+
from lamindb_setup.core.upath import LocalPathClasses, UPath, infer_filesystem
|
20
|
+
|
21
|
+
from ._backed_access import AnnDataAccessor, BackedAccessor
|
22
|
+
from ._tiledbsoma import save_tiledbsoma_experiment
|
23
|
+
from ._valid_suffixes import VALID_SUFFIXES
|
24
|
+
from .objects import infer_suffix, write_to_disk
|
25
|
+
from .paths import delete_storage
|