Skip to content

Commit

Permalink
chore: rename m7g -> larp1_dm15
Browse files Browse the repository at this point in the history
  • Loading branch information
aalexmmaldonado committed May 22, 2024
1 parent 6d35ea4 commit bcac052
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 41 deletions.
16 changes: 8 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ def tmp_dir():


@pytest.fixture
def path_m7g_paths():
def path_larp1_dm15_paths():
paths = {
"topo": os.path.join(TEST_DIR, "files/m7g/mol.prmtop"),
"ref_pdb": os.path.join(TEST_DIR, "files/m7g/mol.pdb"),
"traj": os.path.join(TEST_DIR, "files/m7g/mol.nc"),
"restart": os.path.join(TEST_DIR, "files/m7g/mol.rst"),
"topo": os.path.join(TEST_DIR, "files/larp1_dm15/mol.prmtop"),
"ref_pdb": os.path.join(TEST_DIR, "files/larp1_dm15/mol.pdb"),
"traj": os.path.join(TEST_DIR, "files/larp1_dm15/mol.nc"),
"restart": os.path.join(TEST_DIR, "files/larp1_dm15/mol.rst"),
}
return paths


@pytest.fixture
def m7g_config():
def larp1_dm15_config():
subpex_config = SubpexConfig()
subpex_config.pocket.center = [30.037991, 41.463818, 30.3776]
subpex_config.pocket.radius = 6.5
subpex_config.pocket.water_dist = 6.7
subpex_config.pocket.selection_str = "resid 124 or resid 125 or resid 128 or resid 88 or resid 89 or resid 121 or resid 92 or resid 129 and (not name H*)"
subpex_config.sim.path_traj_relax = os.path.join(
TEST_DIR, "files/m7g/equil_frames.nc"
TEST_DIR, "files/larp1_dm15/equil_frames.nc"
)
subpex_config.sim.path_topo = os.path.join(TEST_DIR, "files/m7g/mol.prmtop")
subpex_config.sim.path_topo = os.path.join(TEST_DIR, "files/larp1_dm15/mol.prmtop")
for aux_data in subpex_config.data.aux.get_all():
aux_data.active = True
return subpex_config
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions tests/test_pocket_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from subpex.pocket.detect import get_fop_pocket_convenience, get_pocket_selection


def test_pocket_selection_m7g(
path_m7g_paths: MutableMapping[str, str], m7g_config: SubpexConfig
def test_pocket_selection_larp1_dm15(
path_larp1_dm15_paths: MutableMapping[str, str], larp1_dm15_config: SubpexConfig
) -> None:
"""
Test the selection of atoms for the binding pocket in a molecular dynamics simulation.
Expand All @@ -17,28 +17,28 @@ def test_pocket_selection_m7g(
is compared against a known selection string from the configuration.
Args:
path_m7g_paths (dict): Dictionary containing paths to the input files required for the test:
path_larp1_dm15_paths (dict): Dictionary containing paths to the input files required for the test:
- "ref_pdb": Path to the reference PDB file.
m7g_config (object): Configuration object for the simulation which includes the parameters
larp1_dm15_config (object): Configuration object for the simulation which includes the parameters
for defining the pocket (center, radius, and selection distance).
Raises:
AssertionError: If the computed pocket selection string does not match the expected value.
"""
# Load structure
u = mda.Universe(path_m7g_paths["ref_pdb"])
u = mda.Universe(path_larp1_dm15_paths["ref_pdb"])

pocket_selection = get_pocket_selection(
u,
center=m7g_config.pocket.center, # type: ignore
radius=m7g_config.pocket.radius,
water_dist=m7g_config.pocket.water_dist, # type: ignore
center=larp1_dm15_config.pocket.center, # type: ignore
radius=larp1_dm15_config.pocket.radius,
water_dist=larp1_dm15_config.pocket.water_dist, # type: ignore
)
assert pocket_selection == m7g_config.pocket.selection_str
assert pocket_selection == larp1_dm15_config.pocket.selection_str


def test_pocket_fop_gen_m7g(
path_m7g_paths: MutableMapping[str, str], m7g_config: SubpexConfig
def test_pocket_fop_gen_larp1_dm15(
path_larp1_dm15_paths: MutableMapping[str, str], larp1_dm15_config: SubpexConfig
) -> None:
"""
Test the generation of the Frame of Pocket (FOP) for the binding pocket in a molecular dynamics simulation.
Expand All @@ -48,17 +48,17 @@ def test_pocket_fop_gen_m7g(
and specific coordinates of a known atom are verified against expected values.
Args:
path_m7g_paths (dict): Dictionary containing paths to the input files required for the test:
path_larp1_dm15_paths (dict): Dictionary containing paths to the input files required for the test:
- "ref_pdb": Path to the reference PDB file.
m7g_config (object): Configuration object for the simulation which includes settings for
larp1_dm15_config (object): Configuration object for the simulation which includes settings for
detecting the pocket.
Raises:
AssertionError: If the number of detected pocket atoms or the coordinates of a specific
atom do not match the expected values.
"""
u = mda.Universe(path_m7g_paths["ref_pdb"])
fop_frame = get_fop_pocket_convenience(u.atoms, m7g_config)
u = mda.Universe(path_larp1_dm15_paths["ref_pdb"])
fop_frame = get_fop_pocket_convenience(u.atoms, larp1_dm15_config)

assert len(fop_frame) == 1057
assert fop_frame[57] == [31.5, 38.5, 31.0]
30 changes: 15 additions & 15 deletions tests/test_traj_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from subpex.pocket.detect import get_fop_pocket_convenience


def test_traj_data_m7g(path_m7g_paths, m7g_config, tmp_dir):
def test_traj_data_larp1_dm15(path_larp1_dm15_paths, larp1_dm15_config, tmp_dir):
"""
Test the computation of auxiliary data during a simulation for the binding pocket descriptors.
Expand All @@ -17,11 +17,11 @@ def test_traj_data_m7g(path_m7g_paths, m7g_config, tmp_dir):
topology, and trajectory files, and verifies the computed auxiliary data against known values.
Args:
path_m7g_paths (dict): Dictionary containing paths to the input files required for the test:
path_larp1_dm15_paths (dict): Dictionary containing paths to the input files required for the test:
- "ref_pdb": Path to the reference PDB file.
- "topo": Path to the topology file.
- "traj": Path to the trajectory file.
m7g_config (object): Configuration object for the simulation which includes settings and
larp1_dm15_config (object): Configuration object for the simulation which includes settings and
parameters for computing the auxiliary data.
tmp_dir (str): Path to a temporary directory for writing output data during the test.
Expand Down Expand Up @@ -52,20 +52,20 @@ def test_traj_data_m7g(path_m7g_paths, m7g_config, tmp_dir):
is the last frame of the same simulation, properties compared to the reference should
be close to zero.
"""
u = mda.Universe(path_m7g_paths["ref_pdb"])
fop_ref = get_fop_pocket_convenience(u.atoms, m7g_config)
u = mda.Universe(path_larp1_dm15_paths["ref_pdb"])
fop_ref = get_fop_pocket_convenience(u.atoms, larp1_dm15_config)

write_dir = os.path.join(tmp_dir, "m7g/calc-data/")
write_dir = os.path.join(tmp_dir, "larp1_dm15/calc-data/")
if os.path.exists(write_dir):
shutil.rmtree(write_dir)
os.makedirs(write_dir, exist_ok=False)

run_compute_data(
topo_path=path_m7g_paths["topo"],
traj_path=path_m7g_paths["traj"],
ref_path=path_m7g_paths["ref_pdb"],
topo_path=path_larp1_dm15_paths["topo"],
traj_path=path_larp1_dm15_paths["traj"],
ref_path=path_larp1_dm15_paths["ref_pdb"],
fop_ref=fop_ref,
subpex_config=m7g_config,
subpex_config=larp1_dm15_config,
selection_align_suffix=" and backbone",
write=False,
write_dir=write_dir,
Expand All @@ -81,7 +81,7 @@ def test_traj_data_m7g(path_m7g_paths, m7g_config, tmp_dir):
0.0002885486464947462,
]
),
np.array(m7g_config.data.aux.backbone_rmsd.values),
np.array(larp1_dm15_config.data.aux.backbone_rmsd.values),
)
assert np.allclose(
np.array(
Expand All @@ -93,7 +93,7 @@ def test_traj_data_m7g(path_m7g_paths, m7g_config, tmp_dir):
0.0,
]
),
np.array(m7g_config.data.aux.pocket_jd.values),
np.array(larp1_dm15_config.data.aux.pocket_jd.values),
)
assert np.allclose(
np.array(
Expand All @@ -105,7 +105,7 @@ def test_traj_data_m7g(path_m7g_paths, m7g_config, tmp_dir):
0.0003747374867089093,
]
),
np.array(m7g_config.data.aux.pocket_rmsd.values),
np.array(larp1_dm15_config.data.aux.pocket_rmsd.values),
)
assert np.allclose(
np.array(
Expand All @@ -117,9 +117,9 @@ def test_traj_data_m7g(path_m7g_paths, m7g_config, tmp_dir):
3.2499845795814117,
]
),
np.array(m7g_config.data.aux.pocket_rog.values),
np.array(larp1_dm15_config.data.aux.pocket_rog.values),
)
assert np.allclose(
np.array([129.625, 123.25, 126.25, 124.625, 129.0]),
np.array(m7g_config.data.aux.pocket_volume.values),
np.array(larp1_dm15_config.data.aux.pocket_volume.values),
)
6 changes: 3 additions & 3 deletions tests/test_westpa_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
from subpex.setup.westpa.main import run_westpa_setup


def test_westpa_init_m7g(path_m7g_paths, m7g_config, tmp_dir):
def test_westpa_init_larp1_dm15(path_larp1_dm15_paths, larp1_dm15_config, tmp_dir):
westpa_config = WestpaConfig()
write_dir = os.path.join(tmp_dir, "westpa_init_m7g")
write_dir = os.path.join(tmp_dir, "westpa_init_larp1_dm15")
if os.path.exists(write_dir):
shutil.rmtree(write_dir)

# Setup WESTPA
westpa_config.env.load_modules = ["gcc/10.2.0", "openmpi/4.1.1", "amber/22"]

run_westpa_setup(
subpex_config=m7g_config,
subpex_config=larp1_dm15_config,
westpa_config=westpa_config,
write_dir=write_dir,
overwrite=True,
Expand Down

0 comments on commit bcac052

Please sign in to comment.