Skip to content

Commit

Permalink
everything except cellpack passing
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Mar 7, 2025
1 parent c2f775d commit 95e16b9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 9 additions & 1 deletion molecularnodes/entities/molecule/pdbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ def _assemblies(self):
return CIFAssemblyParser(self.file).get_assemblies()

def entity_ids(self):
return self.file.block.get("entity").get("pdbx_description").as_array().tolist()
try:
return (
self.file.block.get("entity")
.get("pdbx_description")
.as_array()
.tolist()
)
except AttributeError:
return None

@staticmethod
def _extract_matrices(category):
Expand Down
11 changes: 7 additions & 4 deletions molecularnodes/entities/molecule/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from io import BytesIO
from biotite.structure import AtomArray, AtomArrayStack
from biotite import structure as struc
from biotite.file import File
from biotite.file import File, InvalidFileError
import numpy as np
import json
from ...assets import data
Expand Down Expand Up @@ -67,9 +67,12 @@ def chain_ids(self) -> list[str] | None:
return np.unique(self.array.chain_id).tolist()

def assemblies(self, as_json_string: bool = False) -> dict | str:
if as_json_string:
return json.dumps(self._assemblies())
return self._assemblies()
try:
if as_json_string:
return json.dumps(self._assemblies())
return self._assemblies()
except InvalidFileError:
return ""

def _assemblies(self):
return {}
Expand Down
1 change: 1 addition & 0 deletions molecularnodes/ui/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def execute(self, context):
if not isinstance(obj, bpy.types.Object):
self.report({"ERROR"}, "No active object")
return {"CANCELLED"}

with databpy.nodes.DuplicatePrevention():
try:
if self.inset_node:
Expand Down

0 comments on commit 95e16b9

Please sign in to comment.