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
4 changes: 3 additions & 1 deletion docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
Changelog
=========

* Rename run_analsis to run_analysis
* Move `-nt` to base args (Fixes #109)
* set `long-description` to single file
* remove Py3.8
* Fixing codecov upload
* Translate ```setup.py`` into ``pyproject.toml``
* Translate ``setup.py`` into ``pyproject.toml``

v0.1.24 (2023-01-27)
------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions src/mdacli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .libcli import (
find_cls_members,
init_base_argparse,
run_analsis,
run_analysis,
setup_clients,
split_argparse_into_groups,
)
Expand Down Expand Up @@ -130,12 +130,12 @@ def cli(name,
arg_grouped_dict.setdefault("Output Parameters", {})

with threadpool_limits(limits=args.num_threads):
run_analsis(analysis_callable,
arg_grouped_dict["Mandatory Parameters"],
arg_grouped_dict["Optional Parameters"],
arg_grouped_dict["Reference Universe Parameters"],
arg_grouped_dict["Analysis Run Parameters"],
arg_grouped_dict["Output Parameters"])
run_analysis(analysis_callable,
arg_grouped_dict["Mandatory Parameters"],
arg_grouped_dict["Optional Parameters"],
arg_grouped_dict["Reference Universe Parameters"],
arg_grouped_dict["Analysis Run Parameters"],
arg_grouped_dict["Output Parameters"])
except Exception as e:
if args.debug:
traceback.print_exc()
Expand Down
30 changes: 15 additions & 15 deletions src/mdacli/libcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,6 @@ def add_run_group(analysis_class_parser):
help="step or time step for evaluation (default: %(default)s)"
)

run_group.add_argument(
"-nt",
dest="num_threads",
type=int,
default=0,
help="Total number of threads to start (0 is guess)")

run_group.add_argument(
"-v",
dest="verbose",
Expand Down Expand Up @@ -375,8 +368,8 @@ def create_cli(sub_parser, interface_name, parameters):
formatter_class=argparse.RawDescriptionHelpFormatter,
)

# Add run_analsis function as the default func parameter.
# this is possible because the run_analsis function is equal to all
# Add run_analysis function as the default func parameter.
# this is possible because the run_analysis function is equal to all
# Analysis Classes
analysis_class_parser.set_defaults(
analysis_callable=parameters["callable"])
Expand Down Expand Up @@ -550,12 +543,12 @@ def create_universe(topology,
return universe


def run_analsis(analysis_callable,
mandatory_analysis_parameters,
optional_analysis_parameters=None,
reference_universe_parameters=None,
run_parameters=None,
output_parameters=None):
def run_analysis(analysis_callable,
mandatory_analysis_parameters,
optional_analysis_parameters=None,
reference_universe_parameters=None,
run_parameters=None,
output_parameters=None):
"""Perform main client logic.

Parameters
Expand Down Expand Up @@ -786,6 +779,13 @@ def init_base_argparse(name, version, description):
help="Run with debug options.",
)

ap.add_argument(
"-nt",
dest="num_threads",
type=int,
default=0,
help="Total number of threads to start (0 is guess)")

ap.add_argument('--logfile',
dest='logfile',
action='store',
Expand Down
7 changes: 7 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import subprocess

import pytest
from MDAnalysisTests.datafiles import TPR, XTC


def test_required_args():
Expand All @@ -34,3 +35,9 @@ def test_extra_options(args):
def test_case_insensitive(args):
"""Test for beeing case insensitive."""
subprocess.check_call(['mda', args, "-h"])


def test_running_analysis():
"""Test running a complete analysis."""
subprocess.check_call(
['mda', "rmsf", "-s", TPR, "-f", XTC, "-atomgroup", "all"])
16 changes: 8 additions & 8 deletions tests/test_libcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
find_classes_in_modules,
find_cls_members,
init_base_argparse,
run_analsis,
run_analysis,
setup_clients,
split_argparse_into_groups,
)
Expand Down Expand Up @@ -478,7 +478,7 @@ def test_multi_atomgroup_None(self, universe):
assert analysis_parameters["p0"] is None


class Test_run_analsis:
class Test_run_analysis:
"""Test class for analyze_data."""

@pytest.fixture()
Expand Down Expand Up @@ -506,7 +506,7 @@ def test_default(self,
tmpdir):
"""Test with default arguments."""
with tmpdir.as_cwd():
run_analsis(
run_analysis(
analysis_callable=InterRDF,
reference_universe_parameters=reference_universe_parameters,
mandatory_analysis_parameters=mandatory_parameters)
Expand All @@ -518,7 +518,7 @@ def test_optional_paramaters(self,
"""Test with optional parameters given."""
opt_params = {"nbins": 100}
with tmpdir.as_cwd():
a = run_analsis(
a = run_analysis(
analysis_callable=InterRDF,
reference_universe_parameters=reference_universe_parameters,
mandatory_analysis_parameters=mandatory_parameters,
Expand All @@ -535,7 +535,7 @@ def test_verbose(self,
run_parameters = {"verbose": True}
caplog.set_level(logging.INFO)
with tmpdir.as_cwd():
run_analsis(
run_analysis(
analysis_callable=InterRDF,
reference_universe_parameters=reference_universe_parameters,
mandatory_analysis_parameters=mandatory_parameters,
Expand All @@ -552,7 +552,7 @@ def test_custom_output(self,

with tmpdir.as_cwd():
os.mkdir("foo")
run_analsis(
run_analysis(
analysis_callable=InterRDF,
reference_universe_parameters=reference_universe_parameters,
mandatory_analysis_parameters=mandatory_parameters,
Expand All @@ -569,7 +569,7 @@ def test_output_directory(self,
output_parameters = {"output_directory": "foo"}
with tmpdir.as_cwd():
os.mkdir("foo")
run_analsis(
run_analysis(
analysis_callable=InterRDF,
reference_universe_parameters=reference_universe_parameters,
mandatory_analysis_parameters=mandatory_parameters,
Expand All @@ -585,7 +585,7 @@ def test_output_prefix(self,
output_parameters = {"output_prefix": "foo"}
with tmpdir.as_cwd():
os.mkdir("foo")
run_analsis(
run_analysis(
analysis_callable=InterRDF,
reference_universe_parameters=reference_universe_parameters,
mandatory_analysis_parameters=mandatory_parameters,
Expand Down