Skip to content
Snippets Groups Projects
Commit f950e5a7 authored by Bienchen's avatar Bienchen
Browse files

Exported InChI from compoundslib to Python

parent 5b0e6de4
Branches
Tags
No related merge requests found
......@@ -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)
......
......@@ -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__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment