From c5331bdb99aa7f84b817524b7f1e0846c81ba85d Mon Sep 17 00:00:00 2001
From: Xavier Robin <xavier.robin@unibas.ch>
Date: Mon, 4 Feb 2019 11:33:41 +0100
Subject: [PATCH] Allow running the Processor with PDBStrToEntity.

---
 modules/io/pymod/export_pdb_io.cc | 4 +++-
 modules/io/src/mol/pdb_str.cc     | 6 +++++-
 modules/io/src/mol/pdb_str.hh     | 3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/io/pymod/export_pdb_io.cc b/modules/io/pymod/export_pdb_io.cc
index 752647f67..6aa26d96f 100644
--- a/modules/io/pymod/export_pdb_io.cc
+++ b/modules/io/pymod/export_pdb_io.cc
@@ -98,7 +98,9 @@ void export_pdb_io()
   def("EntityToPDBStr", pdb_str_b,
       (arg("entity"), arg("profile")=IOProfile()));
 
-  def("PDBStrToEntity", &PDBStringToEntity, (arg("pdb_string"),arg("profile")=IOProfile()));
+  def("PDBStrToEntity", &PDBStringToEntity, (arg("pdb_string"),
+                                             arg("profile")=IOProfile(),
+                                             arg("process")=false));
 
   // we need to make sure there are no pending references to Python objects
   // tied to the IOProfileRegistry singleton. The destructor of 
diff --git a/modules/io/src/mol/pdb_str.cc b/modules/io/src/mol/pdb_str.cc
index 7168dfb16..3884fb268 100644
--- a/modules/io/src/mol/pdb_str.cc
+++ b/modules/io/src/mol/pdb_str.cc
@@ -37,11 +37,15 @@ String EntityToPDBString(const mol::EntityView& ent, const IOProfile& profile) {
   return stream.str();
 }
 
-mol::EntityHandle PDBStringToEntity(const String& pdb, const IOProfile& profile) {
+mol::EntityHandle PDBStringToEntity(const String& pdb, const IOProfile& profile,
+                                    bool process) {
   std::stringstream stream(pdb);
   PDBReader reader(stream, profile);
   mol::EntityHandle ent = mol::CreateEntity();
   reader.Import(ent);
+  if(profile.processor && process) {
+    profile.processor->Process(ent);
+  }
   return ent;
 }
 
diff --git a/modules/io/src/mol/pdb_str.hh b/modules/io/src/mol/pdb_str.hh
index d376dce59..a2f070850 100644
--- a/modules/io/src/mol/pdb_str.hh
+++ b/modules/io/src/mol/pdb_str.hh
@@ -34,7 +34,8 @@ String DLLEXPORT_OST_IO
 EntityToPDBString(const mol::EntityView& ent, const IOProfile& profile=IOProfile());
 
 mol::EntityHandle DLLEXPORT_OST_IO
-PDBStringToEntity(const String& pdb, const IOProfile& profile=IOProfile());
+PDBStringToEntity(const String& pdb, const IOProfile& profile=IOProfile(),
+                  bool process=false);
 
 }}
 
-- 
GitLab