test file removed
Browse files- test_adapter_fix.py +0 -65
- test_align.py +0 -34
- test_app_output.py +0 -56
- test_integrated_adapter.py +0 -158
- test_module_loading.py +0 -19
- test_original_compatibility.py +0 -69
test_adapter_fix.py
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
-
|
3 |
-
import sys
|
4 |
-
import os
|
5 |
-
from transformers import AutoModel, AutoTokenizer
|
6 |
-
from transformers.utils import cached_file
|
7 |
-
|
8 |
-
def test_adapter_from_outside():
|
9 |
-
"""Test loading the adapter from outside the repository"""
|
10 |
-
print("π§ͺ Testing adapter loading from outside repository...")
|
11 |
-
|
12 |
-
# Clear cache first
|
13 |
-
cache_dir = os.path.expanduser("~/.cache/huggingface/hub/models--hemantn--ablang2")
|
14 |
-
if os.path.exists(cache_dir):
|
15 |
-
import shutil
|
16 |
-
shutil.rmtree(cache_dir)
|
17 |
-
print("ποΈ Cleared Hugging Face cache")
|
18 |
-
|
19 |
-
try:
|
20 |
-
# Load model and tokenizer
|
21 |
-
print("π₯ Loading model and tokenizer...")
|
22 |
-
model = AutoModel.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
23 |
-
tokenizer = AutoTokenizer.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
24 |
-
|
25 |
-
# Find the cached model directory and import adapter
|
26 |
-
adapter_path = cached_file("hemantn/ablang2", "adapter.py")
|
27 |
-
cached_model_dir = os.path.dirname(adapter_path)
|
28 |
-
sys.path.insert(0, cached_model_dir)
|
29 |
-
|
30 |
-
print(f"π Cached model directory: {cached_model_dir}")
|
31 |
-
print(f"π Files in cached directory:")
|
32 |
-
for f in os.listdir(cached_model_dir):
|
33 |
-
print(f" {f}")
|
34 |
-
|
35 |
-
# Import and create the adapter
|
36 |
-
print("π§ Importing adapter...")
|
37 |
-
from adapter import AbLang2PairedHuggingFaceAdapter
|
38 |
-
ablang = AbLang2PairedHuggingFaceAdapter(model=model, tokenizer=tokenizer)
|
39 |
-
print("β
Adapter created successfully!")
|
40 |
-
|
41 |
-
# Test basic functionality
|
42 |
-
print("𧬠Testing restore functionality...")
|
43 |
-
test_seq = [
|
44 |
-
'EVQ***SGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCAR**PGHGAAFMDVWGTGTTVTVSS',
|
45 |
-
'DIQLTQSPLSLPVTLGQPASISCRSS*SLEASDTNIYLSWFQQRPGQSPRRLIYKI*NRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK'
|
46 |
-
]
|
47 |
-
|
48 |
-
restored = ablang(test_seq, mode='restore')
|
49 |
-
print("β
Restore functionality working!")
|
50 |
-
print(f"π Restored sequences: {len(restored)}")
|
51 |
-
|
52 |
-
return True
|
53 |
-
|
54 |
-
except Exception as e:
|
55 |
-
print(f"β Error: {e}")
|
56 |
-
import traceback
|
57 |
-
traceback.print_exc()
|
58 |
-
return False
|
59 |
-
|
60 |
-
if __name__ == "__main__":
|
61 |
-
success = test_adapter_from_outside()
|
62 |
-
if success:
|
63 |
-
print("π All tests passed! The adapter works from outside the repository.")
|
64 |
-
else:
|
65 |
-
print("π₯ Tests failed. The adapter still has issues.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_align.py
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
import sys
|
2 |
-
import os
|
3 |
-
from transformers import AutoModel, AutoTokenizer
|
4 |
-
from transformers.utils import cached_file
|
5 |
-
|
6 |
-
# Load model and tokenizer from Hugging Face Hub
|
7 |
-
print("Loading model and tokenizer...")
|
8 |
-
model = AutoModel.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
9 |
-
tokenizer = AutoTokenizer.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
10 |
-
|
11 |
-
# Find the cached model directory and import adapter
|
12 |
-
adapter_path = cached_file("hemantn/ablang2", "adapter.py")
|
13 |
-
cached_model_dir = os.path.dirname(adapter_path)
|
14 |
-
sys.path.insert(0, cached_model_dir)
|
15 |
-
|
16 |
-
# Import and create the adapter
|
17 |
-
from adapter import AbLang2PairedHuggingFaceAdapter
|
18 |
-
ablang = AbLang2PairedHuggingFaceAdapter(model=model, tokenizer=tokenizer)
|
19 |
-
|
20 |
-
# Test sequences from the notebook
|
21 |
-
test_sequences = [
|
22 |
-
['EVQ***SGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCAR**PGHGAAFMDVWGTGTTVTVSS',
|
23 |
-
'DIQLTQSPLSLPVTLGQPASISCRSS*SLEASDTNIYLSWFQQRPGQSPRRLIYKI*NRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK']
|
24 |
-
]
|
25 |
-
|
26 |
-
print("Testing restore without alignment:")
|
27 |
-
result_no_align = ablang(test_sequences, mode='restore', align=False)
|
28 |
-
print(f"Result (no align): {result_no_align[0]}")
|
29 |
-
|
30 |
-
print("\nTesting restore with alignment:")
|
31 |
-
result_with_align = ablang(test_sequences, mode='restore', align=True)
|
32 |
-
print(f"Result (with align): {result_with_align[0]}")
|
33 |
-
|
34 |
-
print("\nBoth options work correctly!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_app_output.py
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
import sys
|
2 |
-
import os
|
3 |
-
from transformers import AutoModel, AutoTokenizer
|
4 |
-
from transformers.utils import cached_file
|
5 |
-
|
6 |
-
# Load model and tokenizer from Hugging Face Hub
|
7 |
-
print("Loading model and tokenizer...")
|
8 |
-
model = AutoModel.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
9 |
-
tokenizer = AutoTokenizer.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
10 |
-
|
11 |
-
# Find the cached model directory and import adapter
|
12 |
-
adapter_path = cached_file("hemantn/ablang2", "adapter.py")
|
13 |
-
cached_model_dir = os.path.dirname(adapter_path)
|
14 |
-
sys.path.insert(0, cached_model_dir)
|
15 |
-
|
16 |
-
# Import and create the adapter
|
17 |
-
from adapter import AbLang2PairedHuggingFaceAdapter
|
18 |
-
ablang = AbLang2PairedHuggingFaceAdapter(model=model, tokenizer=tokenizer)
|
19 |
-
|
20 |
-
def restore_sequences(heavy_chain, light_chain, use_align=False):
|
21 |
-
try:
|
22 |
-
# Prepare input sequences
|
23 |
-
if heavy_chain.strip() and light_chain.strip():
|
24 |
-
sequences = [[heavy_chain.strip(), light_chain.strip()]]
|
25 |
-
elif heavy_chain.strip():
|
26 |
-
sequences = [[heavy_chain.strip(), ""]]
|
27 |
-
elif light_chain.strip():
|
28 |
-
sequences = [["", light_chain.strip()]]
|
29 |
-
else:
|
30 |
-
return "Please provide at least one antibody chain sequence."
|
31 |
-
|
32 |
-
# Perform restoration
|
33 |
-
restored = ablang(sequences, mode='restore', align=use_align)
|
34 |
-
|
35 |
-
# Format output
|
36 |
-
if hasattr(restored, '__len__') and len(restored) > 0:
|
37 |
-
result = restored[0] # Get the first (and only) result
|
38 |
-
return result
|
39 |
-
else:
|
40 |
-
return "Error: No restoration result obtained."
|
41 |
-
|
42 |
-
except Exception as e:
|
43 |
-
return f"Error during restoration: {str(e)}"
|
44 |
-
|
45 |
-
# Test the function
|
46 |
-
heavy_chain = "EVQ***SGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCAR**PGHGAAFMDVWGTGTTVTVSS"
|
47 |
-
light_chain = "DIQLTQSPLSLPVTLGQPASISCRSS*SLEASDTNIYLSWFQQRPGQSPRRLIYKI*NRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK"
|
48 |
-
|
49 |
-
result = restore_sequences(heavy_chain, light_chain, False)
|
50 |
-
print("="*80)
|
51 |
-
print("APP OUTPUT TEST:")
|
52 |
-
print("="*80)
|
53 |
-
print(result)
|
54 |
-
print("="*80)
|
55 |
-
print(f"Result length: {len(result)}")
|
56 |
-
print(f"Result type: {type(result)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_integrated_adapter.py
DELETED
@@ -1,158 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
-
"""
|
3 |
-
Test script for the integrated AbLang2 adapter functionality.
|
4 |
-
This script tests that all the utility files are properly integrated and the adapter works correctly.
|
5 |
-
"""
|
6 |
-
|
7 |
-
import sys
|
8 |
-
import os
|
9 |
-
|
10 |
-
# Global variable to store the adapter class
|
11 |
-
AbLang2PairedHuggingFaceAdapter = None
|
12 |
-
|
13 |
-
def test_imports():
|
14 |
-
"""Test that all imports work correctly"""
|
15 |
-
global AbLang2PairedHuggingFaceAdapter
|
16 |
-
|
17 |
-
print("π Testing imports...")
|
18 |
-
|
19 |
-
try:
|
20 |
-
# Test utility imports
|
21 |
-
from restoration import AbRestore
|
22 |
-
print("β
AbRestore imported successfully")
|
23 |
-
|
24 |
-
from ablang_encodings import AbEncoding
|
25 |
-
print("β
AbEncoding imported successfully")
|
26 |
-
|
27 |
-
from alignment import AbAlignment
|
28 |
-
print("β
AbAlignment imported successfully")
|
29 |
-
|
30 |
-
from scores import AbScores
|
31 |
-
print("β
AbScores imported successfully")
|
32 |
-
|
33 |
-
from extra_utils import res_to_seq, res_to_list
|
34 |
-
print("β
extra_utils functions imported successfully")
|
35 |
-
|
36 |
-
# Test adapter import
|
37 |
-
from adapter import AbLang2PairedHuggingFaceAdapter
|
38 |
-
print("β
AbLang2PairedHuggingFaceAdapter imported successfully")
|
39 |
-
|
40 |
-
print("\nπ All imports successful!")
|
41 |
-
return True
|
42 |
-
|
43 |
-
except ImportError as e:
|
44 |
-
print(f"β Import error: {e}")
|
45 |
-
return False
|
46 |
-
except Exception as e:
|
47 |
-
print(f"β Unexpected error: {e}")
|
48 |
-
return False
|
49 |
-
|
50 |
-
def test_model_loading():
|
51 |
-
"""Test model loading from Hugging Face"""
|
52 |
-
global AbLang2PairedHuggingFaceAdapter
|
53 |
-
|
54 |
-
print("\nπ Testing model loading...")
|
55 |
-
|
56 |
-
try:
|
57 |
-
from transformers import AutoModel, AutoTokenizer
|
58 |
-
|
59 |
-
print("Loading model from Hugging Face...")
|
60 |
-
model = AutoModel.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
61 |
-
print("β
Model loaded successfully")
|
62 |
-
|
63 |
-
print("Loading tokenizer from Hugging Face...")
|
64 |
-
tokenizer = AutoTokenizer.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
65 |
-
print("β
Tokenizer loaded successfully")
|
66 |
-
|
67 |
-
print("Creating adapter...")
|
68 |
-
ablang = AbLang2PairedHuggingFaceAdapter(model=model, tokenizer=tokenizer)
|
69 |
-
print("β
Adapter created successfully")
|
70 |
-
|
71 |
-
return True, ablang
|
72 |
-
|
73 |
-
except ImportError as e:
|
74 |
-
print(f"β Transformers not available: {e}")
|
75 |
-
print(" This is expected if transformers is not installed")
|
76 |
-
return False, None
|
77 |
-
except Exception as e:
|
78 |
-
print(f"β Model loading error: {e}")
|
79 |
-
return False, None
|
80 |
-
|
81 |
-
def test_restore_functionality(ablang):
|
82 |
-
"""Test the restore functionality"""
|
83 |
-
print("\nπ Testing restore functionality...")
|
84 |
-
|
85 |
-
try:
|
86 |
-
# Test sequences
|
87 |
-
test_sequences = [
|
88 |
-
["EVQ***SGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCAR**PGHGAAFMDVWGTGTTVTVSS",
|
89 |
-
"DIQLTQSPLSLPVTLGQPASISCRSS*SLEASDTNIYLSWFQQRPGQSPRRLIYKI*NRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK"]
|
90 |
-
]
|
91 |
-
|
92 |
-
print("Testing restore without alignment...")
|
93 |
-
result = ablang(test_sequences, mode='restore', align=False)
|
94 |
-
print(f"β
Restore result: {result}")
|
95 |
-
|
96 |
-
print("Testing restore with alignment...")
|
97 |
-
result_align = ablang(test_sequences, mode='restore', align=True)
|
98 |
-
print(f"β
Restore with alignment result: {result_align}")
|
99 |
-
|
100 |
-
return True
|
101 |
-
|
102 |
-
except Exception as e:
|
103 |
-
print(f"β Restore functionality error: {e}")
|
104 |
-
return False
|
105 |
-
|
106 |
-
def test_encoding_functionality(ablang):
|
107 |
-
"""Test the encoding functionality"""
|
108 |
-
print("\nπ Testing encoding functionality...")
|
109 |
-
|
110 |
-
try:
|
111 |
-
test_sequences = [
|
112 |
-
["EVQLVESGGGLVQPGGSLRLSCAASGFTFSSYAMGWVRQAPGKGLEWVSAISGSGGSTYYADSVKGRFTISRDNSKNTLYLQMNSLRAEDTAVYYCARDYPGHGAAFMDVWGQGTTVTVSS",
|
113 |
-
"DIQLTQSPSSLSASVGDRVTITCRASQSISSYLNWYQQKPGKAPKLLIYASSLQSGVPSRFSGSGSGTDFTLTISSLQPEDFATYYCQQSYSTPTTFGQGTKVEIK"]
|
114 |
-
]
|
115 |
-
|
116 |
-
print("Testing sequence coding...")
|
117 |
-
result = ablang(test_sequences, mode='seqcoding')
|
118 |
-
print(f"β
Sequence coding result shape: {result.shape if hasattr(result, 'shape') else len(result)}")
|
119 |
-
|
120 |
-
return True
|
121 |
-
|
122 |
-
except Exception as e:
|
123 |
-
print(f"β Encoding functionality error: {e}")
|
124 |
-
return False
|
125 |
-
|
126 |
-
def main():
|
127 |
-
"""Main test function"""
|
128 |
-
print("𧬠AbLang2 Integrated Adapter Test")
|
129 |
-
print("=" * 50)
|
130 |
-
|
131 |
-
# Test imports
|
132 |
-
if not test_imports():
|
133 |
-
print("\nβ Import tests failed. Exiting.")
|
134 |
-
return
|
135 |
-
|
136 |
-
# Test model loading
|
137 |
-
model_loaded, ablang = test_model_loading()
|
138 |
-
|
139 |
-
if model_loaded and ablang is not None:
|
140 |
-
# Test functionality
|
141 |
-
test_restore_functionality(ablang)
|
142 |
-
test_encoding_functionality(ablang)
|
143 |
-
|
144 |
-
print("\nπ All tests completed successfully!")
|
145 |
-
print("\nπ Summary:")
|
146 |
-
print("β
All utility files integrated")
|
147 |
-
print("β
Adapter imports working")
|
148 |
-
print("β
Model loading successful")
|
149 |
-
print("β
Restore functionality working")
|
150 |
-
print("β
Encoding functionality working")
|
151 |
-
|
152 |
-
else:
|
153 |
-
print("\nβ οΈ Model loading test skipped (transformers not available)")
|
154 |
-
print("β
Core integration tests passed")
|
155 |
-
print("β
Ready for deployment")
|
156 |
-
|
157 |
-
if __name__ == "__main__":
|
158 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_module_loading.py
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
import sys
|
2 |
-
import os
|
3 |
-
import numpy as np
|
4 |
-
from transformers import AutoModel, AutoTokenizer
|
5 |
-
from transformers.utils import cached_file
|
6 |
-
|
7 |
-
# Load model and tokenizer from Hugging Face Hub
|
8 |
-
model = AutoModel.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
9 |
-
tokenizer = AutoTokenizer.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
10 |
-
|
11 |
-
# Find the cached model directory and import adapter
|
12 |
-
adapter_path = cached_file("hemantn/ablang2", "adapter.py")
|
13 |
-
cached_model_dir = os.path.dirname(adapter_path)
|
14 |
-
sys.path.insert(0, cached_model_dir)
|
15 |
-
|
16 |
-
# Import and create the adapter
|
17 |
-
from adapter import AbLang2PairedHuggingFaceAdapter
|
18 |
-
ablang = AbLang2PairedHuggingFaceAdapter(model=model, tokenizer=tokenizer)
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_original_compatibility.py
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
-
|
3 |
-
import sys
|
4 |
-
import os
|
5 |
-
from transformers import AutoModel, AutoTokenizer
|
6 |
-
from transformers.utils import cached_file
|
7 |
-
|
8 |
-
def test_original_compatibility():
|
9 |
-
"""Test that our adapter produces the same results as the original"""
|
10 |
-
print("π§ͺ Testing compatibility with original AbLang2_final_version...")
|
11 |
-
|
12 |
-
try:
|
13 |
-
# Load model and tokenizer
|
14 |
-
print("π₯ Loading model and tokenizer...")
|
15 |
-
model = AutoModel.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
16 |
-
tokenizer = AutoTokenizer.from_pretrained("hemantn/ablang2", trust_remote_code=True)
|
17 |
-
|
18 |
-
# Find the cached model directory and import adapter
|
19 |
-
adapter_path = cached_file("hemantn/ablang2", "adapter.py")
|
20 |
-
cached_model_dir = os.path.dirname(adapter_path)
|
21 |
-
sys.path.insert(0, cached_model_dir)
|
22 |
-
|
23 |
-
# Import and create the adapter
|
24 |
-
print("π§ Importing adapter...")
|
25 |
-
from adapter import AbLang2PairedHuggingFaceAdapter
|
26 |
-
ablang = AbLang2PairedHuggingFaceAdapter(model=model, tokenizer=tokenizer)
|
27 |
-
print("β
Adapter created successfully!")
|
28 |
-
|
29 |
-
# Test with the same sequences as in the notebook
|
30 |
-
print("𧬠Testing with notebook sequences...")
|
31 |
-
test_seqs = [
|
32 |
-
['EVQ***SGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCAR**PGHGAAFMDVWGTGTTVTVSS', 'DIQLTQSPLSLPVTLGQPASISCRSS*SLEASDTNIYLSWFQQRPGQSPRRLIYKI*NRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK'],
|
33 |
-
['EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCAR**PGHGAAFMDVWGTGTTVTVSS', 'DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK']
|
34 |
-
]
|
35 |
-
|
36 |
-
# Test restore functionality
|
37 |
-
print("π§ Testing restore functionality...")
|
38 |
-
restored = ablang(test_seqs, mode='restore')
|
39 |
-
print("β
Restore functionality working!")
|
40 |
-
print(f"π Restored sequences: {len(restored)}")
|
41 |
-
for i, seq in enumerate(restored):
|
42 |
-
print(f" Sequence {i+1}: {seq[:50]}...")
|
43 |
-
|
44 |
-
# Test seqcoding functionality
|
45 |
-
print("π§ Testing seqcoding functionality...")
|
46 |
-
seqcodings = ablang(test_seqs, mode='seqcoding')
|
47 |
-
print("β
Seqcoding functionality working!")
|
48 |
-
print(f"π Seqcoding shape: {seqcodings.shape}")
|
49 |
-
|
50 |
-
# Test confidence functionality
|
51 |
-
print("π§ Testing confidence functionality...")
|
52 |
-
confidence_scores = ablang(test_seqs, mode='confidence')
|
53 |
-
print("β
Confidence functionality working!")
|
54 |
-
print(f"π Confidence scores: {confidence_scores}")
|
55 |
-
|
56 |
-
return True
|
57 |
-
|
58 |
-
except Exception as e:
|
59 |
-
print(f"β Error: {e}")
|
60 |
-
import traceback
|
61 |
-
traceback.print_exc()
|
62 |
-
return False
|
63 |
-
|
64 |
-
if __name__ == "__main__":
|
65 |
-
success = test_original_compatibility()
|
66 |
-
if success:
|
67 |
-
print("π All tests passed! The adapter is compatible with the original.")
|
68 |
-
else:
|
69 |
-
print("π₯ Tests failed. There are compatibility issues.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|