UCE alignments
Separate the monolithic UCE FASTA by locus and align homologous sequences with
MAFFT using phyluce_align_seqcap_align. The incomplete matrix is
preserved so that occupancy can be evaluated later.
Objective
Produce one multiple-sequence alignment per UCE locus from the
all-taxa-incomplete.fasta dataset generated in Module 07.
This tutorial uses MAFFT, which is the aligner recommended in the PHYLUCE documentation for general UCE analyses. We retain the incomplete matrix during alignment and evaluate matrix occupancy only after the loci have been aligned.
1. Activate PHYLUCE 1.7.3
conda activate phyluce-1.7.3
On Apple Silicon:
conda activate phyluce-1.7.3-x86
Confirm that the alignment tools are available:
phyluce_align_seqcap_align --help mafft --version
2. Define the input and output
PROJECT="/path/to/my_UCE_project" DATASET="$PROJECT/taxon-sets/all" UCE_FASTA="$DATASET/all-taxa-incomplete.fasta" ALIGNMENTS="$DATASET/mafft-nexus" LOGS="$DATASET/log" THREADS=8 N_TAXA=5
N_TAXA=5 is only an example. Set this value to the actual number of
samples listed in your [all] taxon set.
3. Align the UCE loci with MAFFT
phyluce_align_seqcap_align \ --fasta "$UCE_FASTA" \ --output "$ALIGNMENTS" \ --taxa "$N_TAXA" \ --aligner mafft \ --cores "$THREADS" \ --incomplete-matrix \ --log-path "$LOGS"
PHYLUCE documentation contains examples using both --fasta and
--input in different pages. This tutorial uses --fasta,
which is the argument documented in the PHYLUCE 1.7.3 daily-use workflow for
aligning a monolithic UCE FASTA. Confirm the available arguments with
phyluce_align_seqcap_align --help in your installed environment.
4. What happens during alignment?
PHYLUCE first separates the monolithic FASTA into groups of sequences belonging to the same UCE locus. Loci represented by fewer than three taxa are not aligned. The remaining loci are aligned independently with MAFFT.
By default, phyluce_align_seqcap_align also performs its standard
edge-trimming procedure. This removes poorly aligned sequence at the ends of each
locus while retaining the central aligned region.
The standard PHYLUCE workflow uses edge trimming during alignment. More aggressive or alternative trimming strategies can be evaluated later if required by a specific project, but they are not necessary for the general workflow presented here.
5. Expected output
The output directory contains one alignment per UCE locus. With the default output format, these files are written in NEXUS format.
taxon-sets/
└── all/
├── all-taxa-incomplete.fasta
├── mafft-nexus/
│ ├── uce-1.nexus
│ ├── uce-2.nexus
│ ├── uce-3.nexus
│ ├── ...
│ └── uce-N.nexus
└── log/Count the number of retained alignments:
find "$ALIGNMENTS" \ -maxdepth 1 \ -name "*.nexus" \ | wc -l
6. Summarize the alignments
PHYLUCE provides phyluce_align_get_align_summary_data to summarize
thousands of alignments efficiently.
phyluce_align_get_align_summary_data \ --alignments "$ALIGNMENTS" \ --cores "$THREADS" \ --log-path "$LOGS"
The summary reports the number of loci, total aligned length, sequence composition and information useful for evaluating matrix completeness.
7. Inspect a locus
Before moving forward, inspect at least one alignment manually:
FIRST_ALIGNMENT=$(find "$ALIGNMENTS" \ -maxdepth 1 \ -name "*.nexus" \ | sort \ | head -1) echo "$FIRST_ALIGNMENT" head -40 "$FIRST_ALIGNMENT"
Confirm that the alignment contains multiple taxa, nucleotide data and gaps where required, and that the sequence identifiers correspond to the expected samples.
8. Do not choose the final occupancy yet
The incomplete matrix created in Module 07 intentionally retains loci that are not present in every sample. Now that loci are aligned, we can determine how many loci would remain under different occupancy thresholds.
Module 09 will compare alternative completeness thresholds and build the final phylogenomic datasets. For example, a 75% matrix retains only loci containing at least 75% of the total taxa. The appropriate threshold depends on the dataset and analytical objective.
9. Common problems
Many loci are dropped before alignment
PHYLUCE requires at least three taxa for a locus to be aligned. A large number of dropped loci may therefore reflect low UCE recovery, a small taxon set or substantial missing data.
Too many CPU cores requested
Use only the number of physical cores actually available on the machine. The PHYLUCE documentation explicitly warns that requesting more cores than are available can generate errors.
Unexpected ambiguous bases
Review the alignment log and upstream sequence data. PHYLUCE applies checks to ambiguous sequence during the alignment workflow, and problematic loci may be removed.
10. Pre-flight check
References and official documentation
PHYLUCE 1.7.3 — Tutorial I: UCE alignments
PHYLUCE 1.7.3 — UCE processing and incomplete matrices
PHYLUCE 1.7.3 — Alignment program list
Software citation
Katoh K, Standley DM. 2013. MAFFT multiple sequence alignment software version 7: improvements in performance and usability. Molecular Biology and Evolution 30:772–780. doi:10.1093/molbev/mst010
This module follows the PHYLUCE 1.7.3 alignment workflow: MAFFT, incomplete-matrix handling and locus-by-locus output. Occupancy filtering is deliberately postponed until the next module.