Skip to content

Commit

Permalink
pytest test/ - all tests are passed
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaMolod committed Sep 5, 2024
1 parent 423bfb3 commit f39c330
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 9 deletions.
4 changes: 2 additions & 2 deletions test/test_create_multimeric_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ 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/H1142_A.pkl", "rb"))
self.monomer2 = pickle.load(open("./test/example_data/H1142_B.pkl", "rb"))
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])
Expand Down
14 changes: 8 additions & 6 deletions test/test_create_multimeric_template_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
class TestMultimericTemplateFeatures(absltest.TestCase):
def setUp(self):
self.mmcif_file = "./test/test_data/templates/3L4Q.cif"
self.monomer1 = pickle.load(open("./test/test_data/features/3L4Q_A.pkl",'rb'))
self.monomer2 = pickle.load(open("./test/test_data/features/3L4Q_C.pkl",'rb'))
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'))
self.kalign_binary_path = shutil.which('kalign')
self.mmt_dir = './test/test_data/templates/'
self.instruction_file = "./test/test_data/protein_lists/test_truemultimer.csv"
self.instruction_file = "./test/test_data/protein_lists/test_truemultimer.txt"
self.data_dir = '/scratch/AlphaFold_DBs/2.3.2'


@absltest.skip('attribute error')
def test_1_create_template_hit(self):
template_hit = multimeric_template_utils.create_template_hit(index=1, name='3l4q_A',query=self.monomer1.sequence)
self.assertEqual(self.monomer1.sequence,template_hit.hit_sequence)


@absltest.skip('attribute error')
def test_2_build_mapping(self):
template_hit = multimeric_template_utils.create_template_hit(index=1, name='3l4q_A',query=self.monomer1.sequence)
expected_mapping = {i:i for i in range(len(self.monomer1.sequence))}
Expand All @@ -39,7 +41,7 @@ def test_4_parse_instraction_file(self):
"""Test if the instruction csv table is parsed properly"""
multimeric_template_meta = multimeric_template_utils.prepare_multimeric_template_meta_info(self.instruction_file,self.mmt_dir)
self.assertIsInstance(multimeric_template_meta, dict)
expected_dict = {"3L4Q_A":{"3L4Q.cif":"A"}, "3L4Q_C":{"3L4Q.cif":"C"}}
expected_dict = {"3L4Q_A":{"3L4Q.cif":"A"}, "3L4Q_C":{"3L4Q.pdb":"C"}}
self.assertEqual(multimeric_template_meta,expected_dict)

if __name__ == "__main__":
Expand Down
Binary file added test/test_data/features/3L4Q_A.3L4Q.cif.A.pkl
Binary file not shown.
20 changes: 20 additions & 0 deletions test/test_data/features/3L4Q_A.3L4Q.cif.A/pdb_hits.sto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# STOCKHOLM 1.0
#=GF ID query
#=GF AU hmmsearch (HMMER 3.4)

#=GS 3l41_A/7-164 DE [subseq from] mol:protein length:164
#=GS 3l42_A/7-164 DE [subseq from] mol:protein length:164
#=GS 3l43_A/7-164 DE [subseq from] mol:protein length:164
#=GS 3l44_A/7-164 DE [subseq from] mol:protein length:164

3l41_A/7-164 SDEALKMTMASVPASRYLTDMTLEEMSRDWSMLIPKQKVAGPLCIRMDQAIMDKNIILKANFSVIFDRLETLILLRAFTEEGAIVGEISPLPSLPGHTAEDVKNAVGVLIGGLEWNDNTVRVSETLQRFAWRSSNENGRPPLTPKQKREMAGTIRSEV
#=GR 3l41_A/7-164 PP 79**********************************************************************************************************************************************************97
3l42_A/7-164 SDEALKMTMASVPASRYLTDMTLEEMSRDWSMLIPKQKVAGPLCIRMDQAIMDKNIILKANFSVIFDRLETLILLRAFTEEGAIVGEISPLPSLPGHTAEDVKNAVGVLIGGLEWNDNTVRVSETLQRFAWRSSNENGRPPLTPKQKREMAGTIRSEV
#=GR 3l42_A/7-164 PP 79**********************************************************************************************************************************************************97
3l43_A/7-164 SDEALKMTMASVPASRYLTDMTLEEMSRDWSMLIPKQKVAGPLCIRMDQAIMDKNIILKANFSVIFDRLETLILLRAFTEEGAIVGEISPLPSLPGHTAEDVKNAVGVLIGGLEWNDNTVRVSETLQRFAWRSSNENGRPPLTPKQKREMAGTIRSEV
#=GR 3l43_A/7-164 PP 79**********************************************************************************************************************************************************97
3l44_A/7-164 SDEALKMTMASVPASRYLTDMTLEEMSRDWSMLIPKQKVAGPLCIRMDQAIMDKNIILKANFSVIFDRLETLILLRAFTEEGAIVGEISPLPSLPGHTAEDVKNAVGVLIGGLEWNDNTVRVSETLQRFAWRSSNENGRPPLTPKQKREMAGTIRSEV
#=GR 3l44_A/7-164 PP 79**********************************************************************************************************************************************************97
#=GC PP_cons 79**********************************************************************************************************************************************************97
#=GC RF xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"databases": {"UniProt": {"release_date": "2024-08-28 10:19:37", "version": null, "location_url": ["ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_trembl.fasta.gz", "ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz"]}, "PDB seqres": {"release_date": "2024-09-05 09:35:57", "version": "8f1b435c6b4d1b4fc779a18fa656fd2f", "location_url": ["ftp://ftp.wwpdb.org/pub/pdb/derived_data/pdb_seqres.txt"]}, "ColabFold": {"version": "2024-09-05", "release_date": null, "location_url": ["https://wwwuser.gwdg.de/~compbiol/colabfold/colabfold_envdb_202108.tar.gz"]}}, "software": {"AlphaPulldown": {"version": "2.0.0.b5"}, "AlphaFold": {"version": "2.3.2"}, "jackhmmer": {"version": "3.4"}, "hhblits": {"version": "3.3.0"}, "hhsearch": {"version": "3.3.0"}, "hmmsearch": {"version": "3.4"}, "hmmbuild": {"version": "3.4"}, "kalign": {"version": "2.04"}}, "date": "2024-09-05 09:35:57", "other": {"logtostderr": "False", "alsologtostderr": "False", "log_dir": "", "v": "0", "verbosity": "0", "logger_levels": "{}", "stderrthreshold": "fatal", "showprefixforinfo": "True", "run_with_pdb": "False", "pdb_post_mortem": "False", "pdb": "False", "run_with_profiling": "False", "only_check_args": "False", "xml_output_file": "", "op_conversion_fallback_to_while_loop": "True", "delta_threshold": "0.5", "tt_check_filter": "False", "tt_single_core_summaries": "False", "runtime_oom_exit": "True", "hbm_oom_exit": "True", "fasta_paths": "['test/test_data/fastas/3L4Q_A.fasta']", "jackhmmer_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/jackhmmer", "hhblits_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hhblits", "hhsearch_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hhsearch", "hmmsearch_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hmmsearch", "hmmbuild_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hmmbuild", "kalign_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/kalign", "uniprot_database_path": "/scratch/AlphaFold_DBs/2.3.2/uniprot/uniprot.fasta", "pdb_seqres_database_path": "/tmp/tmpz3q9orn3/custom_template_db/3L4Q_A.3L4Q.cif.A/pdb_seqres/pdb_seqres.txt", "template_mmcif_dir": "/tmp/tmpz3q9orn3/custom_template_db/3L4Q_A.3L4Q.cif.A/pdb_mmcif/mmcif_files", "obsolete_pdbs_path": "/tmp/tmpz3q9orn3/custom_template_db/3L4Q_A.3L4Q.cif.A/pdb_mmcif/obsolete.dat", "db_preset": "full_dbs", "model_preset": "monomer", "benchmark": "False", "num_multimer_predictions_per_model": "5", "use_precomputed_msas": "False", "models_to_relax": "ModelsToRelax.BEST", "use_mmseqs2": "False", "save_msa_files": "False", "skip_existing": "False", "use_hhsearch": "False", "compress_features": "False", "threshold_clashes": "1000.0", "hb_allowance": "0.4", "plddt_threshold": "0.0", "multiple_mmts": "False", "use_small_bfd": "False", "protein": "3L4Q_A.3L4Q.cif.A", "multimeric_templates_1": "['test/test_data/templates/3L4Q.cif']", "multimeric_chains_1": "['A']"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"databases": {"UniProt": {"release_date": "2024-08-28 10:19:37", "version": null, "location_url": ["ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_trembl.fasta.gz", "ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz"]}, "PDB seqres": {"release_date": "2024-09-05 09:35:06", "version": "b0d5b0863a718007f5348fd1704e1140", "location_url": ["ftp://ftp.wwpdb.org/pub/pdb/derived_data/pdb_seqres.txt"]}, "ColabFold": {"version": "2024-09-05", "release_date": null, "location_url": ["https://wwwuser.gwdg.de/~compbiol/colabfold/colabfold_envdb_202108.tar.gz"]}}, "software": {"AlphaPulldown": {"version": "2.0.0.b5"}, "AlphaFold": {"version": "2.3.2"}, "jackhmmer": {"version": "3.4"}, "hhblits": {"version": "3.3.0"}, "hhsearch": {"version": "3.3.0"}, "hmmsearch": {"version": "3.4"}, "hmmbuild": {"version": "3.4"}, "kalign": {"version": "2.04"}}, "date": "2024-09-05 09:35:06", "other": {"logtostderr": "False", "alsologtostderr": "False", "log_dir": "", "v": "0", "verbosity": "0", "logger_levels": "{}", "stderrthreshold": "fatal", "showprefixforinfo": "True", "run_with_pdb": "False", "pdb_post_mortem": "False", "pdb": "False", "run_with_profiling": "False", "only_check_args": "False", "xml_output_file": "", "op_conversion_fallback_to_while_loop": "True", "delta_threshold": "0.5", "tt_check_filter": "False", "tt_single_core_summaries": "False", "runtime_oom_exit": "True", "hbm_oom_exit": "True", "fasta_paths": "['test/test_data/fastas/3L4Q_A.fasta']", "jackhmmer_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/jackhmmer", "hhblits_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hhblits", "hhsearch_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hhsearch", "hmmsearch_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hmmsearch", "hmmbuild_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hmmbuild", "kalign_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/kalign", "uniprot_database_path": "/scratch/AlphaFold_DBs/2.3.2/uniprot/uniprot.fasta", "pdb_seqres_database_path": "/tmp/tmpk69tq2wp/custom_template_db/3L4Q_A.3L4Q.pdb.A/pdb_seqres/pdb_seqres.txt", "template_mmcif_dir": "/tmp/tmpk69tq2wp/custom_template_db/3L4Q_A.3L4Q.pdb.A/pdb_mmcif/mmcif_files", "obsolete_pdbs_path": "/tmp/tmpk69tq2wp/custom_template_db/3L4Q_A.3L4Q.pdb.A/pdb_mmcif/obsolete.dat", "db_preset": "full_dbs", "model_preset": "monomer", "benchmark": "False", "num_multimer_predictions_per_model": "5", "use_precomputed_msas": "False", "models_to_relax": "ModelsToRelax.BEST", "use_mmseqs2": "False", "save_msa_files": "False", "skip_existing": "False", "use_hhsearch": "False", "compress_features": "False", "threshold_clashes": "1000.0", "hb_allowance": "0.4", "plddt_threshold": "0.0", "multiple_mmts": "False", "use_small_bfd": "False", "protein": "3L4Q_A.3L4Q.pdb.A", "multimeric_templates_1": "['test/test_data/templates/3L4Q.pdb']", "multimeric_chains_1": "['A']"}}
Binary file modified test/test_data/features/3L4Q_C.3L4Q.pdb.C.pkl
Binary file not shown.
20 changes: 20 additions & 0 deletions test/test_data/features/3L4Q_C.3L4Q.pdb.C/pdb_hits.sto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# STOCKHOLM 1.0
#=GF ID query
#=GF AU hmmsearch (HMMER 3.4)

#=GS 3l41_C/1-163 DE [subseq from] mol:protein length:163
#=GS 3l42_C/1-163 DE [subseq from] mol:protein length:163
#=GS 3l43_C/1-163 DE [subseq from] mol:protein length:163
#=GS 3l44_C/1-163 DE [subseq from] mol:protein length:163

3l41_C/1-163 -------KEDSVEAVGAQLKVYHQQYQDKSREYDQLYEEYTRTSQELQMKRTAIEAFNETIKIFEEQGQTQEKSSKEYLERFRREGNEKEMQRILLNSERLKSRIAEIHESRTKLEQELRAQASDNREIDKRMNSLKPDLMQLRKIRDQYLVWLTQKGARQKKINEWLGI
#=GR 3l41_C/1-163 PP .......79***************************************************************************************************************************************************************98
3l42_C/1-163 -------KEDSVEAVGAQLKVYHQQYQDKSREYDQLYEEYTRTSQELQMKRTAIEAFNETIKIFEEQGQTQEKSSKEYLERFRREGNEKEMQRILLNSERLKSRIAEIHESRTKLEQELRAQASDNREIDKRMNSLKPDLMQLRKIRDQYLVWLTQKGARQKKINEWLGI
#=GR 3l42_C/1-163 PP .......79***************************************************************************************************************************************************************98
3l43_C/1-163 -------KEDSVEAVGAQLKVYHQQYQDKSREYDQLYEEYTRTSQELQMKRTAIEAFNETIKIFEEQGQTQEKSSKEYLERFRREGNEKEMQRILLNSERLKSRIAEIHESRTKLEQELRAQASDNREIDKRMNSLKPDLMQLRKIRDQYLVWLTQKGARQKKINEWLGI
#=GR 3l43_C/1-163 PP .......79***************************************************************************************************************************************************************98
3l44_C/1-163 -------KEDSVEAVGAQLKVYHQQYQDKSREYDQLYEEYTRTSQELQMKRTAIEAFNETIKIFEEQGQTQEKSSKEYLERFRREGNEKEMQRILLNSERLKSRIAEIHESRTKLEQELRAQASDNREIDKRMNSLKPDLMQLRKIRDQYLVWLTQKGARQKKINEWLGI
#=GR 3l44_C/1-163 PP .......79***************************************************************************************************************************************************************98
#=GC PP_cons .......79***************************************************************************************************************************************************************98
#=GC RF xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"databases": {"UniProt": {"release_date": "2024-08-28 10:19:37", "version": null, "location_url": ["ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_trembl.fasta.gz", "ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz"]}, "PDB seqres": {"release_date": "2024-09-05 09:33:41", "version": "999c529d58b977ca065f00bdfff9b2bb", "location_url": ["ftp://ftp.wwpdb.org/pub/pdb/derived_data/pdb_seqres.txt"]}, "ColabFold": {"version": "2024-09-05", "release_date": null, "location_url": ["https://wwwuser.gwdg.de/~compbiol/colabfold/colabfold_envdb_202108.tar.gz"]}}, "software": {"AlphaPulldown": {"version": "2.0.0.b5"}, "AlphaFold": {"version": "2.3.2"}, "jackhmmer": {"version": "3.4"}, "hhblits": {"version": "3.3.0"}, "hhsearch": {"version": "3.3.0"}, "hmmsearch": {"version": "3.4"}, "hmmbuild": {"version": "3.4"}, "kalign": {"version": "2.04"}}, "date": "2024-09-05 09:33:42", "other": {"logtostderr": "False", "alsologtostderr": "False", "log_dir": "", "v": "0", "verbosity": "0", "logger_levels": "{}", "stderrthreshold": "fatal", "showprefixforinfo": "True", "run_with_pdb": "False", "pdb_post_mortem": "False", "pdb": "False", "run_with_profiling": "False", "only_check_args": "False", "xml_output_file": "", "op_conversion_fallback_to_while_loop": "True", "delta_threshold": "0.5", "tt_check_filter": "False", "tt_single_core_summaries": "False", "runtime_oom_exit": "True", "hbm_oom_exit": "True", "fasta_paths": "['test/test_data/fastas/3L4Q_C.fasta']", "jackhmmer_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/jackhmmer", "hhblits_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hhblits", "hhsearch_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hhsearch", "hmmsearch_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hmmsearch", "hmmbuild_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/hmmbuild", "kalign_binary_path": "/home/dmolodenskiy/.conda/envs/AlphaPulldownMamba/bin/kalign", "uniprot_database_path": "/scratch/AlphaFold_DBs/2.3.2/uniprot/uniprot.fasta", "pdb_seqres_database_path": "/tmp/tmpsquro8mh/custom_template_db/3L4Q_C.3L4Q.pdb.C/pdb_seqres/pdb_seqres.txt", "template_mmcif_dir": "/tmp/tmpsquro8mh/custom_template_db/3L4Q_C.3L4Q.pdb.C/pdb_mmcif/mmcif_files", "obsolete_pdbs_path": "/tmp/tmpsquro8mh/custom_template_db/3L4Q_C.3L4Q.pdb.C/pdb_mmcif/obsolete.dat", "db_preset": "full_dbs", "model_preset": "monomer", "benchmark": "False", "num_multimer_predictions_per_model": "5", "use_precomputed_msas": "False", "models_to_relax": "ModelsToRelax.BEST", "use_mmseqs2": "False", "save_msa_files": "False", "skip_existing": "False", "use_hhsearch": "False", "compress_features": "False", "threshold_clashes": "1000.0", "hb_allowance": "0.4", "plddt_threshold": "0.0", "multiple_mmts": "False", "use_small_bfd": "False", "protein": "3L4Q_C.3L4Q.pdb.C", "multimeric_templates_1": "['test/test_data/templates/3L4Q.pdb']", "multimeric_chains_1": "['C']"}}
3 changes: 2 additions & 1 deletion test/test_data/protein_lists/test_truemultimer.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
3L4Q_A;3L4Q_C
3L4Q_A,3L4Q.cif,A
3L4Q_C,3L4Q.pdb,C

0 comments on commit f39c330

Please sign in to comment.