-
Notifications
You must be signed in to change notification settings - Fork 30
Add nextstrain run support
#19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
That is a very weird name for a workflow, esp. a workflow we admit is "the simplest version of a phylogenetic workflow" (emphasis mine). How about we use this opportunity to implement workflow name → directory mapping in workflows:
phylogenetic:
path: .which would allow: Or, alternatively, we could move everything into |
If we want this, it's pretty easy to support: diff --git a/nextstrain/cli/pathogens.py b/nextstrain/cli/pathogens.py
index 5dd0172..411c574 100644
--- a/nextstrain/cli/pathogens.py
+++ b/nextstrain/cli/pathogens.py
@@ -342,8 +342,19 @@ def compatible_workflows(self, feature: str) -> Dict[str, Dict]:
}
- def workflow_path(self, workflow: str) -> Path:
- return self.path / workflow
+ def workflow_registration(self, workflow_name: str) -> Optional[dict]:
+ if (info := self.registered_workflows().get(workflow_name)) and not isinstance(info, dict):
+ debug(f"pathogen registration.workflows[{workflow_name!r}] is not a dict (got a {type(info).__name__})")
+ return None
+ return info
+
+
+ def workflow_path(self, workflow_name: str) -> Path:
+ if (info := self.workflow_registration(workflow_name)) and (workflow_path := info.get("path")):
+ return self.path / workflow_path
+
+ debug(f"pathogen registration does not specify path for workflow {workflow_name!r}; using name as path")
+ return self.path / workflow_name
def setup(self, dry_run: bool = False, force: bool = False) -> SetupStatus:
@@ -747,6 +758,7 @@ def __init__(self, path: str):
registered_workflows = PathogenVersion.registered_workflows
compatible_workflows = PathogenVersion.compatible_workflows
+ workflow_registration = PathogenVersion.workflow_registration
workflow_path = PathogenVersion.workflow_path
def __str__(self) -> str: |
|
(There's some safeguards we'd want to add, like ensuring the registration-provided path is relative and does not specify a location outside the containing dir.) |
Hah, definitely agree! I wasn't happy with the
+1 for workflow name to directory mapping to solve this weirdness. |
This decoupling of workflow names from paths was always expected and intended to be possible, and now it is. Related-to: <nextstrain/zika-tutorial#19> Related-to: <nextstrain/public#1>
This decoupling of workflow names from paths was always expected and intended to be possible, and now it is. Related-to: <nextstrain/zika-tutorial#19> Related-to: <nextstrain/public#1>
|
The release of Nextstrain CLI 10.4.0 yesterday adds support for the workflow name → path mapping. |
e93e1a6 to
6a17025
Compare
Keeping the original behavior where the input files are hard-coded in the workflow and cannot be modified via config parameters. Requires Nextstrain CLI 10.4.0 with support for the workflow name to path mapping to be able to run with ``` nextstrain run zika-tutorial phylogenetic <analysis-dir> ```
6a17025 to
4895151
Compare
Description of proposed changes
The goal of the repo is to present the simplest version of a phylogenetic workflow so I have kept the top level Snakefile and kept the original behavior where the input files are hard-coded in the workflow and cannot be modified via config parameters.
Requires Nextstrain CLI 10.4.0 with support for the workflow name to path mapping to be able to run with
Related issue(s)
Resolves #18