augur.clades module

Assign clades to nodes in a tree based on amino-acid or nucleotide signatures.

augur.clades.assign_clades(clade_designations, all_muts, tree, ref=None)

Ensures all nodes have an entry (or auspice doesn’t display nicely), tests each node to see if it’s the first member of a clade (assigns ‘clade_annotation’), and sets all nodes’s clade_membership to the value of their parent. This will change if later found to be the first member of a clade.

  • clade_designations (dict) – clade definitions as {clade_name:[(gene, site, allele),...]}

  • all_muts (dict) – mutations in each node

  • tree (Phylo.Tree) – phylogenetic tree to process

  • ref (str/list, optional) – reference sequence to look up state when not mutated


mapping of node to clades

Return type


augur.clades.get_reference_sequence_from_root_node(all_muts, root_name)
augur.clades.is_node_in_clade(clade_alleles, node, ref)

Determines whether a node matches the clade definition based on sequence For any condition, will first look in mutations stored in node.sequences, then check whether a reference sequence is available, and other reports ‘non-match’

  • clade_alleles (list) – list of clade defining alleles

  • node (Phylo.Node) – node to check, assuming sequences (as mutations) are attached to node

  • ref (str/list) – positions


True if in clade

Return type



Reads in tab-seperated file that defines clades by amino acid or nucleotide mutations

Inheritance is allowed, but needs to be acyclic. Alleles can be overwritten by inheriting clades.

Sites are 1 indexed in the file, and are converted to 0 indexed in the output

Empty lines are ignored, comments after # are ignored


clade      gene    site     alt
Clade_1    ctpE    81       D
Clade_2    nuc     30642    T
Clade_3    nuc     444296   A
Clade_3    S       1        P
# Clade_4 inherits from Clade_3
Clade_4    clade   Clade_3
Clade_4    pks8    634      T
# Inherited allele can be overwritten
Clade_4    S       1        L

clade_file (str) – meta data file


clade definitions as {clade_name:[(gene, site, allele),...]}

Return type