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/models/transform.py
CHANGED
@@ -18,23 +18,21 @@ from lamindb.base.users import current_user_id
|
|
18
18
|
|
19
19
|
from ..models._is_versioned import process_revises
|
20
20
|
from ._is_versioned import IsVersioned
|
21
|
-
from .record import Record, init_self_from_db, update_attributes
|
22
21
|
from .run import Run, User, delete_run_artifacts
|
22
|
+
from .sqlrecord import SQLRecord, init_self_from_db, update_attributes
|
23
23
|
|
24
24
|
if TYPE_CHECKING:
|
25
25
|
from datetime import datetime
|
26
26
|
|
27
27
|
from lamindb.base.types import TransformType
|
28
28
|
|
29
|
-
from .artifact import Artifact
|
30
|
-
from .collection import Collection
|
31
29
|
from .project import Project, Reference
|
32
30
|
from .ulabel import ULabel
|
33
31
|
|
34
32
|
|
35
33
|
# does not inherit from TracksRun because the Transform
|
36
34
|
# is needed to define a run
|
37
|
-
class Transform(
|
35
|
+
class Transform(SQLRecord, IsVersioned):
|
38
36
|
"""Data transformations such as scripts, notebooks, functions, or pipelines.
|
39
37
|
|
40
38
|
A "transform" can refer to a Python function, a script, a notebook, or a
|
@@ -95,8 +93,9 @@ class Transform(Record, IsVersioned):
|
|
95
93
|
>>> transform.view_lineage()
|
96
94
|
"""
|
97
95
|
|
98
|
-
class Meta(
|
96
|
+
class Meta(SQLRecord.Meta, IsVersioned.Meta):
|
99
97
|
abstract = False
|
98
|
+
unique_together = ("key", "hash")
|
100
99
|
|
101
100
|
_len_stem_uid: int = 12
|
102
101
|
_len_full_uid: int = 16
|
@@ -108,6 +107,9 @@ class Transform(Record, IsVersioned):
|
|
108
107
|
editable=False, unique=True, db_index=True, max_length=_len_full_uid
|
109
108
|
)
|
110
109
|
"""Universal id."""
|
110
|
+
# the fact that key is nullable is consistent with Artifact
|
111
|
+
# it might turn out that there will never really be a use case for this
|
112
|
+
# but there likely also isn't much harm in it except for the mixed type
|
111
113
|
key: str | None = CharField(db_index=True, null=True)
|
112
114
|
"""A name or "/"-separated path-like string.
|
113
115
|
|
@@ -122,16 +124,8 @@ class Transform(Record, IsVersioned):
|
|
122
124
|
)
|
123
125
|
""":class:`~lamindb.base.types.TransformType` (default `"pipeline"`)."""
|
124
126
|
source_code: str | None = TextField(null=True)
|
125
|
-
"""Source code of the transform.
|
126
|
-
|
127
|
-
.. versionchanged:: 0.75
|
128
|
-
The `source_code` field is no longer an artifact, but a text field.
|
129
|
-
"""
|
130
|
-
# we have a unique constraint here but not on artifact because on artifact, we haven't yet
|
131
|
-
# settled how we model the same artifact in different storage locations
|
132
|
-
hash: str | None = CharField(
|
133
|
-
max_length=HASH_LENGTH, db_index=True, null=True, unique=True
|
134
|
-
)
|
127
|
+
"""Source code of the transform."""
|
128
|
+
hash: str | None = CharField(max_length=HASH_LENGTH, db_index=True, null=True)
|
135
129
|
"""Hash of the source code."""
|
136
130
|
reference: str | None = CharField(max_length=255, db_index=True, null=True)
|
137
131
|
"""Reference for the transform, e.g., a URL."""
|
@@ -148,29 +142,14 @@ class Transform(Record, IsVersioned):
|
|
148
142
|
)
|
149
143
|
"""Preceding transforms.
|
150
144
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
The table provides a more convenient method to query for the predecessors that
|
155
|
-
bypasses querying the :class:`~lamindb.Run`.
|
156
|
-
|
157
|
-
It also allows to manually add predecessors whose outputs are not tracked in a run.
|
145
|
+
Allows to _manually_ define predecessors. Is typically not necessary as data lineage is
|
146
|
+
automatically tracked via runs whenever an artifact or collection serves as an input for a run.
|
158
147
|
"""
|
159
148
|
successors: Transform
|
160
149
|
"""Subsequent transforms.
|
161
150
|
|
162
151
|
See :attr:`~lamindb.Transform.predecessors`.
|
163
152
|
"""
|
164
|
-
output_artifacts: Artifact
|
165
|
-
"""The artifacts generated by all runs of this transform.
|
166
|
-
|
167
|
-
If you're looking for the outputs of a single run, see :attr:`lamindb.Run.output_artifacts`.
|
168
|
-
"""
|
169
|
-
output_collections: Collection
|
170
|
-
"""The collections generated by all runs of this transform.
|
171
|
-
|
172
|
-
If you're looking for the outputs of a single run, see :attr:`lamindb.Run.output_collections`.
|
173
|
-
"""
|
174
153
|
projects: Project
|
175
154
|
"""Linked projects."""
|
176
155
|
references: Reference
|
@@ -339,7 +318,12 @@ class Transform(Record, IsVersioned):
|
|
339
318
|
super().delete()
|
340
319
|
|
341
320
|
def view_lineage(self, with_successors: bool = False, distance: int = 5):
|
342
|
-
"""View lineage of transforms.
|
321
|
+
"""View lineage of transforms.
|
322
|
+
|
323
|
+
Note that this only accounts for manually defined predecessors and successors.
|
324
|
+
|
325
|
+
Auto-generate lineage through inputs and outputs of runs is not included.
|
326
|
+
"""
|
343
327
|
from .has_parents import view_parents
|
344
328
|
|
345
329
|
return view_parents(
|
lamindb/models/ulabel.py
CHANGED
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, overload
|
|
5
5
|
from django.db import models
|
6
6
|
from django.db.models import CASCADE, PROTECT
|
7
7
|
|
8
|
+
from lamindb.base import deprecated
|
8
9
|
from lamindb.base.fields import (
|
9
10
|
BooleanField,
|
10
11
|
CharField,
|
@@ -17,8 +18,8 @@ from ..base.ids import base62_8
|
|
17
18
|
from .can_curate import CanCurate
|
18
19
|
from .feature import Feature
|
19
20
|
from .has_parents import HasParents
|
20
|
-
from .record import BasicRecord, LinkORM, Record, _get_record_kwargs
|
21
21
|
from .run import Run, TracksRun, TracksUpdates, User, current_user_id
|
22
|
+
from .sqlrecord import BaseSQLRecord, IsLink, SQLRecord, _get_record_kwargs
|
22
23
|
from .transform import Transform
|
23
24
|
|
24
25
|
if TYPE_CHECKING:
|
@@ -29,7 +30,7 @@ if TYPE_CHECKING:
|
|
29
30
|
from .project import Project
|
30
31
|
|
31
32
|
|
32
|
-
class ULabel(
|
33
|
+
class ULabel(SQLRecord, HasParents, CanCurate, TracksRun, TracksUpdates):
|
33
34
|
"""Universal labels.
|
34
35
|
|
35
36
|
Args:
|
@@ -41,8 +42,7 @@ class ULabel(Record, HasParents, CanCurate, TracksRun, TracksUpdates):
|
|
41
42
|
A `ULabel` record provides the easiest way to annotate a dataset
|
42
43
|
with a label: `"My project"`, `"curated"`, or `"Batch X"`:
|
43
44
|
|
44
|
-
>>> my_project = ULabel(name="My project")
|
45
|
-
>>> my_project.save()
|
45
|
+
>>> my_project = ULabel(name="My project").save()
|
46
46
|
>>> artifact.ulabels.add(my_project)
|
47
47
|
|
48
48
|
Often, a ulabel is measured *within* a dataset. For instance, an artifact
|
@@ -68,11 +68,11 @@ class ULabel(Record, HasParents, CanCurate, TracksRun, TracksUpdates):
|
|
68
68
|
|
69
69
|
Examples:
|
70
70
|
|
71
|
-
Create a
|
71
|
+
Create a ulabel:
|
72
72
|
|
73
73
|
>>> train_split = ln.ULabel(name="train").save()
|
74
74
|
|
75
|
-
Organize
|
75
|
+
Organize ulabels in a hierarchy:
|
76
76
|
|
77
77
|
>>> split_type = ln.ULabel(name="Split", is_type=True).save()
|
78
78
|
>>> train_split = ln.ULabel(name="train", type="split_type").save()
|
@@ -81,12 +81,12 @@ class ULabel(Record, HasParents, CanCurate, TracksRun, TracksUpdates):
|
|
81
81
|
|
82
82
|
>>> artifact.ulabels.add(ulabel)
|
83
83
|
|
84
|
-
Query an artifact by
|
84
|
+
Query an artifact by ulabel:
|
85
85
|
|
86
86
|
>>> ln.Artifact.filter(ulabels=train_split).df()
|
87
87
|
"""
|
88
88
|
|
89
|
-
class Meta(
|
89
|
+
class Meta(SQLRecord.Meta, TracksRun.Meta, TracksUpdates.Meta):
|
90
90
|
abstract = False
|
91
91
|
|
92
92
|
_name_field: str = "name"
|
@@ -99,13 +99,13 @@ class ULabel(Record, HasParents, CanCurate, TracksRun, TracksUpdates):
|
|
99
99
|
"""A universal random id, valid across DB instances."""
|
100
100
|
name: str = CharField(max_length=150, db_index=True)
|
101
101
|
"""Name or title of ulabel."""
|
102
|
-
type: ULabel | None = ForeignKey("self", PROTECT, null=True, related_name="
|
102
|
+
type: ULabel | None = ForeignKey("self", PROTECT, null=True, related_name="ulabels")
|
103
103
|
"""Type of ulabel, e.g., `"donor"`, `"split"`, etc.
|
104
104
|
|
105
105
|
Allows to group ulabels by type, e.g., all donors, all split ulabels, etc.
|
106
106
|
"""
|
107
|
-
|
108
|
-
"""
|
107
|
+
ulabels: ULabel
|
108
|
+
"""ULabels of this type (can only be non-empty if `is_type` is `True`)."""
|
109
109
|
is_type: bool = BooleanField(default=False, db_index=True, null=True)
|
110
110
|
"""Distinguish types from instances of the type.
|
111
111
|
|
@@ -193,8 +193,14 @@ class ULabel(Record, HasParents, CanCurate, TracksRun, TracksUpdates):
|
|
193
193
|
_aux=_aux,
|
194
194
|
)
|
195
195
|
|
196
|
+
@property
|
197
|
+
@deprecated("ulabels")
|
198
|
+
def records(self) -> list[ULabel]:
|
199
|
+
"""Return all instances of this type."""
|
200
|
+
return self.ulabels
|
196
201
|
|
197
|
-
|
202
|
+
|
203
|
+
class ArtifactULabel(BaseSQLRecord, IsLink, TracksRun):
|
198
204
|
id: int = models.BigAutoField(primary_key=True)
|
199
205
|
artifact: Artifact = ForeignKey("Artifact", CASCADE, related_name="links_ulabel")
|
200
206
|
ulabel: ULabel = ForeignKey(ULabel, PROTECT, related_name="links_artifact")
|
@@ -210,7 +216,7 @@ class ArtifactULabel(BasicRecord, LinkORM, TracksRun):
|
|
210
216
|
unique_together = ("artifact", "ulabel", "feature")
|
211
217
|
|
212
218
|
|
213
|
-
class TransformULabel(
|
219
|
+
class TransformULabel(BaseSQLRecord, IsLink, TracksRun):
|
214
220
|
id: int = models.BigAutoField(primary_key=True)
|
215
221
|
transform: Transform = ForeignKey(Transform, CASCADE, related_name="links_ulabel")
|
216
222
|
ulabel: ULabel = ForeignKey(ULabel, PROTECT, related_name="links_transform")
|
@@ -219,7 +225,7 @@ class TransformULabel(BasicRecord, LinkORM, TracksRun):
|
|
219
225
|
unique_together = ("transform", "ulabel")
|
220
226
|
|
221
227
|
|
222
|
-
class RunULabel(
|
228
|
+
class RunULabel(BaseSQLRecord, IsLink):
|
223
229
|
id: int = models.BigAutoField(primary_key=True)
|
224
230
|
run: Run = ForeignKey(Run, CASCADE, related_name="links_ulabel")
|
225
231
|
ulabel: ULabel = ForeignKey(ULabel, PROTECT, related_name="links_run")
|
@@ -236,7 +242,7 @@ class RunULabel(BasicRecord, LinkORM):
|
|
236
242
|
unique_together = ("run", "ulabel")
|
237
243
|
|
238
244
|
|
239
|
-
class CollectionULabel(
|
245
|
+
class CollectionULabel(BaseSQLRecord, IsLink, TracksRun):
|
240
246
|
id: int = models.BigAutoField(primary_key=True)
|
241
247
|
collection: Collection = ForeignKey(
|
242
248
|
"Collection", CASCADE, related_name="links_ulabel"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: lamindb
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.6a2
|
4
4
|
Summary: A data framework for biology.
|
5
5
|
Author-email: Lamin Labs <open-source@lamin.ai>
|
6
6
|
Requires-Python: >=3.10,<3.14
|
@@ -10,21 +10,20 @@ Classifier: Programming Language :: Python :: 3.11
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
12
12
|
Requires-Dist: lamin_utils==0.14.0
|
13
|
-
Requires-Dist: lamin_cli==1.4.
|
14
|
-
Requires-Dist: lamindb_setup[aws]==1.
|
13
|
+
Requires-Dist: lamin_cli==1.4.1
|
14
|
+
Requires-Dist: lamindb_setup[aws]==1.6.0
|
15
15
|
Requires-Dist: pyyaml
|
16
16
|
Requires-Dist: pyarrow
|
17
|
-
Requires-Dist: pandera
|
17
|
+
Requires-Dist: pandera>=0.24.0
|
18
18
|
Requires-Dist: typing_extensions!=4.6.0
|
19
19
|
Requires-Dist: python-dateutil
|
20
|
-
Requires-Dist: scipy<1.15.0
|
21
20
|
Requires-Dist: pandas>=2.0.0
|
21
|
+
Requires-Dist: scipy<1.15.0
|
22
22
|
Requires-Dist: anndata>=0.8.0,<=0.11.4
|
23
23
|
Requires-Dist: fsspec
|
24
24
|
Requires-Dist: graphviz
|
25
25
|
Requires-Dist: psycopg2-binary
|
26
|
-
Requires-Dist: bionty>=1.
|
27
|
-
Requires-Dist: cellregistry ; extra == "cellregistry"
|
26
|
+
Requires-Dist: bionty>=1.4a1 ; extra == "bionty"
|
28
27
|
Requires-Dist: clinicore ; extra == "clinicore"
|
29
28
|
Requires-Dist: tomlkit ; extra == "dev"
|
30
29
|
Requires-Dist: line_profiler ; extra == "dev"
|
@@ -37,7 +36,6 @@ Requires-Dist: pytest-cov ; extra == "dev"
|
|
37
36
|
Requires-Dist: mudata ; extra == "dev"
|
38
37
|
Requires-Dist: nbproject_test>=0.6.0 ; extra == "dev"
|
39
38
|
Requires-Dist: faker-biology ; extra == "dev"
|
40
|
-
Requires-Dist: django-schema-graph ; extra == "erdiagram"
|
41
39
|
Requires-Dist: readfcs>=2.0.1 ; extra == "fcs"
|
42
40
|
Requires-Dist: lamindb_setup[gcp] ; extra == "gcp"
|
43
41
|
Requires-Dist: nbproject==0.11.1 ; extra == "jupyter"
|
@@ -45,15 +43,13 @@ Requires-Dist: jupytext ; extra == "jupyter"
|
|
45
43
|
Requires-Dist: nbconvert>=7.2.1 ; extra == "jupyter"
|
46
44
|
Requires-Dist: mistune!=3.1.0 ; extra == "jupyter"
|
47
45
|
Requires-Dist: omop ; extra == "omop"
|
48
|
-
Requires-Dist: wetlab ; extra == "wetlab"
|
46
|
+
Requires-Dist: wetlab>=1.3a1 ; extra == "wetlab"
|
49
47
|
Requires-Dist: numcodecs<0.16.0 ; extra == "zarr"
|
50
48
|
Requires-Dist: zarr>=2.16.0,<3.0.0a0 ; extra == "zarr"
|
51
49
|
Project-URL: Home, https://github.com/laminlabs/lamindb
|
52
50
|
Provides-Extra: bionty
|
53
|
-
Provides-Extra: cellregistry
|
54
51
|
Provides-Extra: clinicore
|
55
52
|
Provides-Extra: dev
|
56
|
-
Provides-Extra: erdiagram
|
57
53
|
Provides-Extra: fcs
|
58
54
|
Provides-Extra: gcp
|
59
55
|
Provides-Extra: jupyter
|
@@ -0,0 +1,118 @@
|
|
1
|
+
lamindb/__init__.py,sha256=px5ScV0QKnY0KtuFluk-xTdTstnxcoo9osDPDnTER_M,2912
|
2
|
+
lamindb/_finish.py,sha256=XVEaFQQDeGvAnW3Fx-COcXCSXAvu-bIS3VkmqBS81Gs,20148
|
3
|
+
lamindb/_tracked.py,sha256=-wK7BJv30nf4v2_nH5qDCyxHvug7ih6duQNGxDrj3UE,4447
|
4
|
+
lamindb/_view.py,sha256=cod1RnZoLyzMVJcjWjytg78Sf4qsR8IAdqpwzsi8FTw,4950
|
5
|
+
lamindb/errors.py,sha256=JEjXg_DGHmg1wy5lThmg7YpSOVg7z2D4b3N6d45qebU,2009
|
6
|
+
lamindb/base/__init__.py,sha256=6-iUeiBHuxC8vxP3vG880CH1nqP_7z34Appzzr63FBA,295
|
7
|
+
lamindb/base/fields.py,sha256=5l8ke5sAJ5_JvWqjKEMW8oyriGKA7itqGjbmoKKrJrM,8102
|
8
|
+
lamindb/base/ids.py,sha256=X-1N129FOoNw4TPlK_EzgTZOzRidiMyPWszz9r_066g,34
|
9
|
+
lamindb/base/types.py,sha256=HVtZbUqo1nfimep9JyiP-O-pQjyMge1_PcCM9v9je10,2777
|
10
|
+
lamindb/base/uids.py,sha256=cLBi5mIlsf1ltkTb17r1FLzlOjlGmjvsCygoVJHQ-A8,2116
|
11
|
+
lamindb/base/users.py,sha256=8MSmAvCKoUF15YsDE6BGLBXsFWpfoEEg8iDTKZ7kD48,848
|
12
|
+
lamindb/core/__init__.py,sha256=aaBq0UVjNolMynbT1V5hB6UrJm1tK0M6WHu_r6em9_4,604
|
13
|
+
lamindb/core/_compat.py,sha256=NLnKk1qk4xdgMV-QwFDnBnbio02ujjlF86icvhpdv4c,2029
|
14
|
+
lamindb/core/_context.py,sha256=GT9heAYluabme86oJm4n6SQt0ZShnVuBhJd3o474JVo,36005
|
15
|
+
lamindb/core/_mapped_collection.py,sha256=dxyZ1ZHFn5SBl1xILqN9N6TTUJP0PptVBV-2O0EdZww,25751
|
16
|
+
lamindb/core/_settings.py,sha256=I_h_O06BNlzhHkMiJqDlRhfbRwCWdMDjKdalNIfIZT0,6214
|
17
|
+
lamindb/core/_sync_git.py,sha256=Z7keuyS5X7CAj285sEbZIFExZF9mtjGH8DzKwz3xhHw,5881
|
18
|
+
lamindb/core/_track_environment.py,sha256=gKmXiL2meqJT65X-66p_GlonoxzBZXNwNm-G9gk0fS4,847
|
19
|
+
lamindb/core/exceptions.py,sha256=FMEoSvT3FvtLkxQAt2oDXPeaPem8V5x5UBbTsPFYU5w,53
|
20
|
+
lamindb/core/loaders.py,sha256=2qi6CPYbPRVnZaj5iJamB5Cmxm6H2TEDvhphtRhoX1Q,5461
|
21
|
+
lamindb/core/types.py,sha256=yHr2Vn_p1Hepz_mBooXmsKudqu8Tco7lXZmVS_ORQIw,383
|
22
|
+
lamindb/core/datasets/__init__.py,sha256=x5zn_vn8D4xMJOJ9hVc8wRwQk5ea81Un2tGHb2UfiHg,1893
|
23
|
+
lamindb/core/datasets/_core.py,sha256=uaP0snoKuAE5nDTL_XIgPeEoXSp5sTrNNAyOPDciZRU,20286
|
24
|
+
lamindb/core/datasets/_fake.py,sha256=BZF9R_1iF0HDnvtZNqL2FtsjSMuqDIfuFxnw_LJYIh4,953
|
25
|
+
lamindb/core/datasets/_small.py,sha256=HBzyTporAl-6Cr4DbDDEtzbU2ILKNxxiRM-GeZofqsw,2290
|
26
|
+
lamindb/core/datasets/mini_immuno.py,sha256=dSOMZYf8yaNK3ZHu4TQtYLgZNdaK5BXWyBVJhAejAyo,5703
|
27
|
+
lamindb/core/storage/__init__.py,sha256=JOIMu_7unbyhndtH1j0Q-9AvY8knSuc1IJO9sQnyBAQ,498
|
28
|
+
lamindb/core/storage/_anndata_accessor.py,sha256=j7PgAxKL7bumvHja99Ldm6BtWkdGMu2Dh_sYoXocTeQ,26105
|
29
|
+
lamindb/core/storage/_backed_access.py,sha256=LlpRDZ0skseZA5tBFu3-cH1wJwuXm7-NS2RgnTK7wgc,7382
|
30
|
+
lamindb/core/storage/_polars_lazy_df.py,sha256=Z0KMp0OU5S36L5g8EuJk7V_nn-spgG1lFeEFnkTOLcw,1350
|
31
|
+
lamindb/core/storage/_pyarrow_dataset.py,sha256=lRYYt7edUtwauhxd7RwFud6YPDbz2PFvYYgqLhfapfk,1398
|
32
|
+
lamindb/core/storage/_tiledbsoma.py,sha256=QLMOPjdxv9JFs9JR0Kqg1UTkJKNgwIDMeHAewB0-Lqg,11124
|
33
|
+
lamindb/core/storage/_valid_suffixes.py,sha256=MlX1Cj8cYnSPL8qp6Evm8MdioyOCEaPUUeckqHwDXIM,529
|
34
|
+
lamindb/core/storage/_zarr.py,sha256=XZ9FoMYc6xsThAduSf3gUS2mVJfqe1KxQvbRpYv11ac,4270
|
35
|
+
lamindb/core/storage/objects.py,sha256=n1Kj1soxF-_iLFyNnHriVFcngw6nqEAd7aVm0Hm8Tcw,3017
|
36
|
+
lamindb/core/storage/paths.py,sha256=wJTD7qza87Xx7ZMo9HFHKgZWaVnst6qc4F2SzqvBMrE,7118
|
37
|
+
lamindb/core/subsettings/__init__.py,sha256=f_vOqZOjVGez8pLmtrUuc_ayDGXl07t_ZY-P2Cedxbo,201
|
38
|
+
lamindb/core/subsettings/_annotation_settings.py,sha256=o-yTYw-NmjFmtehbKU8qnf7tyaeDFkTRGan1pXAIVT0,370
|
39
|
+
lamindb/core/subsettings/_creation_settings.py,sha256=NGHWKqCFSzVNBxAr2VnmdYguiFdW29XUK7T9wRsVshg,906
|
40
|
+
lamindb/curators/__init__.py,sha256=rv5Xrhv0jS1NMpuRVUHEMAsu6pXhBdDP8PBlO4FXrsE,662
|
41
|
+
lamindb/curators/_legacy.py,sha256=p0jn3VcH-yrCGreKtmbntiJcgxXSOo7KDbP-jgynxyo,76238
|
42
|
+
lamindb/curators/core.py,sha256=6c81R53CqtexivpjvbewXjJdjLFWc_zo4NFz9TpTyLU,66827
|
43
|
+
lamindb/curators/_cellxgene_schemas/__init__.py,sha256=iw6PrzhBQpAR7aQ4_MXopSAVX2hdderHH3LRWeQy7Hk,7511
|
44
|
+
lamindb/curators/_cellxgene_schemas/schema_versions.csv,sha256=X9rmO88TW1Fht1f5mJs0JdW-VPvyKSajpf8lHNeECj4,1680
|
45
|
+
lamindb/examples/__init__.py,sha256=DGImiuWYDvwxh78p5FCwQWClEwsE3ODLU49i_NqbW0c,533
|
46
|
+
lamindb/examples/schemas/__init__.py,sha256=NPDp7VjMOHStEIthx3xW9NSHtY7jnnMzrNPcSDgxT3M,241
|
47
|
+
lamindb/examples/schemas/_anndata.py,sha256=Q0h7YWZ6lqAZtE0i1xxCvJ8JfSa_RhFj4RY1sE_9HZs,764
|
48
|
+
lamindb/examples/schemas/_simple.py,sha256=JdavLLrJnxDLTKBKRk2Tb534AInlzX0jyEvU9LcH-NQ,568
|
49
|
+
lamindb/integrations/__init__.py,sha256=RWGMYYIzr8zvmNPyVB4m-p4gMDhxdRbjES2Ed23OItw,215
|
50
|
+
lamindb/integrations/_vitessce.py,sha256=OvtnBAxlR_PvfeGjpySjzi2uRYsBwDwb3tMyhBzNVFk,4110
|
51
|
+
lamindb/migrations/0069_squashed.py,sha256=7XdiRW0MBtr3Jck9dbIy_9qxmB_sjtLM1SH9x062d2k,62631
|
52
|
+
lamindb/migrations/0070_lamindbv1_migrate_data.py,sha256=tyq_xi6U8TXi9C2Raf6v_UTtfyfqQOUIFJzYj4oCgAE,2429
|
53
|
+
lamindb/migrations/0071_lamindbv1_migrate_schema.py,sha256=o47wYtMTuQ-LEVQSftiV0Wwvs3bcISZ_JtWsMxlLykk,25130
|
54
|
+
lamindb/migrations/0072_remove_user__branch_code_remove_user_aux_and_more.py,sha256=Nek9Mkuop3LgjAuW3moY-dyPXroCFq8UyvCAAWEquCM,4443
|
55
|
+
lamindb/migrations/0073_merge_ourprojects.py,sha256=4X5uM_mGLVx38KMhjmFFKrUm3vUpUh8SC28CviO07zw,35029
|
56
|
+
lamindb/migrations/0074_lamindbv1_part4.py,sha256=NqYjEAmm2bNuK42ufLaJZDBjCjAJNv-N9pEXK7iCfyA,11557
|
57
|
+
lamindb/migrations/0075_lamindbv1_part5.py,sha256=EpRAq6sGHZZM12xlkZXedG-b2R2cDfhpLZ38RWC3uRU,8959
|
58
|
+
lamindb/migrations/0076_lamindbv1_part6.py,sha256=G_Wgog-OgquE0-h_CykjiDWUyPdYlCwA8gXjeuBY2OM,21349
|
59
|
+
lamindb/migrations/0077_lamindbv1_part6b.py,sha256=vErm3muR0iGFnFH0Fx9GhQOR6k4xjhxlXbYBIuRShjY,8208
|
60
|
+
lamindb/migrations/0078_lamindbv1_part6c.py,sha256=RWRXBwyyQ_rFTN5kwstBziV6tqHJcGYI2vsFmuYCCz0,17084
|
61
|
+
lamindb/migrations/0079_alter_rundata_value_json_and_more.py,sha256=yQmbs8yWrFLOVQJqAfzLNMZOqTSnXyG-mQgpO7ls1u8,995
|
62
|
+
lamindb/migrations/0080_polish_lamindbv1.py,sha256=_nR_Pum19tQh3GCtzdiFLfUbFAQNzpuz7GuMZQuR2z8,17658
|
63
|
+
lamindb/migrations/0081_revert_textfield_collection.py,sha256=uHuJ0W4Ips7BrnQnQBGPMn2eFQz29a1QAdHzN7XlDxo,490
|
64
|
+
lamindb/migrations/0082_alter_feature_dtype.py,sha256=qAmZL2g0x43Jk4nbwE-c5z_29Q6vzvrL8DYJE16ZTVo,508
|
65
|
+
lamindb/migrations/0083_alter_feature_is_type_alter_flextable_is_type_and_more.py,sha256=ANFJmrd7rtpDvk0OP0EwAhkB-K4GJobdOaEWmjrQqhM,2725
|
66
|
+
lamindb/migrations/0084_alter_schemafeature_feature_and_more.py,sha256=ATL1Tyfvtvs0ZUH3JwWfBhcRsOGepCoMEjp9yZmO7z0,1012
|
67
|
+
lamindb/migrations/0085_alter_feature_is_type_alter_flextable_is_type_and_more.py,sha256=09KGDirJWH1wkmYBREaF_UrkDGS9qwGxOQuleKydDbI,1941
|
68
|
+
lamindb/migrations/0086_various.py,sha256=6-_vkiBEiv0ZVp-JCMVdea-AaKRU61DHyMWprU_VUrg,2824
|
69
|
+
lamindb/migrations/0087_rename__schemas_m2m_artifact_feature_sets_and_more.py,sha256=zRlBS89VhmECwGA_y9LghKibxJjtEAmHsEavKdj1ces,1132
|
70
|
+
lamindb/migrations/0088_schema_components.py,sha256=t7usNk7rigwAzVgb23SI2UiYXkanKF8SlEFhddkzIds,9229
|
71
|
+
lamindb/migrations/0089_subsequent_runs.py,sha256=ETXBqn-MwhFi3GIUbUqwM2j9un2o-0CI2Ux8b8FXuuw,5859
|
72
|
+
lamindb/migrations/0090_runproject_project_runs.py,sha256=spu1XE08K3I3Wu2-liYYOXxAJshQnIsDIIWhXhNpZ1g,2454
|
73
|
+
lamindb/migrations/0091_alter_featurevalue_options_alter_space_options_and_more.py,sha256=UAn5_7EM3lDAcguK3UByYFB1LBmYS0NUHRfDLHxMqLc,622
|
74
|
+
lamindb/migrations/0092_alter_artifactfeaturevalue_artifact_and_more.py,sha256=x-2Pvi0GJugkLrR--Fw9PBzV-HxqXjl0NktxRtRFJno,2459
|
75
|
+
lamindb/migrations/0093_alter_schemacomponent_unique_together.py,sha256=p6pCGU3xzOo5FuHE_COxVn6qLgRUAdfWXJjl4_euEKU,424
|
76
|
+
lamindb/migrations/0094_writeloglock_writelogmigrationstate_and_more.py,sha256=OiM_1jnRrjRt8pEctpZHGzOT2EZVHX07nAsrno6qgjU,2972
|
77
|
+
lamindb/migrations/0095_remove_rundata_flextable.py,sha256=bdLdrzRASqz6x-YFkacXukuTd5TUxMzxkSdT1cZlKuo,4735
|
78
|
+
lamindb/migrations/0096_remove_artifact__param_values_and_more.py,sha256=o05E_69imSnHj2GnwhKN7ZXOQVT8svIdR3kv7n8y04w,9649
|
79
|
+
lamindb/migrations/0097_remove_schemaparam_param_remove_paramvalue_param_and_more.py,sha256=S4g8zLghEv9DmR3cSISlI6fcydAeSirx7ssSB0TNavE,619
|
80
|
+
lamindb/migrations/0098_alter_feature_type_alter_project_type_and_more.py,sha256=wy3CZNwE6mVG65AmAUyE-AIjcTQjHLv8jgFDUJCh9h0,23626
|
81
|
+
lamindb/migrations/0099_alter_writelog_seqno.py,sha256=Sg4jbLO3dP69_A53EL2L3rwfMZ0vEZ0dNkBUso8syb4,572
|
82
|
+
lamindb/migrations/0100_branch_alter_artifact__branch_code_and_more.py,sha256=dC1b1ntEVayNxBVEvJVVpVjqjV6qnzZxZ7Ez0qy_9j4,3158
|
83
|
+
lamindb/migrations/0101_alter_artifact_hash_alter_feature_name_and_more.py,sha256=FgR_1_I3O8Gfpz-kPyl4EwX2R3LrjqdlVt_WUgM8nKk,14275
|
84
|
+
lamindb/migrations/0102_remove_writelog_branch_code_and_more.py,sha256=LkedZIweHHQGytJbo3OhshLFZLMKAbp22EuW-YqoTp0,2222
|
85
|
+
lamindb/migrations/0103_remove_writelog_migration_state_and_more.py,sha256=pipVgTTq6kmsi0ePCmfT2ajbrPrjJ1O6W5nC1DTG614,1195
|
86
|
+
lamindb/migrations/0103_squashed.py,sha256=kxvlhewpDEvFHD6nREmjgprXS4aEFk-t8P9plFhZtH8,161147
|
87
|
+
lamindb/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
|
+
lamindb/models/__init__.py,sha256=Pu7ugwrc_xTxaY4ZnjD5lU2RlCVF4cAa-3bKWRNbI8I,2386
|
89
|
+
lamindb/models/_describe.py,sha256=DF_AyjxrkBqKM4E1Ym5crvyYc6oJ-EaeOda9KJKBVAU,5482
|
90
|
+
lamindb/models/_django.py,sha256=bBu1yBJcE7RvPWor1Fp2sU0IEyrgTHxJbrDILDAvVFM,9029
|
91
|
+
lamindb/models/_feature_manager.py,sha256=6SNY1gu8CX9rHkwqHp1Vwe98w0dApa9vSin3rRcQWvY,52762
|
92
|
+
lamindb/models/_from_values.py,sha256=cCGPMDlAbBrdhFW-XrIQVZ10q1LNg4MycYPLOkF0fTc,13366
|
93
|
+
lamindb/models/_is_versioned.py,sha256=Th2_cBf9UWh27E6ANxg6LGmjBOumXFy7AjH0GG4FoXA,7601
|
94
|
+
lamindb/models/_label_manager.py,sha256=ZcZuajBX7MRAbXyzkhOHypLeCYAjGJe39cP8I9cVt9M,12304
|
95
|
+
lamindb/models/_relations.py,sha256=zHYLujy9vkuB9jVq5844TpzLSP__iYNCQcsl-FzK1Jw,3700
|
96
|
+
lamindb/models/artifact.py,sha256=eByxq8IpKJqs3OJzMcKqojQ17MmJ7JUQnDKHT5c_LSs,111207
|
97
|
+
lamindb/models/artifact_set.py,sha256=VOZEGDo3m_9Yg_ftx3I2fwdydjHN61X_qV18N6xG4kM,4117
|
98
|
+
lamindb/models/can_curate.py,sha256=ShEva1GGpJcCg7k95t99RzWfz28OFSorPFXLrGoXavE,29266
|
99
|
+
lamindb/models/collection.py,sha256=Jxr1DzSqa7gYnCzhfUXaHVFMUETSNqBzijTBAgUsyqA,28210
|
100
|
+
lamindb/models/core.py,sha256=BIpqguoZwaoZ8JshHz5dZWM7u3GwObYjmN2_vLaICH8,4030
|
101
|
+
lamindb/models/feature.py,sha256=RZG_82HS20esb8dmCW8VH-j6kiR2A9bMmJmDVaATlo8,29392
|
102
|
+
lamindb/models/has_parents.py,sha256=aqYlCN0P8njmEt5CK5AqS_M5S1ttQz8r6FsT-t3WUTk,20328
|
103
|
+
lamindb/models/project.py,sha256=FVAG6IZToVJ2PXr03UWKZGhmX4Zx8jq-Kv21tSn6o08,16420
|
104
|
+
lamindb/models/query_manager.py,sha256=4s0BNB_XaYnNaDNQgk-nzNYq2bOCEr4JsV1e1wLWzoY,10727
|
105
|
+
lamindb/models/query_set.py,sha256=pQ5yRCYB7DkJIXBaUo_oDUTMC4Z8tapiv7sze-yqiNw,31472
|
106
|
+
lamindb/models/record.py,sha256=o_En6QLcCRJ8ImUjc0n1gdYF0V2aN5nmjcZeUPSR6rE,8073
|
107
|
+
lamindb/models/run.py,sha256=C92AyGxGAS5Y8Jl7skF_HSjX2DMzrGy1IKIrolb8R3s,15211
|
108
|
+
lamindb/models/save.py,sha256=JtrEAy1D20EpRm6UmjCfZtCTBeq1RNtqzkq9mfhLFtE,13360
|
109
|
+
lamindb/models/schema.py,sha256=oFXVxQU0GjM4ivbPYSOQaIDoC376_1vlQ-AZoQm39eM,47529
|
110
|
+
lamindb/models/sqlrecord.py,sha256=yc-CxeIzrJB0tVmjWSvxN5NRSKTqpq4kR-z18AXAlNg,65014
|
111
|
+
lamindb/models/transform.py,sha256=lmBkk20tRoOByX3kd5DEbszT1REhBRm1NMNfQgtziKk,12203
|
112
|
+
lamindb/models/ulabel.py,sha256=b9_wY-nsLDBuLvXdEiChjteDf0DkEQxTiLErd1qTABw,9027
|
113
|
+
lamindb/setup/__init__.py,sha256=OwZpZzPDv5lPPGXZP7-zK6UdO4FHvvuBh439yZvIp3A,410
|
114
|
+
lamindb/setup/core/__init__.py,sha256=SevlVrc2AZWL3uALbE5sopxBnIZPWZ1IB0NBDudiAL8,167
|
115
|
+
lamindb-1.6a2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
116
|
+
lamindb-1.6a2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
117
|
+
lamindb-1.6a2.dist-info/METADATA,sha256=PauLRGdmtLxdBGzoQUJcrUDxrFtJ11k0jUYeFzmd-A4,2630
|
118
|
+
lamindb-1.6a2.dist-info/RECORD,,
|
@@ -1,41 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
import warnings
|
4
|
-
|
5
|
-
import scipy.sparse as sparse
|
6
|
-
from pandas import DataFrame
|
7
|
-
|
8
|
-
|
9
|
-
def _size_val(val):
|
10
|
-
with warnings.catch_warnings():
|
11
|
-
warnings.filterwarnings("ignore", category=FutureWarning)
|
12
|
-
|
13
|
-
if sparse.issparse(val):
|
14
|
-
val_csr = sparse.csr_matrix(val)
|
15
|
-
return val_csr.data.nbytes + val_csr.indptr.nbytes + val_csr.indices.nbytes
|
16
|
-
else:
|
17
|
-
return val.__sizeof__()
|
18
|
-
|
19
|
-
|
20
|
-
def _size_elem(elem):
|
21
|
-
if hasattr(elem, "keys") and not isinstance(elem, DataFrame):
|
22
|
-
return sum([_size_val(elem[k]) for k in elem.keys()])
|
23
|
-
else:
|
24
|
-
return _size_val(elem)
|
25
|
-
|
26
|
-
|
27
|
-
def _size_raw(raw):
|
28
|
-
return _size_val(raw.X) + _size_val(raw.var) + _size_elem(raw.varm)
|
29
|
-
|
30
|
-
|
31
|
-
def size_adata(adata):
|
32
|
-
with warnings.catch_warnings():
|
33
|
-
warnings.filterwarnings("ignore", category=FutureWarning)
|
34
|
-
|
35
|
-
total_size = adata.__sizeof__()
|
36
|
-
|
37
|
-
raw = adata.raw
|
38
|
-
if raw is not None:
|
39
|
-
total_size += _size_raw(raw)
|
40
|
-
|
41
|
-
return total_size
|
lamindb/models/flextable.py
DELETED
@@ -1,163 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from typing import TYPE_CHECKING
|
4
|
-
|
5
|
-
from django.db import models
|
6
|
-
from django.db.models import PROTECT, ManyToManyField
|
7
|
-
|
8
|
-
from lamindb.base.fields import (
|
9
|
-
BooleanField,
|
10
|
-
CharField,
|
11
|
-
ForeignKey,
|
12
|
-
IntegerField,
|
13
|
-
)
|
14
|
-
|
15
|
-
from .artifact import Artifact
|
16
|
-
from .feature import Feature
|
17
|
-
from .record import (
|
18
|
-
BasicRecord,
|
19
|
-
Record,
|
20
|
-
)
|
21
|
-
from .run import Param, TracksRun, TracksUpdates
|
22
|
-
|
23
|
-
if TYPE_CHECKING:
|
24
|
-
from .project import Project
|
25
|
-
|
26
|
-
from django.core.exceptions import ValidationError
|
27
|
-
|
28
|
-
from ..base.ids import base62_12
|
29
|
-
from .collection import Collection
|
30
|
-
from .project import Person, Project
|
31
|
-
from .record import Space
|
32
|
-
from .schema import Schema
|
33
|
-
from .ulabel import ULabel
|
34
|
-
|
35
|
-
|
36
|
-
class DataMixin(models.Model):
|
37
|
-
space: Space = ForeignKey(Space, PROTECT, default=1, db_default=1)
|
38
|
-
feature = ForeignKey(
|
39
|
-
Feature, null=True, blank=True, on_delete=models.CASCADE, related_name="+"
|
40
|
-
)
|
41
|
-
param = ForeignKey(
|
42
|
-
Param, null=True, blank=True, on_delete=models.CASCADE, related_name="+"
|
43
|
-
)
|
44
|
-
row = IntegerField(help_text="Use -1 for result data")
|
45
|
-
|
46
|
-
# Value fields
|
47
|
-
value_int = models.BigIntegerField(null=True, blank=True)
|
48
|
-
value_float = models.FloatField(null=True, blank=True)
|
49
|
-
value_str = models.TextField(null=True, blank=True)
|
50
|
-
value_datetime = models.DateTimeField(null=True, blank=True)
|
51
|
-
value_ulabel = models.ForeignKey(
|
52
|
-
ULabel, null=True, blank=True, on_delete=models.CASCADE, related_name="+"
|
53
|
-
)
|
54
|
-
value_person = models.ForeignKey(
|
55
|
-
Person, null=True, blank=True, on_delete=models.CASCADE, related_name="+"
|
56
|
-
)
|
57
|
-
value_artifact = models.ForeignKey(
|
58
|
-
Artifact, null=True, blank=True, on_delete=models.CASCADE, related_name="+"
|
59
|
-
)
|
60
|
-
value_collection = models.ForeignKey(
|
61
|
-
Collection, null=True, blank=True, on_delete=models.CASCADE, related_name="+"
|
62
|
-
)
|
63
|
-
value_project = models.ForeignKey(
|
64
|
-
Project, null=True, blank=True, on_delete=models.CASCADE, related_name="+"
|
65
|
-
)
|
66
|
-
value_json = models.JSONField(null=True, blank=True)
|
67
|
-
|
68
|
-
class Meta:
|
69
|
-
abstract = True
|
70
|
-
|
71
|
-
def clean(self):
|
72
|
-
# Validate feature/param mutual exclusivity
|
73
|
-
if (self.feature is not None) == (self.param is not None):
|
74
|
-
raise ValidationError("Exactly one of feature or param must be set")
|
75
|
-
|
76
|
-
# Validate value fields
|
77
|
-
values = [
|
78
|
-
self.value_int,
|
79
|
-
self.value_float,
|
80
|
-
self.value_str,
|
81
|
-
self.value_datetime,
|
82
|
-
self.value_ulabel,
|
83
|
-
self.value_artifact,
|
84
|
-
self.value_json,
|
85
|
-
]
|
86
|
-
non_null_count = sum(1 for v in values if v is not None)
|
87
|
-
|
88
|
-
if non_null_count != 1:
|
89
|
-
raise ValidationError("Exactly one value field must be set")
|
90
|
-
|
91
|
-
|
92
|
-
class RunData(BasicRecord, DataMixin):
|
93
|
-
run = models.ForeignKey("Run", on_delete=models.CASCADE, related_name="_rundata")
|
94
|
-
|
95
|
-
class Meta:
|
96
|
-
constraints = [
|
97
|
-
models.CheckConstraint(
|
98
|
-
condition=(
|
99
|
-
models.Q(feature__isnull=False, param__isnull=True)
|
100
|
-
| models.Q(feature__isnull=True, param__isnull=False)
|
101
|
-
),
|
102
|
-
name="run_data_feature_param_mutex",
|
103
|
-
),
|
104
|
-
models.UniqueConstraint(
|
105
|
-
fields=["run", "row", "feature", "param"], name="run_data_unique"
|
106
|
-
),
|
107
|
-
]
|
108
|
-
indexes = [
|
109
|
-
models.Index(fields=["run", "row"]),
|
110
|
-
models.Index(fields=["feature"]),
|
111
|
-
models.Index(fields=["param"]),
|
112
|
-
]
|
113
|
-
|
114
|
-
|
115
|
-
class FlexTable(Record, TracksRun, TracksUpdates):
|
116
|
-
uid: str = CharField(
|
117
|
-
editable=False, unique=True, max_length=12, db_index=True, default=base62_12
|
118
|
-
)
|
119
|
-
name = CharField()
|
120
|
-
schema: Schema | None = ForeignKey(
|
121
|
-
Schema, null=True, on_delete=models.SET_NULL, related_name="_tidytables"
|
122
|
-
)
|
123
|
-
type: FlexTable | None = ForeignKey(
|
124
|
-
"self", PROTECT, null=True, related_name="records"
|
125
|
-
)
|
126
|
-
"""Type of tidy table, e.g., `Cell`, `SampleSheet`, etc."""
|
127
|
-
records: ULabel
|
128
|
-
"""Records of this type."""
|
129
|
-
is_type: bool = BooleanField(default=False, db_index=True, null=True)
|
130
|
-
"""Distinguish types from instances of the type."""
|
131
|
-
description: str = CharField(null=True, db_index=True)
|
132
|
-
"""A description."""
|
133
|
-
projects: Project = ManyToManyField(Project, related_name="_tidytables")
|
134
|
-
ulabels: Project = ManyToManyField(ULabel, related_name="_tidytables")
|
135
|
-
|
136
|
-
class Meta:
|
137
|
-
indexes = [models.Index(fields=["uid"]), models.Index(fields=["name"])]
|
138
|
-
|
139
|
-
|
140
|
-
class FlexTableData(BasicRecord, DataMixin):
|
141
|
-
tidytable = models.ForeignKey(
|
142
|
-
FlexTable, on_delete=models.CASCADE, related_name="data"
|
143
|
-
)
|
144
|
-
|
145
|
-
class Meta:
|
146
|
-
constraints = [
|
147
|
-
models.CheckConstraint(
|
148
|
-
condition=(
|
149
|
-
models.Q(feature__isnull=False, param__isnull=True)
|
150
|
-
| models.Q(feature__isnull=True, param__isnull=False)
|
151
|
-
),
|
152
|
-
name="tidy_table_data_feature_param_mutex",
|
153
|
-
),
|
154
|
-
models.UniqueConstraint(
|
155
|
-
fields=["tidytable", "row", "feature", "param"],
|
156
|
-
name="tidy_table_data_unique",
|
157
|
-
),
|
158
|
-
]
|
159
|
-
indexes = [
|
160
|
-
models.Index(fields=["tidytable", "row"]),
|
161
|
-
models.Index(fields=["feature"]),
|
162
|
-
models.Index(fields=["param"]),
|
163
|
-
]
|