Choosing and building a UCE pseudoreference
Reference choice is one of the most important decisions in UCE-based SNP analysis. This module compares the major strategies used in the literature and then builds a shared UCE pseudoreference from the aligned loci produced by the PHYLUCE workflow.
Objective
Understand when to use an individual-specific reference, a single shared reference, a multi-individual UCE pseudoreference, or an external genome, and construct a reproducible shared UCE pseudoreference for joint SNP calling.
For PCA, DAPC, ADMIXTURE, STRUCTURE and other analyses based on a joint VCF, all individuals should normally be genotyped in the same coordinate system. A shared reference therefore provides a simpler and more defensible basis for population-level SNP comparisons than separate coordinates for each individual.
1. Why reference choice matters
SNP calling is not only a search for variable bases. Reads must first be placed onto a coordinate system. The chosen reference affects which reads map, which sites can be compared among individuals, and how missing data and reference bias enter the dataset.
UCE target capture creates a special situation: sequencing depth is concentrated on a relatively small set of homologous loci rather than distributed uniformly across an entire genome. A UCE-derived pseudoreference can therefore be a natural coordinate system when a suitable genome is absent.
2. Four reference strategies
| Strategy | Best suited to | Main advantage | Main limitation |
|---|---|---|---|
| A. Individual-specific reference | Phasing, haplotype reconstruction and correction of an individual's own UCE contigs. | Minimizes divergence between reads and that individual's reference. | Each individual has a different coordinate/reference sequence, which is inconvenient for a single joint population VCF. |
| B. One representative individual | Closely related samples when one specimen has exceptionally complete and high-quality UCE recovery. | Simple, transparent and computationally inexpensive. | Can introduce reference bias toward the chosen individual and may omit loci missing from that specimen. |
| C. Shared multi-individual UCE pseudoreference | Population genomics without a high-quality close genome; broad population sampling; joint SNP calling. | One common coordinate system while reducing dependence on a single specimen. | Requires an explicit rule for choosing or constructing one representative sequence per locus. |
| D. External genome reference | Studies with a high-quality, biologically close genome, especially when genome coordinates and annotation matter. | Provides genomic context, chromosome coordinates and annotation opportunities. | A distant reference can reduce mapping efficiency and create allele/reference bias; much of the genome has no UCE-capture coverage. |
3. Strategy A — Individual-specific references
This is the strategy used in the official PHYLUCE 1.7.3 phasing tutorial. PHYLUCE recommends starting from aligned and edge-trimmed UCE loci, exploding those alignments by taxon, and mapping each individual's raw reads back to that individual's own reference contigs.
phyluce_align_explode_alignments \ --alignments /path/to/edge-trimmed-alignments \ --input-format nexus \ --output /path/to/exploded-by-taxon \ --by-taxon
This is an excellent design when the biological objective is individual-level phasing or haplotype reconstruction. It has also been used in published UCE studies that explicitly followed PHYLUCE Tutorial II.
Individual-specific references are not naturally expressed in one shared coordinate system. For a joint VCF used by PCA, ADMIXTURE or DAPC, a common reference is operationally simpler and makes position-by-position comparison explicit.
4. Strategy B — One representative individual
A simple alternative is to choose one well-sequenced specimen as the shared UCE reference and map every individual to it.
Published UCE studies have used this approach. For example, a phylogeographic study of Mexican highland frogs selected the sample with the largest number of recovered UCE contigs and mapped all samples to that reference before SNP calling. A population genomics study of common seadragons similarly produced a UCE reference assembly from one individual and selected one contig per UCE locus for read mapping.
This strategy is most attractive when:
Samples are closely related
+
one individual has excellent coverage
+
that individual recovers nearly all target loci
+
the study prioritizes simplicityReads carrying alleles more divergent from the chosen specimen can map less efficiently than reads similar to the reference allele. The effect is expected to become more relevant as divergence among samples increases.
5. Strategy C — Shared multi-individual UCE pseudoreference
A shared pseudoreference can use information from many individuals while retaining only one reference sequence for each UCE locus.
Several published implementations illustrate this general idea:
Composite assembly from reads across individuals
↓
identify orthologous UCE loci
↓
one shared reference set
↓
map every individual's reads to the same UCE coordinatesIn an avian population-genomic study, reads from all individuals were combined to build a composite assembly; PHYLUCE was then used to retain orthologous UCE loci, and all individuals were mapped back to that shared reference set.
A 2023 comparison of reduced-representation and whole-genome data used another locus-wise solution: for each UCE locus, the authors selected the longest sequence meeting a missing-data criterion to create a common reference before GATK variant calling.
More recently, a marine UCE population-genomics study built a consensus pseudoreference using assemblies from all sampled individuals and compared that pseudoreference directly with an available genome reference. The UCE pseudoreference concentrated the captured data onto the targeted loci and produced much higher average depth over those coordinates than mapping the same target-capture reads across the entire genome.
We use this general approach. Starting from the already aligned and edge-trimmed UCE loci, we select one high-quality representative sequence per locus across the complete sample set. The result is one FASTA record per UCE and one common coordinate system for every individual.
6. Strategy D — External genome reference
If a chromosome-scale or otherwise high-quality genome exists for the same species, or for a sufficiently close lineage, it can be an excellent reference.
This strategy becomes particularly valuable when the objective includes:
Genome coordinates Functional annotation Gene proximity Intronic / exonic context Chromosomal distribution Physical linkage among SNPs
However, UCE capture reads cover only targeted loci and their flanks. Mapping them to a multi-gigabase genome does not create genome-wide sequence coverage. In addition, a phylogenetically distant genome can increase mapping bias.
The recent marine UCE comparison mentioned above is useful because the same target- capture dataset was mapped both to a genome and to a UCE pseudoreference. Both strategies recovered useful population structure, but their coverage distributions and sets of retained SNPs differed substantially. Reference choice is therefore an analytical decision rather than a purely technical detail.
7. What about calling SNPs directly from UCE alignments?
UCE alignments themselves contain polymorphic sites, and extracting variable columns can be useful for some phylogenetic or clustering analyses. Recent reference-free methods can even estimate population-level diversity directly from aligned UCEs.
That is not the primary route in this tutorial because alignment-only SNP extraction does not use the original read depth, base quality, mapping quality or genotype likelihood information available from the sequencing reads.
We return to the original cleaned reads, map them to a shared UCE pseudoreference, and call genotypes from read-level evidence.
8. Decision guide
What is the objective?
Phasing / individual haplotypes
↓
Individual-specific PHYLUCE references
Joint SNP population analysis
↓
Is a high-quality close genome available?
│
├── Yes → genome reference can be considered
│ especially if genomic context matters
│
└── No
↓
Are samples very closely related and is one specimen exceptionally complete?
│
├── Yes → one representative-individual pseudoreference is reasonable
│
└── No / broad sampling
↓
shared multi-individual UCE pseudoreference9. Our tutorial strategy
We will construct one shared reference record for every selected UCE locus using the PHYLUCE-aligned dataset as the source.
PHYLUCE UCE recovery
↓
MAFFT alignment + PHYLUCE edge trimming
↓
aligned and trimmed UCE loci
↓
choose one high-quality representative sequence per UCE
↓
remove alignment gaps
↓
rename each record with the UCE locus ID
↓
shared UCE pseudoreference FASTA
↓
map ALL individuals to the same referenceThis preserves the logic of PHYLUCE Tutorial II — using aligned and edge-trimmed loci as the reference source — while adapting it from individual-specific phasing to joint population-level SNP calling.
Population-genomics environment
At the beginning of the population-genomics workflow, create a dedicated Conda environment once. The same environment will be reused for pseudoreference handling, read mapping, BAM processing and the first variant-processing steps.
conda create -n uce-popgen \ -c conda-forge \ -c bioconda \ python=3.11 \ bwa-mem2 \ samtools \ bcftools conda activate uce-popgen
Confirm the main executables:
python --version bwa-mem2 version samtools --version bcftools --version
The following population-genomics modules assume that
uce-popgen already exists. In later modules, simply activate it with
conda activate uce-popgen.
10. Choose the UCE locus set
For construction of the SNP pseudoreference, use the broad set of UCE loci that has already passed multiple-sequence alignment and trimming. This does not need to be the same 75%, 90% or 95% occupancy matrix used for phylogenetic inference.
The reason is methodological: occupancy filtering used for phylogenetic matrices can remove loci that are still informative for population-level SNP discovery. Missing genotypes and locus representation can be evaluated later during mapping, genotype calling and VCF filtering.
# Root directory of the complete UCE project. PROJECT="/path/to/my_UCE_project" # Directory containing processed UCE datasets. DATASET="$PROJECT/uce_datasets" # Broad set of UCE alignments used as the source # for pseudoreference construction. # One FASTA file is expected for each aligned and trimmed UCE locus. UCE_ALIGNMENTS="$DATASET/aligned_trimmed" # Main directory for all population-genomic analyses. POPGEN="$PROJECT/population_genomics" # Working directory for pseudoreference construction. PSEUDO="$POPGEN/01_pseudoreference" # Final shared UCE pseudoreference. PSEUDOREF="$PSEUDO/shared_uce_pseudoref.fasta" # Provenance table recording which sequence was selected # to represent each UCE locus. PSEUDO_REPORT="$PSEUDO/shared_uce_pseudoref.tsv" mkdir -p "$PSEUDO"
Use UCE loci that have already been aligned and trimmed to remove poorly aligned sequence. Avoid using completely unprocessed alignments, but also avoid imposing a stringent phylogenetic occupancy threshold solely for pseudoreference construction.
11. Confirm the alignment format
The pseudoreference builder expects one FASTA alignment per UCE locus:
aligned_trimmed/ ├── uce-1.fasta ├── uce-2.fasta ├── uce-3.fasta └── ...
Confirm the number of UCE loci:
find "$UCE_ALIGNMENTS" \ -maxdepth 1 \ -type f \ -name "uce-*.fasta" \ | wc -l
Inspect one alignment:
FIRST_UCE=$(find "$UCE_ALIGNMENTS" \ -maxdepth 1 \ -type f \ -name "uce-*.fasta" \ | sort \ | head -1) echo "$FIRST_UCE" grep "^>" "$FIRST_UCE" | head head -30 "$FIRST_UCE"
Alignment gaps such as - are expected at this stage. They will be removed
from the selected sequence before it enters the mapping pseudoreference.
Convert them to locus-by-locus FASTA before continuing. The important requirement is that each input file represents one aligned and trimmed UCE locus containing the sequences recovered from the sampled individuals.
12. Select one representative sequence per locus
For each UCE alignment, the shared pseudoreference uses one observed sequence as the reference record. The selection rule used in this tutorial is:
aligned UCE locus
↓
remove alignment gaps
↓
convert ambiguous nucleotide symbols to N
↓
exclude sequences containing >10% N
↓
select the longest remaining ungapped sequence
↓
if tied: choose the sequence with fewer ambiguous bases
↓
if still tied: choose by sample ID for deterministic reproducibility
↓
rename the FASTA record using the UCE locus IDThe 10% ambiguity filter and preference for the longest acceptable sequence follow a published UCE pseudoreference-building strategy. The deterministic tie-break replaces random selection so repeated runs generate the same reference.
Different loci can be represented by sequences originating from different individuals. The resulting pseudoreference is therefore not tied to one specimen, while every sample is still mapped against exactly the same set of reference coordinates.
Run the pseudoreference builder in any Python 3 environment:
python3 build_shared_uce_pseudoref.py \ --alignments "$UCE_ALIGNMENTS" \ --output "$PSEUDOREF" \ --report "$PSEUDO_REPORT" \ --max-ambiguous 0.10
The helper script uses only the Python standard library, so no additional Python packages are required.
13. Inspect the pseudoreference
PSEUDOREF="$PSEUDO/shared_uce_pseudoref.fasta" grep -c "^>" "$PSEUDOREF" grep "^>" "$PSEUDOREF" | head head "$PSEUDO/shared_uce_pseudoref.tsv"
The number of FASTA records is the number of UCE loci retained in the pseudoreference. Every header should be a unique UCE locus identifier rather than a sample identifier.
The TSV report preserves provenance by recording which sample sequence was selected for each UCE locus.
14. Why one FASTA record per UCE?
Do not concatenate all UCEs into a single artificial chromosome. Keeping each locus as an independent FASTA record preserves natural locus boundaries:
>uce-1 ACGT... >uce-2 ACGT... >uce-3 ACGT...
This makes later filtering straightforward and allows us to select one SNP per UCE when analyses require approximately independent markers.
15. What this pseudoreference is — and is not
The pseudoreference is not a genome assembly and should not be described as one. It represents only the UCE loci and flanking sequence recovered by the capture experiment and selected for population-genomic analysis.
In the next module, every individual's original cleaned reads will be mapped to this
same FASTA. The resulting BAM files will therefore share the same
UCE-locus : position coordinate system.
16. Pre-flight check
References and examples from the literature
PHYLUCE 1.7.3 — Tutorial II: Phasing UCE data
Official individual-specific reference workflow using aligned and edge-trimmed UCEs.
Winker K, Glenn TC, Faircloth BC. 2018. Ultraconserved elements illuminate the
population genomics of a recent avian speciation event. PeerJ 6:e5735.
Example of a composite reference assembled from data across individuals and then used
as a common UCE reference for variant calling.
Duckett DJ et al. 2023. Reduced representation approaches produce similar results
to whole genome sequencing for some common phylogeographic analyses.
Example of a locus-wise shared UCE reference built by selecting a high-quality
representative sequence for each UCE locus before GATK SNP calling.
Melendez D et al. 2026. SPrUCE: Utilizing Ultraconserved Elements of DNA for
Population-Level Genetic Diversity Estimation.
Example of a recent reference-free approach that estimates diversity directly from
UCE alignments, illustrating that read-mapping pipelines are not the only possible
population-level use of UCE data.
No single reference strategy is optimal for all UCE datasets. The shared multi-individual/locus-wise pseudoreference used here is chosen because the downstream objective is joint SNP calling and population structure from a common coordinate system. Other objectives can justify different reference strategies.