sokrypton / sokrypton/ColabFold

Issue with Stack overflow at the Run Prediction cell

Open
#359 2 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

Expected Behavior: Initiation of the "run prediction" algorithm on the AlphaFold2.ipynb web application.

Current Behavior: Gives an error saying "Stack Overflow" immediately after initiation.

Steps to Reproduce (for bugs):

Initially I thought it was because I had entered a set of sequences that was too ambitious, but the problem occurred with sequences I had already evaluated. Any set of sequences I input, however small, cause this error by the "Run Prediction" cell. It was working yesterday and earlier today, and stopped.

ColabFold Output (for bugs)

#@title Run Prediction
import sys
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

from colabfold.download import download_alphafold_params, default_data_dir
from colabfold.utils import setup_logging
from colabfold.batch import get_queries, run, set_model_type
import os
try:
K80_chk = os.popen('nvidia-smi | grep "Tesla K80" | wc -l').read()
except:
K80_chk = "0"
pass
if "1" in K80_chk:
print("WARNING: found GPU Tesla K80: limited to total length < 1000")
if "TF_FORCE_UNIFIED_MEMORY" in os.environ:
del os.environ["TF_FORCE_UNIFIED_MEMORY"]
if "XLA_PYTHON_CLIENT_MEM_FRACTION" in os.environ:
del os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"]

from colabfold.colabfold import plot_protein
from pathlib import Path
import matplotlib.pyplot as plt

For some reason we need that to get pdbfixer to import

if use_amber and f"/usr/local/lib/python{python_version}/site-packages/" not in sys.path:
sys.path.insert(0, f"/usr/local/lib/python{python_version}/site-packages/")

def prediction_callback(unrelaxed_protein, length, prediction_result, input_features, type):
fig = plot_protein(unrelaxed_protein, Ls=length, dpi=150)
plt.show()
plt.close()

result_dir="."
if 'logging_setup' not in globals():
setup_logging(Path(".").joinpath("log.txt"))
logging_setup = True

queries, is_complex = get_queries(queries_path)
model_type = set_model_type(is_complex, model_type)
download_alphafold_params(model_type, Path("."))
run(
queries=queries,
result_dir=result_dir,
use_templates=use_templates,
custom_template_path=custom_template_path,
use_amber=use_amber,
msa_mode=msa_mode,
model_type=model_type,
num_models=5,
num_recycles=num_recycles,
model_order=[1, 2, 3, 4, 5],
is_complex=is_complex,
data_dir=Path("."),
keep_existing_results=False,
recompile_padding=1.0,
rank_by="auto",
pair_mode=pair_mode,
stop_at_score=float(100),
prediction_callback=prediction_callback,
dpi=dpi,
zip_results=True
)
os.system(f"unzip {jobname}.result.zip")

UnicodeEncodeError Traceback (most recent call last)
in
42 model_type = set_model_type(is_complex, model_type)
43 download_alphafold_params(model_type, Path("."))
---> 44 run(
45 queries=queries,
46 result_dir=result_dir,
/usr/local/lib/python3.8/dist-packages/colabfold/batch.py in run(queries, result_dir, num_models, num_recycles, model_order, is_complex, num_ensemble, model_type, msa_mode, use_templates, custom_template_path, use_amber, keep_existing_results, rank_by, pair_mode, data_dir, host_url, random_seed, stop_at_score, recompile_padding, recompile_all_models, zip_results, prediction_callback, save_single_representations, save_pair_representations, training, use_gpu_relax, stop_at_score_below, dpi, max_msa)
1270 )
1271
-> 1272 bibtex_file = write_bibtex(
1273 model_type, use_msa, use_env, use_templates, use_amber, result_dir
1274 )

/usr/local/lib/python3.8/dist-packages/colabfold/citations.py in write_bibtex(model, use_msa, use_env, use_templates, use_amber, result_dir, bibtex_file)
129 with bibtex_file.open("w") as writer:
130 for i in to_cite:
--> 131 writer.write(citations[i])
132 writer.write("\n")
133

UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 53: ordinal not in range(128)

Context

As stated above, no set of sequences will work.

Your Environment

I used the web application, from an up-to-date Google Chrome browser, on a Windows 10 laptop.

  • Git commit used
  • If you run it on a local system. Please add the server specifications
  • Operating system and version:

Any help would be great.

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 by reproducing the Run Prediction cell in AlphaFold2.ipynb, then inspect colabfold/batch.py around run() and colabfold/citations.py in write_bibtex(), where the traceback points. Verify that the citation-writing step handles the non-ASCII character shown in the error and that prediction completes without the reported encoding failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.