Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions snakemake/config.smk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,45 @@ 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.
Comment on lines +22 to +25
Copy link
Copy Markdown
Member Author

@victorlin victorlin Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a draft of what that could look like: nextstrain/avian-flu@dadbde0...bbad70d.

I don't think it should block this PR, but that's what I have in mind. We could discuss at the next dev chat.

search_paths = [
# User analysis directory
Path.cwd(),

# Workflow defaults folder
Path(workflow.basedir) / "defaults",

# Workflow root (contains Snakefile)
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.¹
# ¹ <https://github.com/nextstrain/cli/blob/d5e184c5/nextstrain/cli/command/build.py#L413-L420>
repo_root = Path(workflow.basedir) / ".."
if (repo_root / "nextstrain-pathogen.yaml").is_file():
search_paths.extend([
# Pathogen repo root
repo_root,
])

search_paths = [path.resolve() for path in search_paths if path.is_dir()]

os.environ["AUGUR_SEARCH_PATHS"] = ":".join(map(str, search_paths))


class InvalidConfigError(Exception):
pass

Expand Down