From 90385c384d270892a98ce0a39dc3831b0795e1e6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 19 Sep 2023 19:03:46 +0000 Subject: [PATCH 01/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index cfd6aef..bc5b986 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "47c71811", + "id": "afa346a0", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0125771c", + "id": "fe5acc2b", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c430d13", + "id": "b8057332", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "dc165ee6", + "id": "b84046af", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d7305551", + "id": "9ec1de10", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "6c6c1e75", + "id": "7e71f87d", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "66d5db20", + "id": "1fe0a456", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "87713e3c", + "id": "8469d464", "metadata": {}, "outputs": [], "source": [ From 444d9491a5aa64bb4122be71ce635d8e5679147a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 19 Sep 2023 19:04:02 +0000 Subject: [PATCH 02/21] Updating the notebooks according last script(s) changes --- share/contacts_chunk.py | 1 + src/contact_probability.ipynb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) create mode 120000 share/contacts_chunk.py diff --git a/share/contacts_chunk.py b/share/contacts_chunk.py new file mode 120000 index 0000000..5dc94ea --- /dev/null +++ b/share/contacts_chunk.py @@ -0,0 +1 @@ +../src/contacts_chunk.py \ No newline at end of file diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index bc5b986..62c2c49 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "afa346a0", + "id": "36561010", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fe5acc2b", + "id": "b5ed49d0", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8057332", + "id": "5e06eca0", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "b84046af", + "id": "2dd36bd6", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9ec1de10", + "id": "a321feba", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "7e71f87d", + "id": "8db62556", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "1fe0a456", + "id": "529bb13e", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8469d464", + "id": "7c23da2b", "metadata": {}, "outputs": [], "source": [ From f47444d2147bd5b0240c02d17ec830f75a256395 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 19 Sep 2023 19:08:35 +0000 Subject: [PATCH 03/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index 62c2c49..0a726bd 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "36561010", + "id": "9e728e14", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b5ed49d0", + "id": "f48e1eff", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e06eca0", + "id": "e33096ab", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "2dd36bd6", + "id": "dedf31e7", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a321feba", + "id": "22083b65", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "8db62556", + "id": "952eca3f", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "529bb13e", + "id": "995527c4", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c23da2b", + "id": "a5f1f904", "metadata": {}, "outputs": [], "source": [ From 323313cac479aa01288242042467c24b68d907df Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Wed, 20 Sep 2023 10:42:09 -0300 Subject: [PATCH 04/21] [ISSUE6] Fixing less_equal and absolute differences. --- share/test_contact_probability.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/share/test_contact_probability.py b/share/test_contact_probability.py index cc6f8ac..3f73f8b 100644 --- a/share/test_contact_probability.py +++ b/share/test_contact_probability.py @@ -27,8 +27,8 @@ def test_evaluate_r_initial():#pairs_section, initial_distances): pdb_loaded = md.load(pdb_file) initial_distances = md.compute_distances(pdb_loaded, pairs_indexes) r_initial = cp.evaluate_r_initial(pairs_section) - test = (np.subtract(r_initial, \ - initial_distances) <= threshold_distances).all() + test = np.less_equal(np.absolute(np.subtract(r_initial, \ + initial_distances)), threshold_distances).all() assert test def test_gen_contact_probability(): @@ -51,12 +51,12 @@ def test_gen_contact_probability(): 'share/ci2-AA-120-run.gro', 'share/ci2-AA-120-run.xtc', pairs_indexes, r_initial ) - test_raw = (np.subtract(raw_prob, \ - defined_raw_output) <= threshold_prob).all() - test_contacts = (np.subtract(contacts, \ - defined_contacts_involved) <= threshold_contacts).all() - test_atoms = (np.subtract(atoms, \ - defined_atoms_involved) <= threshold_atoms).all() + test_raw = np.less_equal(np.absolute(np.subtract(raw_prob, \ + defined_raw_output)), threshold_prob).all() + test_contacts = np.less_equal(np.absolute(np.subtract(contacts, \ + defined_contacts_involved)), threshold_contacts).all() + test_atoms = np.less_equal(np.absolute(np.subtract(atoms, \ + defined_atoms_involved)), threshold_atoms).all() test = test_raw and test_contacts and test_atoms assert test @@ -73,6 +73,6 @@ def test_contacts_chunk(): defined_contacts_output = np.genfromtxt('share/contacts-output-ci2.dat') contacts = cc.evaluating_contacts_chunk('share/ci2-adjusted.pdb', \ 'share/ci2-AA-120-run.xtc', pairs_indexes, r_initial) - test = (np.absolute(np.subtract(contacts, defined_contacts_output))\ - <= error_margin_contacts).all() + test = np.less_equal(np.absolute(np.subtract(contacts,\ + defined_contacts_output)), error_margin_contacts).all() assert test \ No newline at end of file From ae372fff3e34f3d4c13aca5663c857aa15b036b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 20 Sep 2023 13:45:17 +0000 Subject: [PATCH 05/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index 0a726bd..ebd45d7 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "9e728e14", + "id": "763bb5d8", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f48e1eff", + "id": "97a69975", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e33096ab", + "id": "a01b6334", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "dedf31e7", + "id": "3bd8f23a", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22083b65", + "id": "b4637809", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "952eca3f", + "id": "1b87eae2", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "995527c4", + "id": "611f651a", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5f1f904", + "id": "5a42c708", "metadata": {}, "outputs": [], "source": [ From d5b56370b14fcace5455cb05889ae853c459f04a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 20 Sep 2023 13:53:00 +0000 Subject: [PATCH 06/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index ebd45d7..1b7ea6b 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "763bb5d8", + "id": "e8c09081", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "97a69975", + "id": "2c0cfa51", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a01b6334", + "id": "42cb7222", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "3bd8f23a", + "id": "f85efd44", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b4637809", + "id": "49e70069", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "1b87eae2", + "id": "866c53d7", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "611f651a", + "id": "0b591312", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a42c708", + "id": "2216b0f2", "metadata": {}, "outputs": [], "source": [ From 0e685d98ac4cc4ada23d6b3f6c0ec897613933ee Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Wed, 20 Sep 2023 10:58:22 -0300 Subject: [PATCH 07/21] Updating gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 64ad3a3..9c0db84 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ # ignore links created to test the code share/contact_probability.py +share/contacts_chunk.py + ### JupyterNotebooks ### # gitignore template for Jupyter Notebooks From 289c9373b76606a4e03fba61cb952bc996cb4247 Mon Sep 17 00:00:00 2001 From: fredcfreitas <39501703+fredcfreitas@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:39:03 -0300 Subject: [PATCH 08/21] Delete share/contacts_chunk.py Fixing the tests --- share/contacts_chunk.py | 1 - 1 file changed, 1 deletion(-) delete mode 120000 share/contacts_chunk.py diff --git a/share/contacts_chunk.py b/share/contacts_chunk.py deleted file mode 120000 index 5dc94ea..0000000 --- a/share/contacts_chunk.py +++ /dev/null @@ -1 +0,0 @@ -../src/contacts_chunk.py \ No newline at end of file From b963481f2880d4e5a198a123c368c84dfaad4447 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 26 Sep 2023 13:42:50 +0000 Subject: [PATCH 09/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index 1b7ea6b..7e01975 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "e8c09081", + "id": "c0ce2ae7", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c0cfa51", + "id": "56563c48", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42cb7222", + "id": "cff7a3e0", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "f85efd44", + "id": "b3e1cac0", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49e70069", + "id": "a1299fc9", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "866c53d7", + "id": "3f2cf908", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "0b591312", + "id": "9b995240", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2216b0f2", + "id": "ac4f2f0a", "metadata": {}, "outputs": [], "source": [ From 7ef176a16966728fd69f41b49dcffad12ef89b9c Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Mon, 16 Dec 2024 10:55:10 -0300 Subject: [PATCH 10/21] Just to check passing tests. --- .github/workflows/test_contact_probability.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_contact_probability.yml b/.github/workflows/test_contact_probability.yml index 7e11ea3..b37ea23 100644 --- a/.github/workflows/test_contact_probability.yml +++ b/.github/workflows/test_contact_probability.yml @@ -12,6 +12,7 @@ on: [push] #permissions: # contents: read # + jobs: build: From 35698288ef24968275c3217cd77f59247742d221 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Dec 2024 13:58:11 +0000 Subject: [PATCH 11/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index 7e01975..a84fb54 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c0ce2ae7", + "id": "dd8312d3", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "56563c48", + "id": "2badc7c4", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cff7a3e0", + "id": "cd0921d5", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "b3e1cac0", + "id": "4c2990c6", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1299fc9", + "id": "8704abe2", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "3f2cf908", + "id": "a68081f0", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "9b995240", + "id": "badb0439", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ac4f2f0a", + "id": "a5eaf40d", "metadata": {}, "outputs": [], "source": [ From bcb5c46faa238b2b1c9f174f41cf8cdb1870c006 Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Mon, 16 Dec 2024 11:15:06 -0300 Subject: [PATCH 12/21] Updating actions. --- .github/workflows/test_contact_probability.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test_contact_probability.yml b/.github/workflows/test_contact_probability.yml index b37ea23..1d8e4d3 100644 --- a/.github/workflows/test_contact_probability.yml +++ b/.github/workflows/test_contact_probability.yml @@ -53,7 +53,7 @@ jobs: - uses: webfactory/ssh-agent@v0.7.0 with: ssh-private-key: ${{ secrets.PAT_TOKEN }} -# github_token: ${{ secrets.PAT_TOKEN }} + github_token: ${{ secrets.PAT_TOKEN }} - name: Creating the Jupyter Notebook run: | @@ -71,7 +71,6 @@ jobs: with: ssh: true ssh-private-key: ${{ secrets.PAT_TOKEN }} -# github_token: ${{ secrets.GITHUB_TOKEN }} ssh_key: ${{ secrets.PAT_TOKEN }} github_token: ${{ secrets.PAT_TOKEN }} branch: ${{ github.ref }} From 6270f772d9a7b841975aee7594eacc63ffdde6b6 Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Mon, 16 Dec 2024 11:29:21 -0300 Subject: [PATCH 13/21] Fixing issues --- .github/workflows/test_contact_probability.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_contact_probability.yml b/.github/workflows/test_contact_probability.yml index 1d8e4d3..64def64 100644 --- a/.github/workflows/test_contact_probability.yml +++ b/.github/workflows/test_contact_probability.yml @@ -53,7 +53,7 @@ jobs: - uses: webfactory/ssh-agent@v0.7.0 with: ssh-private-key: ${{ secrets.PAT_TOKEN }} - github_token: ${{ secrets.PAT_TOKEN }} +# github_token: ${{ secrets.PAT_TOKEN }} - name: Creating the Jupyter Notebook run: | @@ -72,6 +72,6 @@ jobs: ssh: true ssh-private-key: ${{ secrets.PAT_TOKEN }} ssh_key: ${{ secrets.PAT_TOKEN }} - github_token: ${{ secrets.PAT_TOKEN }} +# github_token: ${{ secrets.PAT_TOKEN }} branch: ${{ github.ref }} force: true From 86e009a1efd4fa05fde48de70e0837e9920feddd Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Mon, 16 Dec 2024 18:27:55 -0300 Subject: [PATCH 14/21] Solving? --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 608f4c1..cb8733c 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ # contacts-python [![Test contact_probability.py](https://github.com/fredcfreitas/contacts-python/actions/workflows/test_contact_probability.yml/badge.svg?branch=release&event=push)](https://github.com/fredcfreitas/contacts-python/actions/workflows/test_contact_probability.yml) Created by Frederico Campos Freitas + This is a set of scripts to evaluate the number of contacts and/or contact probability in a GROMACS-SMOG simulation. Some features were implemented to fit our needs, so feel free to make any changes in order to tailor the scripts to your needs. + It relies on mdtraj and numpy libraries, so take a look at the requirements. + You may find some useful information in the scripts' comments. Contact us if you need some help: fredcfreitas(at)gmail.com From 99aa80a1550077042e3f19b6b82155e699ce46ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 17 Dec 2024 01:48:16 +0000 Subject: [PATCH 15/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index a84fb54..fc2b762 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "dd8312d3", + "id": "d6ad8c09", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2badc7c4", + "id": "f94bed97", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cd0921d5", + "id": "b09eef0e", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "4c2990c6", + "id": "755b1776", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8704abe2", + "id": "1afcb616", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "a68081f0", + "id": "159fe980", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "badb0439", + "id": "e0c62ca3", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5eaf40d", + "id": "2aa2b744", "metadata": {}, "outputs": [], "source": [ From 2fb26ed80ecc59cc3de1d99134c3e9f71afecd0e Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Tue, 17 Dec 2024 09:33:00 -0300 Subject: [PATCH 16/21] Fixing ssh-key comments --- .github/workflows/test_contact_probability.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_contact_probability.yml b/.github/workflows/test_contact_probability.yml index 64def64..a50ccca 100644 --- a/.github/workflows/test_contact_probability.yml +++ b/.github/workflows/test_contact_probability.yml @@ -52,7 +52,7 @@ jobs: # Make sure the @v0.7.0 matches the current version of the action - uses: webfactory/ssh-agent@v0.7.0 with: - ssh-private-key: ${{ secrets.PAT_TOKEN }} + ssh-private-key: ${{ secrets.PAT_TOKEN }} -C "git@github.com:fredcfreitas/contacts-python" # github_token: ${{ secrets.PAT_TOKEN }} - name: Creating the Jupyter Notebook @@ -70,7 +70,7 @@ jobs: uses: ad-m/github-push-action@master with: ssh: true - ssh-private-key: ${{ secrets.PAT_TOKEN }} + ssh-private-key: ${{ secrets.PAT_TOKEN }} -C "git@github.com:fredcfreitas/contacts-python" ssh_key: ${{ secrets.PAT_TOKEN }} # github_token: ${{ secrets.PAT_TOKEN }} branch: ${{ github.ref }} From 8043dccd6260620fc5f962263cc7efbf89cadc47 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 17 Dec 2024 12:36:34 +0000 Subject: [PATCH 17/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index fc2b762..6dec1da 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d6ad8c09", + "id": "c8dd8d2e", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f94bed97", + "id": "43160514", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b09eef0e", + "id": "aeef8f68", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "755b1776", + "id": "712b0b49", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1afcb616", + "id": "576a6a26", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "159fe980", + "id": "d07a2200", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "e0c62ca3", + "id": "26336a69", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2aa2b744", + "id": "12867c24", "metadata": {}, "outputs": [], "source": [ From 341ac8395cb9f34d0328f828772d4ea874833df8 Mon Sep 17 00:00:00 2001 From: fredcfreitas Date: Tue, 17 Dec 2024 11:31:44 -0300 Subject: [PATCH 18/21] Cosmetic changes --- .github/workflows/test_contact_probability.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_contact_probability.yml b/.github/workflows/test_contact_probability.yml index a50ccca..dbc0a57 100644 --- a/.github/workflows/test_contact_probability.yml +++ b/.github/workflows/test_contact_probability.yml @@ -58,7 +58,7 @@ jobs: - name: Creating the Jupyter Notebook run: | py2nb src/contact_probability.py - - name: Commiting generated files # + - name: Committing generated files # run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" From cc51934b3d456b3e116449da9e05a9e1c7862cdd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 17 Dec 2024 14:34:41 +0000 Subject: [PATCH 19/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index 6dec1da..acce861 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c8dd8d2e", + "id": "de9935d6", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "43160514", + "id": "bf90731c", "metadata": {}, "outputs": [], "source": [ @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aeef8f68", + "id": "a259576a", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +149,7 @@ }, { "cell_type": "markdown", - "id": "712b0b49", + "id": "643e087b", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "576a6a26", + "id": "3d8759ee", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "d07a2200", + "id": "7cf8ab0a", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "26336a69", + "id": "d7540886", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12867c24", + "id": "98b1340c", "metadata": {}, "outputs": [], "source": [ From 29a4feed95163b95b448d69a75c907245ae5f7ed Mon Sep 17 00:00:00 2001 From: Frederico Campos Freitas Date: Wed, 15 Oct 2025 10:58:39 -0300 Subject: [PATCH 20/21] Still is going to work if file.cont has only 4 columns --- src/contacts_chunk.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/contacts_chunk.py b/src/contacts_chunk.py index 1d3aa05..de73906 100755 --- a/src/contacts_chunk.py +++ b/src/contacts_chunk.py @@ -36,15 +36,15 @@ def evaluate_r_initial(contacts, model="AA", precision=np.double): """ contacts = np.asarray(contacts, dtype=precision) if model == "CA": - r_initial = np.power(np.divide(np.multiply(contacts[:, 4], 1.2), \ - contacts[:, 3]), \ + r_initial = np.power(np.divide(np.multiply(contacts[:, -1], 1.2), \ + contacts[:, -2]), \ np.divide(1, 2)) elif model == "AA": - r_initial = np.power(np.divide(np.multiply(contacts[:, 4], 2), \ - contacts[:, 3]),\ + r_initial = np.power(np.divide(np.multiply(contacts[:, -1], 2), \ + contacts[:, -2]),\ np.divide(1, 6)) else: - print("You have not provided an unimplemented model.") + print("You have not provided a model.") sys.exit() return r_initial From 73cc7b8ddea9a12f959bda87070be5ef19ad251b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 Oct 2025 14:00:55 +0000 Subject: [PATCH 21/21] Updating the notebooks according last script(s) changes --- src/contact_probability.ipynb | 45 ++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/contact_probability.ipynb b/src/contact_probability.ipynb index acce861..125d9f8 100644 --- a/src/contact_probability.ipynb +++ b/src/contact_probability.ipynb @@ -2,7 +2,6 @@ "cells": [ { "cell_type": "markdown", - "id": "de9935d6", "metadata": {}, "source": [ "### This code calculate the contact probability using mdtraj and numpy libraries." @@ -11,11 +10,23 @@ { "cell_type": "code", "execution_count": null, - "id": "bf90731c", + "metadata": { + "collapsed": false, + "tags": [ + "command" + ] + }, + "outputs": [], + "source": [ + "!/usr/bin/env python3" + ] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "#!/usr/bin/env python3\n", "# usage: python3 contact_probability.py #MODEL(AA or CA) #PDB_BASE #XTC_FILE \\\n", "# #file.cont_FILE #OUTPUT\n", "#\n", @@ -29,7 +40,6 @@ { "cell_type": "code", "execution_count": null, - "id": "a259576a", "metadata": {}, "outputs": [], "source": [ @@ -149,7 +159,6 @@ }, { "cell_type": "markdown", - "id": "643e087b", "metadata": {}, "source": [ "#### Here starts the main part. Be sure to use the right files." @@ -158,7 +167,6 @@ { "cell_type": "code", "execution_count": null, - "id": "3d8759ee", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +209,6 @@ }, { "cell_type": "markdown", - "id": "7cf8ab0a", "metadata": {}, "source": [ "Uncomment the first lines below with the 'sys.argv' to run the notebook\n", @@ -212,7 +219,6 @@ }, { "cell_type": "markdown", - "id": "d7540886", "metadata": {}, "source": [ "`sys.argv = \"contact_probability.py AA ../share/ci2-AA-120-run.gro ../share/ci2-AA-120-run.xtc ../share/ci2-AA-contacts.dat output\".split()`" @@ -221,7 +227,6 @@ { "cell_type": "code", "execution_count": null, - "id": "98b1340c", "metadata": {}, "outputs": [], "source": [ @@ -231,7 +236,25 @@ ] } ], - "metadata": {}, + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.0" + } + }, "nbformat": 4, - "nbformat_minor": 5 + "nbformat_minor": 2 }