Skip to content

Commit

Permalink
Biotite Bump to >=1 (#737)
Browse files Browse the repository at this point in the history
* update for biotite 1.1

* additional CIF fixes

* completely remove oldcif

* update readme with some examples (#738)

---------

Co-authored-by: Brady Johnston <[email protected]>
Co-authored-by: Brady Johnston <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2025
1 parent ecd852d commit ca52651
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 350 deletions.
325 changes: 0 additions & 325 deletions molecularnodes/entities/molecule/oldcif.py

This file was deleted.

21 changes: 15 additions & 6 deletions molecularnodes/entities/molecule/pdbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import biotite.structure as struc
import biotite.structure.io.pdbx as pdbx
import numpy as np
from biotite import InvalidFileError

from .molecule import Molecule

Expand Down Expand Up @@ -67,13 +68,21 @@ def get_structure(
bonds=True,
model: int | None = None,
):
array = pdbx.get_structure(self.file, model=model, extra_fields=extra_fields)
array = self.set_extra_annotations(array, self.file)

if not array.bonds and bonds:
array.bonds = struc.bonds.connect_via_residue_names(
array, inter_residue=True
try:
array = pdbx.get_structure(
self.file, model=model, extra_fields=extra_fields
)
array = self.set_extra_annotations(array, self.file)
if not array.bonds and bonds:
array.bonds = struc.bonds.connect_via_residue_names(
array, inter_residue=True
)
except InvalidFileError:
array = pdbx.get_component(self.file)
if not array.bonds and bonds:
array.bonds = struc.bonds.connect_via_residue_names(
array, inter_residue=True
)

return array

Expand Down
7 changes: 1 addition & 6 deletions molecularnodes/entities/molecule/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from ...download import FileDownloadPDBError, download, CACHE_DIR
from ...blender import path_resolve
from .oldcif import OldCIF
from .molecule import Molecule
from .pdb import PDB
from .pdbx import BCIF, CIF
Expand Down Expand Up @@ -38,12 +37,8 @@ def parse(filepath) -> Molecule:

if suffix not in parser:
raise ValueError(f"Unable to open local file. Format '{suffix}' not supported.")
try:
molecule = parser[suffix](filepath)
except InvalidFileError:
molecule = OldCIF(filepath)

return molecule
return parser[suffix](filepath)


def fetch(
Expand Down
Loading

0 comments on commit ca52651

Please sign in to comment.