From e0c3ec65053cc85bfa7db8a05ffde10ba8e331b8 Mon Sep 17 00:00:00 2001 From: Atharva Tilewale <165510686+AtharvaTilewale@users.noreply.github.com> Date: Sun, 25 Oct 2026 04:26:29 +0530 Subject: [PATCH] Default --db2 to the template database of setup_databases.sh --use-templates 1 without --db2 left the template database as an empty path, so the existence check reported the confusing "Database . does not exist". Give --db2 the default name that setup_databases.sh creates, the same way --db1 and --db3 already have defaults. Fixes #748 --- colabfold/mmseqs/search.py | 6 ++++-- tests/test_search.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 tests/test_search.py diff --git a/colabfold/mmseqs/search.py b/colabfold/mmseqs/search.py index 9c3be7f03..99cfccfd4 100644 --- a/colabfold/mmseqs/search.py +++ b/colabfold/mmseqs/search.py @@ -51,7 +51,7 @@ def mmseqs_search_monomer( dbbase: Path, base: Path, uniref_db: Path = Path("uniref30_2302_db"), - template_db: Path = Path(""), # Unused by default + template_db: Path = Path("pdb100_230517"), # Unused by default metagenomic_db: Path = Path("colabfold_envdb_202108_db"), mmseqs: Path = Path("mmseqs"), use_env: bool = True, @@ -322,7 +322,9 @@ def main(): parser.add_argument( "--db1", type=Path, default=Path("uniref30_2302_db"), help="UniRef database" ) - parser.add_argument("--db2", type=Path, default=Path(""), help="Templates database") + parser.add_argument( + "--db2", type=Path, default=Path("pdb100_230517"), help="Templates database" + ) parser.add_argument( "--db3", type=Path, diff --git a/tests/test_search.py b/tests/test_search.py new file mode 100644 index 000000000..b42bed10d --- /dev/null +++ b/tests/test_search.py @@ -0,0 +1,35 @@ +import sys + +import pytest + +from colabfold.mmseqs import search + + +def test_use_templates_without_db2(tmp_path, monkeypatch): + """--use-templates must use the template database of setup_databases.sh (#748)""" + dbbase = tmp_path.joinpath("colabfold_db") + dbbase.mkdir() + for suffix in [".dbtype", ".idx"]: + dbbase.joinpath(f"uniref30_2302_db{suffix}").touch() + query = tmp_path.joinpath("query.fasta") + query.write_text(">test\nMEIIALLIEEGIIIIKDKKVAERFLKDLESSQGMDWKEIRERAERAKKQLEEGIEWAKKTKL\n") + + monkeypatch.setattr(search, "run_mmseqs", lambda *args, **kwargs: None) + monkeypatch.setattr( + sys, + "argv", + [ + "colabfold_search", + str(query), + str(dbbase), + str(tmp_path.joinpath("out")), + "--use-env", + "0", + "--use-templates", + "1", + ], + ) + + # the template database is not downloaded here, but the error has to name it + with pytest.raises(FileNotFoundError, match="pdb100_230517"): + search.main()