yaledeus / ElliDock

This repository contains the code for our paper "Rigid protein-protein docking via equivariant elliptic-paraboloid interface prediction" (ICLR 2024)
MIT License
5 stars 1 forks source link

How to inference with custome PDBs? #7

Open ELMIAR-0642 opened 9 months ago

ELMIAR-0642 commented 9 months ago

How to run the provided Inference code with custom set of Antibody and Antigen PDBs?

Should it be preprocessed to be in DB5 format? How to do that?

yaledeus commented 9 months ago

You can adopt following steps to construct your custom test set:

  1. your directory should contain two folders named as complexes and random_transformed and two files named as test.json and test.txt
  2. test.txt: each line shows the name of one complex, e.g., 1AVX
  3. test.json: each line is a json format dictionary, containing following keys: PDB, which should be the same as in test.txt, e.g., 1AVX; rchain, the chain names of the receptor, list format, e.g., ["A"]; lchain, the chain names of the ligand.
  4. complexes: for each ground-truth complex, split it into two PDB files named as {name}_l_b_COMPLEX.pdb and {name}_r_b_COMPLEX.pdb, representing the ligand and receptor respectively. Here {name} should be the same as in test.txt.
  5. random_transformed: for each complex, split it into two PDB files named as {name}_l_b.pdb and {name}_r_b.pdb, while at least one of them should be transformed by a random rotation and translation.
  6. Put your directory under test_sets_pdb, add your dataset name into the argument --dataset, and insert codes into test.py to support loading from your dataset, like this:
    if args.dataset == 'DB5':
        test_path = './test_sets_pdb/db5_test_random_transformed'
    ...
    elif args.dataset == {your_dataset_name}:
        test_path = './test_sets_pdb/{your_dataset_directory_name}'
        test_desc_path = os.path.join(test_path, 'test.json')
        with open(test_desc_path, 'r') as fin:
            lines = fin.read().strip().split('\n')
        for line in lines:
            item = json.loads(line)
            test_desc[item['pdb']] = [item['rchain'], item['lchain']]
ELMIAR-0642 commented 9 months ago

Can't Access VM rn, will check it and let you know.

Thanks to you. You have been so responsive.

ELMIAR-0642 commented 9 months ago
(ellidock2) root@2d175a2198f1:/ElliDock# python test.py --dataset custom_set_000 --gpu 0 --ckpt /ElliDock/checkpoints/db5_be
st.ckpt

Model type: ElliDock 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "test.py", line 272, in main(parse()) File "test.py", line 119, in main batch = test_complex_process(ligand_bound_path, receptor_unbound_path) File "/ElliDock/data/dataset.py", line 683, in test_complex_process complex = BaseComplex.from_pdb(ligand_path, receptor_path) File "/ElliDock/data/bio_parse.py", line 313, in from_pdb ligand_seq, ligand_coord = base_pdb_parse(ligand_path) File "/ElliDock/data/bio_parse.py", line 60, in base_pdb_parse structure = parser.get_structure(pdb_id, pdb_path) File "/conda/envs/ellidock2/lib/python3.8/site-packages/Bio/PDB/PDBParser.py", line 89, in get_structure with as_handle(file) as handle: File "/conda/envs/ellidock2/lib/python3.8/contextlib.py", line 113, in enter return next(self.gen) File "/conda/envs/ellidock2/lib/python3.8/site-packages/Bio/File.py", line 72, in as_handle with open(handleish, mode, **kwargs) as fp: FileNotFoundError: [Errno 2] No such file or directory: './test_sets_pdb/custom_set_000/complexes/1AVX_l_b_COMPLEX.pdb'

I don't wish to compare complexes and docked ( like Ground Truth vs Predicted Truth) but to dock the receptor and ligand

koushikmj commented 9 months ago

Facing a similar issue. I was interested in using this for a project. But I am not able to find out how to run inference for docking 2 proteins.

koushikmj commented 9 months ago
(ellidock2) root@2d175a2198f1:/ElliDock# python test.py --dataset custom_set_000 --gpu 0 --ckpt /ElliDock/checkpoints/db5_be
st.ckpt

Model type: ElliDock 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "test.py", line 272, in main(parse()) File "test.py", line 119, in main batch = test_complex_process(ligand_bound_path, receptor_unbound_path) File "/ElliDock/data/dataset.py", line 683, in test_complex_process complex = BaseComplex.from_pdb(ligand_path, receptor_path) File "/ElliDock/data/bio_parse.py", line 313, in from_pdb ligand_seq, ligand_coord = base_pdb_parse(ligand_path) File "/ElliDock/data/bio_parse.py", line 60, in base_pdb_parse structure = parser.get_structure(pdb_id, pdb_path) File "/conda/envs/ellidock2/lib/python3.8/site-packages/Bio/PDB/PDBParser.py", line 89, in get_structure with as_handle(file) as handle: File "/conda/envs/ellidock2/lib/python3.8/contextlib.py", line 113, in enter return next(self.gen) File "/conda/envs/ellidock2/lib/python3.8/site-packages/Bio/File.py", line 72, in as_handle with open(handleish, mode, **kwargs) as fp: FileNotFoundError: [Errno 2] No such file or directory: './test_sets_pdb/custom_set_000/complexes/1AVX_l_b_COMPLEX.pdb'

I don't wish to compare complexes and docked ( like Ground Truth vs Predicted Truth) but to dock the receptor and ligand

Yo, did you find any solution of your own?

joelBrelson commented 9 months ago

Even i am facing similar kind of issue has any one found a soultion for this. I badly need this for my college project.

yaledeus commented 9 months ago

If you only want to generate docked complex structures without evaluation, we have provided inference.py similar to test.py, and you can follow the command in README:

image

Now you do not have to construct complexes directory for your own test set any more.