From a5c5c72269d6fcc29c64e09f14230b605589115e Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Sun, 21 Jan 2024 22:09:50 +0100
Subject: [PATCH] mmcif writer: docu update

---
 modules/io/doc/mmcif.rst | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/modules/io/doc/mmcif.rst b/modules/io/doc/mmcif.rst
index 2791add55..b05225f2e 100644
--- a/modules/io/doc/mmcif.rst
+++ b/modules/io/doc/mmcif.rst
@@ -1794,6 +1794,45 @@ The special cases listed above (_atom_site.auth_asym_id,
 _pdbx_poly_seq_scheme.pdb_strand_id, _atom_site.auth_seq_id etc.) are
 treated the same as if *mmcif_conform* was true.
 
+To see it all in action:
+
+.. code-block:: python
+
+  from ost import io
+  
+  ent = io.LoadMMCIF("1a0s", remote=True)
+  
+  writer = io.MMCifWriter()
+  
+  # The MMCifWriter is still object of type StarWriter
+  # I can decorate my mmCIF file with any data I want
+  val = io.StarWriterValue.FromInt(42)
+  data_item = io.StarWriterDataItem("_the", "answer", val)
+  writer.Push(data_item)
+  
+  # pre-define mmCIF entity which is total nonsense
+  entity_info = io.MMCifWriterEntityList()
+  mon_ids = ost.StringList()
+  mon_ids.append("ALA")
+  mon_ids.append("GLU")
+  mon_ids.append("ALA")
+  lib = conop.GetDefaultLib()
+  mmcif_ent = io.MMCifWriterEntity.FromPolymer("polypeptide(L)",
+                                               mon_ids, lib)
+  entity_info.append(mmcif_ent)
+  
+  # The actual relevant part... mmcif_conform can be set to
+  # True, as we loaded from mmCIF file
+  writer.SetStructure(ent, mmcif_conform = True,
+                      entity_info = entity_info)
+  
+  # And write...
+  writer.Write("1a0s", "1a0s.cif.gz")
+  
+  # The written mmCIF file will contain _the.answer and
+  # writes out the mmCIF entity we defined above in 
+  # _entity_poly. However, nothing matches that entity...
+
 .. class:: MMCifWriterEntity
 
   Defines mmCIF entity which will be written in :class:`MMCifWriter`
-- 
GitLab