Skip to content

Commit

Permalink
Update libstructure.Structure class documentation.
Browse files Browse the repository at this point in the history
Merge pull request #254
  • Loading branch information
joaomcteixeira authored Oct 27, 2023
2 parents 13538c0 + a89e51c commit 8a6bcf2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ While in version ``0``, minor and patch upgrades converge in the ``patch`` numbe
Changelog
=========

* Update `libstructure.Structure` documentation.

v0.7.8 (2023-10-02)
------------------------------------------------------------

Expand Down
12 changes: 10 additions & 2 deletions src/idpconfgen/libs/libstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,29 @@ class Structure:
----------
data : str, bytes, Path
Raw structural data from PDB/mmCIF formatted files.
If `data` is a path to a file it *must* be a `pathlib.Path`
object. If string or bytes, it must be the raw content of the
input file.
Examples
--------
Opens a PDB file, selects only chain 'A' and saves selection to a file.
>>> s = Structure('1ABC.pdb')
>>> s = Structure(Path('1ABC.pdb'))
>>> s.build()
>>> s.add_filter_chain('A')
>>> s.write_PDB('out.pdb')
Opens a mmCIF file, selects only residues above 50 and saves
selection to a file.
>>> s = Structure('1ABC.cif')
>>> s = Structure(Path('1ABC.cif'))
>>> s.build()
>>> s.add_filter(lambda x: int(x[col_resSeq]) > 50)
>>> s.write_PDB('out.pdb')
>>> with open('1ABC.pdb', 'r') as fin:
>>> lines = fin.read()
>>> s = Structure(lines)
>>> s.build()
"""

__slots__ = [
Expand Down

0 comments on commit 8a6bcf2

Please sign in to comment.