diff --git a/modules/conop/pymod/export_compound.cc b/modules/conop/pymod/export_compound.cc index 3a9e4e6118867027b04db2bbf3eb3031878c44ed..661fa9db11019c805f6eb8d032aa06d8b50c9990 100644 --- a/modules/conop/pymod/export_compound.cc +++ b/modules/conop/pymod/export_compound.cc @@ -106,7 +106,7 @@ void export_Compound() { .def("GetAtomSpecs", &Compound::GetAtomSpecs, return_value_policy<copy_const_reference>()) .add_property("bond_specs", make_function(&Compound::GetBondSpecs, - return_value_policy<copy_const_reference>())) + return_value_policy<copy_const_reference>())) .add_property("atom_specs", make_function(&Compound::GetAtomSpecs, return_value_policy<copy_const_reference>())) .def("AddAtom", &Compound::AddAtom) @@ -120,6 +120,12 @@ void export_Compound() { &Compound::SetFormula) .add_property("dialect", &Compound::GetDialectAsString, &set_dialect) + .add_property("inchi", + make_function(&Compound::GetInchi, + return_value_policy<copy_const_reference>())) + .add_property("inchi_key", + make_function(&Compound::GetInchiKey, + return_value_policy<copy_const_reference>())) ; class_<AtomSpec>("AtomSpec", no_init) diff --git a/modules/conop/tests/test_compound.py b/modules/conop/tests/test_compound.py index 80e9ac8b6142a7e93c47c210f1935e9df4224905..fd480a54bc95dcb4958d635038ec43dde1c2db7e 100644 --- a/modules/conop/tests/test_compound.py +++ b/modules/conop/tests/test_compound.py @@ -29,6 +29,9 @@ class TestCompound(unittest.TestCase): self.assertEqual(compound.dialect, 'PDB') self.assertEqual(compound.formula, 'C3 H7 N O2') self.assertEqual(compound.chem_class, mol.L_PEPTIDE_LINKING) + self.assertEqual(compound.inchi, + "1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m0/s1") + self.assertEqual(compound.inchi_key, "QNAYBMKLOCPYGJ-REOHCLBHSA-N") if __name__=='__main__':