From 28a6fd9c98e69f769b62c3e2e2fa728dad142c7d Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Wed, 21 Aug 2024 17:37:12 -0700 Subject: [PATCH] Support input files in mmCIF format for rrt --- modules/kinematics/bin/rrt_ccd.cpp | 12 +++--- modules/kinematics/bin/rrt_sample.cpp | 12 +++--- modules/kinematics/test/input/three.cif | 46 ++++++++++++++++++++++ modules/kinematics/test/test_rrt_sample.py | 13 ++++-- 4 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 modules/kinematics/test/input/three.cif diff --git a/modules/kinematics/bin/rrt_ccd.cpp b/modules/kinematics/bin/rrt_ccd.cpp index 76df20e362..1250ff2a9a 100644 --- a/modules/kinematics/bin/rrt_ccd.cpp +++ b/modules/kinematics/bin/rrt_ccd.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include #include @@ -115,12 +115,12 @@ int main(int argc, char **argv) // read in the input protein IMP::Pointer 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); diff --git a/modules/kinematics/bin/rrt_sample.cpp b/modules/kinematics/bin/rrt_sample.cpp index 58a4602272..7e9f211a1e 100644 --- a/modules/kinematics/bin/rrt_sample.cpp +++ b/modules/kinematics/bin/rrt_sample.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include #include @@ -113,12 +113,12 @@ int rrt_sample(int argc, char **argv) // read in the input protein IMP::Pointer 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); diff --git a/modules/kinematics/test/input/three.cif b/modules/kinematics/test/input/three.cif new file mode 100644 index 0000000000..18be9d2859 --- /dev/null +++ b/modules/kinematics/test/input/three.cif @@ -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 diff --git a/modules/kinematics/test/test_rrt_sample.py b/modules/kinematics/test/test_rrt_sample.py index 630c464bb7..c6d7486f69 100644 --- a/modules/kinematics/test/test_rrt_sample.py +++ b/modules/kinematics/test/test_rrt_sample.py @@ -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()