boltz icon indicating copy to clipboard operation
boltz copied to clipboard

Errors for prediction with templates

Open ichxw opened this issue 10 months ago • 1 comments

Thanks for this great tool. I tried to run the prediction with a template. But got errors as follows:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/home/xzhu/boltz/boltz/src/boltz/data/module/inferencev2.py", line 274, in __getitem__
    features = self.featurizer.process(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/home/xzhu/boltz/boltz/src/boltz/data/feature/featurizerv2.py", line 2175, in process
    template_features = process_template_features(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/home/xzhu/boltz/boltz/src/boltz/data/feature/featurizerv2.py", line 1797, in process_template_features
    row_features = compute_template_features(data, row_tokens, max_tokens)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/home/xzhu/boltz/boltz/src/boltz/data/feature/featurizerv2.py", line 1693, in compute_template_features
    query_token = query_tokens.tokens[idx]
                  ~~~~~~~~~~~~~~~~~~~^^^^^
IndexError: index 288 is out of bounds for axis 0 with size 235

Below is the yaml file:

version: 1  # Optional, defaults to 1
sequences:
  - protein:
      id: A
      sequence: GPHMEEASKRSYQFWDTQPVPKLGEVVNTHGPVEPDKDNIRQEPYTLPQGFTWDALDLGDRGVLKELYTLLNENYVEDDDNMFRFDYSPEFLLWALRPPGWLPQWHCGVRVVSSRKLVGFISAIPANIHIYDTEKKMVEINFLCVHKKLRSKRVAPVLIREITRRVHLEGIFQAVYTAGVVLPKPVGTCRYWHRSLNPRKLIEVKFSHLSRNMTMQRTMKLYRLPETPKTAGLRPMETKDIPVVHQLLTRYLKQFHLTPVMSQEEVEHWFYPQENIIDTFVVENANGEVTDFLSFYTLPSTIMNHPTHKSLKAAYSFYNVHTQTPLLDLMSDALVLAKMKGFDVFNALDLMENKTFLEKLKFGIGDGNLQYYLYNWKCPSMGAEKVGLVLQ
  - ligand:
      id: B
      smiles: 'Cc1nn(C)c(C)c1CCOc2c(F)c(F)ccc2c3ccc4c(c3)c(CN(C)C)nn4C'
templates:
  - cif: '5mu6.cif'
    chain_id: A
properties:
  - affinity:
      binder: B

The template was this file: https://files.rcsb.org/download/5MU6.cif. All heteroatoms were deleted. Command to run the prediction:

boltz predict template.yaml --use_msa_server --diffusion_samples 5 --recycling_steps 15 --sampling_steps 800 --devices 1 --num_workers 8 --out_dir affinity_template

ichxw avatar Jun 11 '25 04:06 ichxw

Perhaps you can try running the same prediction without a template in the YAML file, and it will work. This question may help you #300

MonaLee1973 avatar Jun 16 '25 06:06 MonaLee1973

Perhaps you can try running the same prediction without a template in the YAML file, and it will work. This question may help you #300

Thanks for the comments. Running without a template had no problem. I wanted to know if results got any improvement with a template constraint.

ichxw avatar Jun 18 '25 18:06 ichxw

I have the exact same issue, can't run with a template, getting the same error during the affinity prediction. Did you figure out how to fix it?

poly997 avatar Jun 20 '25 18:06 poly997

My issue is exactly the same, I am using 6N19 (https://www.rcsb.org/structure/6N19) PDB structure in .cif format, in a fresh conda environment. Here's the text of the issue:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pavdiunina/miniconda3/envs/Boltz2/lib/python3.10/site-packages/boltz/data/module/inferencev2.py", line 274, in getitem features = self.featurizer.process( File "/home/pavdiunina/miniconda3/envs/Boltz2/lib/python3.10/site-packages/boltz/data/feature/featurizerv2.py", line 2175, in process template_features = process_template_features( File "/home/pavdiunina/miniconda3/envs/Boltz2/lib/python3.10/site-packages/boltz/data/feature/featurizerv2.py", line 1797, in process_template_features row_features = compute_template_features(data, row_tokens, max_tokens) File "/home/pavdiunina/miniconda3/envs/Boltz2/lib/python3.10/site-packages/boltz/data/feature/featurizerv2.py", line 1693, in compute_template_features query_token = query_tokens.tokens[idx] IndexError: index 244 is out of bounds for axis 0 with size 225

Here's a .yaml file I used

sequences:

  • protein: id: A sequence: SGEGQDIWDMLDKGNPFQFYLTRVSGVKPKYNSGALHIKDILSPLFGTLVSSAQFNYCFDVDWLVKQYPPEFRKKPILLVHGDKREAKAHLHAQAKPYENISLCQAKLDIAFGTHHTKMMLLLYEEGLRVVIHTSNLIHADWHQKTQGIWLSPLYPRIADGTHKSGESPTHFKADLISYLMAYNAPSLKEWIDVIHKHDLSETNVYLIGSTPGRFQGSQKDNWGHFRLKKLLKDHASSMPNAESWPVVGQFSSVGSLGADESKWLCSEFKESMLTLGKESKTPGKSSVPLYLIYPSVENVRTSLEGYPAGGSLPYSIQTAEKQNWLHSYFHKWSAETSGRSNAMPHIKTYMRPSPDFSKIAWFLVTSANLSKAAWGALEKNGTQLMIRSYELGVLFLPSAFGLDSFKVKQKFFAGSQEPMATFPVPYDLPPELYGSKDRPWIWNIPYVKAPDTHGNMWVPS
  • ligand: id: B smiles: '[H]c1nn2c([H])c3c4nc2c1C(=O)N([H])C([H])([H])C@(C([H])([H])[H])Oc1c([H])c([H])c([H])c([H])c1C([H])([H])N4C@(C([H])([H])[H])C([H])([H])O3' templates:
  • cif: /home/pavdiunina/boltz2/6N19.cif properties:
  • affinity: binder: B

The command I ran:

boltz predict prediction_boltz2.yaml --use_msa_server

poly997 avatar Jun 20 '25 23:06 poly997