Skip to content
Snippets Groups Projects
Unverified Commit a270dce7 authored by Xavier Robin's avatar Xavier Robin
Browse files

feat: add a function to save an SDF file directly

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