Skip to content

Commit

Permalink
Support input files in mmCIF format for rrt
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Aug 22, 2024
1 parent 2479ea9 commit 28a6fd9
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 15 deletions.
12 changes: 6 additions & 6 deletions modules/kinematics/bin/rrt_ccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <IMP/core/SphereDistancePairScore.h>

#include <IMP/atom/pdb.h>
#include <IMP/atom/mmcif.h>
#include <IMP/atom/dihedrals.h>
#include <IMP/atom/Hierarchy.h>
#include <IMP/atom/CHARMMParameters.h>
Expand Down Expand Up @@ -115,12 +115,12 @@ int main(int argc, char **argv)

// read in the input protein
IMP::Pointer<IMP::Model> model = new IMP::Model();
std::cerr << "Starting reading pdb file " << pdb_name << std::endl;
std::cerr << "Starting reading PDB or mmCIF file " << pdb_name << std::endl;
IMP::atom::Hierarchy mhd =
IMP::atom::read_pdb(pdb_name, model,
new IMP::atom::NonWaterNonHydrogenPDBSelector(),
// don't add radii
true, true);
IMP::atom::read_pdb_or_mmcif(
pdb_name, model, new IMP::atom::NonWaterNonHydrogenPDBSelector(),
// don't add radii
true, true);

IMP::ParticlesTemp atoms = IMP::atom::get_by_type(mhd, IMP::atom::ATOM_TYPE);
IMP::ParticlesTemp residues = IMP::atom::get_by_type(mhd, IMP::atom::RESIDUE_TYPE);
Expand Down
12 changes: 6 additions & 6 deletions modules/kinematics/bin/rrt_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <IMP/core/SphereDistancePairScore.h>

#include <IMP/atom/pdb.h>
#include <IMP/atom/mmcif.h>
#include <IMP/atom/Hierarchy.h>
#include <IMP/atom/CHARMMParameters.h>
#include <IMP/atom/CHARMMStereochemistryRestraint.h>
Expand Down Expand Up @@ -113,12 +113,12 @@ int rrt_sample(int argc, char **argv)

// read in the input protein
IMP::Pointer<IMP::Model> model = new IMP::Model();
std::cerr << "Starting reading pdb file " << pdb_name << std::endl;
std::cerr << "Starting reading PDB or mmCIF file " << pdb_name << std::endl;
IMP::atom::Hierarchy mhd =
IMP::atom::read_pdb(pdb_name, model,
new IMP::atom::NonWaterNonHydrogenPDBSelector(),
// don't add radii
true, true);
IMP::atom::read_pdb_or_mmcif(
pdb_name, model, new IMP::atom::NonWaterNonHydrogenPDBSelector(),
// don't add radii
true, true);

IMP::ParticlesTemp atoms = IMP::atom::get_by_type(mhd, IMP::atom::ATOM_TYPE);
IMP::ParticlesTemp residues = IMP::atom::get_by_type(mhd, IMP::atom::RESIDUE_TYPE);
Expand Down
46 changes: 46 additions & 0 deletions modules/kinematics/test/input/three.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
loop_
_atom_site.group_PDB
_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.auth_asym_id
_atom_site.label_seq_id
_atom_site.auth_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.label_entity_id
_atom_site.id
_atom_site.pdbx_PDB_model_num
ATOM N N . LYS A A 1 1 ? 3.287 10.092 10.329 1.000 5.890 1 1 1
ATOM C CA . LYS A A 1 1 ? 2.445 10.457 9.182 1.000 8.160 1 2 1
ATOM C C . LYS A A 1 1 ? 2.500 11.978 9.038 1.000 8.040 1 3 1
ATOM O O . LYS A A 1 1 ? 2.588 12.719 10.041 1.000 7.070 1 4 1
ATOM C CB . LYS A A 1 1 ? 1.006 9.995 9.385 1.000 3.880 1 5 1
ATOM C CG . LYS A A 1 1 ? 0.016 10.546 8.377 1.000 3.810 1 6 1
ATOM C CD . LYS A A 1 1 ? -1.404 10.093 8.699 1.000 2.910 1 7 1
ATOM C CE . LYS A A 1 1 ? -2.269 10.030 7.451 1.000 3.970 1 8 1
ATOM N NZ . LYS A A 1 1 ? -3.559 9.362 7.735 1.000 2.080 1 9 1
ATOM N N . VAL A A 2 2 ? 2.441 12.404 7.789 1.000 8.750 1 10 1
ATOM C CA . VAL A A 2 2 ? 2.396 13.826 7.425 1.000 9.160 1 11 1
ATOM C C . VAL A A 2 2 ? 1.003 14.071 6.846 1.000 6.430 1 12 1
ATOM O O . VAL A A 2 2 ? 0.719 13.722 5.679 1.000 4.910 1 13 1
ATOM C CB . VAL A A 2 2 ? 3.509 14.142 6.435 1.000 7.060 1 14 1
ATOM C CG1 . VAL A A 2 2 ? 3.490 15.586 5.874 1.000 6.530 1 15 1
ATOM C CG2 . VAL A A 2 2 ? 4.864 13.746 6.959 1.000 6.530 1 16 1
ATOM N N . PHE A A 3 3 ? 0.170 14.674 7.679 1.000 4.250 1 17 1
ATOM C CA . PHE A A 3 3 ? -1.200 15.052 7.311 1.000 7.490 1 18 1
ATOM C C . PHE A A 3 3 ? -1.320 16.157 6.264 1.000 9.110 1 19 1
ATOM O O . PHE A A 3 3 ? -0.422 17.016 6.128 1.000 9.900 1 20 1
ATOM C CB . PHE A A 3 3 ? -1.944 15.502 8.553 1.000 6.650 1 21 1
ATOM C CG . PHE A A 3 3 ? -2.576 14.509 9.484 1.000 6.920 1 22 1
ATOM C CD1 . PHE A A 3 3 ? -3.879 14.182 9.312 1.000 5.760 1 23 1
ATOM C CD2 . PHE A A 3 3 ? -1.854 13.862 10.454 1.000 5.120 1 24 1
ATOM C CE1 . PHE A A 3 3 ? -4.533 13.235 10.153 1.000 6.100 1 25 1
ATOM C CE2 . PHE A A 3 3 ? -2.511 12.876 11.267 1.000 7.790 1 26 1
ATOM C CZ . PHE A A 3 3 ? -3.823 12.611 11.125 1.000 6.200 1 27 1
13 changes: 10 additions & 3 deletions modules/kinematics/test/test_rrt_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@

class Tests(IMP.test.ApplicationTestCase):

def test_simple(self):
"""Simple test of rrt_sample application"""
def test_simple_pdb(self):
"""Simple test of rrt_sample application, PDB format"""
return self._test_simple('three.pdb')

def test_simple_mmcif(self):
"""Simple test of rrt_sample application, mmCIF format"""
return self._test_simple('three.cif')

def _test_simple(self, infile):
p = self.run_application('rrt_sample',
[self.get_input_file_name('three.pdb'),
[self.get_input_file_name(infile),
self.get_input_file_name('hinges.txt'),
'-n', '1'])
out, err = p.communicate()
Expand Down

0 comments on commit 28a6fd9

Please sign in to comment.