From 917c493ee3aaa12bfee730ac61e95a3693ccb026 Mon Sep 17 00:00:00 2001 From: David Prihoda Date: Tue, 29 Mar 2022 11:29:54 +0200 Subject: [PATCH] Add humanization test --- tests/pytest/test_sapiens.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/pytest/test_sapiens.py b/tests/pytest/test_sapiens.py index b81e3d6..92e2f61 100644 --- a/tests/pytest/test_sapiens.py +++ b/tests/pytest/test_sapiens.py @@ -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(): @@ -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' \ No newline at end of file