diff --git a/modules/mol/alg/doc/molalg.rst b/modules/mol/alg/doc/molalg.rst index c31c9ffc6d441d8ad735577219aa19b0e7ba8101..a5796db6aad75b0cf6b4ddd8328a50c460b98ded 100644 --- a/modules/mol/alg/doc/molalg.rst +++ b/modules/mol/alg/doc/molalg.rst @@ -873,5 +873,9 @@ used to skip frames in the analysis. .. automodule:: ost.mol.alg.trajectory_analysis :members: +:mod:`mol.alg.structure_analysis <ost.mol.alg.trajectory_analysis>` -- Functions to analyze structures +============================================================================================================= +.. automodule:: ost.mol.alg.structure_analysis + :members: diff --git a/modules/mol/alg/pymod/structure_analysis.py b/modules/mol/alg/pymod/structure_analysis.py index a9f600bca0a16ea181e2f9780c085208d7b8a7d6..4a2cb0dae47a4717a34127a628306aec6e9fcb8b 100644 --- a/modules/mol/alg/pymod/structure_analysis.py +++ b/modules/mol/alg/pymod/structure_analysis.py @@ -1,27 +1,33 @@ """ -Some functions for analyzing trajectories +Some functions for analyzing structures -Author: Niklaus Johner +Author: Niklaus Johner (Niklaus.Johner@unibas.ch) """ - import os import ost def GetFrameFromEntity(eh): """ This function returns a CoordFrame from an EntityHandle - Input: - eh : EntityHandle + + :param eh: + :type eh: :class:`~ost.mol.EntityHandle` + + :return: :class:`ost.mol.CoordFrame` """ return ost.mol.CreateCoordFrame(eh.GetAtomPosList(ordered_by_index=True)) def GetDistanceBetwCenterOfMass(sele1,sele2): """ This function calculates the distance between the centers of mass - of sele1 and sele2, two selections from the same Entity. - Input: - sele1 : EntityView - sele2 : EntityView + of **sele1** and **sele2**, two selections from the same Entity. + + :param sele1: + :param sele2: + :type sele1: :class:`~ost.mol.EntityView` + :type sele2: :class:`~ost.mol.EntityView` + + :return: :class:`float` """ if not sele1.IsValid() and sele2.IsValid(): print 'invalid view' @@ -36,10 +42,14 @@ def GetDistanceBetwCenterOfMass(sele1,sele2): def GetMinDistanceBetweenViews(sele1,sele2): """ This function calculates the minimal distance between - sele1 and sele2, two selections from the same Entity. - Input: - sele1 : EntityView - sele2 : EntityView + **sele1** and **sele2**, two selections from the same Entity. + + :param sele1: + :param sele2: + :type sele1: :class:`~ost.mol.EntityView` + :type sele2: :class:`~ost.mol.EntityView` + + :return: :class:`float` """ if not sele1.IsValid() and sele2.IsValid(): print 'invalid view' @@ -53,11 +63,15 @@ def GetMinDistanceBetweenViews(sele1,sele2): def GetMinDistBetwCenterOfMassAndView(sele1,sele2): """ - This function calculates the minimal distance between sele2 and - the center of mass of sele1, two selections from the same Entity. - Input: - sele1 : EntityView from which the center of mass is taken - sele2 : EntityView + This function calculates the minimal distance between **sele2** and + the center of mass of **sele1**, two selections from the same Entity. + + :param sele1: The selection from which the center of mass is taken + :param sele2: + :type sele1: :class:`~ost.mol.EntityView` + :type sele2: :class:`~ost.mol.EntityView` + + :return: distance (\ :class:`float`\ ) """ if not sele1.IsValid() and sele2.IsValid(): print 'invalid view' @@ -74,8 +88,11 @@ def GetAlphaHelixContent(sele1): """ This function calculates the content of alpha helix in a view. All residues in the view have to ordered and adjacent (no gaps allowed) - Input: - sele1 : EntityView + + :param sele1: + :type sele1: :class:`~ost.mol.EntityView` + + :return: :class:`float` """ if not sele1.IsValid(): print 'invalid view' @@ -87,10 +104,12 @@ def GetAlphaHelixContent(sele1): def CalculateBestFitLine(sele1): """ - This function calculates the best fit line to the atoms in sele1. - Input: - sele1 : EntityView - It returns a geom::Line3 + This function calculates the best fit line to the atoms in **sele1**. + + :param sele1: + :type sele1: :class:`~ost.mol.EntityView` + + :return: :class:`~ost.geom.Line3` """ if not sele1.IsValid(): print 'invalid view' @@ -101,10 +120,12 @@ def CalculateBestFitLine(sele1): def CalculateBestFitPlane(sele1): """ - This function calculates the best fit plane to the atoms in sele1. - Input: - sele1 : EntityView - It returns a geom::Plane + This function calculates the best fit plane to the atoms in **sele1**. + + :param sele1: + :type sele1: :class:`~ost.mol.EntityView` + + :return: :class:`~ost.geom.Plane` """ if not sele1.IsValid(): print 'invalid view' @@ -115,12 +136,14 @@ def CalculateBestFitPlane(sele1): def CalculateHelixAxis(sele1): """ - This function calculates the best fit cylinder to the CA atoms in sele1, - and returns its axis as a Line3. residues should be ordered correctly - in the EntityView. - Input: - sele1 : EntityView - It returns a geom::Line3 + This function calculates the best fit cylinder to the CA atoms in **sele1**, + and returns its axis. Residues should be ordered correctly + in **sele1**. + + :param sele1: + :type sele1: :class:`~ost.mol.EntityView` + + :return: :class:`~ost.geom.Line3` """ if not sele1.IsValid(): print 'invalid view' @@ -132,10 +155,17 @@ def CalculateHelixAxis(sele1): def CalculateDistanceDifferenceMatrix(sele1,sele2): """ - This function calculates the pairwise distance differences between two EntityViews. - The two EntityViews should have the same number of atoms + This function calculates the pairwise distance differences between two selections (\ :class:`~ost.mol.EntityView`\ ). + The two selections should have the same number of atoms It returns an NxN DistanceDifferenceMatrix M (where N is the number of atoms in sele1) - where M[i,j]=(sele2.atoms[i].pos-sele2.atoms[j].pos)-(sele1.atoms[i].pos-sele1.atoms[j].pos) + where M[i,j]=||(sele2.atoms[i].pos-sele2.atoms[j].pos)||-||(sele1.atoms[i].pos-sele1.atoms[j].pos)|| + + :param sele1: + :param sele2: + :type sele1: :class:`~ost.mol.EntityView` + :type sele2: :class:`~ost.mol.EntityView` + + :return: NxN numpy matrix """ try:import numpy as npy except ImportError: