-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_omegafold.py
49 lines (35 loc) · 1.21 KB
/
test_omegafold.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import warnings
warnings.filterwarnings("ignore")
import os
import numpy
import pandas
import prody
import yabul
import proteopt
import proteopt.common
import proteopt.omegafold
DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data")
from .util import OMEGAFOLD_WEIGHTS_DIR
model = proteopt.omegafold.OmegaFold(data_dir=OMEGAFOLD_WEIGHTS_DIR)
def test_basic():
# Predict a peptide
prediction = model.run("SIINFEKL")
print(prediction)
assert prediction.ca.getSequence() == "SIINFEKL"
assert (prediction.getCoords()**2).sum() > 0
def test_multiple():
# Run a bunch of peptide predictions at once
items = []
for i in range(10):
items.append("SIIN" * numpy.random.randint(3, 10))
predictions = model.run_multiple(items)
for (i, prediction) in enumerate(predictions):
assert prediction.ca.getSequence() == items[i]
def test_ground_truth():
# Compare to ground truth for a real structure
truth = prody.parsePDB(
os.path.join(DATA_DIR, "1MBN.pdb")).select("protein chain A")
prediction = model.run(truth.ca.getSequence())
rmsd = proteopt.common.calculate_rmsd(truth, prediction)
print("All atom rmsd", rmsd)
assert rmsd < 3.0