Skip to content
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

Add parameter to enable overriding tree args #871

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion defaults/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ combine_sequences_for_subsampling:
warn_about_duplicates: true

tree:
tree-builder-args: "'-ninit 10 -n 4'"
tree-builder-args: "'-ninit 10 -n 4 -me 0.05'"
override_default_args: true
Comment on lines +118 to +119
Copy link
Member

Choose a reason for hiding this comment

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

The mix of - and _ in parameter names right next to each other seems a bit off. Looking at the rest of this file, _ is used for everything but tree-builder-args. It's probably beyond this PR to change that, so probably fine to use underscores for override_default_args here to follow broader convention.


# TreeTime settings
refine:
Expand Down
4 changes: 4 additions & 0 deletions docs/src/reference/change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
As of April 2021, we use major version numbers (e.g. v2) to reflect backward incompatible changes to the workflow that likely require you to update your Nextstrain installation.
We also use this change log to document new features that maintain backward compatibility, indicating these features by the date they were added.

## v12 (? February 2022)

- Add a new workflow parameter in the `tree` config named [`override_default_args`](https://docs.nextstrain.org/projects/ncov/en/latest/reference/configuration.html#override_default_args) that enables overriding default tree builder arguments with the values defined by [`tree-builder-args`](https://docs.nextstrain.org/projects/ncov/en/latest/reference/configuration.html#tree-builder-args). This release of the workflow sets this parameter to `true` by default, which may be a breaking change for users who have modified the default tree builder arguments. Upgrade to [Augur 14.0.0](https://github.com/nextstrain/augur/blob/master/CHANGES.md#1400-8-february-2022) and run `augur tree -h` to see the default arguments for the tree builder you use. [See the original Augur pull request](https://github.com/nextstrain/augur/pull/839), for more details.

## New features since last version update

## v12 (12 July 2022)
Expand Down
9 changes: 8 additions & 1 deletion docs/src/reference/workflow-config-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,14 @@ tree-builder-args

- type: string
- description: Arguments specific to the tree method (``iqtree``) to be passed through to the tree builder command run by ``augur tree``.
- default: ``'-ninit 10 -n 4'``
- default: ``'-ninit 10 -n 4 -me 0.05'``

override_default_args
~~~~~~~~~~~~~~~~~~~~~

- type: boolean
- description: Override default tree builder arguments with the values provided by the user in ``tree-builder-args`` instead of augmenting the existing defaults.
- default: ``true``



Expand Down
2 changes: 2 additions & 0 deletions workflow/snakemake_rules/main_workflow.smk
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ rule tree:
tree = "results/{build_name}/tree_raw.nwk"
params:
args = lambda w: config["tree"].get("tree-builder-args","") if "tree" in config else "",
override_default_args = lambda wildcards: "--override-default-args" if config["tree"].get("override_default_args", False) else "",
exclude_sites = lambda w: f"--exclude-sites {config['files']['sites_to_mask']}" if "sites_to_mask" in config["files"] else ""
log:
"logs/tree_{build_name}.txt"
Expand All @@ -804,6 +805,7 @@ rule tree:
augur tree \
--alignment {input.alignment} \
--tree-builder-args {params.args} \
{params.override_default_args} \
{params.exclude_sites} \
--output {output.tree} \
--nthreads {threads} 2>&1 | tee {log}
Expand Down