Skip to content

Commit

Permalink
better iotbx.pdb fix - preserves the ANISOUs
Browse files Browse the repository at this point in the history
  • Loading branch information
natechols committed Apr 28, 2024
1 parent 15e2fa3 commit 029bcf9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/qfit/structure/pdbfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import defaultdict, namedtuple
import itertools as itl
import itertools
from math import inf
import logging

Expand Down Expand Up @@ -156,10 +156,10 @@ def load_combined_atoms(*atom_lists):


def load_atoms_from_labels(atom_labels):
atom_lines = [atom.format_atom_record_group().split('\n')[0]
for atom in atom_labels]
atom_lines = itertools.chain(*[atom.format_atom_record_group().split('\n')
for atom in atom_labels])
return iotbx.pdb.pdb_input(source_info="qfit_structure",
lines=atom_lines)
lines=list(atom_lines))


def write_mmcif(fname, structure):
Expand Down Expand Up @@ -250,7 +250,7 @@ def format_line(cls, values):
)

# Intersperse formatted values with spaces
line = itl.zip_longest(formatted_values, spaces, fillvalue="")
line = itertools.zip_longest(formatted_values, spaces, fillvalue="")
line = "".join(flatten(line)) + "\n"
return line

Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ def test_structure_extract_io_recycling(self):
s2.tofile(pdb_tmp)
s3 = Structure.fromfile(pdb_tmp)
assert len(list(s3.single_conformer_residues)) == 2
# sanity check for presence of ANISOUs
PDB2 = op.join(self.DATA, "..", "qfit_ligand_test", "5AGK.pdb")
s4 = Structure.fromfile(PDB2)
s5 = s4.combine(s3)
xrs = s5.to_xray_structure()

def test_structure_pickle(self):
PDB = op.join(self.DATA, "4ms6_tiny.pdb.gz")
Expand Down

0 comments on commit 029bcf9

Please sign in to comment.