Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Deprecations
* core.universe.as_Universe() will be removed in 2.0.0
* analysis.leaflets.LeafletFinder() will not accept a filename any more,
only a Universe, in 2.0.0
* analysis.helanal will be removed in 2.0.0 and replaced by
analysis.helix_analysis (PR #2622)


06/09/20 richardjgowers, kain88-de, lilyminium, p-j-smith, bdice, joaomcteixeira,
Expand Down
37 changes: 31 additions & 6 deletions package/MDAnalysis/analysis/helanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@


"""
HELANAL --- analysis of protein helices
=======================================
HELANAL (Deprecated) --- analysis of protein helices
====================================================

:Author: Benjamin Hall <benjamin.a.hall@ucl.ac.uk>, Oliver Beckstein, Xavier Deupi
:Year: 2009, 2011, 2013
:License: GNU General Public License v2 (or higher)

.. note::

This module was deprecated in 1.0 and will be removed in 2.0.
Please use MDAnalysis.analysis.helix_analysis instead
(available in 2.0.0).


The :mod:`MDAnalysis.analysis.helanal` module is a Python implementation of the
HELANAL_ algorithm [Bansal2000]_ in `helanal.f`_, which is also available
through the `HELANAL webserver`_.
Expand Down Expand Up @@ -117,20 +124,24 @@

"""
from __future__ import print_function, division, absolute_import
from six.moves import range, zip

import os

import numpy as np

import MDAnalysis
from MDAnalysis.lib.log import ProgressBar
from MDAnalysis.lib import mdamath
from ..lib.log import ProgressBar
from ..lib import mdamath, util

import warnings
import logging
logger = logging.getLogger("MDAnalysis.analysis.helanal")

warnings.warn("This module is deprecated as of MDAnalysis version 1.0. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably want some test for this? (not sure how strict we are being with 1.0.1 tests, but if it's getting released we should try to get coverage down?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the tests are failing here, so we it'll need fixing anyways.

"It will be removed in MDAnalysis version 2.0."
"Please use (available in 2.0.0) "
"MDAnalysis.analysis.helix_analysis instead.",
category=DeprecationWarning)

def center(coordinates):
"""Return the geometric center (centroid) of the coordinates.

Expand Down Expand Up @@ -158,6 +169,9 @@ def mean_abs_dev(a, mean_a=None):
mean_a = np.mean(a)
return np.mean(np.fabs(a - mean_a))


@util.deprecate(release="1.0.1", remove="2.0",
message="In 2.0 use the upcoming helix_analysis module")
def helanal_trajectory(universe, select="name CA",
begin=None, finish=None,
matrix_filename="bending_matrix.dat",
Expand Down Expand Up @@ -243,7 +257,12 @@ def helanal_trajectory(universe, select="name CA",

.. versionchanged:: 1.0.0
Changed `selection` keyword to `select`

.. deprecated:: 1.0.1
helanal_trajectory is deprecated and will be removed in 2.0.0.
Please use helix_analysis.HELANAL instead (available in 2.0.0).
"""

if ref_axis is None:
ref_axis = np.array([0., 0., 1.])
else:
Expand Down Expand Up @@ -525,6 +544,8 @@ def stats(some_list):
return [list_mean, list_sd, list_abdev]


@util.deprecate(release="1.0.1", remove="2.0",
message="In 2.0 use the upcoming helix_analysis module")
def helanal_main(pdbfile, select="name CA", ref_axis=None):
"""Simple HELANAL_ run on a single frame PDB/GRO.

Expand Down Expand Up @@ -581,6 +602,10 @@ def helanal_main(pdbfile, select="name CA", ref_axis=None):
.. versionchanged:: 1.0.0
Changed `selection` keyword to `select`

.. deprecated:: 1.0.1
helanal_trajectory is deprecated and will be removed in 2.0.0.
Please use helix_analysis.HELANAL instead (available in 2.0.0).

"""

universe = MDAnalysis.Universe(pdbfile)
Expand Down
7 changes: 3 additions & 4 deletions testsuite/MDAnalysisTests/analysis/test_helanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,13 @@ def test_warnings(tmpdir):
u, select="name CA", begin=-1, finish=99999
)

assert len(record) == 2
assert len(record) == 3
wmsg1 = ("The input begin time (-1 ps) precedes the starting "
"trajectory time --- Setting starting frame to 0".format(
-1,0))
assert str(record[0].message.args[0]) == wmsg1
assert str(record[1].message.args[0]) == wmsg1
wmsg2 = ("The input finish time ({0} ps) occurs after the end of "
"the trajectory ({1} ps). Finish time will be set to "
"the end of the trajectory".format(
99999,1000.0000762939453))
assert str(record[1].message.args[0]) == wmsg2

assert str(record[2].message.args[0]) == wmsg2