...
Some checks failed
API CI / api-tests (pull_request) Failing after 22s
CI / test (pull_request) Failing after 23s

This commit is contained in:
Tim Lorsbach
2026-07-01 20:55:58 +02:00
parent 5c6b854bde
commit 6c4cf8c71b
4 changed files with 27 additions and 6 deletions

View File

@ -29,7 +29,7 @@ services:
container_name: epbiotransformer3 container_name: epbiotransformer3
celery_worker: celery_worker:
image: git.envipath.com/envipath/envipy-bayer:1.0 image: git.envipath.com/envipath/envipy-bayer:1.2
container_name: epcelery container_name: epcelery
env_file: env_file:
- .env - .env

View File

@ -860,7 +860,7 @@ class Compound(
@staticmethod @staticmethod
@transaction.atomic @transaction.atomic
def create( def create(
package: "Package", smiles: str, name: str = None, description: str = None, *args, **kwargs package: "Package", smiles: str, name: str = None, description: str = None, molfile: str = None, *args, **kwargs
) -> "Compound": ) -> "Compound":
if smiles is None or smiles.strip() == "": if smiles is None or smiles.strip() == "":
raise InvalidSMILESException("SMILES is required") raise InvalidSMILESException("SMILES is required")
@ -885,9 +885,11 @@ class Compound(
# Check if we find a direct match for a given SMILES # Check if we find a direct match for a given SMILES
if qs.exists(): if qs.exists():
found_compound = qs.first().compound found_structure = qs.first()
found_compound = found_structure.compound
if name: if name:
found_structure.add_alias(name)
found_compound.add_alias(name) found_compound.add_alias(name)
return found_compound return found_compound
@ -900,9 +902,11 @@ class Compound(
# Check if we can find the standardized one # Check if we can find the standardized one
if qs.exists(): if qs.exists():
# TODO should we add a structure? # TODO should we add a structure?
found_compound = qs.first().compound found_structure = qs.first()
found_compound = found_structure.compound
if name: if name:
found_structure.add_alias(name)
found_compound.add_alias(name) found_compound.add_alias(name)
return found_compound return found_compound
@ -1161,7 +1165,7 @@ class CompoundStructure(
@staticmethod @staticmethod
@transaction.atomic @transaction.atomic
def create( def create(
compound: Compound, smiles: str, name: str = None, description: str = None, *args, **kwargs compound: Compound, smiles: str, name: str = None, description: str = None, molfile: str = None, *args, **kwargs
): ):
# Clean for potential XSS # Clean for potential XSS
if name is not None: if name is not None:
@ -1189,6 +1193,10 @@ class CompoundStructure(
cs.smiles = smiles cs.smiles = smiles
cs.compound = compound cs.compound = compound
# Check if molfile is present and valid
if molfile is not None and FormatConverter.from_molfile(molfile) is not None:
cs.molfile = molfile
if "normalized_structure" in kwargs: if "normalized_structure" in kwargs:
cs.normalized_structure = kwargs["normalized_structure"] cs.normalized_structure = kwargs["normalized_structure"]
@ -1206,6 +1214,8 @@ class CompoundStructure(
@property @property
def as_svg(self, width: int = 800, height: int = 400): def as_svg(self, width: int = 800, height: int = 400):
if self.molfile is not None and self.molfile.strip() != "":
return IndigoUtils.mol_to_svg(self.molfile, width=width, height=height)
return IndigoUtils.mol_to_svg(self.smiles, width=width, height=height) return IndigoUtils.mol_to_svg(self.smiles, width=width, height=height)
@property @property
@ -2341,7 +2351,8 @@ class Node(EnviPathModel, AliasMixin, ScenarioMixin, AdditionalInformationMixin)
"node_label_id": self.default_node_label.url, "node_label_id": self.default_node_label.url,
"image": f"{self.url}?image=svg", "image": f"{self.url}?image=svg",
"image_svg": IndigoUtils.mol_to_svg( "image_svg": IndigoUtils.mol_to_svg(
self.default_node_label.smiles, width=40, height=40 self.default_node_label.molfile if self.default_node_label.molfile is not None and self.default_node_label.molfile.strip() else self.default_node_label.smiles,
width=40, height=40
), ),
"image_type": "svg", "image_type": "svg",
"name": self.get_name(), "name": self.get_name(),
@ -2395,6 +2406,8 @@ class Node(EnviPathModel, AliasMixin, ScenarioMixin, AdditionalInformationMixin)
@property @property
def as_svg(self): def as_svg(self):
if self.default_node_label.molfile is not None and self.default_node_label.molfile.strip() != "":
return IndigoUtils.mol_to_svg(self.default_node_label.molfile)
return IndigoUtils.mol_to_svg(self.default_node_label.smiles) return IndigoUtils.mol_to_svg(self.default_node_label.smiles)
def get_timeseries_data(self): def get_timeseries_data(self):

View File

@ -1124,6 +1124,9 @@ def package_model(request, package_uuid, model_uuid):
} }
) )
# Sort data by prob desc
res["pred"] = sorted(res["pred"], key=lambda x: x["probability"], reverse=True)
return JsonResponse(res, safe=False) return JsonResponse(res, safe=False)
elif half_life: elif half_life:

View File

@ -34,3 +34,8 @@
} }
@import "./daisyui-theme.css"; @import "./daisyui-theme.css";
select.select[multiple] {
display: block;
white-space: normal;
}