Skip to content

Commit 917c493

Browse files
committed
Add humanization test
1 parent 924fece commit 917c493

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/pytest/test_sapiens.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import numpy as np
22
import sapiens
3+
from abnumber import Chain
4+
from biophi.humanization.methods.humanization import humanize_chain, SapiensHumanizationParams
35

46

57
def test_sapiens_predict():
@@ -11,3 +13,17 @@ def test_sapiens_predict():
1113
)
1214
assert pred.shape == (len(seq), 20), 'Expected matrix (length of sequence * 20 amino acids)'
1315
assert (pred.idxmax(axis=1).values == np.array(list(seq))).sum() > 100, 'Prediction should be similar to input sequence'
16+
17+
18+
def test_sapiens_humanize():
19+
seq = 'QVQLVQSGVEVKKPGASVKVSCKASGYTFTNYYMYWVRQAPGQGLEWMGGINPSNGGTNFNEKFKNRVTLTTDSSTTTAYMELKSLQFDDTAVYYCARRDYRFDMGFDYWGQGTTVTVSS'
20+
chain = Chain(seq, scheme='kabat')
21+
humanization_params = SapiensHumanizationParams(
22+
model_version='latest',
23+
humanize_cdrs=False,
24+
scheme='kabat',
25+
cdr_definition='kabat',
26+
iterations=1
27+
)
28+
humanization = humanize_chain(chain, params=humanization_params)
29+
assert humanization.humanized_chain.seq == 'QVQLVQSGAEVKKPGASVKVSCKASGYTFTNYYMYWVRQAPGQGLEWMGGINPSNGGTNFNEKFKNRVTLTTDTSTTTAYMELRSLRSDDTAVYYCARRDYRFDMGFDYWGQGTLVTVSS'

0 commit comments

Comments
 (0)