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

mmcif writer: allow to pre-define entities in io.SaveMMCIF

parent a855a571
No related branches found
No related tags found
No related merge requests found
...@@ -1956,7 +1956,9 @@ To see it all in action: ...@@ -1956,7 +1956,9 @@ To see it all in action:
(:class:`ost.StringList`) Asym chain names that are assigned to this entity (:class:`ost.StringList`) Asym chain names that are assigned to this entity
.. class:: MMCifWriterEntityList
A list for :class:`MMCifWriterEntity`
.. class:: MMCifWriter .. class:: MMCifWriter
...@@ -1979,11 +1981,11 @@ To see it all in action: ...@@ -1979,11 +1981,11 @@ To see it all in action:
starting point, i.e. chains in *ent* are matched to starting point, i.e. chains in *ent* are matched to
entities in *entity_info*. In case of no match, this entities in *entity_info*. In case of no match, this
list gets extended. Starts from empty list if not given. list gets extended. Starts from empty list if not given.
:type entity_info: :class:`list` of :class:`MMCifWriterEntity` :type entity_info: :class:`MMCifWriterEntityList`
.. method:: GetEntities() .. method:: GetEntities()
Returns :class:`list` of :class:`MMCifWriterEntity`. Useful to check after Returns :class:`MMCifWriterEntityList`. Useful to check after
:func:`SetStructure` has been called. Order in this list defines entity :func:`SetStructure` has been called. Order in this list defines entity
ids in written mmCIF file with zero based indexing. ids in written mmCIF file with zero based indexing.
......
...@@ -457,7 +457,8 @@ def LoadMMCIF(filename, fault_tolerant=None, calpha_only=None, ...@@ -457,7 +457,8 @@ def LoadMMCIF(filename, fault_tolerant=None, calpha_only=None,
raise raise
def SaveMMCIF(ent, filename, data_name="OST_structure", mmcif_conform = True): def SaveMMCIF(ent, filename, data_name="OST_structure", mmcif_conform = True,
entity_info = MMCifWriterEntityList()):
""" """
Save OpenStructure entity in mmCIF format Save OpenStructure entity in mmCIF format
...@@ -477,12 +478,16 @@ def SaveMMCIF(ent, filename, data_name="OST_structure", mmcif_conform = True): ...@@ -477,12 +478,16 @@ def SaveMMCIF(ent, filename, data_name="OST_structure", mmcif_conform = True):
to identify and separate mmCIF entities based on to identify and separate mmCIF entities based on
:class:`ost.mol.ChemClass` of the residues in a chain. :class:`ost.mol.ChemClass` of the residues in a chain.
:type ent: :class:`ost.mol.EntityHandle`/:class:`ost.mol.EntityView` :type ent: :class:`ost.mol.EntityHandle`/:class:`ost.mol.EntityView`
:param entity_info: Advanced usage - passed as *entity_info* parameter to
:func:`MMCifWriter.SetStructure`
:type filename: :class:`str` :type filename: :class:`str`
:type data_name: :class:`str` :type data_name: :class:`str`
:type mmcif_conform: :class:`bool` :type mmcif_conform: :class:`bool`
:type entity_info: :class:`MMCifWriterEntityList`
""" """
writer = MMCifWriter() writer = MMCifWriter()
writer.SetStructure(ent, mmcif_conform = mmcif_conform) writer.SetStructure(ent, mmcif_conform = mmcif_conform,
entity_info = entity_info)
writer.Write(data_name, filename) writer.Write(data_name, filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment