Skip to content
Snippets Groups Projects
Commit cf6facd1 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

mmcif writer: introduce EntityToMMCifString

parent 7f9090e4
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,18 @@ boost::python::tuple WrapMMCifStringToEntity(const String& mmcif,
std::get<2>(res));
}
String WrapEntityToMMCifStringEnt(const ost::mol::EntityHandle& ent,
const String& data_name,
bool mmcif_conform) {
return EntityToMMCifString(ent, data_name, mmcif_conform);
}
String WrapEntityToMMCifStringView(const ost::mol::EntityView& ent,
const String& data_name,
bool mmcif_conform) {
return EntityToMMCifString(ent, data_name, mmcif_conform);
}
void WrapStarLoopAddData(StarWriterLoop& sl, const boost::python::list& l) {
std::vector<StarWriterValue> v;
for (int i = 0; i < boost::python::len(l); ++i){
......@@ -516,4 +528,12 @@ void export_mmcif_io()
def("MMCifStrToEntity", &WrapMMCifStringToEntity, (arg("pdb_string"),
arg("profile")=IOProfile(),
arg("process")=false));
def("EntityToMMCifString", &WrapEntityToMMCifStringEnt, (arg("ent"),
arg("data_name")="OST_structure",
arg("mmcif_conform")=true));
def("EntityToMMCifString", &WrapEntityToMMCifStringView, (arg("ent"),
arg("data_name")="OST_structure",
arg("mmcif_conform")=true));
}
......@@ -19,9 +19,28 @@
#include <sstream>
#include <ost/io/mol/mmcif_str.hh>
#include <ost/io/mol/mmcif_reader.hh>
#include <ost/io/mmcif_writer.hh>
namespace ost { namespace io {
String EntityToMMCifString(const ost::mol::EntityHandle& ent,
const String& data_name, bool mmcif_conform) {
std::stringstream ss;
MMCifWriter writer;
writer.SetStructure(ent, mmcif_conform);
writer.Write(data_name, ss);
return ss.str();
}
String EntityToMMCifString(const ost::mol::EntityView& ent,
const String& data_name, bool mmcif_conform) {
std::stringstream ss;
MMCifWriter writer;
writer.SetStructure(ent, mmcif_conform);
writer.Write(data_name, ss);
return ss.str();
}
std::tuple<mol::EntityHandle, MMCifInfo, ost::seq::SequenceList>
MMCifStringToEntity(const String& mmcif, const IOProfile& profile, bool process) {
std::stringstream stream(mmcif);
......
......@@ -27,6 +27,14 @@
namespace ost { namespace io {
String DLLEXPORT_OST_IO
EntityToMMCifString(const ost::mol::EntityHandle& ent, const String& data_name,
bool mmcif_conform);
String DLLEXPORT_OST_IO
EntityToMMCifString(const ost::mol::EntityView& ent, const String& data_name,
bool mmcif_conform);
std::tuple<mol::EntityHandle, MMCifInfo, ost::seq::SequenceList> DLLEXPORT_OST_IO
MMCifStringToEntity(const String& mmcif, const IOProfile& profile, bool process);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment