Skip to content

Commit

Permalink
Test adding files containing nonpolymers
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Feb 13, 2024
1 parent 3f6543b commit 51e1a4f
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 0 deletions.
82 changes: 82 additions & 0 deletions test/input/mini_nonpoly.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
data_model
_entry.id model
_struct.entry_id model
_struct.pdbx_model_details .
_struct.pdbx_structure_determination_methodology integrative
_struct.title .
_audit_conform.dict_location https://raw.githubusercontent.com/ihmwg/IHM-dictionary/9be59e1/ihm-extension.dic
_audit_conform.dict_name ihm-extension.dic
_audit_conform.dict_version 1.24
#
loop_
_chem_comp.id
_chem_comp.type
_chem_comp.name
_chem_comp.formula
_chem_comp.formula_weight
HEM non-polymer 'PROTOPORPHYRIN IX CONTAINING FE' 'C34 H32 Fe N4 O4' 616.499
#
#
loop_
_entity.id
_entity.type
_entity.src_method
_entity.pdbx_description
_entity.formula_weight
_entity.pdbx_number_of_molecules
_entity.details
1 non-polymer man Heme 616.499 2 .
#
#
loop_
_pdbx_entity_nonpoly.entity_id
_pdbx_entity_nonpoly.name
_pdbx_entity_nonpoly.comp_id
1 Heme HEM
#
#
loop_
_struct_asym.id
_struct_asym.entity_id
_struct_asym.details
A 1 'First heme'
B 1 'Second heme'
#
#
loop_
_pdbx_nonpoly_scheme.asym_id
_pdbx_nonpoly_scheme.entity_id
_pdbx_nonpoly_scheme.mon_id
_pdbx_nonpoly_scheme.ndb_seq_num
_pdbx_nonpoly_scheme.pdb_seq_num
_pdbx_nonpoly_scheme.auth_seq_num
_pdbx_nonpoly_scheme.auth_mon_id
_pdbx_nonpoly_scheme.pdb_strand_id
_pdbx_nonpoly_scheme.pdb_ins_code
A 1 HEM 1 100 100 HEM A .
B 1 HEM 1 200 200 HEM B .
#
#
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_seq_id
_atom_site.auth_seq_id
_atom_site.pdbx_PDB_ins_code
_atom_site.label_asym_id
_atom_site.Cartn_x
_atom_site.Cartn_y
_atom_site.Cartn_z
_atom_site.occupancy
_atom_site.label_entity_id
_atom_site.auth_asym_id
_atom_site.auth_comp_id
_atom_site.B_iso_or_equiv
_atom_site.pdbx_PDB_model_num
_atom_site.ihm_model_id
HETATM 1 FE FE . HEM . 100 ? A 0 0 0 . 1 A HEM . 1 1
HETATM 2 FE FE . HEM . 200 ? B 10.000 10.000 10.000 . 1 B HEM . 1 1
82 changes: 82 additions & 0 deletions test/input/mini_nonpoly_add.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
data_model
_entry.id model
_struct.entry_id model
_struct.pdbx_model_details .
_struct.pdbx_structure_determination_methodology integrative
_struct.title .
_audit_conform.dict_location https://raw.githubusercontent.com/ihmwg/IHM-dictionary/9be59e1/ihm-extension.dic
_audit_conform.dict_name ihm-extension.dic
_audit_conform.dict_version 1.24
#
loop_
_chem_comp.id
_chem_comp.type
_chem_comp.name
_chem_comp.formula
_chem_comp.formula_weight
HEM non-polymer 'PROTOPORPHYRIN IX CONTAINING FE' 'C34 H32 Fe N4 O4' 616.499
#
#
loop_
_entity.id
_entity.type
_entity.src_method
_entity.pdbx_description
_entity.formula_weight
_entity.pdbx_number_of_molecules
_entity.details
1 non-polymer man Heme 616.499 2 .
#
#
loop_
_pdbx_entity_nonpoly.entity_id
_pdbx_entity_nonpoly.name
_pdbx_entity_nonpoly.comp_id
1 Heme HEM
#
#
loop_
_struct_asym.id
_struct_asym.entity_id
_struct_asym.details
A 1 'First heme'
B 1 'Second heme'
#
#
loop_
_pdbx_nonpoly_scheme.asym_id
_pdbx_nonpoly_scheme.entity_id
_pdbx_nonpoly_scheme.mon_id
_pdbx_nonpoly_scheme.ndb_seq_num
_pdbx_nonpoly_scheme.pdb_seq_num
_pdbx_nonpoly_scheme.auth_seq_num
_pdbx_nonpoly_scheme.auth_mon_id
_pdbx_nonpoly_scheme.pdb_strand_id
_pdbx_nonpoly_scheme.pdb_ins_code
A 1 HEM 1 100 100 HEM A .
B 1 HEM 1 800 800 HEM B .
#
#
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_seq_id
_atom_site.auth_seq_id
_atom_site.pdbx_PDB_ins_code
_atom_site.label_asym_id
_atom_site.Cartn_x
_atom_site.Cartn_y
_atom_site.Cartn_z
_atom_site.occupancy
_atom_site.label_entity_id
_atom_site.auth_asym_id
_atom_site.auth_comp_id
_atom_site.B_iso_or_equiv
_atom_site.pdbx_PDB_model_num
_atom_site.ihm_model_id
HETATM 1 FE FE . HEM . 100 ? A 0 0 0 . 1 A HEM . 1 1
HETATM 2 FE FE . HEM . 800 ? B 10.000 10.000 10.000 . 1 B HEM . 1 1
45 changes: 45 additions & 0 deletions test/test_make_mmcif.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,51 @@ def test_add_polymers(self):
self.assertEqual(s.title, 'Auto-generated system')
os.unlink('output.cif')

@unittest.skipIf(sys.version_info[0] < 3, "make-mmcif.py needs Python 3")
def test_add_non_polymers(self):
"""Check that make-mmcif combines non-polymer information"""
# mini_nonpoly.cif contains two hemes A, B
incif = utils.get_input_file_name(TOPDIR, 'mini_nonpoly.cif')
# mini_nonpoly_add.cif also contains A, B; A has the same author
# provided residue number as mini_nonpoly.cif but B is different
# (so should be renamed C when we add)
addcif = utils.get_input_file_name(TOPDIR, 'mini_nonpoly_add.cif')
subprocess.check_call([sys.executable, MAKE_MMCIF, incif,
'--add', addcif])
with open('output.cif') as fh:
s, = ihm.reader.read(fh)
self.assertEqual(len(s.entities), 1)
self.assertEqual(len(s.asym_units), 3)
self.assertEqual(len(s.state_groups), 2)
# Model from mini_nonpoly.cif
self.assertEqual(len(s.state_groups[0]), 1)
self.assertEqual(len(s.state_groups[0][0]), 1)
self.assertEqual(len(s.state_groups[0][0][0]), 1)
m = s.state_groups[0][0][0][0]
self.assertEqual(m.protocol.name, 'modeling')
self.assertEqual(m.assembly.name, 'Modeled assembly')
chain_a, chain_b, = m.representation
self.assertIs(chain_a.asym_unit, s.asym_units[0])
self.assertIs(chain_b.asym_unit, s.asym_units[1])
for chain in chain_a, chain_b:
self.assertIsInstance(chain, ihm.representation.AtomicSegment)
self.assertFalse(chain.rigid)
# Model from mini_nonpoly_add.cif
self.assertEqual(len(s.state_groups[1]), 1)
self.assertEqual(len(s.state_groups[1][0]), 1)
self.assertEqual(len(s.state_groups[1][0][0]), 1)
m = s.state_groups[1][0][0][0]
self.assertEqual(m.protocol.name, 'modeling')
self.assertEqual(m.assembly.name, 'Modeled assembly')
chain_a, chain_c, = m.representation
self.assertIs(chain_a.asym_unit, s.asym_units[0])
self.assertIs(chain_c.asym_unit, s.asym_units[2])
for chain in chain_a, chain_c:
self.assertIsInstance(chain, ihm.representation.AtomicSegment)
self.assertFalse(chain.rigid)
self.assertEqual(s.title, 'Auto-generated system')
os.unlink('output.cif')


if __name__ == '__main__':
unittest.main()

0 comments on commit 51e1a4f

Please sign in to comment.