Module M03: Multiple Sequence Alignment
M03 aligns the subsampled sequences from M02 against a fixed reference genome using MAFFT in reference-guided mode (invoked viaaugur align). The resulting alignment establishes a unified coordinate system where every column corresponds to a specific position in the reference sequence. This coordinate normalisation is a prerequisite for both:
- Track A (M07 Bridge Builder): per-position Shannon entropy calculation requires aligned coordinates.
- Track B (M04 → M05 phylogenetics): IQ-TREE and HyPhy require gap-aware codon-position alignments.
trimAl (alignment column trimming) was explicitly dropped from the pipeline design. Reference-guided alignment via
--fill-gaps inherently produces cleaner columns than de novo alignment, and trimming would risk removing conserved regions critical for primer design. Codon-level sanitisation for HyPhy is handled separately in M05 by clean_alignment_for_hyphy.py.Input Requirements
Configuration Parameters
Processing
Rule: augur_align
Environment: envs/nextstrain.yamlTool: MAFFT (called internally by
augur align)
What reference-guided alignment means in practice:
Rather than building a full multiple sequence alignment from scratch (which is in time), MAFFT first aligns each query sequence pairwise to the reference, then reconciles insertions relative to reference coordinates. Insertions that are present in query sequences but absent in the reference are removed from the output alignment. This preserves a consistent coordinate system (position 1 in the output always corresponds to position 1 of the reference).
Downstream Usage of aligned.fasta
The aligned.fasta file produced by M03 is a shared, non-modified input used by multiple downstream modules:
Outputs
Sanity-Checking the Alignment
After alignment, verify that all sequences have the same length as the reference:Conda Environment
augur, mafft
Known Limitations & Edge Cases
- Sequences diverged from reference: Highly divergent sequences (e.g., inter-subtype Influenza A variants) may produce poorly-aligned regions when forced into a single reference coordinate system. Review the alignment manually in a tool like AliView or UGENE if M07 reports unexpectedly high entropy across the entire alignment.
- Reference must match segment: Ensure
references.genomecorresponds to the correct viral segment (e.g.,NC_002016.1for Influenza A M segment). Aligning HA sequences against an NA reference will produce a meaningless alignment without error. - Gaps vs. missing data: The
--fill-gapsflag converts terminal gaps toN. This means 3’ and 5’ truncated sequences are padded rather than having real data. The N-content filter in M02 (max_n_content) helps exclude sequences that are too fragmented, but some padding remains unavoidable for partially complete assemblies. - Memory scaling: MAFFT reference-guided mode scales approximately linearly in memory with sequence length × count. For whole-genome alignments (>10 kb) with >5,000 sequences, ensure at least 16 GB RAM is available.
