Files
AlphaPulldown/test/outdated/test_create_multimeric_objects.py
Dima 4d802be7d6 support both af2 and af3 data pipelines (#523)
* symmetrical refactoring to support both af2 and af3 data pipelines

* Clean tests

* Keep GPU tests in place

* Reverted accidentally deleted templates

* Add AlphaFold3 feature creation pipeline and per-chain input generation

- Implement `create_pipeline_af3` to construct the AlphaFold3 data pipeline with correct database and binary paths.
- Add `create_af3_individual_features` to generate AlphaFold3 input features for each chain in a FASTA, handling protein, RNA, and DNA sequences.
- Integrate new AF3 logic into the main entry point, dispatching to AF2 or AF3 as appropriate.
- Ensure output directory creation and error handling for missing dependencies or invalid sequences.

* Convert template dates to datetime for af3

* First check for nucleotides, then for amino-acids

* Skip existing features json if --skip_existing=true

* Check if DNA before RNA

* Bump 2.1.0

* Git ignore build/ dir
2025-07-16 12:30:18 +02:00

30 lines
1.4 KiB
Python

from absl.testing import absltest
from alphapulldown.objects import MultimericObject
import pickle
import numpy as np
class TestCreateMultimericObject(absltest.TestCase):
"""A class that test major functions of creating feature_dict of a MultimericObject object"""
def setUp(self) -> None:
self.monomer1 = pickle.load(open("./test/test_data/features/3L4Q_A.3L4Q.cif.A.pkl", "rb"))
self.monomer2 = pickle.load(open("./test/test_data/features/3L4Q_C.3L4Q.pdb.C.pkl", "rb"))
def test_1_initiate_default_multimericobject(self) -> MultimericObject:
multimer_obj = MultimericObject([self.monomer1, self.monomer2])
return multimer_obj
def test_1_initiate_multimericobject_without_msa_pairing(self) -> MultimericObject:
multimer_obj = MultimericObject([self.monomer1, self.monomer2],pair_msa=False)
return multimer_obj
def test_2_check_residue_indexes(self):
multimer_obj = self.test_1_initiate_default_multimericobject()
seq_1_length = self.monomer1.feature_dict['seq_length'][0]
seq_2_length = self.monomer2.feature_dict['seq_length'][0]
expected_residue_index=np.array(list(range(seq_1_length)) + list(range(seq_2_length)))
self.assertTrue(np.array_equal(multimer_obj.feature_dict['residue_index'],expected_residue_index))
if __name__=="__main__":
absltest.main()