Skip to content

Commit 2315f2a

Browse files
authored
Merge pull request #891 from padix-key/fix-missing-intra-bonds
Fix missing intra-residue bonds in PDBx files
2 parents 028b560 + 7b2f910 commit 2315f2a

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/biotite/database/rcsb/query.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ class FieldQuery(SingleQuery):
218218
Examples
219219
--------
220220
221-
>>> query = FieldQuery("reflns.d_resolution_high", less_or_equal=0.6)
221+
>>> query = FieldQuery("reflns.d_resolution_high", less_or_equal=0.5)
222222
>>> print(sorted(search(query)))
223-
['1EJG', '1I0T', '3NIR', '3P4J', '4JLJ', '5D8V', '5NW3', '7ATG', '7R0H']
223+
['3NIR', '4JLJ', '5D8V', '7R0H']
224224
"""
225225

226226
def __init__(
@@ -731,12 +731,12 @@ def count(query, return_type="entry", group_by=None, content_types=("experimenta
731731
Examples
732732
--------
733733
734-
>>> query = FieldQuery("reflns.d_resolution_high", less_or_equal=0.6)
734+
>>> query = FieldQuery("reflns.d_resolution_high", less_or_equal=0.5)
735735
>>> print(count(query))
736-
9
736+
4
737737
>>> ids = search(query)
738738
>>> print(sorted(ids))
739-
['1EJG', '1I0T', '3NIR', '3P4J', '4JLJ', '5D8V', '5NW3', '7ATG', '7R0H']
739+
['3NIR', '4JLJ', '5D8V', '7R0H']
740740
"""
741741
query_dict = _initialize_query_dict(query, return_type, group_by, content_types)
742742

@@ -853,22 +853,22 @@ def search(
853853
Examples
854854
--------
855855
856-
>>> query = FieldQuery("reflns.d_resolution_high", less_or_equal=0.6)
856+
>>> query = FieldQuery("reflns.d_resolution_high", less_or_equal=0.5)
857857
>>> print(sorted(search(query)))
858-
['1EJG', '1I0T', '3NIR', '3P4J', '4JLJ', '5D8V', '5NW3', '7ATG', '7R0H']
858+
['3NIR', '4JLJ', '5D8V', '7R0H']
859859
>>> print(search(query, sort_by="rcsb_accession_info.initial_release_date"))
860-
['7R0H', '7ATG', '5NW3', '5D8V', '4JLJ', '3P4J', '3NIR', '1I0T', '1EJG']
860+
['7R0H', '5D8V', '4JLJ', '3NIR']
861861
>>> print(search(
862862
... query, range=(1,4), sort_by="rcsb_accession_info.initial_release_date"
863863
... ))
864-
['7ATG', '5NW3', '5D8V']
864+
['5D8V', '4JLJ', '3NIR']
865865
>>> print(sorted(search(query, return_type="polymer_instance")))
866-
['1EJG.A', '1I0T.A', '1I0T.B', '3NIR.A', '3P4J.A', '3P4J.B', '4JLJ.A', '4JLJ.B', '5D8V.A', '5NW3.A', '7ATG.A', '7ATG.B', '7R0H.A']
866+
['3NIR.A', '4JLJ.A', '4JLJ.B', '5D8V.A', '7R0H.A']
867867
>>> print(search(
868868
... query, return_type="polymer_entity", return_groups=True,
869869
... group_by=UniprotGrouping(sort_by="rcsb_accession_info.initial_release_date"),
870870
... ))
871-
{'P24297': ['5NW3_1'], 'P27707': ['4JLJ_1'], 'P80176': ['5D8V_1'], 'O29777': ['7R0H_1'], 'P01542': ['3NIR_1', '1EJG_1']}
871+
{'P27707': ['4JLJ_1'], 'P80176': ['5D8V_1'], 'O29777': ['7R0H_1'], 'P01542': ['3NIR_1']}
872872
"""
873873
query_dict = _initialize_query_dict(query, return_type, group_by, content_types)
874874

src/biotite/structure/io/pdbx/convert.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
filter_highest_occupancy_altloc,
4848
)
4949
from biotite.structure.geometry import centroid
50+
from biotite.structure.info.bonds import bonds_in_residue
5051
from biotite.structure.io.pdbx.bcif import (
5152
BinaryCIFBlock,
5253
BinaryCIFColumn,
@@ -418,6 +419,11 @@ def get_structure(
418419
if "chem_comp_bond" in block:
419420
try:
420421
custom_bond_dict = _parse_intra_residue_bonds(block["chem_comp_bond"])
422+
# For some reason the PDB does not add `chem_comp_bond` entries for
423+
# some residues
424+
# Therefore add the most common missing residues manually
425+
for res_name in ["UNK", "N"]:
426+
custom_bond_dict[res_name] = bonds_in_residue(res_name)
421427
except KeyError:
422428
warnings.warn(
423429
"The 'chem_comp_bond' category has missing columns, "

0 commit comments

Comments
 (0)