Skip to content

Commit

Permalink
test: suppress some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniBodor committed Jan 16, 2024
1 parent 3a891f1 commit 3ee5785
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
8 changes: 5 additions & 3 deletions deeprank2/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,11 @@ def save_hist(
else:
raise ValueError("Please provide valid features names. They must be present in the current :class:`DeeprankDataset` children instance.")

fig.tight_layout()
fig.savefig(fname)
plt.close(fig)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fig.tight_layout()
fig.savefig(fname)
plt.close(fig)

def _compute_mean_std(self):
means = {
Expand Down
6 changes: 5 additions & 1 deletion tests/features/test_secondary_structure.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import numpy as np

from deeprank2.domain import nodestorage as Nfeat
Expand All @@ -19,7 +21,9 @@ def test_secondary_structure_residue():
influence_radius=10,
max_edge_length=10,
)
add_features(pdb_path, graph)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
add_features(pdb_path, graph)

# Create a list of node information (residue number, chain ID, and secondary structure features)
node_info_list = [[node.id.number, node.id.chain.id, node.features[Nfeat.SECSTRUCT]] for node in graph.nodes]
Expand Down
39 changes: 21 additions & 18 deletions tests/tools/test_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import shutil
import tempfile
import unittest
import warnings

from pdb2sql import StructureSimilarity

Expand Down Expand Up @@ -34,25 +35,27 @@ def test_add_target(self):
os.remove(graph_path)

def test_compute_ppi_scores(self):
scores = compute_ppi_scores(
os.path.join(self.pdb_path, "1ATN_1w.pdb"),
os.path.join(self.ref, "1ATN.pdb"),
)
with warnings.catch_warnings():
warnings.simplefilter("ignore")

sim = StructureSimilarity(
os.path.join(self.pdb_path, "1ATN_1w.pdb"),
os.path.join(self.ref, "1ATN.pdb"),
enforce_residue_matching=False,
)
lrmsd = sim.compute_lrmsd_fast(method="svd")
irmsd = sim.compute_irmsd_fast(method="svd")
fnat = sim.compute_fnat_fast()
dockq = sim.compute_DockQScore(fnat, lrmsd, irmsd)
binary = irmsd < 4.0
capri = 4
for thr, val in zip([6.0, 4.0, 2.0, 1.0], [4, 3, 2, 1], strict=True):
if irmsd < thr:
capri = val
scores = compute_ppi_scores(
os.path.join(self.pdb_path, "1ATN_1w.pdb"),
os.path.join(self.ref, "1ATN.pdb"),
)
sim = StructureSimilarity(
os.path.join(self.pdb_path, "1ATN_1w.pdb"),
os.path.join(self.ref, "1ATN.pdb"),
enforce_residue_matching=False,
)
lrmsd = sim.compute_lrmsd_fast(method="svd")
irmsd = sim.compute_irmsd_fast(method="svd")
fnat = sim.compute_fnat_fast()
dockq = sim.compute_DockQScore(fnat, lrmsd, irmsd)
binary = irmsd < 4.0
capri = 4
for thr, val in zip([6.0, 4.0, 2.0, 1.0], [4, 3, 2, 1], strict=True):
if irmsd < thr:
capri = val

assert scores["irmsd"] == irmsd
assert scores["lrmsd"] == lrmsd
Expand Down

0 comments on commit 3ee5785

Please sign in to comment.