lamindb 1.2.0__py3-none-any.whl → 1.3.0__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 +1 -1
- lamindb/core/_context.py +6 -0
- lamindb/core/datasets/__init__.py +1 -0
- lamindb/core/datasets/_core.py +23 -0
- lamindb/core/datasets/_small.py +16 -2
- lamindb/core/storage/objects.py +1 -2
- lamindb/curators/__init__.py +1269 -1513
- lamindb/curators/_cellxgene_schemas/__init__.py +190 -18
- lamindb/curators/_cellxgene_schemas/schema_versions.csv +43 -0
- lamindb/models/_feature_manager.py +65 -14
- lamindb/models/_from_values.py +113 -78
- lamindb/models/artifact.py +138 -95
- lamindb/models/can_curate.py +185 -216
- lamindb/models/feature.py +32 -2
- lamindb/models/project.py +69 -7
- lamindb/models/record.py +43 -25
- lamindb/models/run.py +18 -1
- lamindb/models/schema.py +0 -8
- {lamindb-1.2.0.dist-info → lamindb-1.3.0.dist-info}/METADATA +6 -5
- {lamindb-1.2.0.dist-info → lamindb-1.3.0.dist-info}/RECORD +22 -22
- lamindb/curators/_cellxgene_schemas/schema_versions.yml +0 -104
- {lamindb-1.2.0.dist-info → lamindb-1.3.0.dist-info}/LICENSE +0 -0
- {lamindb-1.2.0.dist-info → lamindb-1.3.0.dist-info}/WHEEL +0 -0
lamindb/__init__.py
CHANGED
lamindb/core/_context.py
CHANGED
@@ -301,6 +301,12 @@ class Context:
|
|
301
301
|
"""
|
302
302
|
from lamindb.models import Project
|
303
303
|
|
304
|
+
instance_settings = ln_setup.settings.instance
|
305
|
+
# similar logic here: https://github.com/laminlabs/lamindb/pull/2527
|
306
|
+
# TODO: refactor upon new access management
|
307
|
+
if instance_settings.dialect == "postgresql" and "read" in instance_settings.db:
|
308
|
+
logger.warning("skipping track(), connected in read-only mode")
|
309
|
+
return None
|
304
310
|
if project is not None:
|
305
311
|
project_record = Project.filter(
|
306
312
|
Q(name=project) | Q(uid=project)
|
lamindb/core/datasets/_core.py
CHANGED
@@ -13,6 +13,7 @@ from lamindb.core._settings import settings
|
|
13
13
|
|
14
14
|
if TYPE_CHECKING:
|
15
15
|
from mudata import MuData
|
16
|
+
from spatialdata import SpatialData
|
16
17
|
|
17
18
|
|
18
19
|
def file_fcs() -> Path:
|
@@ -552,3 +553,25 @@ def schmidt22_perturbseq(basedir=".") -> Path: # pragma: no cover
|
|
552
553
|
"schmidt22_perturbseq.h5ad",
|
553
554
|
)
|
554
555
|
return Path(filepath).rename(Path(basedir) / filepath)
|
556
|
+
|
557
|
+
|
558
|
+
def spatialdata_blobs() -> SpatialData:
|
559
|
+
"""Example SpatialData dataset for tutorials."""
|
560
|
+
from spatialdata.datasets import blobs
|
561
|
+
|
562
|
+
sdata = blobs()
|
563
|
+
sdata.attrs["sample"] = {
|
564
|
+
"assay": "Visium Spatial Gene Expression",
|
565
|
+
"disease": "Alzheimer disease",
|
566
|
+
"developmental_stage": "adult stage",
|
567
|
+
}
|
568
|
+
sdata.tables["table"].var.index = [
|
569
|
+
"ENSG00000139618", # BRCA2
|
570
|
+
"ENSG00000157764", # BRAF
|
571
|
+
"ENSG00000999999", # Does not exist
|
572
|
+
]
|
573
|
+
sdata.tables["table"].obs["sample_region"] = pd.Categorical(
|
574
|
+
["sample region 1"] * 13 + ["sample region 2"] * 13
|
575
|
+
)
|
576
|
+
|
577
|
+
return sdata
|
lamindb/core/datasets/_small.py
CHANGED
@@ -8,9 +8,11 @@ import pandas as pd
|
|
8
8
|
|
9
9
|
|
10
10
|
def small_dataset1(
|
11
|
-
otype: Literal["DataFrame", "AnnData"],
|
11
|
+
otype: Literal["DataFrame", "AnnData"] = "DataFrame",
|
12
12
|
gene_symbols_in_index: bool = False,
|
13
13
|
with_typo: bool = False,
|
14
|
+
with_cell_type_synonym: bool = False,
|
15
|
+
with_cell_type_typo: bool = False,
|
14
16
|
) -> pd.DataFrame | ad.AnnData:
|
15
17
|
# define the data in the dataset
|
16
18
|
# it's a mix of numerical measurements and observation-level metadata
|
@@ -19,14 +21,25 @@ def small_dataset1(
|
|
19
21
|
var_ids = ["CD8A", "CD4", "CD14"]
|
20
22
|
else:
|
21
23
|
var_ids = ["ENSG00000153563", "ENSG00000010610", "ENSG00000170458"]
|
24
|
+
abt_cell = (
|
25
|
+
"CD8-pos alpha-beta T cell"
|
26
|
+
if with_cell_type_typo
|
27
|
+
else "CD8-positive, alpha-beta T cell"
|
28
|
+
)
|
22
29
|
dataset_dict = {
|
23
30
|
var_ids[0]: [1, 2, 3],
|
24
31
|
var_ids[1]: [3, 4, 5],
|
25
32
|
var_ids[2]: [5, 6, 7],
|
26
33
|
"perturbation": pd.Categorical(["DMSO", ifng, "DMSO"]),
|
27
34
|
"sample_note": ["was ok", "looks naah", "pretty! 🤩"],
|
28
|
-
"cell_type_by_expert": pd.Categorical(
|
35
|
+
"cell_type_by_expert": pd.Categorical(
|
36
|
+
["B-cell" if with_cell_type_synonym else "B cell", abt_cell, abt_cell]
|
37
|
+
),
|
29
38
|
"cell_type_by_model": pd.Categorical(["B cell", "T cell", "T cell"]),
|
39
|
+
"assay_oid": pd.Categorical(["EFO:0008913", "EFO:0008913", "EFO:0008913"]),
|
40
|
+
"concentration": ["0.1%", "200 nM", "0.1%"],
|
41
|
+
"treatment_time_h": [24, 24, 6],
|
42
|
+
"donor": ["D0001", "D0002", None],
|
30
43
|
}
|
31
44
|
# define the dataset-level metadata
|
32
45
|
metadata = {
|
@@ -100,6 +113,7 @@ def small_dataset3_cellxgene(
|
|
100
113
|
"disease_ontology_term_id": ["MONDO:0004975", "MONDO:0004980", "MONDO:0004980"],
|
101
114
|
"organism": ["human", "human", "human"],
|
102
115
|
"sex": ["female", "male", "unknown"],
|
116
|
+
"sex_ontology_term_id": ["PATO:0000383", "PATO:0000384", "unknown"],
|
103
117
|
"tissue": ["lungg", "lungg", "heart"],
|
104
118
|
"donor": ["-1", "1", "2"],
|
105
119
|
}
|
lamindb/core/storage/objects.py
CHANGED