Skip to content

Commit

Permalink
Mention 'compress()' in the tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed Oct 16, 2024
1 parent 5f362d7 commit 064c8af
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/tutorial/structure/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,21 @@ A well chosen encoding can reduce the file size significantly.
).serialize()
)

As finding good encodings manually can be tedious, :func:`compress()` does this
automatically - from a single :class:`BinaryCIFData` to an entire
:class:`BinaryCIFFile`.

.. jupyter-execute::

uncompressed_data = pdbx.BinaryCIFData(np.arange(100))
print(f"Uncompressed size: {len(uncompressed_data.serialize()["data"])} bytes")
compressed_data = pdbx.compress(uncompressed_data)
print(f"Compressed size: {len(compressed_data.serialize()["data"])} bytes")


Using structures from a PDBx file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

While this low-level API is useful for using the entire potential of
the PDBx format, most applications require only reading/writing a
structure.
Expand Down

0 comments on commit 064c8af

Please sign in to comment.