tol-sdk 1.8.2__py3-none-any.whl → 1.8.3__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.
- tol/flows/converters/__init__.py +1 -0
- tol/flows/converters/auto_detect_manifest_type_converter.py +46 -0
- tol/sql/pipeline_step/factory.py +6 -1
- tol/validators/__init__.py +2 -0
- tol/validators/unique_value_check.py +41 -0
- tol/validators/value_check.py +36 -0
- {tol_sdk-1.8.2.dist-info → tol_sdk-1.8.3.dist-info}/METADATA +1 -1
- {tol_sdk-1.8.2.dist-info → tol_sdk-1.8.3.dist-info}/RECORD +12 -9
- {tol_sdk-1.8.2.dist-info → tol_sdk-1.8.3.dist-info}/WHEEL +0 -0
- {tol_sdk-1.8.2.dist-info → tol_sdk-1.8.3.dist-info}/entry_points.txt +0 -0
- {tol_sdk-1.8.2.dist-info → tol_sdk-1.8.3.dist-info}/licenses/LICENSE +0 -0
- {tol_sdk-1.8.2.dist-info → tol_sdk-1.8.3.dist-info}/top_level.txt +0 -0
tol/flows/converters/__init__.py
CHANGED
|
@@ -56,3 +56,4 @@ from .sts_sample_to_casm_benchling_converter import StsSampleToCasmBenchlingConv
|
|
|
56
56
|
from .treeofsex_species_to_treeofsexwh_species_converter import TreeofsexSpeciesToTreeofsexwhSpeciesConverter # noqa F401
|
|
57
57
|
from .treeofsex_upload_to_treeofsex_attribute_converter import TreeofsexUploadToTreeofsexAttributeConverter # noqa F401
|
|
58
58
|
from .skip_null_fields_converter import SkipNullFieldsConverter # noqa F401
|
|
59
|
+
from .auto_detect_manifest_type_converter import AutoDetectManifestTypeConverter # noqa F401
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Genome Research Ltd.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import re
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import Iterable
|
|
7
|
+
|
|
8
|
+
from tol.core import DataObject, DataObjectToDataObjectOrUpdateConverter
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AutoDetectManifestTypeConverter(DataObjectToDataObjectOrUpdateConverter):
|
|
12
|
+
|
|
13
|
+
@dataclass(slots=True, frozen=True, kw_only=True)
|
|
14
|
+
class Config:
|
|
15
|
+
rack_or_plate: str
|
|
16
|
+
|
|
17
|
+
__slots__ = ['__config']
|
|
18
|
+
__config: Config
|
|
19
|
+
|
|
20
|
+
def __init__(self, data_object_factory, config: Config) -> None:
|
|
21
|
+
super().__init__(data_object_factory)
|
|
22
|
+
self.__config = config
|
|
23
|
+
self._data_object_factory = data_object_factory
|
|
24
|
+
|
|
25
|
+
def convert(self, data_object: DataObject) -> Iterable[DataObject]:
|
|
26
|
+
"""
|
|
27
|
+
converting the samples DataObject into ENA format
|
|
28
|
+
"""
|
|
29
|
+
s = data_object
|
|
30
|
+
attributes = {}
|
|
31
|
+
rack_or_plate_based_manifest = bool(
|
|
32
|
+
re.fullmatch(r'^[A-P][12]?[0-9]$',
|
|
33
|
+
s.attributes.get(self.__config.rack_or_plate))
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
if rack_or_plate_based_manifest:
|
|
37
|
+
attributes['manifest_type'] = 'PLATE_WELL'
|
|
38
|
+
else:
|
|
39
|
+
attributes['manifest_type'] = 'RACK_TUBE'
|
|
40
|
+
|
|
41
|
+
ret = self._data_object_factory(
|
|
42
|
+
data_object.type,
|
|
43
|
+
s.id,
|
|
44
|
+
attributes=attributes,
|
|
45
|
+
)
|
|
46
|
+
yield ret
|
tol/sql/pipeline_step/factory.py
CHANGED
|
@@ -9,7 +9,7 @@ from dataclasses import dataclass
|
|
|
9
9
|
from datetime import datetime
|
|
10
10
|
from typing import Any, Dict, Iterator, List
|
|
11
11
|
|
|
12
|
-
from sqlalchemy import ForeignKey, UniqueConstraint
|
|
12
|
+
from sqlalchemy import ForeignKey, Text, UniqueConstraint
|
|
13
13
|
from sqlalchemy.dialects.postgresql import JSONB
|
|
14
14
|
from sqlalchemy.orm import (
|
|
15
15
|
Mapped,
|
|
@@ -121,6 +121,11 @@ def create_pipeline_step_models(
|
|
|
121
121
|
nullable=False
|
|
122
122
|
)
|
|
123
123
|
|
|
124
|
+
description: Mapped[str | None] = mapped_column(
|
|
125
|
+
Text,
|
|
126
|
+
nullable=True
|
|
127
|
+
)
|
|
128
|
+
|
|
124
129
|
is_visible: Mapped[bool] = mapped_column(
|
|
125
130
|
nullable=False,
|
|
126
131
|
default=True
|
tol/validators/__init__.py
CHANGED
|
@@ -20,3 +20,5 @@ from .unique_values import UniqueValuesValidator # noqa
|
|
|
20
20
|
from .unique_whole_organisms import UniqueWholeOrganismsValidator # noqa
|
|
21
21
|
from .interfaces import Condition # noqa
|
|
22
22
|
from .min_one_valid_value import MinOneValidValueValidator # noqa
|
|
23
|
+
from .value_check import ValueCheckValidator # noqa
|
|
24
|
+
from .unique_value_check import UniqueValueCheckValidator # noqa
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Genome Research Ltd.
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
from tol.core import Validator
|
|
8
|
+
from tol.core.data_object import DataObject
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class UniqueValueCheckValidator(Validator):
|
|
12
|
+
"""
|
|
13
|
+
Validates an incoming stream of `DataObject` instances.
|
|
14
|
+
For each data object (sample) it checks if the GAL column has only one value
|
|
15
|
+
"""
|
|
16
|
+
@dataclass(slots=True, frozen=True, kw_only=True)
|
|
17
|
+
class Config:
|
|
18
|
+
field: str
|
|
19
|
+
|
|
20
|
+
__slots__ = ['__config', '_cached']
|
|
21
|
+
__config: Config
|
|
22
|
+
_cached: str | None
|
|
23
|
+
|
|
24
|
+
def __init__(self, config: Config, **kwargs) -> None:
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.__config = config
|
|
27
|
+
self._cached = None
|
|
28
|
+
|
|
29
|
+
def _validate_data_object(self, obj: DataObject) -> None:
|
|
30
|
+
# This function is used to check if the data object has a single value for GAL column
|
|
31
|
+
|
|
32
|
+
if not self._cached:
|
|
33
|
+
self._cached = obj.attributes.get(self.__config.field)
|
|
34
|
+
|
|
35
|
+
else:
|
|
36
|
+
if obj.attributes.get(self.__config.field) != self._cached:
|
|
37
|
+
self.add_error(
|
|
38
|
+
object_id=obj.id,
|
|
39
|
+
detail=f'More than one value detected in {self.__config.field}',
|
|
40
|
+
field=self.__config.field,
|
|
41
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Genome Research Ltd.
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
from tol.core import Validator
|
|
8
|
+
from tol.core.data_object import DataObject
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ValueCheckValidator(Validator):
|
|
12
|
+
"""
|
|
13
|
+
Validates an incoming stream of `DataObject` instances.
|
|
14
|
+
For each data object (sample) it checks if it is a SYMBIONT
|
|
15
|
+
"""
|
|
16
|
+
@dataclass(slots=True, frozen=True, kw_only=True)
|
|
17
|
+
class Config:
|
|
18
|
+
field: str
|
|
19
|
+
value: str
|
|
20
|
+
|
|
21
|
+
__slots__ = ['__config']
|
|
22
|
+
__config: Config
|
|
23
|
+
|
|
24
|
+
def __init__(self, config: Config, **kwargs) -> None:
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.__config = config
|
|
27
|
+
|
|
28
|
+
def _validate_data_object(self, obj: DataObject) -> None:
|
|
29
|
+
# This function is used to check if the data object is SYMBIONT or not
|
|
30
|
+
|
|
31
|
+
if obj.attributes.get(self.__config.field) == self.__config.value:
|
|
32
|
+
self.add_error(
|
|
33
|
+
object_id=obj.id,
|
|
34
|
+
detail=f'{self.__config.value} is detected',
|
|
35
|
+
field=self.__config.field,
|
|
36
|
+
)
|
|
@@ -149,7 +149,8 @@ tol/flows/__init__.py,sha256=M7iSvnBJs6fJ8M38cW0bYQa9WW0TN8FHAMjIHPDNAJ4,166
|
|
|
149
149
|
tol/flows/logger.py,sha256=rWXbaknGcPEZRFvC1CiB1qkhFRZsQk435w7VyJ3cpyw,170
|
|
150
150
|
tol/flows/secrets.py,sha256=1mlbsxaahzYRfVAx3XdztHOmUCtDMSJDzHysdbaCtj0,352
|
|
151
151
|
tol/flows/sequencing_submissions.py,sha256=ukz_y5be-BCBN2y3JPQ2EK6b3jwOCh-187j-jnw3EUY,11027
|
|
152
|
-
tol/flows/converters/__init__.py,sha256=
|
|
152
|
+
tol/flows/converters/__init__.py,sha256=QgbwWIbMKI8LWZBwYVrHARKi03ISLDS3yzpHNPRLXdk,6324
|
|
153
|
+
tol/flows/converters/auto_detect_manifest_type_converter.py,sha256=uHakTmVHMbm2kFQOWaAv8ynD9ueh7p-kq6wmfEGnmEw,1361
|
|
153
154
|
tol/flows/converters/benchling_entity_to_benchling_worklist_item_converter_factory.py,sha256=PN27fcvN4JLBnLrtPPAot1cWjAwPQHVcIDoMfPDeKzU,1210
|
|
154
155
|
tol/flows/converters/benchling_extraction_to_elastic_extraction_converter.py,sha256=S8pbmIeKlcXrLPRJHYBUGP0-Q7jTOV2QQk2TeA2naWo,1966
|
|
155
156
|
tol/flows/converters/benchling_extraction_to_elastic_sequencing_request_converter.py,sha256=2RiyRvGRSWzpUwEI4p-s0afshJpFUUxPqv2z-nyDSVg,1992
|
|
@@ -308,7 +309,7 @@ tol/sql/auth/__init__.py,sha256=e3JuwugXmXobklqZ1Mt1w03qPgb1WdUaJVM7oblzHyk,202
|
|
|
308
309
|
tol/sql/auth/blueprint.py,sha256=u0vT_TC9IMKrg08QFa9W29_83mT0y0jzLj3DvXy1BBw,25906
|
|
309
310
|
tol/sql/auth/models.py,sha256=U4CsKMMyzGMg6hj4tp_iRenr3_Q--64WJmHWvxQ2--Q,12297
|
|
310
311
|
tol/sql/pipeline_step/__init__.py,sha256=O7u4RrLfuoB0mwLcPxFoUrdTBZGB_4bE1vWCn5ho-qw,147
|
|
311
|
-
tol/sql/pipeline_step/factory.py,sha256=
|
|
312
|
+
tol/sql/pipeline_step/factory.py,sha256=FaO61WLST4GQdAWuCIGqAvpVBvzkfBOgZWgHEZy2OXo,5483
|
|
312
313
|
tol/sql/standard/__init__.py,sha256=2NbLXFk0rneGZosZ2ESIRcT0WMK0KncmPWaLPqvX-i4,142
|
|
313
314
|
tol/sql/standard/factory.py,sha256=yY8iWmZRMvUqphwnzBeOIQtKGgxsU6AcA7YTz53UYvc,20010
|
|
314
315
|
tol/status/__init__.py,sha256=sBo-j1wCmberl89uryVCBEJk8ohbfsYhaNpIp_brR9Y,146
|
|
@@ -322,7 +323,7 @@ tol/treeval/treeval_datasource.py,sha256=GzY6JwH67b5QdV-UVdCFJfgGAIuZ96J2nl53YxZ
|
|
|
322
323
|
tol/utils/__init__.py,sha256=764-Na1OaNGUDWpMIu51ZtXG7n_nB5MccUFK6LmkWRI,138
|
|
323
324
|
tol/utils/csv.py,sha256=mihww25fSn72c4h-RFeqD_pFIG6KHZP4v1_C0rx81ws,421
|
|
324
325
|
tol/utils/s3.py,sha256=aoYCwJ-qcMqFrpxmViFqPa0O1jgp0phtztO3-0CSNjw,491
|
|
325
|
-
tol/validators/__init__.py,sha256=
|
|
326
|
+
tol/validators/__init__.py,sha256=vRuNMVhUlRPinTZQ-TBtmfIAW40vcE4dez6RI89sgoI,1295
|
|
326
327
|
tol/validators/allowed_keys.py,sha256=RJcHBiguL84B8hjSRaXLNES21yZqaKFwJNp2Tz9zvh0,1506
|
|
327
328
|
tol/validators/allowed_values.py,sha256=-Yy3Sqo1WYacGKlot_dn3M2o7Oj5MXOioJrJmrWCCxs,1536
|
|
328
329
|
tol/validators/allowed_values_from_datasource.py,sha256=ICFO6FcYXDN7M2Cv1OwpyN38CdhmY7oU-njzIatA3-w,3185
|
|
@@ -338,13 +339,15 @@ tol/validators/specimens_have_same_taxon.py,sha256=m2LLRIZMdhPj1fzyioDJOraI6UHXg
|
|
|
338
339
|
tol/validators/sts_fields.py,sha256=aYbzy15btEg4-ocDT1qrspe7-atoWRrOJ_KmuPU6J14,8936
|
|
339
340
|
tol/validators/tolid.py,sha256=yODebLYbKtlem3IpVcv8XImvq90r-AK68asH9JEawqo,3897
|
|
340
341
|
tol/validators/types.py,sha256=KDBNqx5isJG5XI1l2V9Wmi9135ZwDace3MU6Qij3J6E,2612
|
|
342
|
+
tol/validators/unique_value_check.py,sha256=sFvDooYkKeORvULGEOTsgIcxlbe0AXDWxY3Gbr3j0KI,1282
|
|
341
343
|
tol/validators/unique_values.py,sha256=o5IrfUNLEmlEp8kpInTtFnTq-FqiHSC9TItKdf-LI1o,3114
|
|
342
344
|
tol/validators/unique_whole_organisms.py,sha256=RdqA1GzIf3LTdrmNGGdxv0aW2udDY2P9EaqZb40hhik,5735
|
|
345
|
+
tol/validators/value_check.py,sha256=lxfhfL8BCIs_B838CQ5znJ6KFD7ms_fSVCS9QuVearE,1052
|
|
343
346
|
tol/validators/interfaces/__init__.py,sha256=jtOxnwnwqV_29xjmmMcS_kvlt-pQiWwQYJn2YRP07_w,172
|
|
344
347
|
tol/validators/interfaces/condition_evaluator.py,sha256=nj8Cb8hi47OBy6OVNfeLhF-Pjwtr8MiOSymYL6hfVes,3766
|
|
345
|
-
tol_sdk-1.8.
|
|
346
|
-
tol_sdk-1.8.
|
|
347
|
-
tol_sdk-1.8.
|
|
348
|
-
tol_sdk-1.8.
|
|
349
|
-
tol_sdk-1.8.
|
|
350
|
-
tol_sdk-1.8.
|
|
348
|
+
tol_sdk-1.8.3.dist-info/licenses/LICENSE,sha256=RF9Jacy-9BpUAQQ20INhTgtaNBkmdTolYCHtrrkM2-8,1077
|
|
349
|
+
tol_sdk-1.8.3.dist-info/METADATA,sha256=xD9AOIVwrZlC5Vgb3rPRM9eT5HdJ0FmCsJDRmxfdvw8,3142
|
|
350
|
+
tol_sdk-1.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
351
|
+
tol_sdk-1.8.3.dist-info/entry_points.txt,sha256=jH3HfTwxjzog7E3lq8CKpUWGIRY9FSXbyL6CpUmv6D0,36
|
|
352
|
+
tol_sdk-1.8.3.dist-info/top_level.txt,sha256=PwKMQLphyZNvagBoriVbl8uwHXQl8IC1niawVG0iXMM,10
|
|
353
|
+
tol_sdk-1.8.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|