diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ec1373c40..7e223e3ab 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,26 +14,25 @@ env: jobs: build: - runs-on: ubuntu-20.04 strategy: matrix: - py_version: ["3.8", "3.9", "3.10", "3.11"] + py_version: ["3.9", "3.10", "3.11", "3.12"] include: - - py_version: "3.8" - WITH_CODECOV: true - py_version: "3.9" WITH_CODECOV: true - py_version: "3.10" WITH_CODECOV: true - py_version: "3.11" WITH_CODECOV: true + - py_version: "3.12" + WITH_CODECOV: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.py_version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.py_version }} cache: pip @@ -54,6 +53,7 @@ jobs: run: | coverage run $(which pytest) -vv --hypothesis-show-statistics coverage report --omit='*/bin/pytest' + coverage xml - if: ${{ matrix.WITH_CODECOV }} name: Upload coverage codecov @@ -68,11 +68,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.x' cache: pip cache-dependency-path: | **/setup.cfg @@ -93,11 +93,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.x' cache: pip cache-dependency-path: | **/setup.cfg @@ -118,11 +118,18 @@ jobs: deploy: needs: [build, lint, docs] runs-on: ubuntu-latest - + environment: + name: pypi + url: https://pypi.org/p/vermouth + permissions: + id-token: write steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + with: + fetch-tags: true + fetch-depth: 0 + - name: Set up Python 3 + uses: actions/setup-python@v5 with: python-version: '3.11' cache: pip @@ -130,25 +137,14 @@ jobs: **/setup.cfg **/requirements-*.txt **/pyproject.toml - + - name: Install dependencies + run: | + pip install --upgrade setuptools pip + pip install --upgrade . - name: Install pypa/build - run: >- - python -m - pip install - build - --user - pip install pbr - + run: | + python3 -m pip install build pbr --user - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - - - name: Publish package to PyPI + run: python3 -m build --sdist --wheel --outdir dist/ + - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index f5dc54266..fa2e10b2d 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -16,26 +16,25 @@ env: jobs: build: - runs-on: ubuntu-20.04 strategy: matrix: - py_version: ["3.8", "3.9", "3.10", "3.11"] + py_version: ["3.9", "3.10", "3.11", "3.12"] include: - - py_version: "3.8" - WITH_CODECOV: true - py_version: "3.9" WITH_CODECOV: true - py_version: "3.10" WITH_CODECOV: true - py_version: "3.11" WITH_CODECOV: true + - py_version: "3.12" + WITH_CODECOV: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.py_version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.py_version }} cache: pip @@ -71,11 +70,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.x' cache: pip cache-dependency-path: | **/setup.cfg @@ -96,11 +95,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.x' cache: pip cache-dependency-path: | **/setup.cfg @@ -116,3 +115,39 @@ jobs: run: | mkdir -p doc/source/_static sphinx-build -EnW -b html doc/source/ doc/build/html + + deploy: + needs: [build, lint, docs] + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://test.pypi.org/p/vermouth + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-tags: true + fetch-depth: 0 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: pip + cache-dependency-path: | + **/setup.cfg + **/requirements-*.txt + **/pyproject.toml + - name: Install dependencies + run: | + pip install --upgrade setuptools pip + pip install --upgrade . + - name: Install pypa/build + run: | + python3 -m pip install build pbr --user + - name: Build a binary wheel and a source tarball + run: python3 -m build --sdist --wheel --outdir dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/doc/source/martinize2_tutorials/basic_usage.rst b/doc/source/martinize2_tutorials/basic_usage.rst index eb1017d4e..bfd198cd9 100644 --- a/doc/source/martinize2_tutorials/basic_usage.rst +++ b/doc/source/martinize2_tutorials/basic_usage.rst @@ -1,6 +1,6 @@ -========== +=========== Basic usage -========== +=========== Overly basic usage ================== diff --git a/doc/source/martinize2_tutorials/elastic_networks.rst b/doc/source/martinize2_tutorials/elastic_networks.rst index a2e548b9e..fc88befc8 100644 --- a/doc/source/martinize2_tutorials/elastic_networks.rst +++ b/doc/source/martinize2_tutorials/elastic_networks.rst @@ -1,4 +1,6 @@ -# Elastic Networks +================ +Elastic Networks +================ The first method applied to maintain the secondary and tertiary structure of Martini proteins was `Elastic Networks `_. diff --git a/doc/source/martinize2_tutorials/go_models.rst b/doc/source/martinize2_tutorials/go_models.rst index 9b153e3ef..160f6ac53 100644 --- a/doc/source/martinize2_tutorials/go_models.rst +++ b/doc/source/martinize2_tutorials/go_models.rst @@ -1,6 +1,6 @@ -======= +========= Go models -======= +========= GoMartini is a popular method for retaining the secondary and tertiary structures of proteins originating from the lab of `Adolfo Poma `_. In contrast to an elastic network, the Go diff --git a/doc/source/martinize2_tutorials/index.rst b/doc/source/martinize2_tutorials/index.rst index ee633c0db..a4fe5b26f 100644 --- a/doc/source/martinize2_tutorials/index.rst +++ b/doc/source/martinize2_tutorials/index.rst @@ -12,4 +12,6 @@ repository: https://github.com/marrink-lab/martinize-examples .. toctree:: basic_usage - 7_adding_modifications/index + elastic_networks + go_models + mutmod diff --git a/doc/source/martinize2_tutorials/mutmod.rst b/doc/source/martinize2_tutorials/mutations_and_modifications.rst similarity index 97% rename from doc/source/martinize2_tutorials/mutmod.rst rename to doc/source/martinize2_tutorials/mutations_and_modifications.rst index 1e42ec24c..dec1a33ae 100644 --- a/doc/source/martinize2_tutorials/mutmod.rst +++ b/doc/source/martinize2_tutorials/mutations_and_modifications.rst @@ -1,6 +1,6 @@ -====== +=========================== Mutations and modifications -====== +=========================== Martinize2 facilitates a powerful syntax for defining mutations and modifications to your input protein structure. Here we'll look at some of the options for how your protein can be changed during the coarse graining process. While diff --git a/doc/source/martinize2_tutorials/water_biasing.rst b/doc/source/martinize2_tutorials/water_biasing.rst index 001e39805..dd236ef8d 100644 --- a/doc/source/martinize2_tutorials/water_biasing.rst +++ b/doc/source/martinize2_tutorials/water_biasing.rst @@ -1,6 +1,6 @@ -========= +============= Water biasing -========= +============= One feature associated with the latest version of the `Go model `_ is the ability to diff --git a/pyproject.toml b/pyproject.toml index b2a592a45..980ae368e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ requires = [ "setuptools >= 30.3.0", "pbr", ] +build-backend = "pbr.build" [tool.pytest.ini_options] addopts = "--import-mode=importlib" diff --git a/setup.cfg b/setup.cfg index fb0f3fc2b..c51c299e2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,10 +17,10 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: OS Independent Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Scientific/Engineering :: Bio-Informatics Topic :: Scientific/Engineering :: Chemistry keywords = martini MD martinize diff --git a/vermouth/data/mappings/his.charmm.mapping b/vermouth/data/mappings/his.charmm.mapping new file mode 100644 index 000000000..3cfe5816e --- /dev/null +++ b/vermouth/data/mappings/his.charmm.mapping @@ -0,0 +1,30 @@ +[ block ] +[ from ] +charmm +[ to ] +martini22 + +[ from blocks ] +HIS + +[ to blocks ] +HSE + +[ mapping ] + N BB + HN BB + CA BB + HA BB + CB SC1 +HB1 SC1 +HB2 SC1 +CD2 SC2 +HD2 SC2 + CG SC1 +NE2 SC2 +HE2 SC2 +ND1 SC3 +CE1 SC3 +HE1 SC3 + C BB + O BB \ No newline at end of file diff --git a/vermouth/data/mappings/his.gromos.mapping b/vermouth/data/mappings/his.gromos.mapping new file mode 100644 index 000000000..78425909c --- /dev/null +++ b/vermouth/data/mappings/his.gromos.mapping @@ -0,0 +1,27 @@ +[ block ] +[ from ] +gromos +[ to ] +martini22 + +[ from blocks ] +HIS + +[ to blocks ] +HSE + +[ mapping ] + N BB + H BB + CA BB + CB SC1 + CG SC1 +ND1 SC3 +HD1 SC3 +CD2 SC2 +HD2 SC2 +CE1 SC3 +HE1 SC3 +NE2 SC2 + C BB + O BB diff --git a/vermouth/processors/annotate_mut_mod.py b/vermouth/processors/annotate_mut_mod.py index 8994d56c9..d8763f824 100644 --- a/vermouth/processors/annotate_mut_mod.py +++ b/vermouth/processors/annotate_mut_mod.py @@ -252,10 +252,9 @@ def annotate_modifications(molecule, modifications, mutations, resspec_counts): # Get the name of the chain in the molecule that we're looking at residue = {key: residue_graph.nodes[0].get(key) for key in 'chain resid resname insertion_code'.split()} - chain = residue['chain'] - extra = False for mutmod, key, library in associations: for resspec, mod in mutmod: + extra = False mod_found = _resiter(mod, residue_graph, resspec, library, key, molecule) if not mod_found: #if no mod found, return that there's a problem diff --git a/vermouth/tests/test_annotate_mut_mod.py b/vermouth/tests/test_annotate_mut_mod.py index 2b37f575a..79ed77e82 100644 --- a/vermouth/tests/test_annotate_mut_mod.py +++ b/vermouth/tests/test_annotate_mut_mod.py @@ -304,7 +304,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): assert found == expected @pytest.mark.parametrize('node_data, edge_data, mutation, expected', [ - ( + (# test 0 [ {'chain': 'A', 'resname': 'GLY', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -314,7 +314,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'GLY', 'resid': 1, 'chain': 'A'}, 'MET')], False ), - ( + (# test 1 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -324,7 +324,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'GLY', 'resid': 1, 'chain': 'A'}, 'MET')], True ), - ( + (# test 2 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -334,7 +334,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'GLY', 'resid': 1}, 'MET')], True ), - ( + (# test 3 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -344,7 +344,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'ALA', 'resid': 1}, 'MET')], False ), - ( + (# test 4 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -357,7 +357,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'ALA', 'chain': 'A'}, 'GLY')], False ), - ( + (# test 5 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -370,7 +370,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'GLY', 'resid': 1}, 'ALA')], True ), - ( + (# test 6 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -383,7 +383,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'GLY', 'resid': 1, 'chain': 'A'}, 'ALA')], True ), - ( + (# test 7 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -396,7 +396,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'ALA', 'resid': 1}, 'GLY')], False ), - ( + (# test 8 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -409,7 +409,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resname': 'GLY', 'chain': 'A'}, 'ALA')], True ), - ( + (# test 9 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -422,7 +422,7 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [({'resid': 1, 'resname': 'ASN'}, 'ALA')], False ), - ( + (# test 10 [ {'chain': 'A', 'resname': 'ALA', 'resid': 1}, {'chain': 'A', 'resname': 'ALA', 'resid': 2}, @@ -434,6 +434,19 @@ def test_nter_cter_modifications(node_data, edge_data, expected): [(0, 1), (1, 2), (3, 4), (4, 5)], [({'chain':'B', 'resname': 'ASN'}, 'ALA')], False + ), + ( # test 11 + [ + {'chain': 'A', 'resname': 'GLY', 'resid': 1}, + {'chain': 'A', 'resname': 'ALA', 'resid': 2}, + {'chain': 'A', 'resname': 'SER', 'resid': 3}, + {'chain': 'B', 'resname': 'GLY', 'resid': 1}, + {'chain': 'B', 'resname': 'ALA', 'resid': 2}, + {'chain': 'B', 'resname': 'SER', 'resid': 3} + ], + [(0, 1), (1, 2), (3, 4), (4, 5)], + [({'chain': 'A', 'resname': 'ALA', 'resid': 2}, 'GLY')], + False ) ]) def test_mod_resid_not_correct(caplog, node_data, edge_data, mutation, expected):