Beast module

This module contains the rules to generate dynamic beast XML input files, update previous BEAST analyses with new samples, run BEAST2 and produce summary plots and statistics for the McCoy report.

Rules

Rule dynamicbeast[source]

Use dynamicbeast to generate a dynamic BEAST2 XML template from a standard static one, for use with feast.

Input:
  • template – the BEAST XML template file

  • phytest_report – the phytest report file generated by the phytest rule. By using this as an input, we ensure that this rule (and all downstream rules) only run when our quality control checks pass.

Output:

the dynamic XML template file to be used by the onlinebeast and/or beast rules

Conda:
channels:
  - conda-forge
dependencies:
  - pip:
    - dynamic-beast

Rule onlinebeast[source]

Use online-beast to add any new sequences to the Beast2 analysis from an inherited run and update the state.

Warning

This rule will only run if the --inherit or --inherit-last flags are passed to McCoy.

Input:
  • xml – the template file generated by the dynamicbeast rule

  • state – the statefile from the inherited McCoy run. This is compied into the data directory by the McCoy CLI.

  • alignment – the aligned sequences from the align rule

Output:

the updated state file produced by online-beast.

Note: No XML file is produced as we are using a template XML which doesn’t actually contain the sequences in it.

Conda:
channels:
  - bioconda
  - conda-forge
dependencies:
  - beast2==2.6.3
  - beagle-lib<4
  - pip
  - pip:
    - online-beast

Rule beast[source]

Run Beast2, either restarting from a state file or from scratch.

Note

GPU acceleration is requested if available by default. If you are running on a machine with a compatible GPU then the code will crash when using the bioconda package. To avoid this, either:

  1. ensure you pass --use-envmodules to McCoy and set the envmodules directives of this rule appropriately, or

  2. remove the -beagle_GPU flag from the beast.beast entry in your McCoy config file.

Input:
  • alignment – the aligned fasta file output from align

  • template

    the Beast 2 input XML file, templated with feast. If inherit is set in the config then the output of the onlinebeast rule is used, otherwise the output of the dynamicbeast rule is used.

Output:

the tree log, trace log, and statefile from Beast2

Config:
  • inherit – are we inheriting from a previous run?

    default: False

  • beast.dynamic – the dynamic variables used to populate the feast template.

    default: ['ePopSize=0.3', 'Date.dateFormat=yyyy/MM/dd', 'Date.delimiter=_', 'mutationRate=1.0', 'mcmc.chainLength=10000', 'treelog.logEvery=1000', 'tracelog.logEvery=1000']

  • beast.beast – Beast2 command line arguments to pass (beyond the params, statefile and input)

    default: ['-beagle_SSE', '-seed 98202873']

  • beast.threads – the number of cores to run with (both locally or when submitting to a cluster)

    default: 6

  • beast.resources – the resources to request when submitting to a cluster

    default: {'runtimtime': 1200, 'mem_mb': 16000}

Envmodules:

environment variables to load for the Spartan HPC system

..note::

GPU acceleration is not requested by default. If you are running on a machine with a compatible GPU then please replace -beagle with -beagle_GPU in the beast.beast entry in your McCoy config.yaml file.

Conda:
channels:
  - bioconda
  - conda-forge
dependencies:
  - beast2==2.6.3
  - beagle-lib<4
  - pip
  - pip:
    - online-beast

Rule plot_traces[source]

Makes trace plots from the beast log file.

Conda:
channels:
  - conda-forge
dependencies:
  - python=3.9
  - numpy
  - typer
  - pandas
  - plotly
  - pip
  - pip:
    - kaleido

Rule arviz[source]

Makes trace plots from the beast log file.

Conda:
name: arviz
channels:
  - conda-forge
dependencies:
  - python=3.9
  - pip
  - pip:
    - arviz
    - pandas
    - typer
    - bokeh

Rule max_clade_credibility_tree[source]

Makes trace plots from the beast log file.

Conda:
channels:
  - bioconda
  - conda-forge
dependencies:
  - beast2==2.6.3
  - beagle-lib<4
  - pip
  - pip:
    - online-beast

Rule max_clade_credibility_tree_newick[source]

Makes trace plots from the beast log file.

Conda:
name: plot_traces
channels:
  - conda-forge
dependencies:
  - python=3.9
  - pip
  - pip:
    - typer
    - dendropy

Rule max_clade_credibility_tree_render[source]

Renders the consensus maximum likelihood tree from iqtree in SVG and HTML format.

Conda:
channels:
  - conda-forge
dependencies:
  - toytree=2.0.5
  - typer
  - pip:
    - numpy==1.22.4