google-deepmind / alphafold

Open source code for AlphaFold 2.
Apache License 2.0
12.82k stars 2.27k forks source link

TypeError: tuple indices must be integers or slices, not str #743

Open DrJesseHansen opened 1 year ago

DrJesseHansen commented 1 year ago

Hi all,

I have resubmitted the same job as my previous issue, except this time on GeForce RTX 2080 Ti rather than A10 or A40s (under the assumption that these latter two need to have drivers updated). This gave a new error below.

thanks in advance!

I0406 08:08:54.468482 23367702087488 templates.py:256] Found an exact template match 2hxp_A.
I0406 08:08:54.631971 23367702087488 templates.py:256] Found an exact template match 4bvx_B.
I0406 08:08:54.644156 23367702087488 pipeline.py:234] Uniref90 MSA size: 36 sequences.
I0406 08:08:54.644257 23367702087488 pipeline.py:235] BFD MSA size: 36 sequences.
I0406 08:08:54.644309 23367702087488 pipeline.py:236] MGnify MSA size: 3 sequences.
I0406 08:08:54.644356 23367702087488 pipeline.py:237] Final (deduplicated) MSA size: 75 sequences.
I0406 08:08:54.644787 23367702087488 pipeline.py:239] Total number of templates (NB: this can include bad templates and is later filtered to top 4): 20.
I0406 08:08:54.674234 23367702087488 run_alphafold.py:216] Running model model_1_multimer_v3_pred_0 on test_multi
I0406 08:08:54.674847 23367702087488 model.py:138] Running predict with shape(feat) = {'aatype': (480,), 'residue_index': (480,), 'seq_length': (), 'msa': (512, 480), 'num_alignments': (), 'template_aatype': (4, 480), 'template_all_atom_mask': (4, 480, 37), 'template_all_atom_positions': (4, 480, 37, 3), 'asym_id': (480,), 'sym_id': (480,), 'entity_id': (480,), 'deletion_matrix': (512, 480), 'deletion_mean': (480,), 'all_atom_mask': (480, 37), 'all_atom_positions': (480, 37, 3), 'assembly_num_chains': (), 'entity_mask': (480,), 'num_templates': (), 'cluster_bias_mask': (512,), 'bert_mask': (512, 480), 'seq_mask': (480,), 'msa_mask': (512, 480)}
I0406 08:17:29.640328 23367702087488 model.py:201] Output shape was {'aligned_confidence_probs': (480, 480, 64), 'distogram': {'bin_edges': (63,), 'logits': (480, 480, 64)}, 'experimentally_resolved': {'logits': (480, 37)}, 'iptm': (), 'masked_msa': {'logits': (508, 480, 22)}, 'max_predicted_aligned_error': (), 'mean_plddt': (), 'plddt': (480,), 'predicted_aligned_error': (480, 480), 'predicted_lddt': {'logits': (480, 50)}, 'ptm': (), 'ranking_confidence': (), 'structure_module': {'final_atom_mask': (480, 37), 'final_atom_positions': (480, 37, 3)}, 'tol': ()}
I0406 08:17:29.641377 23367702087488 run_alphafold.py:228] Total JAX model model_1_multimer_v3_pred_0 on test_multi predict time (includes compilation time, see --benchmark): 515.0s
Traceback (most recent call last):
  File "/mnt/nfs/clustersw/Debian/bullseye/cuda/11.2/alphafold/2.3.4/alphafold-2.3.4/run_alphafold.py", line 468, in <module>
    app.run(main)
  File "/mnt/nfs/clustersw/Debian/bullseye/cuda/11.2/alphafold/2.3.4/lib/python3.9/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/mnt/nfs/clustersw/Debian/bullseye/cuda/11.2/alphafold/2.3.4/lib/python3.9/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "/mnt/nfs/clustersw/Debian/bullseye/cuda/11.2/alphafold/2.3.4/alphafold-2.3.4/run_alphafold.py", line 443, in main
    predict_structure(
  File "/mnt/nfs/clustersw/Debian/bullseye/cuda/11.2/alphafold/2.3.4/alphafold-2.3.4/run_alphafold.py", line 242, in predict_structure
    plddt = prediction_result['plddt']
TypeError: tuple indices must be integers or slices, not str
Htomlinson14 commented 1 year ago

Hi! Has the code been adapted at all? There is no 2.3.4 tag.

Doscinco commented 1 year ago

I got the same error below. Has anyone figured out how to fix this? Thanks.

Traceback (most recent call last): File "/apps/eb/AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold/bin/alphafold", line 507, in app.run(main) File "/apps/eb/jax/0.3.25-foss-2022a-CUDA-11.7.0/lib/python3.10/site-packages/absl/app.py", line 308, in run _run_main(main, args) File "/apps/eb/jax/0.3.25-foss-2022a-CUDA-11.7.0/lib/python3.10/site-packages/absl/app.py", line 254, in _run_main sys.exit(main(argv)) File "/apps/eb/AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold/bin/alphafold", line 488, in main predict_structure( File "/apps/eb/AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold/bin/alphafold", line 283, in predict_structure plddt = prediction_result['plddt'] TypeError: tuple indices must be integers or slices, not str

sokrypton commented 1 year ago

Can you provide more details of what and how you are running thing?

Looks like there is mention of colabfold in the error message...

Doscinco commented 1 year ago

I am running AlphaFold 2.3.4, which was installed with EasyBuild on a Rocky 8 Linux cluster. Thanks.

"This package of AlphaFold contains patches for ColabFold."

https://docs.easybuild.io/version-specific/supported-software/#alphafold

JD-Crick commented 1 year ago

DrJesseHansen did you ever resolve this issue? Same TypeError as my runs.

DrJesseHansen commented 1 year ago

yes, but unfortunately I don't recall how. We had tons of errors during that time and eventually all got resolved. Are you running the latest ver of AF2? I remember upgrading helped a lot.

JD-Crick commented 1 year ago

Hi, thanks for the response. Alphafold is installed on my workplace's cluster so I am not in control of updating it. We currently run "AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold" which I believe is the latest iteration. Others in my workplace are getting the same error.

mvheetve commented 9 months ago

Hi there,

exact same error here, on all submitted jobs. Using AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold.

Command:

alphafold  \
  --fasta_paths=${input} \
  --max_template_date=2023-03-10 \
  --db_preset=full_dbs \
  --data_dir ${ALPHAFOLD_DATA_DIR}\
  --model_preset=multimer \
  --output_dir ${outdir}

Error:

I0206 23:12:05.705442 22790460397376 model.py:201] Output shape was {'aligned_confidence_probs': (1066, 1066, 64), 'distogram': {'bin_edges': (63,), 'logits': (1066, 1066, 64)}, 'experimentally_resolved': {'logits': (1066, 37)}, 'iptm': (), 'masked_msa': {'logits': (508, 1066, 22)}, 'max_predicted_aligned_error': (), 'mean_plddt': (), 'plddt': (1066,), 'predicted_aligned_error': (1066, 1066), 'predicted_lddt': {'logits': (1066, 50)}, 'ptm': (), 'ranking_confidence': (), 'structure_module': {'final_atom_mask': (1066, 37), 'final_atom_positions': (1066, 37, 3)}, 'tol': ()}
I0206 23:12:05.706495 22790460397376 alphafold:269] Total JAX model model_1_multimer_v3_pred_0 on XXXX predict time (includes compilation time, see --benchmark): 252.4s
Traceback (most recent call last):
  File "/apps/gent/RHEL8/cascadelake-volta-ib/software/AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold/bin/alphafold", line 507, in <module>
    app.run(main)
  File "/apps/gent/RHEL8/cascadelake-volta-ib/software/jax/0.3.25-foss-2022a-CUDA-11.7.0/lib/python3.10/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/apps/gent/RHEL8/cascadelake-volta-ib/software/jax/0.3.25-foss-2022a-CUDA-11.7.0/lib/python3.10/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
  File "/apps/gent/RHEL8/cascadelake-volta-ib/software/AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold/bin/alphafold", line 488, in main
    predict_structure(
  File "/apps/gent/RHEL8/cascadelake-volta-ib/software/AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold/bin/alphafold", line 283, in predict_structure
    plddt = prediction_result['plddt']
TypeError: tuple indices must be integers or slices, not str

Going to try a previous version for now, but fixes are welcome.

Regards Mattias

gaspode commented 8 months ago

Also getting this on AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold built with EasyBuild

mbuyukyoruk commented 5 months ago

Hi all,

I have been getting the same error for AlphaFoldv2 as well on a HPC cluster. I have tried three different versions that was available on the system (AlphaFold/2.3.1-foss-2022a-CUDA-11.7.0, AlphaFold/2.3.4-foss-2022a-ColabFold or AlphaFold/2.3.4-foss-2022a-CUDA-11.7.0-ColabFold) and having the following error related to plddt:

plddt = prediction_result['plddt']
TypeError: tuple indices must be integers or slices, not str

Since, I couldn't access the AlphaFold scripts as a non-sudo user, I was trying to figure our if it was related to the input file and I though it might be related to string parsing of the sequence header.

Solution that worked for me:

Editing the Fasta header to include the accession only helped me to solve the problem. I am not sure if this was the exact solution but I figured you might want to try if your header is long and contains a series of 'strings' especially separated with black spaces.

Example Fasta header format that worked for me:

>NZ_CP032157.1_5712
MNNFSSHIASRYKQKGKFFLPPLFLILFLLVFTDKFT...

I hope this would help some of you to troubleshoot on your servers.

Regards,

Murat