-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #690 from haddocking/alascan2.0
alascan module
- Loading branch information
Showing
16 changed files
with
1,412 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ignore: | ||
- "tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# ================================================== | ||
# Alanine Scan with HADDOCK3 | ||
# | ||
# This example workflow will refine a complex in 10 | ||
# different models, cluster them, and then do an | ||
# alanine scan across the whole interface. | ||
# ================================================== | ||
|
||
# General parameters | ||
run_dir = "run1-alanine-scan" | ||
ncores = 10 | ||
|
||
# Input | ||
molecules = ["../docking-protein-protein/data/e2a-hpr_1GGR.pdb"] | ||
|
||
# Workflow definition | ||
# ==================================================================== | ||
[topoaa] | ||
autohis = true | ||
|
||
[mdref] | ||
# this will produce 10 refined models | ||
sampling_factor = 10 | ||
|
||
[caprieval] | ||
reference_fname="../docking-protein-protein/data/e2a-hpr_1GGR.pdb" | ||
|
||
[rmsdmatrix] | ||
|
||
[clustrmsd] | ||
tolerance=2 | ||
|
||
[alascan] | ||
scan_residue="ALA" | ||
output=true | ||
plot=true | ||
int_cutoff = 3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import tempfile | ||
from pathlib import Path | ||
|
||
import pytest | ||
import shutil | ||
import pandas as pd | ||
import numpy as np | ||
|
||
from haddock.modules.analysis.alascan import DEFAULT_CONFIG as DEFAULT_ALASCAN_CONFIG | ||
from haddock.modules.analysis.alascan import HaddockModule as AlascanModule | ||
from haddock.libs.libontology import PDBFile | ||
from . import CNS_EXEC, DATA_DIR, has_cns | ||
from tests import golden_data | ||
|
||
@pytest.fixture | ||
def alascan_module(): | ||
"""Return a default alascan module.""" | ||
with tempfile.TemporaryDirectory(dir=".") as tmpdir: | ||
alascan = AlascanModule( | ||
order=0, path=".", initial_params=DEFAULT_ALASCAN_CONFIG | ||
) | ||
alascan.params["int_cutoff"] = 3.5 | ||
yield alascan | ||
|
||
class MockPreviousIO(): | ||
def __init__(self, path): | ||
self.path = path | ||
|
||
def retrieve_models(self, individualize: bool = False): | ||
shutil.copy(Path(golden_data, "protprot_complex_1.pdb"), Path(".", "protprot_complex_1.pdb")) | ||
shutil.copy(Path(golden_data, "protprot_complex_2.pdb"), Path(".", "protprot_complex_2.pdb")) | ||
model_list = [ | ||
PDBFile(file_name="protprot_complex_1.pdb", path="."), | ||
PDBFile(file_name="protprot_complex_2.pdb", path="."), | ||
] | ||
|
||
return model_list | ||
|
||
def output(self): | ||
return None | ||
|
||
@has_cns | ||
def test_alascan_default(alascan_module, mocker): | ||
"""Test the alascan module.""" | ||
alascan_module.previous_io = MockPreviousIO(path=alascan_module.path) | ||
alascan_module.run() | ||
|
||
expected_csv1 = Path(alascan_module.path, "scan_protprot_complex_1.csv") | ||
expected_csv2 = Path(alascan_module.path, "scan_protprot_complex_2.csv") | ||
expected_clt_csv = Path(alascan_module.path, "scan_clt_-.csv") | ||
|
||
assert expected_csv1.exists(), f"{expected_csv1} does not exist" | ||
assert expected_csv2.exists(), f"{expected_csv2} does not exist" | ||
assert expected_clt_csv.exists(), f"{expected_clt_csv} does not exist" | ||
|
||
# check single complex csv | ||
df = pd.read_csv(expected_csv1, sep="\t", comment="#") | ||
assert df.shape == (10, 16), f"{expected_csv1} has wrong shape" | ||
# ARG 17 B should have a delta_score approximately equal to 28.53 | ||
assert np.isclose( | ||
df.loc[df["ori_resname"] == "ARG"].iloc[0,:]["delta_score"], | ||
28.53, | ||
atol=10) | ||
|
||
# check clt csv | ||
df_clt = pd.read_csv(expected_clt_csv, sep="\t", comment="#") | ||
assert df_clt.shape == (18, 11), f"{expected_clt_csv} has wrong shape" | ||
# average delta score of A-38-ASP should be around 8.18 | ||
assert np.isclose( | ||
df_clt.loc[df_clt["full_resname"] == "A-38-ASP"]["delta_score"], | ||
8.18, | ||
atol=2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.