Change substitution model in SARS-CoV-2 workflow?

Dear Nextstrain team,

Is there currently a way to customize the tree-builder-args in the SARS-CoV-2 workflow, e.g. changing the substitution model?

I see there is an open pull request related to this (Add parameter to enable overriding tree args by huddlej · Pull Request #871 · nextstrain/ncov · GitHub)

Best wishes,

1 Like

Hi Robert,

Thanks for getting in touch here. Good digging, I’m not sure the PR is ever going to get merged - there’s a good chance we’ll simplify how we produce SARS-CoV-2 trees in the future - the current workflow is rather complicated.

In general, the easiest might be to fork and make the changes you’d want directly in the code base.

Looking at this particular question of tree builder args I see two options:

  1. You should be able to change it here in the default.yaml config file:

  2. If this doesn’t work, you can always fork the workflow and just directly make the changes you’d like to make to tree builder args here:

Let me know if this doesn’t work or you encounter some other issues.



Hi Cornelius!
Thanks for the rapid reply!

I had tried to modify both the default.yaml and the main workflow file but still got the same error (“conflict with hardcoded defaults”), so I wonder where the value ‘-ninit 10 -n 4’ is hardcoded?


I think the way to specify substitution model is via --substitution-model as opposed to default args:

augur tree -h
usage: augur tree [-h] --alignment ALIGNMENT [--method {fasttree,raxml,iqtree}] [--output OUTPUT] [--substitution-model SUBSTITUTION_MODEL]
                  [--nthreads NTHREADS] [--vcf-reference VCF_REFERENCE] [--exclude-sites EXCLUDE_SITES] [--tree-builder-args TREE_BUILDER_ARGS]

Build a tree using a variety of methods.
  --substitution-model SUBSTITUTION_MODEL
                        substitution model to use. Specify 'auto' to run ModelTest. Currently, only available for IQ-TREE. (default: GTR)

Also see the relevant code:
check_conflicting_args(tree_builder_args, (“-ntmax”, “-s”, “-m”))

auto is a special argument, but anything else gets passed through. See IQtree2 manual for valid substitution model strings:

iqtree2 -h
--m MODEL_STRING          Specify the evolutionary model. See Manual for more detail

Link to relevant IQtree docs:

Very good suggestion! It worked when I did the following modifications:
In main_workflow.smk I add to params and shell in rule tree:

rule tree:
        subst_model = config["tree"]["subst_model"]
            --substitution-model {params.subst_model} 

and in parameters.yaml:

  subst_model: "GTR+F+R2"

Many thanks Cornelius!