Hi,

I'd like to bring to python a function that returns a list (or vector?) of RDKit molecules. But I am lost in boost::python.

BOOST_PYTHON_MODULE(pyrogen) {
   def("extract_ligands_from_coords_file", 
coot::extract_ligands_from_coords_file);
}

boost::python::list
coot::extract_ligands_from_coords_file(const std::string &file_name) {

   boost::python::list rdkit_mols_list;
   std::vector<RDKit::ROMol *> mols_vec = my_get_mols(file_name);
   for(unsigned int i=0; i<mols_vec.size(); i++) {
      rdkit_mols_list.append(mols_vec[i]);
   }
   return rdkit_mols_list;
}

When I try to use it:

>>> m = pyrogen.extract_ligands_from_coords_mol('test.pdb')
TypeError: No to_python (by-value) converter found for C++ type: RDKit::ROMol

I am not sure what I should do (instead). At a guess, maybe I need to convert/wrap the mols_vec[i] before using it in append()? Please advise.

Thanks,

Paul.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-devel mailing list
Rdkit-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-devel

Reply via email to