Skip to content
Snippets Groups Projects
Commit 846569b3 authored by BIOPZ-Johner Niklaus's avatar BIOPZ-Johner Niklaus
Browse files

Added documentation for mol.alg.structure_analysis

parent 94fdba12
No related branches found
No related tags found
No related merge requests found
...@@ -873,5 +873,9 @@ used to skip frames in the analysis. ...@@ -873,5 +873,9 @@ used to skip frames in the analysis.
.. automodule:: ost.mol.alg.trajectory_analysis .. automodule:: ost.mol.alg.trajectory_analysis
:members: :members:
:mod:`mol.alg.structure_analysis <ost.mol.alg.trajectory_analysis>` -- Functions to analyze structures
=============================================================================================================
.. automodule:: ost.mol.alg.structure_analysis
:members:
""" """
Some functions for analyzing trajectories Some functions for analyzing structures
Author: Niklaus Johner Author: Niklaus Johner (Niklaus.Johner@unibas.ch)
""" """
import os import os
import ost import ost
def GetFrameFromEntity(eh): def GetFrameFromEntity(eh):
""" """
This function returns a CoordFrame from an EntityHandle 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)) return ost.mol.CreateCoordFrame(eh.GetAtomPosList(ordered_by_index=True))
def GetDistanceBetwCenterOfMass(sele1,sele2): def GetDistanceBetwCenterOfMass(sele1,sele2):
""" """
This function calculates the distance between the centers of mass This function calculates the distance between the centers of mass
of sele1 and sele2, two selections from the same Entity. of **sele1** and **sele2**, two selections from the same Entity.
Input:
sele1 : EntityView :param sele1:
sele2 : EntityView :param sele2:
:type sele1: :class:`~ost.mol.EntityView`
:type sele2: :class:`~ost.mol.EntityView`
:return: :class:`float`
""" """
if not sele1.IsValid() and sele2.IsValid(): if not sele1.IsValid() and sele2.IsValid():
print 'invalid view' print 'invalid view'
...@@ -36,10 +42,14 @@ def GetDistanceBetwCenterOfMass(sele1,sele2): ...@@ -36,10 +42,14 @@ def GetDistanceBetwCenterOfMass(sele1,sele2):
def GetMinDistanceBetweenViews(sele1,sele2): def GetMinDistanceBetweenViews(sele1,sele2):
""" """
This function calculates the minimal distance between This function calculates the minimal distance between
sele1 and sele2, two selections from the same Entity. **sele1** and **sele2**, two selections from the same Entity.
Input:
sele1 : EntityView :param sele1:
sele2 : EntityView :param sele2:
:type sele1: :class:`~ost.mol.EntityView`
:type sele2: :class:`~ost.mol.EntityView`
:return: :class:`float`
""" """
if not sele1.IsValid() and sele2.IsValid(): if not sele1.IsValid() and sele2.IsValid():
print 'invalid view' print 'invalid view'
...@@ -53,11 +63,15 @@ def GetMinDistanceBetweenViews(sele1,sele2): ...@@ -53,11 +63,15 @@ def GetMinDistanceBetweenViews(sele1,sele2):
def GetMinDistBetwCenterOfMassAndView(sele1,sele2): def GetMinDistBetwCenterOfMassAndView(sele1,sele2):
""" """
This function calculates the minimal distance between sele2 and This function calculates the minimal distance between **sele2** and
the center of mass of sele1, two selections from the same Entity. the center of mass of **sele1**, two selections from the same Entity.
Input:
sele1 : EntityView from which the center of mass is taken :param sele1: The selection from which the center of mass is taken
sele2 : EntityView :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(): if not sele1.IsValid() and sele2.IsValid():
print 'invalid view' print 'invalid view'
...@@ -74,8 +88,11 @@ def GetAlphaHelixContent(sele1): ...@@ -74,8 +88,11 @@ def GetAlphaHelixContent(sele1):
""" """
This function calculates the content of alpha helix in a view. This function calculates the content of alpha helix in a view.
All residues in the view have to ordered and adjacent (no gaps allowed) 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(): if not sele1.IsValid():
print 'invalid view' print 'invalid view'
...@@ -87,10 +104,12 @@ def GetAlphaHelixContent(sele1): ...@@ -87,10 +104,12 @@ def GetAlphaHelixContent(sele1):
def CalculateBestFitLine(sele1): def CalculateBestFitLine(sele1):
""" """
This function calculates the best fit line to the atoms in sele1. This function calculates the best fit line to the atoms in **sele1**.
Input:
sele1 : EntityView :param sele1:
It returns a geom::Line3 :type sele1: :class:`~ost.mol.EntityView`
:return: :class:`~ost.geom.Line3`
""" """
if not sele1.IsValid(): if not sele1.IsValid():
print 'invalid view' print 'invalid view'
...@@ -101,10 +120,12 @@ def CalculateBestFitLine(sele1): ...@@ -101,10 +120,12 @@ def CalculateBestFitLine(sele1):
def CalculateBestFitPlane(sele1): def CalculateBestFitPlane(sele1):
""" """
This function calculates the best fit plane to the atoms in sele1. This function calculates the best fit plane to the atoms in **sele1**.
Input:
sele1 : EntityView :param sele1:
It returns a geom::Plane :type sele1: :class:`~ost.mol.EntityView`
:return: :class:`~ost.geom.Plane`
""" """
if not sele1.IsValid(): if not sele1.IsValid():
print 'invalid view' print 'invalid view'
...@@ -115,12 +136,14 @@ def CalculateBestFitPlane(sele1): ...@@ -115,12 +136,14 @@ def CalculateBestFitPlane(sele1):
def CalculateHelixAxis(sele1): def CalculateHelixAxis(sele1):
""" """
This function calculates the best fit cylinder to the CA atoms in 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 and returns its axis. Residues should be ordered correctly
in the EntityView. in **sele1**.
Input:
sele1 : EntityView :param sele1:
It returns a geom::Line3 :type sele1: :class:`~ost.mol.EntityView`
:return: :class:`~ost.geom.Line3`
""" """
if not sele1.IsValid(): if not sele1.IsValid():
print 'invalid view' print 'invalid view'
...@@ -132,10 +155,17 @@ def CalculateHelixAxis(sele1): ...@@ -132,10 +155,17 @@ def CalculateHelixAxis(sele1):
def CalculateDistanceDifferenceMatrix(sele1,sele2): def CalculateDistanceDifferenceMatrix(sele1,sele2):
""" """
This function calculates the pairwise distance differences between two EntityViews. This function calculates the pairwise distance differences between two selections (\ :class:`~ost.mol.EntityView`\ ).
The two EntityViews should have the same number of atoms 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) 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 try:import numpy as npy
except ImportError: except ImportError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment