diff --git a/modules/io/pymod/wrap_io.cc b/modules/io/pymod/wrap_io.cc index 0731751124b73221c44440191147c2b101276389..bae73b1e0fd9168c7673fc39da52ce678d6878d9 100644 --- a/modules/io/pymod/wrap_io.cc +++ b/modules/io/pymod/wrap_io.cc @@ -69,6 +69,9 @@ ost::mol::alg::StereoChemicalProps (*read_props_b)(bool check) = &ReadStereoChem String (*sdf_str_a)(const mol::EntityHandle&)=&EntityToSDFString; String (*sdf_str_b)(const mol::EntityView&)=&EntityToSDFString; +void (*save_sdf_handle)(const mol::EntityHandle& entity, const String& filename)=&SaveSDF; +void (*save_sdf_view)(const mol::EntityView& entity, const String& filename)=&SaveSDF; + } void export_pdb_io(); @@ -120,6 +123,8 @@ BOOST_PYTHON_MODULE(_ost_io) def("SaveSequence", &SaveSequence, (arg("sequence"), arg("filename"), arg("format")="auto")); def("LoadSDF", &LoadSDF); + def("SaveSDF", save_sdf_view); + def("SaveSDF", save_sdf_handle); def("EntityToSDFStr", sdf_str_a); def("EntityToSDFStr", sdf_str_b); diff --git a/modules/io/src/mol/entity_io_sdf_handler.cc b/modules/io/src/mol/entity_io_sdf_handler.cc index a843d986c1ee676ef6c0265d24036a189ba970c1..129ce2c86be7a7ec56e1cbee52488a231411067a 100644 --- a/modules/io/src/mol/entity_io_sdf_handler.cc +++ b/modules/io/src/mol/entity_io_sdf_handler.cc @@ -103,5 +103,15 @@ mol::EntityHandle LoadSDF(const String& file_name) { return ent_handle; } +void SaveSDF(const mol::EntityHandle& ent, const String& file_name) { + SDFWriter writer(file_name); + writer.Write(ent); +} + +void SaveSDF(const mol::EntityView& ent, const String& file_name) { + SDFWriter writer(file_name); + writer.Write(ent); +} + }} // ns diff --git a/modules/io/src/mol/entity_io_sdf_handler.hh b/modules/io/src/mol/entity_io_sdf_handler.hh index d5b4aef15d2a3b241f605685303a2487c30cee42..1dc593ec5e820231fb41e568ea893fbb09b8c484 100644 --- a/modules/io/src/mol/entity_io_sdf_handler.hh +++ b/modules/io/src/mol/entity_io_sdf_handler.hh @@ -49,6 +49,8 @@ public: typedef EntityIOHandlerFactory<EntityIOSDFHandler> EntityIOSDFHandlerFactory; mol::EntityHandle DLLEXPORT_OST_IO LoadSDF(const String& file_name); +void DLLEXPORT_OST_IO SaveSDF(const mol::EntityHandle& ent, const String& file_name); +void DLLEXPORT_OST_IO SaveSDF(const mol::EntityView& ent, const String& file_name); }} // ns