Skip to content

Commit

Permalink
Check that longer alt_locs are OK in mmCIF
Browse files Browse the repository at this point in the history
The alternate location indicator used to be
truncated to a single character, as in legacy
PDB format. Check that multi-character indicators
are now handled correctly in mmCIF.
  • Loading branch information
benmwebb committed Sep 28, 2023
1 parent 584c028 commit dd96e8e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
28 changes: 28 additions & 0 deletions modules/atom/test/input/nonalttest.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
loop_
_atom_site.group_PDB
_atom_site.id
_atom_site.type_symbol
_atom_site.label_atom_id
_atom_site.label_alt_id
_atom_site.label_comp_id
_atom_site.label_asym_id
_atom_site.label_entity_id
_atom_site.label_seq_id
_atom_site.pdbx_PDB_ins_code
_atom_site.Cartn_x
_atom_site.Cartn_y
_atom_site.Cartn_z
_atom_site.occupancy
_atom_site.B_iso_or_equiv
_atom_site.pdbx_formal_charge
_atom_site.auth_seq_id
_atom_site.auth_comp_id
_atom_site.auth_asym_id
_atom_site.auth_atom_id
_atom_site.pdbx_PDB_model_num
ATOM 1 C CA . ALA A 1 1 ? 953.312 704.510 700.259 1.00 84.31 ? 1 ALA A CA 1
ATOM 2 C CA A GLN A 1 2 ? 862.521 620.909 612.377 1.00 10.00 ? 2 GLN A CA 1
ATOM 3 C CA B GLN A 1 3 ? 862.521 620.909 612.377 1.00 10.00 ? 3 GLN A CA 1
ATOM 4 C CA AA ALA A 1 4 ? 953.312 704.510 700.259 1.00 84.31 ? 4 ALA A CA 1
ATOM 5 C CA . GLN A 1 5 ? 862.521 620.909 612.377 1.00 10.00 ? 5 GLN A CA 1
ATOM 6 C CA . GLN A 1 6 ? 862.521 620.909 612.377 1.00 10.00 ? 6 GLN A CA 1
15 changes: 15 additions & 0 deletions modules/atom/test/test_mmcif.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ def test_multiple_ligands_no_auth(self):
for x in residues],
['LYS', 'CA', '7ZTVU', '7ZTVU'])

def test_non_alt_selector(self):
"""Check NonAlternativePDBSelector when reading mmCIF files"""
m = IMP.Model()

mp = IMP.atom.read_mmcif(self.get_input_file_name('nonalttest.cif'), m,
IMP.atom.NonAlternativePDBSelector())
residues = IMP.atom.get_by_type(mp, IMP.atom.RESIDUE_TYPE)
# Residue #3 should be rejected because its alt_loc is "B" (only
# blank or "A" alt_loc should be accepted)
# Residue #4 should be rejected because alt_loc is "AA". Previous
# versions of IMP would pass this because it would be truncated to
# one character, "A".
self.assertEqual([IMP.atom.Residue(x).get_index() for x in residues],
[1, 2, 5, 6])

def test_chain_selector(self):
"""Check reading single chain from an mmCIF file"""
m = IMP.Model()
Expand Down

0 comments on commit dd96e8e

Please sign in to comment.