sokrypton / sokrypton/ColabFold

Type Error when altering stop_at_score parameter in Alphafold2_batch in Google Colab

Open
#634 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
2.9k
Forks
747
PR merge metrics
No merged PRs in 30d

Description

I have been using the AlphaFold2_batch.ipynb notebook within Google Colab to model protein complexes. It runs perfectly when I use it with the default settings or changing only the num_recycles parameter. Today I altered the stop_at_score parameter from 100 (the default) to 40 . The expected behaviour is that as soon as one of the recycles or models reaches this specified score, the job should terminate and move onto modelling the next complex. I have two issues:

  1. I get an error (see below). I think it might pertain to the fact that the stop_at_score parameter is read in as a string and not subsequently converted to a numeric datatype.
  2. It is unclear to me whether the correct metric is being compared to determine whether the stopping threshold has been reached (the notebook says it uses "ptmscore" for modelling complexes, but it isn't clear to me whether this is pTM, ipTM or 0.8 ipTM+0.2 pTM). It would be great if there was an option to specify which metric is being used. I'm particularly confused because it says here (https://github.com/sokrypton/ColabFold/wiki/v1.5.0) that stop_at_score operates on a scale of 0-100, whereas the pTM values are on a scale of 0 to 1. I assume some conversion must take place but it wasn't clear to me how/ where this was happening.

Regarding point (1), I get the following output and error:

2024-07-11 14:27:15,800 Running on GPU
2024-07-11 14:27:16,012 Found 5 citations for tools or databases
2024-07-11 14:27:16,013 Query 1/2: AT2G41110.1-IQD26 (length 538)
COMPLETE: 100%|██████████| 300/300 [elapsed: 00:01 remaining: 00:00]
COMPLETE: 100%|██████████| 300/300 [elapsed: 00:00 remaining: 00:00]
2024-07-11 14:28:52,090 alphafold2_multimer_v3_model_1_seed_000 recycle=0 pLDDT=36.5 pTM=0.284 ipTM=0.196
... (output of recycles 1-23) .....
2024-07-11 14:32:41,616 alphafold2_multimer_v3_model_1_seed_000 recycle=24 pLDDT=38.7 pTM=0.298 ipTM=0.202 tol=9.58
2024-07-11 14:32:41,617 alphafold2_multimer_v3_model_1_seed_000 took 312.6s (24 recycles)

UFuncTypeError Traceback (most recent call last)
in <cell line: 17>()
15
16 queries, is_complex = get_queries(input_dir)
---> 17 run(
18 queries=queries,
19 result_dir=result_dir,

1 frames
/content/colabfold/batch.py in run(queries, result_dir, num_models, is_complex, num_recycles, recycle_early_stop_tolerance, model_order, num_ensemble, model_type, msa_mode, use_templates, custom_template_path, num_relax, relax_max_iterations, relax_tolerance, relax_stiffness, relax_max_outer_iterations, keep_existing_results, rank_by, pair_mode, pairing_strategy, data_dir, host_url, user_agent, random_seed, num_seeds, recompile_padding, zip_results, prediction_callback, save_single_representations, save_pair_representations, jobname_prefix, save_all, save_recycles, use_dropout, use_gpu_relax, stop_at_score, dpi, max_seq, max_extra_seq, pdb_hit_file, local_pdb_path, use_cluster_profile, feature_dict_callback, **kwargs)
1579 first_job = False
1580
-> 1581 results = predict_structure(
1582 prefix=jobname,
1583 result_dir=result_dir,

/content/colabfold/batch.py in predict_structure(prefix, result_dir, feature_dict, is_complex, use_templates, sequences_lengths, pad_len, model_type, model_runner_and_params, num_relax, relax_max_iterations, relax_tolerance, relax_stiffness, relax_max_outer_iterations, rank_by, random_seed, num_seeds, stop_at_score, prediction_callback, use_gpu_relax, save_all, save_single_representations, save_pair_representations, save_recycles)
495
496 # early stop criteria fulfilled
--> 497 if mean_scores[-1] > stop_at_score: break
498
499 # early stop criteria fulfilled

UFuncTypeError: ufunc 'greater' did not contain a loop with signature matching types (<class 'numpy.dtypes.Float16DType'>, <class 'numpy.dtypes.StrDType'>) -> None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AlphaFold2_batch.ipynb and the traceback location in /content/colabfold/batch.py, especially predict_structure around line 497. Reproduce the issue with stop_at_score set to 40, then trace how the parameter and mean_scores are produced and identify which score is compared. Done means the setting no longer raises a type error and the documented score scale and metric are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
bioinformatics, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.