Skip to content

Commit

Permalink
Note that add_structure() works with mmCIF too
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Aug 25, 2023
1 parent d853308 commit 61136c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pyext/src/topology/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
like Molecule.get_atomic_residues() and Molecule.get_non_atomic_residues().
These functions all return Python sets for easy set arithmetic using
& (and), | (or), - (difference)
* Molecule.add_structure() to add structural information from a PDB file.
* Molecule.add_structure() to add structural information from an mmCIF
or PDB file.
* Molecule.add_representation() to create a representation unit - here you
can choose bead resolutions as well as alternate representations like
densities or ideal helices.
Expand Down Expand Up @@ -548,7 +549,7 @@ def add_structure(self, pdb_fn, chain_id, res_range=[],
soft_check=False):
"""Read a structure and store the coordinates.
@return the atomic residues (as a set)
@param pdb_fn The file to read
@param pdb_fn The file to read (in PDB or mmCIF format)
@param chain_id Chain ID to read
@param res_range Add only a specific set of residues from the PDB
file. res_range[0] is the starting and res_range[1]
Expand Down
8 changes: 7 additions & 1 deletion test/test_hierarchy_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
class Tests(IMP.test.TestCase):
def test_hierarchy_construction(self):
"""Test construction of a hierarchy"""
self._test_hierarchy_internal(self.get_input_file_name("mini.pdb"))

def test_hierarchy_construction_mmcif(self):
"""Test construction of a hierarchy using mmCIF inputs"""
self._test_hierarchy_internal(self.get_input_file_name("mini.cif"))

def _test_hierarchy_internal(self, pdbfile):
# input parameter
pdbfile = self.get_input_file_name("mini.pdb")
fastafile = self.get_input_file_name("mini.fasta")

components = ["Rpb1", "Rpb2" ]
Expand All @@ -32,6 +37,7 @@ def test_hierarchy_construction(self):
mol.add_representation(mol.get_non_atomic_residues(),
resolutions=[10])
hier = simo.build()
self.assertEqual(len(IMP.atom.get_leaves(hier)), 12)

ev = IMP.pmi.restraints.stereochemistry.ExcludedVolumeSphere(
included_objects=hier, resolution=10)
Expand Down

0 comments on commit 61136c6

Please sign in to comment.