From cd3def601cd2afd3f3881b96946dbec33edc15f1 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:15:10 -0800 Subject: [PATCH 1/4] Set AUGUR_SEARCH_PATHS To be used by various Augur commands and pathogen workflows, starting with augur subsample in the measles repo. --- snakemake/config.smk | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/snakemake/config.smk b/snakemake/config.smk index b47ee9b..579cd28 100644 --- a/snakemake/config.smk +++ b/snakemake/config.smk @@ -11,6 +11,39 @@ from typing import Optional from textwrap import dedent, indent +# Set search paths for Augur +if "AUGUR_SEARCH_PATHS" in os.environ: + print(dedent(f"""\ + Using existing search paths in AUGUR_SEARCH_PATHS: + + {os.environ["AUGUR_SEARCH_PATHS"]!r} + """), file=sys.stderr) +else: + # Note that this differs from the search paths used in + # resolve_config_path(). + # This is the preferred default moving forwards, and the plan is to + # eventually update resolve_config_path() to use AUGUR_SEARCH_PATHS. + search_paths = [ + # User analysis directory + Path.cwd(), + + # Workflow defaults folder + Path(workflow.basedir) / "defaults", + + # Workflow root (contains Snakefile) + Path(workflow.basedir), + ] + + repo_root = Path(workflow.basedir) / ".." + if (repo_root / "nextstrain-pathogen.yaml").is_file(): + search_paths.extend([ + # Pathogen repo root + repo_root, + ]) + + os.environ["AUGUR_SEARCH_PATHS"] = ":".join(map(str, search_paths)) + + class InvalidConfigError(Exception): pass From 07387c754b631dcbfd22d8a86b53fa4a9caaed87 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Mon, 2 Feb 2026 11:00:25 -0800 Subject: [PATCH 2/4] Filter to existing directories This removes files and non-existent directories. --- snakemake/config.smk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snakemake/config.smk b/snakemake/config.smk index 579cd28..c1e2b5f 100644 --- a/snakemake/config.smk +++ b/snakemake/config.smk @@ -41,6 +41,8 @@ else: repo_root, ]) + search_paths = [path for path in search_paths if path.is_dir()] + os.environ["AUGUR_SEARCH_PATHS"] = ":".join(map(str, search_paths)) From 0ea01d6f56854433c75d741aa34ada431e568cc4 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Mon, 2 Feb 2026 11:07:33 -0800 Subject: [PATCH 3/4] Resolve to absolute paths This removes references such as "..", for clarity while debugging. --- snakemake/config.smk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snakemake/config.smk b/snakemake/config.smk index c1e2b5f..8850423 100644 --- a/snakemake/config.smk +++ b/snakemake/config.smk @@ -41,7 +41,7 @@ else: repo_root, ]) - search_paths = [path for path in search_paths if path.is_dir()] + search_paths = [path.resolve() for path in search_paths if path.is_dir()] os.environ["AUGUR_SEARCH_PATHS"] = ":".join(map(str, search_paths)) From 0eda59ea22ae3eb4c65e8eb656e072e8a2f6b395 Mon Sep 17 00:00:00 2001 From: Victor Lin Date: Wed, 4 Feb 2026 13:10:41 -0800 Subject: [PATCH 4/4] Note naive repo_root definition Co-authored-by: Jover Lee --- snakemake/config.smk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snakemake/config.smk b/snakemake/config.smk index 8850423..2f0df30 100644 --- a/snakemake/config.smk +++ b/snakemake/config.smk @@ -34,6 +34,10 @@ else: Path(workflow.basedir), ] + # This should work for majority of workflows, but we could consider doing a + # more thorough search for the nextstrain-pathogen.yaml. This would likely + # replicate how CLI searches for the root.¹ + # ¹ repo_root = Path(workflow.basedir) / ".." if (repo_root / "nextstrain-pathogen.yaml").is_file(): search_paths.extend([