sapiopycommons 2024.10.25a345__tar.gz → 2024.10.29a346__tar.gz
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.
Potentially problematic release.
This version of sapiopycommons might be problematic. Click here for more details.
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/PKG-INFO +1 -1
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/pyproject.toml +1 -1
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/chem/IndigoMolecules.py +0 -1
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/chem/Molecules.py +19 -77
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/customreport/custom_report_builder.py +9 -4
- sapiopycommons-2024.10.29a346/src/sapiopycommons/datatype/data_fields.py +61 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/eln/experiment_handler.py +13 -3
- sapiopycommons-2024.10.29a346/src/sapiopycommons/eln/experiment_report_util.py +653 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/aliases.py +16 -9
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/multimodal/multimodal_data.py +3 -6
- sapiopycommons-2024.10.29a346/src/sapiopycommons/processtracking/custom_workflow_handler.py +406 -0
- sapiopycommons-2024.10.29a346/src/sapiopycommons/webhook/webhook_context.py +39 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/data_type_models.py +17495 -38169
- sapiopycommons-2024.10.25a345/src/sapiopycommons/eln/experiment_report_util.py +0 -245
- sapiopycommons-2024.10.25a345/src/sapiopycommons/flowcyto/flow_cyto.py +0 -77
- sapiopycommons-2024.10.25a345/src/sapiopycommons/flowcyto/flowcyto_data.py +0 -75
- sapiopycommons-2024.10.25a345/tests/chem_test_curation_queue.py +0 -31
- sapiopycommons-2024.10.25a345/tests/curation_queue_test.sdf +0 -168
- sapiopycommons-2024.10.25a345/tests/flowcyto/101_DEN084Y5_15_E01_008_clean.fcs +0 -0
- sapiopycommons-2024.10.25a345/tests/flowcyto/101_DEN084Y5_15_E03_009_clean.fcs +0 -0
- sapiopycommons-2024.10.25a345/tests/flowcyto/101_DEN084Y5_15_E05_010_clean.fcs +0 -0
- sapiopycommons-2024.10.25a345/tests/flowcyto/8_color_ICS.wsp +0 -4833
- sapiopycommons-2024.10.25a345/tests/flowcyto/COVID19_W_001_O.fcs +0 -0
- sapiopycommons-2024.10.25a345/tests/flowcyto_test.py +0 -71
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/.gitignore +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/LICENSE +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/README.md +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/callbacks/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/callbacks/callback_util.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/chem/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/customreport/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/customreport/column_builder.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/customreport/term_builder.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/datatype/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/datatype/attachment_util.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/datatype/pseudo_data_types.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/eln/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/eln/plate_designer.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/complex_data_loader.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/file_bridge.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/file_bridge_handler.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/file_data_handler.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/file_util.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/file_validator.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/files/file_writer.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/accession_service.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/audit_log.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/custom_report_util.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/exceptions.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/popup_util.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/sapio_links.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/storage_util.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/general/time_util.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/multimodal/multimodal.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/processtracking/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/processtracking/endpoints.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/recordmodel/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/recordmodel/record_handler.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/rules/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/rules/eln_rule_handler.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/rules/on_save_rule_handler.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/sftpconnect/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/sftpconnect/sftp_builder.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/webhook/__init__.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/webhook/webhook_handlers.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/webhook/webservice_handlers.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/_do_not_add_init_py_here +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/accession_test.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/bio_reg_test.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/chem_test.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/kappa.chains.fasta +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/mafft_test.py +0 -0
- {sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/tests/test.gb +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2024.10.
|
|
3
|
+
Version: 2024.10.29a346
|
|
4
4
|
Summary: Official Sapio Python API Utilities Package
|
|
5
5
|
Project-URL: Homepage, https://github.com/sapiosciences
|
|
6
6
|
Author-email: Jonathan Steck <jsteck@sapiosciences.com>, Yechen Qiao <yqiao@sapiosciences.com>
|
|
@@ -9,7 +9,6 @@ indigo.setOption("ignore-stereochemistry-errors", True)
|
|
|
9
9
|
indigo.setOption("render-stereo-style", "ext")
|
|
10
10
|
indigo.setOption("aromaticity-model", "generic")
|
|
11
11
|
indigo.setOption("render-coloring", True)
|
|
12
|
-
indigo.setOption("molfile-saving-mode", "3000")
|
|
13
12
|
indigo_inchi = IndigoInchi(indigo);
|
|
14
13
|
|
|
15
14
|
|
{sapiopycommons-2024.10.25a345 → sapiopycommons-2024.10.29a346}/src/sapiopycommons/chem/Molecules.py
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Author Yechen Qiao
|
|
2
2
|
# Common Molecule Utilities for Molecule Transfers with Sapio
|
|
3
|
-
from typing import cast
|
|
4
3
|
|
|
5
4
|
from rdkit import Chem
|
|
6
5
|
from rdkit.Chem import Crippen, MolToInchi
|
|
@@ -21,25 +20,6 @@ tautomer_params.tautomerReassignStereo = False
|
|
|
21
20
|
tautomer_params.tautomerRemoveIsotopicHs = True
|
|
22
21
|
enumerator = rdMolStandardize.TautomerEnumerator(tautomer_params)
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
def get_enhanced_stereo_reg_hash(mol: Mol, enhanced_stereo: bool) -> str:
|
|
26
|
-
"""
|
|
27
|
-
Get the Registration Hash for the molecule by the current registration configuration.
|
|
28
|
-
When we are running if we are canonicalization of tautomers or cleaning up any other way, do they first before calling.
|
|
29
|
-
:param mol: The molecule to obtain hash for.
|
|
30
|
-
:param canonical_tautomer: Whether the registry system canonicalize the tautomers.
|
|
31
|
-
:param enhanced_stereo: Whether we are computing enhanced stereo at all.
|
|
32
|
-
:return: The enhanced stereo hash.
|
|
33
|
-
"""
|
|
34
|
-
if enhanced_stereo:
|
|
35
|
-
from rdkit.Chem.RegistrationHash import GetMolLayers, GetMolHash, HashScheme
|
|
36
|
-
layers = GetMolLayers(mol, enable_tautomer_hash_v2=True)
|
|
37
|
-
hash_scheme: HashScheme = HashScheme.TAUTOMER_INSENSITIVE_LAYERS
|
|
38
|
-
return GetMolHash(layers, hash_scheme=hash_scheme)
|
|
39
|
-
else:
|
|
40
|
-
return ""
|
|
41
|
-
|
|
42
|
-
|
|
43
23
|
def neutralize_atoms(mol) -> Mol:
|
|
44
24
|
"""
|
|
45
25
|
Neutralize atoms per https://baoilleach.blogspot.com/2019/12/no-charge-simple-approach-to.html
|
|
@@ -106,6 +86,7 @@ def mol_to_img(mol_str: str) -> str:
|
|
|
106
86
|
return renderer.renderToString(mol)
|
|
107
87
|
|
|
108
88
|
|
|
89
|
+
|
|
109
90
|
def mol_to_sapio_partial_pojo(mol: Mol):
|
|
110
91
|
"""
|
|
111
92
|
Get the minimum information about molecule to Sapio, just its SMILES, V3000, and image data.
|
|
@@ -115,7 +96,7 @@ def mol_to_sapio_partial_pojo(mol: Mol):
|
|
|
115
96
|
Chem.SanitizeMol(mol)
|
|
116
97
|
mol.UpdatePropertyCache()
|
|
117
98
|
smiles = Chem.MolToSmiles(mol)
|
|
118
|
-
molBlock = Chem.MolToMolBlock(mol
|
|
99
|
+
molBlock = Chem.MolToMolBlock(mol)
|
|
119
100
|
img = mol_to_img(mol)
|
|
120
101
|
molecule = dict()
|
|
121
102
|
molecule["smiles"] = smiles
|
|
@@ -124,52 +105,23 @@ def mol_to_sapio_partial_pojo(mol: Mol):
|
|
|
124
105
|
return molecule
|
|
125
106
|
|
|
126
107
|
|
|
127
|
-
def
|
|
128
|
-
"""
|
|
129
|
-
Return the SHA1 CXS Smiles hash for the canonical, isomeric CXS SMILES of the molecule.
|
|
130
|
-
"""
|
|
131
|
-
if not enhanced_stereo:
|
|
132
|
-
return ""
|
|
133
|
-
import hashlib
|
|
134
|
-
return hashlib.sha1(Chem.MolToCXSmiles(mol, canonical=True, isomericSmiles=True).encode()).hexdigest()
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
def get_has_or_group(mol: Mol, enhanced_stereo: bool) -> bool:
|
|
138
|
-
"""
|
|
139
|
-
Return true if and only if: enhanced stereochemistry is enabled and there is at least one OR group in mol.
|
|
140
|
-
"""
|
|
141
|
-
if not enhanced_stereo:
|
|
142
|
-
return False
|
|
143
|
-
from rdkit.Chem import StereoGroup_vect, STEREO_OR
|
|
144
|
-
stereo_groups: StereoGroup_vect = mol.GetStereoGroups()
|
|
145
|
-
for stereo_group in stereo_groups:
|
|
146
|
-
if stereo_group.GetGroupType() == STEREO_OR:
|
|
147
|
-
return True
|
|
148
|
-
return False
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def mol_to_sapio_substance(mol: Mol, include_stereoisomers=False,
|
|
108
|
+
def mol_to_sapio_substance(mol: Mol, include_stereoisomers: bool = False,
|
|
152
109
|
normalize: bool = False, remove_salt: bool = False, make_images: bool = False,
|
|
153
|
-
salt_def: str | None = None, canonical_tautomer: bool = True
|
|
154
|
-
enhanced_stereo: bool = False, remove_atom_map: bool = True):
|
|
110
|
+
salt_def: str | None = None, canonical_tautomer: bool = True):
|
|
155
111
|
"""
|
|
156
112
|
Convert a molecule in RDKit to a molecule POJO in Sapio.
|
|
157
113
|
|
|
158
114
|
:param mol: The molecule in RDKit.
|
|
115
|
+
:param include_stereoisomers: If true, will compute all stereoisomer permutations of this molecule.
|
|
159
116
|
:param normalize If true, will normalize the functional groups and return normalized result.
|
|
160
117
|
:param remove_salt If true, we will remove salts iteratively from the molecule before returning their data.
|
|
161
118
|
We will also populate desaltedList with molecules we deleted.
|
|
162
|
-
:param make_images Whether to make images as part of the result without having another script to resolve it.
|
|
163
119
|
:param salt_def: if not none, specifies custom salt to be used during the desalt process.
|
|
164
120
|
:param canonical_tautomer: if True, we will attempt to compute canonical tautomer for the molecule. Slow!
|
|
165
121
|
This is needed for a registry. Note it stops after enumeration of 1000.
|
|
166
|
-
:param enhanced_stereo: If enabled, enhanced stereo hash will be produced.
|
|
167
|
-
:param remove_atom_map: When set, clear all atom AAM maps that were set had it been merged into some reactions earlier.
|
|
168
122
|
:return: The molecule POJO for Sapio.
|
|
169
123
|
"""
|
|
170
124
|
molecule = dict()
|
|
171
|
-
if remove_atom_map:
|
|
172
|
-
[a.SetAtomMapNum(0) for a in mol.GetAtoms()]
|
|
173
125
|
Chem.SanitizeMol(mol)
|
|
174
126
|
mol.UpdatePropertyCache()
|
|
175
127
|
Chem.GetSymmSSSR(mol)
|
|
@@ -205,7 +157,7 @@ def mol_to_sapio_substance(mol: Mol, include_stereoisomers=False,
|
|
|
205
157
|
exactMass = Descriptors.ExactMolWt(mol)
|
|
206
158
|
molFormula = rdMolDescriptors.CalcMolFormula(mol)
|
|
207
159
|
charge = Chem.GetFormalCharge(mol)
|
|
208
|
-
molBlock = Chem.MolToMolBlock(mol
|
|
160
|
+
molBlock = Chem.MolToMolBlock(mol)
|
|
209
161
|
|
|
210
162
|
molecule["cLogP"] = cLogP
|
|
211
163
|
molecule["tpsa"] = tpsa
|
|
@@ -229,38 +181,28 @@ def mol_to_sapio_substance(mol: Mol, include_stereoisomers=False,
|
|
|
229
181
|
# We need to test the INCHI can be loaded back to indigo.
|
|
230
182
|
indigo_mol = indigo.loadMolecule(molBlock)
|
|
231
183
|
indigo_mol.aromatize()
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
molecule["inchiKey"] = Chem.MolToInchiKey(mol_copy)
|
|
238
|
-
else:
|
|
239
|
-
indigo_inchi.resetOptions()
|
|
240
|
-
indigo_inchi_str = indigo_inchi.getInchi(indigo_mol)
|
|
241
|
-
molecule["inchi"] = indigo_inchi_str
|
|
242
|
-
indigo_inchi_key_str = indigo_inchi.getInchiKey(indigo_inchi_str)
|
|
243
|
-
molecule["inchiKey"] = indigo_inchi_key_str
|
|
184
|
+
indigo_inchi.resetOptions()
|
|
185
|
+
indigo_inchi_str = indigo_inchi.getInchi(indigo_mol)
|
|
186
|
+
molecule["inchi"] = indigo_inchi_str
|
|
187
|
+
indigo_inchi_key_str = indigo_inchi.getInchiKey(indigo_inchi_str)
|
|
188
|
+
molecule["inchiKey"] = indigo_inchi_key_str
|
|
244
189
|
molecule["smiles"] = indigo_mol.smiles()
|
|
245
|
-
molecule["reg_hash"] = get_enhanced_stereo_reg_hash(mol, enhanced_stereo=enhanced_stereo)
|
|
246
|
-
molecule["cxsmiles_hash"] = get_cxs_smiles_hash(mol, enhanced_stereo=enhanced_stereo)
|
|
247
|
-
molecule["has_or_group"] = get_has_or_group(mol, enhanced_stereo=enhanced_stereo)
|
|
248
190
|
|
|
191
|
+
if include_stereoisomers and has_chiral_centers(mol):
|
|
192
|
+
stereoisomers = find_all_possible_stereoisomers(mol, only_unassigned=False, try_embedding=False, unique=True)
|
|
193
|
+
molecule["stereoisomers"] = [mol_to_sapio_partial_pojo(x) for x in stereoisomers]
|
|
249
194
|
return molecule
|
|
250
195
|
|
|
251
196
|
|
|
252
|
-
def mol_to_sapio_compound(mol: Mol, include_stereoisomers
|
|
197
|
+
def mol_to_sapio_compound(mol: Mol, include_stereoisomers: bool = False,
|
|
253
198
|
salt_def: str | None = None, resolve_canonical: bool = True,
|
|
254
|
-
make_images: bool = False, canonical_tautomer: bool = True
|
|
255
|
-
remove_atom_map: bool = True):
|
|
199
|
+
make_images: bool = False, canonical_tautomer: bool = True):
|
|
256
200
|
ret = dict()
|
|
257
|
-
ret['originalMol'] = mol_to_sapio_substance(mol, include_stereoisomers
|
|
201
|
+
ret['originalMol'] = mol_to_sapio_substance(mol, include_stereoisomers,
|
|
258
202
|
normalize=False, remove_salt=False, make_images=make_images,
|
|
259
|
-
canonical_tautomer=canonical_tautomer
|
|
260
|
-
enhanced_stereo=enhanced_stereo, remove_atom_map=remove_atom_map)
|
|
203
|
+
canonical_tautomer=canonical_tautomer)
|
|
261
204
|
if resolve_canonical:
|
|
262
205
|
ret['canonicalMol'] = mol_to_sapio_substance(mol, include_stereoisomers=False,
|
|
263
206
|
normalize=True, remove_salt=True, make_images=make_images,
|
|
264
|
-
salt_def=salt_def, canonical_tautomer=canonical_tautomer
|
|
265
|
-
enhanced_stereo=enhanced_stereo, remove_atom_map=remove_atom_map)
|
|
207
|
+
salt_def=salt_def, canonical_tautomer=canonical_tautomer)
|
|
266
208
|
return ret
|
|
@@ -96,14 +96,19 @@ class CustomReportBuilder:
|
|
|
96
96
|
AliasUtil.to_record_id(base_record),
|
|
97
97
|
AliasUtil.to_data_type_name(base_record))
|
|
98
98
|
|
|
99
|
-
def add_join(self, comparison_term: FieldCompareReportTerm) -> None:
|
|
99
|
+
def add_join(self, comparison_term: FieldCompareReportTerm, data_type: DataTypeIdentifier | None = None) -> None:
|
|
100
100
|
"""
|
|
101
101
|
Add a join statement to this report builder.
|
|
102
102
|
|
|
103
|
-
:param comparison_term: The field comparison term to join with.
|
|
104
|
-
|
|
103
|
+
:param comparison_term: The field comparison term to join with.
|
|
104
|
+
:param data_type: The data type name that this join is on. If not provided, then the left side data type name
|
|
105
|
+
of the comparison term will be the data type that is joined against.
|
|
105
106
|
"""
|
|
106
|
-
|
|
107
|
+
if data_type is None:
|
|
108
|
+
data_type: str = comparison_term.left_data_type_name
|
|
109
|
+
else:
|
|
110
|
+
data_type: str = AliasUtil.to_data_type_name(data_type)
|
|
111
|
+
self.join_list.append(ExplicitJoinDefinition(data_type, comparison_term))
|
|
107
112
|
|
|
108
113
|
def build_report_criteria(self, page_size: int = 0, page_number: int = -1, case_sensitive: bool = False,
|
|
109
114
|
owner_restriction_set: list[str] = None) -> CustomReportCriteria:
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from sapiopylib.rest.pojo.datatype.FieldDefinition import FieldType
|
|
2
|
+
from sapiopylib.rest.utils.recordmodel.RecordModelWrapper import WrapperField
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class SystemFields:
|
|
6
|
+
RECORD_ID__FIELD = WrapperField("RecordId", FieldType.LONG)
|
|
7
|
+
DATA_RECORD_NAME__FIELD = WrapperField("DataRecordName", FieldType.IDENTIFIER)
|
|
8
|
+
CREATED_BY__FIELD = WrapperField("CreatedBy", FieldType.STRING)
|
|
9
|
+
DATE_CREATED__FIELD = WrapperField("DateCreated", FieldType.DATE)
|
|
10
|
+
LAST_MODIFIED_BY__FIELD = WrapperField("VeloxLastModifiedBy", FieldType.STRING)
|
|
11
|
+
LAST_MODIFIED_DATE__FIELD = WrapperField("VeloxLastModifiedDate", FieldType.DATE)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ProcessQueueItemFields:
|
|
15
|
+
DATA_TYPE_NAME: str = 'ProcessQueueItem'
|
|
16
|
+
ASSIGNED_TO__FIELD = WrapperField('AssignedTo', FieldType.SELECTION)
|
|
17
|
+
DATA_RECORD_ID__FIELD = WrapperField('DataRecordId', FieldType.LONG)
|
|
18
|
+
DATA_TYPE_NAME__FIELD = WrapperField('DataTypeName', FieldType.STRING)
|
|
19
|
+
DURATION_IN_QUEUE__FIELD = WrapperField('DurationInQueue', FieldType.LONG)
|
|
20
|
+
EXPERIMENT__FIELD = WrapperField('Experiment', FieldType.SIDE_LINK)
|
|
21
|
+
LAUNCHED_DATE__FIELD = WrapperField('LaunchedDate', FieldType.DATE)
|
|
22
|
+
PROCESS_HEADER_NAME__FIELD = WrapperField('ProcessHeaderName', FieldType.STRING)
|
|
23
|
+
SCHEDULED_DATE__FIELD = WrapperField('ScheduledDate', FieldType.DATE)
|
|
24
|
+
SHOW_IN_QUEUE__FIELD = WrapperField('ShowInQueue', FieldType.BOOLEAN)
|
|
25
|
+
WORKFLOW_HEADER_NAME__FIELD = WrapperField('WorkflowHeaderName', FieldType.STRING)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ProcessWorkflowTrackingFields:
|
|
29
|
+
DATA_TYPE_NAME: str = 'ProcessWorkflowTracking'
|
|
30
|
+
ACTIVE_WORKFLOW_ID__FIELD = WrapperField("ActiveWorkflowId", FieldType.LONG)
|
|
31
|
+
BRANCH_LONG_ID__FIELD = WrapperField("BranchLongId", FieldType.LONG)
|
|
32
|
+
END_DATE__FIELD = WrapperField("EndDate", FieldType.DATE)
|
|
33
|
+
END_HOUR__FIELD = WrapperField("EndHour", FieldType.LONG)
|
|
34
|
+
END_MINUTE_TIME__FIELD = WrapperField("EndMinuteTime", FieldType.LONG)
|
|
35
|
+
EXPECTED_QUEUE_TIME__FIELD = WrapperField("ExpectedQueueTime", FieldType.DOUBLE)
|
|
36
|
+
EXPECTED_TAT__FIELD = WrapperField("ExpectedTAT", FieldType.DOUBLE)
|
|
37
|
+
PROCESS_QUEUE_ITEM__FIELD = WrapperField("ProcessQueueItem", FieldType.SIDE_LINK)
|
|
38
|
+
PROCESS_STEP_NUMBER__FIELD = WrapperField("ProcessStepNumber", FieldType.LONG)
|
|
39
|
+
QUEUED_HOURS__FIELD = WrapperField("QueuedHours", FieldType.LONG)
|
|
40
|
+
QUEUED_MINUTES__FIELD = WrapperField("QueuedMinutes", FieldType.LONG)
|
|
41
|
+
QUEUED_TIME__FIELD = WrapperField("QueuedTime", FieldType.DOUBLE)
|
|
42
|
+
QUEUE_START_DATE__FIELD = WrapperField("QueueStartDate", FieldType.DATE)
|
|
43
|
+
QUEUE_START_HOUR__FIELD = WrapperField("QueueStartHour", FieldType.LONG)
|
|
44
|
+
QUEUE_START_MINUTE_TIME__FIELD = WrapperField("QueueStartMinuteTime", FieldType.LONG)
|
|
45
|
+
SAMPLE_RECORD_ID__FIELD = WrapperField("SampleRecordId", FieldType.LONG)
|
|
46
|
+
START_DATE__FIELD = WrapperField("StartDate", FieldType.DATE)
|
|
47
|
+
START_HOUR__FIELD = WrapperField("StartHour", FieldType.LONG)
|
|
48
|
+
START_MINUTE_TIME__FIELD = WrapperField("StartMinuteTime", FieldType.LONG)
|
|
49
|
+
STATUS__FIELD = WrapperField("Status", FieldType.PICKLIST)
|
|
50
|
+
TURN_AROUND_HOURS__FIELD = WrapperField("TurnAroundHours", FieldType.LONG)
|
|
51
|
+
TURN_AROUND_MINUTES__FIELD = WrapperField("TurnAroundMinutes", FieldType.LONG)
|
|
52
|
+
WORKFLOW_END_USER_ID__FIELD = WrapperField("WorkflowEndUserId", FieldType.STRING)
|
|
53
|
+
WORKFLOW_EXPECTED_QUEUE_TIME__FIELD = WrapperField("WorkflowExpectedQueueTime", FieldType.STRING)
|
|
54
|
+
WORKFLOW_EXPECTED_TAT__FIELD = WrapperField("WorkflowExpectedTAT", FieldType.STRING)
|
|
55
|
+
WORKFLOW_EXPECTED_TOTAL_TAT__FIELD = WrapperField("WorkflowExpectedTotalTAT", FieldType.DOUBLE)
|
|
56
|
+
WORKFLOW_ID_NUMBER__FIELD = WrapperField("WorkflowIdNumber", FieldType.LONG)
|
|
57
|
+
WORKFLOW_NAME__FIELD = WrapperField("WorkflowName", FieldType.STRING)
|
|
58
|
+
WORKFLOW_PROCESS_TAT__FIELD = WrapperField("WorkflowProcessTAT", FieldType.DOUBLE)
|
|
59
|
+
WORKFLOW_START_USER_ID__FIELD = WrapperField("WorkflowStartUserId", FieldType.STRING)
|
|
60
|
+
WORKFLOW_TAT__FIELD = WrapperField("WorkflowTAT", FieldType.DOUBLE)
|
|
61
|
+
WORKFLOW_VERSION__FIELD = WrapperField("WorkflowVersion", FieldType.LONG)
|
|
@@ -57,9 +57,9 @@ class ExperimentHandler:
|
|
|
57
57
|
# additional queries to obtain, but may also be repeatedly accessed. In such cases, cache the information after it
|
|
58
58
|
# has been requested so that the user doesn't need to worry about caching it themselves.
|
|
59
59
|
# CR-46341: Replace class variables with instance variables.
|
|
60
|
-
__exp_record: DataRecord
|
|
60
|
+
__exp_record: DataRecord | None
|
|
61
61
|
"""The data record for this experiment. Only cached when first accessed."""
|
|
62
|
-
__exp_template: ElnTemplate
|
|
62
|
+
__exp_template: ElnTemplate | None
|
|
63
63
|
"""The template for this experiment. Only cached when first accessed."""
|
|
64
64
|
__exp_options: dict[str, str]
|
|
65
65
|
"""Experiment options for this experiment. Only cached when first accessed."""
|
|
@@ -277,6 +277,7 @@ class ExperimentHandler:
|
|
|
277
277
|
"""
|
|
278
278
|
template_id: int | None = self.__eln_exp.template_id
|
|
279
279
|
if template_id is None:
|
|
280
|
+
self.__exp_template = None
|
|
280
281
|
if exception_on_none:
|
|
281
282
|
raise SapioException(f"Experiment with ID {self.__exp_id} has no template ID.")
|
|
282
283
|
return None
|
|
@@ -635,6 +636,9 @@ class ExperimentHandler:
|
|
|
635
636
|
if not records:
|
|
636
637
|
return
|
|
637
638
|
dt: str = AliasUtil.to_singular_data_type_name(records)
|
|
639
|
+
if ElnBaseDataType.is_base_data_type(dt):
|
|
640
|
+
raise SapioException(f"{dt} is an ELN data type. This function call has no effect on ELN data types. "
|
|
641
|
+
f"Use add_eln_rows or add_sample_details instead.")
|
|
638
642
|
if dt != step.get_data_type_names()[0]:
|
|
639
643
|
raise SapioException(f"Cannot add {dt} records to entry {step.get_name()} of type "
|
|
640
644
|
f"{step.get_data_type_names()[0]}.")
|
|
@@ -659,6 +663,9 @@ class ExperimentHandler:
|
|
|
659
663
|
if not records:
|
|
660
664
|
return
|
|
661
665
|
dt: str = AliasUtil.to_singular_data_type_name(records)
|
|
666
|
+
if ElnBaseDataType.is_base_data_type(dt):
|
|
667
|
+
raise SapioException(f"{dt} is an ELN data type. This function call has no effect on ELN data types. "
|
|
668
|
+
f"Use remove_eln_rows or remove_sample_details instead.")
|
|
662
669
|
if dt != step.get_data_type_names()[0]:
|
|
663
670
|
raise SapioException(f"Cannot remove {dt} records from entry {step.get_name()} of type "
|
|
664
671
|
f"{step.get_data_type_names()[0]}.")
|
|
@@ -687,6 +694,9 @@ class ExperimentHandler:
|
|
|
687
694
|
step = self.__to_eln_step(step)
|
|
688
695
|
if records:
|
|
689
696
|
dt: str = AliasUtil.to_singular_data_type_name(records)
|
|
697
|
+
if ElnBaseDataType.is_base_data_type(dt):
|
|
698
|
+
raise SapioException(f"{dt} is an ELN data type. This function call has no effect on ELN data types. "
|
|
699
|
+
f"Use add_eln_rows or add_sample_details instead.")
|
|
690
700
|
if dt != step.get_data_type_names()[0]:
|
|
691
701
|
raise SapioException(f"Cannot set {dt} records for entry {step.get_name()} of type "
|
|
692
702
|
f"{step.get_data_type_names()[0]}.")
|
|
@@ -779,7 +789,7 @@ class ExperimentHandler:
|
|
|
779
789
|
raise SapioException("The provided step is not an ELN data type entry.")
|
|
780
790
|
if not records:
|
|
781
791
|
return
|
|
782
|
-
record_dt: str = AliasUtil.to_singular_data_type_name(records)
|
|
792
|
+
record_dt: str = AliasUtil.to_singular_data_type_name(records, False)
|
|
783
793
|
if record_dt != dt:
|
|
784
794
|
raise SapioException(f"Cannot remove {dt} records from entry {step.get_name()} of type "
|
|
785
795
|
f"{step.get_data_type_names()[0]}.")
|