Skip to content

Commit

Permalink
update docs for v0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvoegele committed Sep 10, 2021
1 parent 9269dfd commit 9470024
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/create_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
rm -r source/* _build

# Auto-generate API docs:
sphinx-apidoc -M -o ./source ../pensa
sphinx-apidoc -M -o ./source ../pensa ../pensa/diffnets/

# Format the auto-generated API docs
sed -i 's/ package//g' source/*.rst
Expand Down
8 changes: 8 additions & 0 deletions docs/source/pensa.comparison.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ pensa.comparison
:undoc-members:
:show-inheritance:

pensa.comparison.metrics
-------------------------------

.. automodule:: pensa.comparison.metrics
:members:
:undoc-members:
:show-inheritance:

pensa.comparison.relative\_entropy
-----------------------------------------

Expand Down
24 changes: 24 additions & 0 deletions docs/source/pensa.dimensionality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ pensa.dimensionality
:undoc-members:
:show-inheritance:

pensa.dimensionality.lda
-------------------------------

.. automodule:: pensa.dimensionality.lda
:members:
:undoc-members:
:show-inheritance:

pensa.dimensionality.pca
-------------------------------

Expand All @@ -14,10 +22,26 @@ pensa.dimensionality.pca
:undoc-members:
:show-inheritance:

pensa.dimensionality.qda
-------------------------------

.. automodule:: pensa.dimensionality.qda
:members:
:undoc-members:
:show-inheritance:

pensa.dimensionality.tica
--------------------------------

.. automodule:: pensa.dimensionality.tica
:members:
:undoc-members:
:show-inheritance:

pensa.dimensionality.visualization
-----------------------------------------

.. automodule:: pensa.dimensionality.visualization
:members:
:undoc-members:
:show-inheritance:
16 changes: 16 additions & 0 deletions docs/source/pensa.features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ pensa.features.atom\_features
:undoc-members:
:show-inheritance:

pensa.features.mda\_distances
------------------------------------

.. automodule:: pensa.features.mda_distances
:members:
:undoc-members:
:show-inheritance:

pensa.features.processing
--------------------------------

Expand All @@ -30,6 +38,14 @@ pensa.features.pyemma\_features
:undoc-members:
:show-inheritance:

pensa.features.txt\_features
-----------------------------------

.. automodule:: pensa.features.txt_features
:members:
:undoc-members:
:show-inheritance:

pensa.features.water\_features
-------------------------------------

Expand Down
36 changes: 15 additions & 21 deletions docs/tut-2-preprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ In many cases, you probably have several runs of the same simulation
that you want to combine to one structural ensemble. This is why the
trajectory argument takes a list as arguments, e.g.

::
.. code:: python
extract_coordinates(system.psf, system.pdb, ['run1.nc','run2.nc','run3.nc'],
'rho_receptor', 'protein', start_frame=1000)
extract_coordinates('system.psf', 'system.pdb', ['run1.nc','run2.nc','run3.nc'],
'receptor', 'protein', start_frame=1000)
With the option ``start_frame``, you can exclude the equilibrium phase
Expand All @@ -105,23 +105,17 @@ Selecting Subsets of Coordinates
For some analysis types, we only want to use the part of the receptor
that is inside the membrane. In this way, very flexible loops outside
the membrane cannot distort the analysis result. We can manually
construct a selection string in MDAnalysis format or load the selections
from a file. We call this file ``mor_tm.txt`` and generate it on the fly
so we can demonstrate the loader function. We use selections based on
construct a selection string in MDAnalysis format We use selections based on
the definitions of transmembrane helices in the
`GPCRdb <https://gpcrdb.org/protein/oprm_human/>`__.

.. code:: python
! echo "76 98\n105 133\n138 173\n182 208\n226 264\n270 308\n315 354" > mor_tm.txt
! cat mor_tm.txt
.. code:: python
# Load the selection and generate the strings
sel_string_a = load_selection("mor_tm.txt", sel_base_a+" and ")
resnums = "76:98 105:133 138:173 182:208 226:264 270:308 315:354"
# Generate the selection strings
sel_string_a = sel_base_a+" and resnum "+resnums
print('Selection A:\n', sel_string_a, '\n')
sel_string_b = load_selection("mor_tm.txt", sel_base_b+" and ")
sel_string_b = sel_base_b+" and resnum "+resnums
print('Selection B:\n', sel_string_b, '\n')
# Extract the coordinates of the transmembrane region from the trajectory
extract_coordinates(ref_file_a, pdb_file_a, [trj_file_a], out_name_a+"_tm", sel_string_a)
Expand Down Expand Up @@ -172,8 +166,8 @@ densities from a smaller selection.

.. code:: python
# # # First we preprocess the trajectories to extract coordinates for protein
# # # and waters.
# First we preprocess the trajectories to extract coordinates for protein
# and waters.
root_dir = './mor-data'
# Simulation A
ref_file_a = root_dir+'/11427_dyn_151.psf'
Expand All @@ -189,7 +183,7 @@ densities from a smaller selection.
root_dir+'/11578_trj_169.xtc']
# Base for the selection string for each simulation protein and all waters (OH2)
sel_base = "protein or byres name OH2"
# # # # Names of the output files
# Names of the output files
out_name_a = "traj/cond-a_water"
out_name_b = "traj/cond-b_water"
Expand All @@ -207,11 +201,11 @@ we have to ensure that the protein is aligned across both simulations.

.. code:: python
# # # Extract the coordinates of the receptor from the trajectory
# Extract the coordinates of the receptor from the trajectory
extract_coordinates(ref_file_a, pdb_file_a, trj_file_a, out_name_a, sel_base)
extract_coordinates(ref_file_b, pdb_file_b, trj_file_b, out_name_b, sel_base)
# # # Extract the aligned coordinates of the ensemble a aligned to ensemble b
# Extract the aligned coordinates of the ensemble a aligned to ensemble b
extract_aligned_coords(out_name_a+".gro", out_name_a+".xtc",
out_name_b+".gro", out_name_b+".xtc")
Expand All @@ -224,7 +218,7 @@ cavities are aligned.

.. code:: python
# # # Extract the combined density of the waters in both ensembles a and b
# Extract the combined density of the waters in both ensembles a and b
extract_combined_grid(out_name_a+".gro", "dens/cond-a_wateraligned.xtc",
out_name_b+".gro", out_name_b+".xtc",
atomgroup="OH2",
Expand All @@ -233,4 +227,4 @@ cavities are aligned.
This density can now be used to locate and featurize the same water pockets in
both individual simulations, even if a water site only exists in one simulation.


8 changes: 4 additions & 4 deletions pensa/dimensionality/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def compare_projections(data_a, data_b, ana, num=3, saveas=None, label_a=None, l
label_b : str, optional
Label for the second dataset.
Returns:
--------
Returns
-------
projections : list of float arrays
Projections of the trajectory on each component.
Expand Down Expand Up @@ -86,8 +86,8 @@ def compare_mult_projections(data, ana, num=3, saveas=None, labels=None, colors=
labels : list of str, optional
Labels for the datasets. If provided, it must have the same length as data.
Returns:
--------
Returns
-------
projections : list of float arrays
Projections of the trajectory on each principal component.
Expand Down

0 comments on commit 9470024

Please sign in to comment.