Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run AF3 with one mmcif template file properly #225

Open
chricl95 opened this issue Dec 19, 2024 · 4 comments
Open

How to run AF3 with one mmcif template file properly #225

chricl95 opened this issue Dec 19, 2024 · 4 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation question Further information is requested

Comments

@chricl95
Copy link

chricl95 commented Dec 19, 2024

  1. In input.md, Structural Template, you wrote:

mmcifPath: str: An optional path to a file that contains the mmCIF with the structural template instead of providing it inline using the mmcifPath field. The path can be either absolute, or relative to the input JSON path. The file must be in the A3M format, and could be either plain text, or compressed using gzip, xz, or zstd.

I guess A3M format is wrong? What should follow after mmcifPath: e.g. "home/user/8DFY.cif"

  1. Is it possible, to provide a full example of AF3 with template cif? I tried to run AF3 one protein chain, one cif template, but always got the error:
I1218 20:54:57.929302 22842087186432 folding_input.py:1044] Detected /root/work/input_template/8FDY_test.json is an AlphaFold 3 JSON since the top-level is not a list.
Traceback (most recent call last):
  File "/home/.../user/alphafold3/run_alphafold.py", line 738, in <module>
    app.run(main)
  File "/alphafold3_venv/lib/python3.11/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/alphafold3_venv/lib/python3.11/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/home/.../user/alphafold3/run_alphafold.py", line 622, in main
    fold_inputs = folding_input.load_fold_inputs_from_path(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/alphafold3_venv/lib/python3.11/site-packages/alphafold3/common/folding_input.py", line 1050, in load_fold_inputs_from_path
    fold_inputs.append(Input.from_json(json_str))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/alphafold3_venv/lib/python3.11/site-packages/alphafold3/common/folding_input.py", line 731, in from_json
    chains.append(ProteinChain.from_dict(sequence, seq_id=seq_id))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/alphafold3_venv/lib/python3.11/site-packages/alphafold3/common/folding_input.py", line 183, in from_dict
    templates = [
                ^
  File "/alphafold3_venv/lib/python3.11/site-packages/alphafold3/common/folding_input.py", line 185, in <listcomp>
    mmcif=template['mmcif'],
          ~~~~~~~~^^^^^^^^^
KeyError: 'mmcif'

My input json was:
8FDY_test.json

Thank you very much in advance!

@Augustin-Zidek Augustin-Zidek added bug Something isn't working documentation Improvements or additions to documentation question Further information is requested labels Dec 20, 2024
@Augustin-Zidek
Copy link
Collaborator

  1. Thanks for catching this, it is indeed a typo and should be "The file must be in the mmCIF format...".
  2. It looks to me like you have old version of the code that doesn't support this. Could you try git clone of the latest version and then rebuild the Docker container?

@Augustin-Zidek
Copy link
Collaborator

Fix for the documentation issue pushed in b380a7c.

@chricl95
Copy link
Author

chricl95 commented Dec 22, 2024

I already cloned the repo again. Mayb there are several incompatibilities in the input.md

  1. Version number
    8FDY_test_2.json

Again the KeyError: 'mmcif' with version 2, but with version: 1, AF3 at least reads the input.json

input.md: "[Version] 2: added the option of specifying external MSA and templates using newly added fields unpairedMsaPath, pairedMsaPath, and mmcifPath."

So I do not know, why the run starts with template, with version 1 but not with version 2.

  1. input.md says:

pairedMsa: str: We recommend not using this optional field and using the unpairedMsa for the purposes of pairing. See more details below.
pairedMsaPath: str: An optional path to a file that contains the multiple sequence alignment for this chain instead of providing it inline using the pairedMsa field. The path can be either absolute, or relative to the input JSON path. The file must be in the A3M format, and could be either plain text, or compressed using gzip, xz, or zstd.

But with following input json:
8FDY_test_3.json
it rises ValueError:

File "/alphafold3_venv/lib/python3.11/site-packages/alphafold3/data/pipeline.py", line 461, in process_protein_chain
    raise ValueError(
ValueError: Protein chain A has unpaired MSA, paired MSA, or templates set only partially. If you want to run the pipeline with custom MSA/templates, you need to set all of them. You can set MSA to empty string and templates to empty list to signify that they should not be used and searched for
  1. unpairedMsaPath, pairedMsaPath and mmcifPath do not work properly

with input json:
8FDY_test_4.json

it rises

File "/alphafold3_venv/lib/python3.11/site-packages/alphafold3/common/folding_input.py", line 1052, in load_fold_inputs_from_path
    raise ValueError(
ValueError: Failed to load fold input from /root/work/input_template/8FDY_test_inline.json. The JSON at /root/work/input_template/8FDY_test_inline.json was detected to be an AlphaFold 3 JSON since the top-level
  1. so with unpairedMsa, pairedMsa and mmcif (not with ending "Path"), but follwoing the path to the a3m and cif file, the json looks like:
    8FDY_test_5.json

and another error occurs, but the program starts though:

I1222 12:48:30.001812 23075703513088 folding_input.py:1044] Detected /root/work/input_template/8FDY_test_inline.json is an AlphaFold 3 JSON since the top-level is not a list.
I1222 12:48:30.862669 23075703513088 xla_bridge.py:895] Unable to initialize backend 'rocm': module 'jaxlib.xla_extension' has no attribute 'GpuAllocatorConfig'
I1222 12:48:30.875725 23075703513088 xla_bridge.py:895] Unable to initialize backend 'tpu': INTERNAL: Failed to open libtpu.so: libtpu.so: cannot open shared object file: No such file or directory
I1222 12:48:33.561209 23075703513088 pipeline.py:468] Skipping MSA and template search for protein chain A because it already has MSAs and templates.
Running AlphaFold 3. Please note that standard AlphaFold 3 model parameters are
only available under terms of use provided at
https://github.com/google-deepmind/alphafold3/blob/main/WEIGHTS_TERMS_OF_USE.md.
If you do not agree to these terms and are using AlphaFold 3 derived model
parameters, cancel execution of AlphaFold 3 inference with CTRL-C, and do not
use the model parameters.
Found local devices: [CudaDevice(id=0)]
Building model from scratch...
Processing fold inputs.
Processing fold input #1
Processing fold input Test_id_8FDY_test
Output directory /root/work/output/test_id_8fdy_test exists and non-empty, using instead  /root/work/output/test_id_8fdy_test_20241222_124830.
Checking we can load the model parameters...
Running data pipeline...
Processing chain A
Processing chain A took 0.00 seconds
Output directory: /root/work/output/test_id_8fdy_test_20241222_124830
Writing model input JSON to /root/work/output/test_id_8fdy_test_20241222_124830
Predicting 3D structure for Test_id_8FDY_test for seed(s) (1,)...
Featurising data for seeds (1,)...
Traceback (most recent call last):
  File "/home/sc.uni-leipzig.de/cc77miri/alphafold3/run_alphafold.py", line 791, in <module>
    app.run(main)
  File "/alphafold3_venv/lib/python3.11/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/alphafold3_venv/lib/python3.11/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/home/sc.uni-leipzig.de/cc77miri/alphafold3/run_alphafold.py", line 774, in main
    process_fold_input(
  File "/home/sc.uni-leipzig.de/cc77miri/alphafold3/run_alphafold.py", line 630, in process_fold_input
    all_inference_results = predict_structure(
                            ^^^^^^^^^^^^^^^^^^
  File "/home/sc.uni-leipzig.de/cc77miri/alphafold3/run_alphafold.py", line 406, in predict_structure
    featurised_examples = featurisation.featurise_input(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: featurise_input() got an unexpected keyword argument 'conformer_max_iterations'

@Augustin-Zidek
Copy link
Collaborator

Augustin-Zidek commented Dec 23, 2024

I think you haven't updated fully -- looks like only run_alphafold.py was updated, but not the rest of the files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants