Skip to content
Snippets Groups Projects
Commit 11a209f4 authored by marco's avatar marco
Browse files

more work on documentation

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2359 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 84b467c3
Branches
Tags
No related merge requests found
......@@ -88,7 +88,7 @@ exclude_trees = []
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
modindex_common_prefix = ['ost.']
# -- Options for HTML output ---------------------------------------------------
......
......@@ -82,12 +82,12 @@ to access a property of a different data type, e.g.:
Use of Generic Properties in Queries
--------------------------------------------------------------------------------
The :doc:`query` can also be used for numeric generic properties (i.e. bool,
The :doc:`../mol/base/query` can also be used for numeric generic properties (i.e. bool,
int, float), but the syntax is slightly different. To access any generic
properties, it needs to be specified that they are generic and at which level
they are defined. Therefore, all generic properties start with a 'g', followed
by an 'a', 'r' or 'c' for atom, residue or chain level respectively. For more
details see :doc:`query`.
details see :doc:`../mol/base/query`.
API documentation
......
:mod:`conop` -- Connectivity and Topology of Molecules
:mod:`~ost.conop` -- Connectivity and Topology of Molecules
================================================================================
.. module:: conop
.. module:: ost.conop
:synopsis: The conop modules implement different strategies to derive
connectivity information of molecules.
......
......@@ -114,7 +114,7 @@ the module shared library, a `CMakeLists.txt` file needs to be written for the
The line containing the `DEPENDS_ON` directive lists all the modules on which
the new module depends (in this case :mod:`mol` and :mod:`mol.alg`). The
the new module depends (in this case :mod:`mol` and :mod:`ost.mol.alg`). The
`module` macro will take care of staging the headers, in this case into
`ost/mod` and compiling, linking and staging of a library with the name
`libost_mod.so` (`libost_gmod.dylib` on MacOS X).
......@@ -243,7 +243,7 @@ Here is finally the build script skeleton that needs to be put into
In the last line the call to the 'target\_link\_libraries' function contains the
names of the modules on which the 'mod' unit test code depends (in this case,
the :mod:`mol` and :mod:`mol.alg` modules), in addition to the `mod` module
the :mod:`mol` and :mod:`ost.mol.alg` modules), in addition to the `mod` module
itself.
The Python Wrapper
......
:mod:`ost.geom` -- vectors, matrices and geometrical objects
:mod:`~ost.geom` -- vectors, matrices and geometrical objects
================================================================================
.. module:: ost.geom
......
:mod:`img.alg` - Image Processing Algorithms
:mod:`~ost.img.alg` - Image Processing Algorithms
================================================================================
.. module:: ost.img.alg
:synopsis: Image processing algorithms
Usage of Image Algorithms
--------------------------------------------------------------------------------
Image algorithms are objects. To execute them, the algorithms are applied to an
image by passing it to the :meth:`img.ImageHandle.Apply` or
:meth:`img.ImageHandle.ApplyIP` method:
image by passing it to the :meth:`ost.img.ImageHandle.Apply` or
:meth:`ost.img.ImageHandle.ApplyIP` method:
.. code-block:: python
......
:mod:`img` Images and Density Maps
:mod:`~ost.img` Images and Density Maps
================================================================================
.. module:: mol
:synopsis: Images and Density Maps
.. module:: ost.img
:synopsis: Images and density maps
Introduction : The ImageHandle
--------------------------------------------------------------------------------
......
......@@ -11,7 +11,7 @@ Introduction
:maxdepth: 2
intro
install.rst
install
Modules
--------------------------------------------------------------------------------
......@@ -27,6 +27,7 @@ Modules
mol/base/mol
seq/base/seq
base/base
io/io
Extending OpenStructure
--------------------------------------------------------------------------------
......
:mod:`~ost.io` - Input and Output of Sequences, Structures and Maps
================================================================================
.. module:: ost.io
:synopsis: Input and output of sequences, structures and density maps
The io module deals with input and output of :class:`entities
<ost.mol.EntityHandle>`, :class:`alignments <ost.seq.AlignmentHandle>`, and
:class:`images <ost.img.ImageHandle>`. Importers for common file formats such
as PDB, SDF, FASTA, CLUSTAL W, DX and CHARMM trajectory files are available.
Molecular Structures
--------------------------------------------------------------------------------
Loading Molecular Structures
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The :mod:`~ost.io` modules offers several ways to load molecular structures
depending on your requirements. The most general way is offered by
:func:`~ost.io.LoadEntity`, which will automatically detect the file format based
on the file extension.
.. function:: LoadEntity(filename, format='auto')
Load entity from disk. If format is set to 'auto', the function guesses the
filetype based on the extension of the file. Files ending in '.pdb', '.ent',
'.ent.gz', '.pdb.gz' will automatically be loaded as PDB files, for example.
For files without or exotic extensions, the format can be set explicitly as
the second parameter.
.. code-block:: python
# recognizes SDF file by file extension
ent=io.LoadEntity('file.sdf')
# In this case, there is no file extensions, so you have to say it's a
# SDF file explicitly
ent=io.LoadEntity('file', 'sdf')
For a list of file formats supported by :func:`LoadEntity`, see :doc:`formats`.
:raises: :exc:`~ost.io.IOUnknownFormatException` if the format string supplied
is not recognized or the file format can not be detected based on the
file extension
:exc:`~ost.io.IOException` if the import fails due to an erroneous or
inexistent file
Some of the formats have a dedicated function that allows you to tweak many
parameters that affect the import. PDB files can be loaded with
:func:`~ost.io.LoadPDB`. It offers a tighter control over the exact loading
behaviour.
.. autofunction:: ost.io.LoadPDB
Saving Molecular Structures
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Saving a complete entity or a view is a matter of calling
:func:`~ost.io.SaveEntity`.
.. code-block:: python
ent=io.LoadEntity('protein.pdb')
# save full entity
io.SaveEntity(ent, 'full.pdb')
# only save C-alpha atoms
io.SaveEntity(ent.Select('aname=CA and peptide=true'), 'calpha.pdb')
:func:`~ost.io.SavePDB` provides a simple way to save several entities into one
file:
.. code-block:: python
ent=io.LoadEntity('protein.pdb')
# Save complete entity
io.SavePDB(ent, 'full.pdb')
# Save chain A and chain B separately
io.SavePDB([ent.Select('cname=A'), ent.Select('cname=B')], 'split.pdb')
.. function:: SaveEntity(ent, filename, format='auto')
Save entity to disk. If format is set to 'auto', the function guesses the
filetype based on the file extension, otherwise the supplied format is checked
against the available export plugins.
:param ent: The entity to be saved
:type ent: :class:`~ost.mol.EntityHandle` or :class:`~ost.mol.EntityView`
:param filename: The filename
:type filename: string
:param format: Name of the format
:type format: string
:raises: :exc:`~ost.io.IOUnknownFormatException` if the format string supplied
is not recognized or the file format can not be detected based on the
file extension
.. autofunction:: ost.io.SavePDB
\ No newline at end of file
......@@ -17,29 +17,35 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#------------------------------------------------------------------------------
from _io import *
from ost import mol,conop
from ost import mol, conop
def LoadPDB(filename, restrict_chains="", no_hetatms=False,
fault_tolerant=False, load_multi=False,
join_spread_atom_records=False, calpha_only=False):
"""
Load PDB file from disk.
Load PDB file from disk and returns one or more entities. Several options
allow to customize the exact behaviour of the PDB import.
If restrict_chains is not an empty string, only chains listed in the
string will be imported.
:param restrict_chains: If not an empty string, only chains listed in the
string will be imported.
If fault_tolerant is set to true, the import will succeed, even if the
PDB contains faulty records. The faulty records will be ignored in that
case.
:param fault_tolerant: If True, the import will succeed, even if the
PDB contains faulty records. The faulty records will be ignored and import
continues as if the records haven't been present.
If not_hetatms is set to True, HETATM records will be ignored
:param no_hetatms: If set to True, HETATM records will be ignored
If load_multi is set to true, a list of entities will be returned instead
of only the first.
:param load_multi: If set to True, a list of entities will be returned instead
of only the first. This is useful when dealing with multi-PDB files.
If join_spread_atom_records is set to true, atom records belonging to the
same residue are joined, even if they do not appear sequentially in the PDB
file.
:param join_spread_atom_records: If set to true, atom records belonging to the
same residue are joined, even if they do not appear sequentially in the PDB
file.
:rtype: :class:`~ost.mol.EntityHandle` or a list thereof if `load_multi` is
True.
:raises: :exc:`~ost.io.IOException` if the import fails due to an erroneous or
inexistent file
"""
conop_inst=conop.Conopology.Instance()
builder=conop_inst.GetBuilder("DEFAULT")
......@@ -78,7 +84,13 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=False,
def SavePDB(models, filename):
"""
Save entity or list of entities to disk
Save entity or list of entities to disk. If a list of entities is supplied the
PDB file will be saved as a multi PDB file. Each of the entities is wrapped
into a MODEL/ENDMDL pair.
:param models: The entity or list of entities (handles or views) to be saved
:param filename: The filename
:type filename: string
"""
if not getattr(models, '__len__', None):
models=[models]
......
Editors
================================================================================
.. currentmodule:: mol
.. currentmodule:: ost.mol
The structure, topology and connectivity of entities is edited via editors. This
includes operations such as changing atom positions, connecting atoms with bonds
......@@ -118,7 +118,7 @@ euclidian space.
transform.
:param atom: must be a valid atom handle
:type atom: :class:`mol.AtomHandle`
:type atom: :class:`ost.mol.AtomHandle`
:param pos: The new position
:type pos: :class:`geom.Vec3`
......@@ -129,7 +129,7 @@ euclidian space.
the original pos.
:param atom: must be a valid atom handle
:type atom: :class:`mol.AtomHandle`
:type atom: :class:`ost.mol.AtomHandle`
:param pos: The new untransformed position
:type pos: :class:`geom.Vec3`
......
The Molecular Entity
================================================================================
.. currentmodule:: mol
.. currentmodule:: ost.mol
This document describes the :class:`EntityHandle` and related classes.
......@@ -10,7 +10,7 @@ This document describes the :class:`EntityHandle` and related classes.
Creates a new entity. The created entity is empty, that is, it does not
contain any atoms, residues, chains, bonds or torsions. To populate the
entity, use an :ref:`editor`.
entity, use an :doc:`editors`.
:returns: The newly created :class:`EntityHandle`
......
:mod:`mol` -- Molecular structures and surfaces
:mod:`~ost.mol` -- Molecular structures and surfaces
================================================================================
.. module:: mol
.. module:: ost.mol
:synopsis: Contains classes and functions to deal with molecular structures
and surfaces
......
:mod:`seq` -- Sequences and Alignments
:mod:`~ost.seq` -- Sequences and Alignments
================================================================================
.. module:: seq
.. module:: ost.seq
:synopsis: Contains classes and functions to deal with sequences and
alignments
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment