From 252bfa6549ecc17231b8d927f5f26bba65694cef Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Mon, 18 Dec 2023 16:09:57 +0100
Subject: [PATCH] mmcif writer: rename SetEntity to SetStructure

Avoids confusion with mmCIF entities
---
 modules/io/pymod/export_mmcif_io.cc |  2 +-
 modules/io/src/mol/mmcif_writer.cc  | 36 ++++++++++++++---------------
 modules/io/src/mol/mmcif_writer.hh  |  2 +-
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc
index 59265e130..2cdee1b9b 100644
--- a/modules/io/pymod/export_mmcif_io.cc
+++ b/modules/io/pymod/export_mmcif_io.cc
@@ -77,7 +77,7 @@ void export_mmcif_io()
     ;
 
   class_<MMCifWriter, boost::noncopyable>("MMCifWriter", init<const String&, const IOProfile&>())
-    .def("SetEntity", &MMCifWriter::SetEntity, (arg("ent"), arg("mmcif_conform")=true))
+    .def("SetStructure", &MMCifWriter::SetStructure, (arg("ent"), arg("mmcif_conform")=true))
     .def("Write", &MMCifWriter::Write)
     ;
 
diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc
index 9c0b8ce4d..553692418 100644
--- a/modules/io/src/mol/mmcif_writer.cc
+++ b/modules/io/src/mol/mmcif_writer.cc
@@ -1192,11 +1192,11 @@ namespace {
     }
   }
 
-  void SetEntity_(const ost::mol::EntityHandle& ent,
-                  std::map<String, CompInfo>& comp_infos,
-                  std::vector<EntityInfo>& entity_info,
-                  ost::io::StarLoop* atom_site,
-                  ost::io::StarLoop* pdbx_poly_seq_scheme) {
+  void SetStructure_(const ost::mol::EntityHandle& ent,
+                     std::map<String, CompInfo>& comp_infos,
+                     std::vector<EntityInfo>& entity_info,
+                     ost::io::StarLoop* atom_site,
+                     ost::io::StarLoop* pdbx_poly_seq_scheme) {
     ost::mol::ChainHandleList chain_list = ent.GetChainList();
     for(auto ch: chain_list) {
 
@@ -1218,11 +1218,11 @@ namespace {
     }
   }
 
-  void SetEntitymmCIFify_(const ost::mol::EntityHandle& ent,
-                          std::map<String, CompInfo>& comp_infos,
-                          std::vector<EntityInfo>& entity_info,
-                          ost::io::StarLoop* atom_site,
-                          ost::io::StarLoop* pdbx_poly_seq_scheme) {
+  void SetStructuremmCIFify_(const ost::mol::EntityHandle& ent,
+                             std::map<String, CompInfo>& comp_infos,
+                             std::vector<EntityInfo>& entity_info,
+                             ost::io::StarLoop* atom_site,
+                             ost::io::StarLoop* pdbx_poly_seq_scheme) {
 
     std::vector<std::vector<ost::mol::ResidueHandle> > L_chains; // L_PEPTIDE_LINKING
     std::vector<std::vector<ost::mol::ResidueHandle> > D_chains; // D_PEPTIDE_LINKING
@@ -1532,8 +1532,8 @@ MMCifWriter::~MMCifWriter() {
   }
 }
 
-void MMCifWriter::SetEntity(const ost::mol::EntityHandle& ent,
-                            bool mmcif_conform) {
+void MMCifWriter::SetStructure(const ost::mol::EntityHandle& ent,
+                               bool mmcif_conform) {
 
   // tabula rasa
   if(atom_type_ != NULL) {
@@ -1573,7 +1573,7 @@ void MMCifWriter::SetEntity(const ost::mol::EntityHandle& ent,
   std::map<String, CompInfo> comp_infos;
   std::vector<EntityInfo> entity_info;
 
-  // The SetEntity functions fill CompInfo and EntityInfo, i.e. gather info on
+  // The SetStructure functions fill CompInfo and EntityInfo, i.e. gather info on
   // all unique compounds and entities observed in ent and relate the entities
   // with asym chain names that are directly written to
   // atom_site_/pdbx_poly_seq_scheme_.
@@ -1583,13 +1583,13 @@ void MMCifWriter::SetEntity(const ost::mol::EntityHandle& ent,
     // chain type property set to the chains in ent. If any of the residues in
     // the respective chains is incompatible with the set chain type, an error
     // is thrown.
-    SetEntity_(ent, comp_infos, entity_info,
-               atom_site_, pdbx_poly_seq_scheme_);
+    SetStructure_(ent, comp_infos, entity_info,
+                  atom_site_, pdbx_poly_seq_scheme_);
   } else {
     // rule based splitting of chains into mmCIF conform chains
-    SetEntitymmCIFify_(ent, comp_infos, entity_info,
-                       atom_site_, pdbx_poly_seq_scheme_);
-  }
+    SetStructuremmCIFify_(ent, comp_infos, entity_info,
+                          atom_site_, pdbx_poly_seq_scheme_);
+  } 
   Feed_entity_(entity_, entity_info);
   Feed_struct_asym_(struct_asym_, entity_info);
   Feed_entity_poly_(entity_poly_, entity_info);
diff --git a/modules/io/src/mol/mmcif_writer.hh b/modules/io/src/mol/mmcif_writer.hh
index 0258242e6..262c516be 100644
--- a/modules/io/src/mol/mmcif_writer.hh
+++ b/modules/io/src/mol/mmcif_writer.hh
@@ -36,7 +36,7 @@ public:
 
   virtual ~MMCifWriter();
 
-  void SetEntity(const ost::mol::EntityHandle& ent, bool mmcif_conform=true);
+  void SetStructure(const ost::mol::EntityHandle& ent, bool mmcif_conform=true);
 
 private:
   IOProfile profile_;
-- 
GitLab