Skip to content

Commit

Permalink
Add humanization test
Browse files Browse the repository at this point in the history
  • Loading branch information
prihoda committed Mar 29, 2022
1 parent 924fece commit 917c493
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/pytest/test_sapiens.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import numpy as np
import sapiens
from abnumber import Chain
from biophi.humanization.methods.humanization import humanize_chain, SapiensHumanizationParams


def test_sapiens_predict():
Expand All @@ -11,3 +13,17 @@ def test_sapiens_predict():
)
assert pred.shape == (len(seq), 20), 'Expected matrix (length of sequence * 20 amino acids)'
assert (pred.idxmax(axis=1).values == np.array(list(seq))).sum() > 100, 'Prediction should be similar to input sequence'


def test_sapiens_humanize():
seq = 'QVQLVQSGVEVKKPGASVKVSCKASGYTFTNYYMYWVRQAPGQGLEWMGGINPSNGGTNFNEKFKNRVTLTTDSSTTTAYMELKSLQFDDTAVYYCARRDYRFDMGFDYWGQGTTVTVSS'
chain = Chain(seq, scheme='kabat')
humanization_params = SapiensHumanizationParams(
model_version='latest',
humanize_cdrs=False,
scheme='kabat',
cdr_definition='kabat',
iterations=1
)
humanization = humanize_chain(chain, params=humanization_params)
assert humanization.humanized_chain.seq == 'QVQLVQSGAEVKKPGASVKVSCKASGYTFTNYYMYWVRQAPGQGLEWMGGINPSNGGTNFNEKFKNRVTLTTDTSTTTAYMELRSLRSDDTAVYYCARRDYRFDMGFDYWGQGTLVTVSS'

0 comments on commit 917c493

Please sign in to comment.