Skip to content

Commit

Permalink
Merge pull request #50 from HITS-MBM/issue-48
Browse files Browse the repository at this point in the history
Issue 48: fix residue coordinates by aligning index group
  • Loading branch information
BerndDoser authored May 16, 2023
2 parents 100f8e5 + 8154f45 commit c359ccf
Show file tree
Hide file tree
Showing 17 changed files with 1,295 additions and 111 deletions.
23 changes: 12 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
},
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
]
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"DavidSchuldenfrei.gtest-adapter"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/fda-graph-test",
"args": [],
"args": ["--gtest_filter=AllFDAGraphTests/FDAGraphTest.text/8"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
Expand Down
28 changes: 27 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,31 @@
"numbers": "cpp",
"semaphore": "cpp",
"stop_token": "cpp"
}
},
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "googletest.failed",
"settings": {
"foreground": "#f00"
}
},
{
"scope": "googletest.passed",
"settings": {
"foreground": "#0f0"
}
},
{
"scope": "googletest.run",
"settings": {
"foreground": "#0f0"
}
}
]
},
"gtest-adapter.debugConfig": [
"(gdb) fda-graph-test"
],
"gtest-adapter.supportLocation": false
}
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pipeline {

agent {
dockerfile {
label 'docker-gpu-host'
filename 'devel/Dockerfile'
}
}
Expand Down
1 change: 1 addition & 0 deletions src/gromacs/gmxana/fda/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gmx_add_gtest_executable(
FDAGraphTest.cpp
FDAShortestPathTest.cpp
FDAViewStressTest.cpp
GraphTest.cpp
PDBTest.cpp
)

Expand Down
19 changes: 13 additions & 6 deletions src/gromacs/gmxana/fda/tests/FDAGraphTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ TEST_P(FDAGraphTest, binary)
}

INSTANTIATE_TEST_CASE_P(AllFDAGraphTests, FDAGraphTest, ::testing::Values(
TestDataStructure(
TestDataStructure( // 0
"maxime_all_prot",
{"-i", "cap0_all_prot.pfr", "-diff", "cap1_all_prot.pfr", "-s", "1G6N.pdb",
"-n", "index.ndx", "-frame", "0", "-t", "100", "-min", "2", "-convert"},
"C-alpha",
"result.pdb",
"FDAGraphTest.ref0.pdb"
),
TestDataStructure(
TestDataStructure( // 1
"maxime_all_prot",
{"-i", "cap0_all_prot.pfr", "-diff", "cap1_all_prot.pfr", "-s", "1G6N.pdb",
"-n", "index.ndx", "-frame", "0", "-t", "20", "-min", "2", "-convert"},
Expand All @@ -141,21 +141,21 @@ INSTANTIATE_TEST_CASE_P(AllFDAGraphTests, FDAGraphTest, ::testing::Values(
"result.pdb",
"FDAGraphTest.ref2.pdb"
),
TestDataStructure(
TestDataStructure( // 3
"alagly",
{"-i", "fda.pfa", "-s", "conf.gro", "-frame", "all", "-t", "1000", "-pymol", "result.pml"},
"",
"result.pdb",
"FDAGraphTest.ref3.pdb"
),
TestDataStructure(
TestDataStructure( // 4
"alagly",
{"-i", "fda.pfa", "-s", "conf.gro", "-frame", "skip 3", "-t", "1000", "-pymol", "result.pml"},
"",
"result.pdb",
"FDAGraphTest.ref4.pdb"
),
TestDataStructure(
TestDataStructure( // 5
"alagly",
{"-i", "fda.pfa", "-s", "conf.gro", "-frame", "average 3", "-t", "1000", "-pymol", "result.pml"},
"",
Expand All @@ -169,13 +169,20 @@ INSTANTIATE_TEST_CASE_P(AllFDAGraphTests, FDAGraphTest, ::testing::Values(
"result.pdb",
"FDAGraphTest.ref6.pdb"
),
TestDataStructure(
TestDataStructure( // 7
"maxime_all_prot",
{"-i", "cap0_all_prot.pfr", "-diff", "cap1_all_prot.pfr", "-s", "1G6N.pdb",
"-n", "index.ndx", "-frame", "0", "-t", "100", "-min", "4", "-convert", "-big"},
"C-alpha",
"result.pdb",
"FDAGraphTest.ref7.pdb"
),
TestDataStructure( // 8
"alagly",
{"-i", "fda.pfr", "-s", "conf.gro", "-n", "index.ndx", "-frame", "0"},
"C-alpha",
"result.pdb",
"FDAGraphTest.ref8.pdb"
)
));

Expand Down
36 changes: 36 additions & 0 deletions src/gromacs/gmxana/fda/tests/GraphTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* GraphTest.cpp
*
* Created on: Oct 17, 2022
* Author: Bernd Doser, HITS gGmbH <[email protected]>
*/

#include <iostream>
#include <string>
#include <vector>
#include <gtest/gtest.h>
#include "gromacs/gmxana/fda/Graph.h"
#include "testutils/cmdlinetest.h"

using namespace fda_analysis;

//! Test fixture for FDA
class GraphTest : public gmx::test::CommandLineTestBase
{};

TEST_F(GraphTest, empty)
{
Graph graph;
}

TEST_F(GraphTest, residue)
{
std::vector<double> forceMatrix{1.0, 1.0, 1.0, 1.0};
rvec coord_traj[3] = {{1.0, 1.1, 1.2}, {2.0, 2.1, 2.2}, {3.0, 3.1, 3.2}};
int index[2] = {0, 1};
int isize = 2;

Graph graph(forceMatrix, coord_traj, index, isize);

std::cout << graph << std::endl;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ATOM 1 2 -0.000 0.060 -0.490 1.003437.44 AA
ATOM 2 3 3.700 0.320 -1.170 1.003437.44 AA
CONECT 1 2
ENDMDL
68 changes: 22 additions & 46 deletions src/gromacs/gmxana/fda/tests/data/alagly/index.ndx
Original file line number Diff line number Diff line change
@@ -1,46 +1,22 @@
[ all ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

[ ala ]
1
2
3
4
5
6
7
8
9
10
11
12

[ gly ]
13
14
15
16
17
18
19
20

[ System ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20
[ Protein ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20
[ Protein-H ]
1 5 7 11 12 13 15 18 19 20
[ C-alpha ]
1 1 5 15
[ Backbone ]
1 5 11 13 15 18
[ MainChain ]
1 5 11 12 13 15 18 19 20
[ MainChain+Cb ]
1 5 7 11 12 13 15 18 19 20
[ MainChain+H ]
1 2 3 4 5 11 12 13 14 15 18 19 20
[ SideChain ]
6 7 8 9 10 16 17
[ SideChain-H ]
7
41 changes: 41 additions & 0 deletions src/gromacs/gmxana/fda/tests/data/alagly/result.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ATOM 1 2 -0.410 -1.740 -1.310 1.003437.44 AA
ATOM 2 3 -0.410 -1.740 0.330 1.003437.44 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.414 -1.736 -1.304 1.003012.43 AA
ATOM 2 3 -0.358 -1.713 0.330 1.003012.43 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.415 -1.736 -1.301 1.002642.37 AA
ATOM 2 3 -0.306 -1.687 0.331 1.002642.37 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.412 -1.739 -1.304 1.001851.51 AA
ATOM 2 3 -0.255 -1.664 0.332 1.001851.51 AA
CONECT 1 2
ENDMDL
ENDMDL
ATOM 1 2 -0.398 -1.752 -1.316 1.001287.64 AA
ATOM 2 3 -0.175 -1.620 0.323 1.001287.64 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.391 -1.758 -1.321 1.002612.83 AA
ATOM 2 3 -0.151 -1.599 0.311 1.002612.83 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.384 -1.762 -1.322 1.003843.68 AA
ATOM 2 3 -0.136 -1.581 0.296 1.003843.68 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.380 -1.761 -1.318 1.004795.50 AA
ATOM 2 3 -0.131 -1.566 0.281 1.004795.50 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.378 -1.758 -1.310 1.005377.95 AA
ATOM 2 3 -0.131 -1.558 0.270 1.005377.95 AA
CONECT 1 2
ENDMDL
ATOM 1 2 -0.377 -1.754 -1.301 1.005551.85 AA
ATOM 2 3 -0.133 -1.557 0.266 1.005551.85 AA
CONECT 1 2
ENDMDL
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ATOM 1 2 -0.000 0.060 -0.490 1.003437.44 AA
ATOM 2 3 3.700 0.320 -1.170 1.003437.44 AA
CONECT 1 2
ENDMDL
68 changes: 22 additions & 46 deletions src/gromacs/gmxana/fda/tests/data/alagly_binary/index.ndx
Original file line number Diff line number Diff line change
@@ -1,46 +1,22 @@
[ all ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

[ ala ]
1
2
3
4
5
6
7
8
9
10
11
12

[ gly ]
13
14
15
16
17
18
19
20

[ System ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20
[ Protein ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20
[ Protein-H ]
1 5 7 11 12 13 15 18 19 20
[ C-alpha ]
1 1 5 15
[ Backbone ]
1 5 11 13 15 18
[ MainChain ]
1 5 11 12 13 15 18 19 20
[ MainChain+Cb ]
1 5 7 11 12 13 15 18 19 20
[ MainChain+H ]
1 2 3 4 5 11 12 13 14 15 18 19 20
[ SideChain ]
6 7 8 9 10 16 17
[ SideChain-H ]
7
8 changes: 8 additions & 0 deletions src/gromacs/gmxana/gmx_fda_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,15 @@ int gmx_fda_graph(int argc, char *argv[])
// Convert from kJ/mol/nm into pN
if (convert) for (auto & f : forceMatrix) f *= 1.66;

std::cout << "isize " << isize << std::endl;
std::cout << "index ";
for (int i = 0; i != isize; ++i) {
std::cout << index[i] << " ";
}
std::cout << std::endl;
Graph graph(forceMatrix, coord, index, isize);
std::cout << graph << std::endl;

if (resultFormat == PDB)
graph.convertInPDBMinGraphOrder(opt2fn("-o", NFILE, fnm), threshold, minGraphOrder, onlyBiggestNetwork, false);
else if (resultFormat == DIMACS)
Expand Down
Loading

0 comments on commit c359ccf

Please sign in to comment.