Extracting UCE loci
Convert the probe-to-contig matches identified in the previous module into a monolithic FASTA dataset containing the recovered UCE loci across all samples.
Objective
Define the samples to include, summarize the UCE loci present in the match database, and extract the corresponding sequences from the assembled contigs.
We will generate an incomplete matrix. This retains loci that are present in only a subset of samples. Matrix completeness will be evaluated and filtered later, after alignment.
1. Activate PHYLUCE 1.7.3
conda activate phyluce-1.7.3
On Apple Silicon:
conda activate phyluce-1.7.3-x86
Confirm that both programs are available:
phyluce_assembly_get_match_counts --help phyluce_assembly_get_fastas_from_match_counts --help
2. Define the project paths
PROJECT="/path/to/my_UCE_project" CONTIGS="$PROJECT/spades-assemblies/contigs" LOCUS_DB="$PROJECT/uce-search-results/probe.matches.sqlite" TAXON_SETS="$PROJECT/taxon-sets" DATASET="$TAXON_SETS/all" LOGS="$DATASET/log" mkdir -p "$DATASET" "$LOGS"
3. Create the sample-set configuration
PHYLUCE uses a simple configuration file to define which samples should be included in a dataset. Create:
TAXON_CONF="$PROJECT/taxon-set.conf"
Example:
[all] sample01 sample02 sample03 sample04 sample05
The identifiers must match the sample names stored in
probe.matches.sqlite.
Inspect the file:
cat "$TAXON_CONF"
4. Generate the UCE match-count configuration
Use phyluce_assembly_get_match_counts to determine which UCE loci are
available for the selected samples.
phyluce_assembly_get_match_counts \ --locus-db "$LOCUS_DB" \ --taxon-list-config "$TAXON_CONF" \ --taxon-group all \ --output "$DATASET/all-taxa-incomplete.conf" \ --incomplete-matrix \ --log-path "$LOGS"
[all].Requiring a complete matrix at this stage can discard many informative loci. PHYLUCE recommends retaining the broader set first and deciding the desired occupancy threshold after alignment.
5. Inspect the match-count configuration
The generated file contains two sections: the samples included in the dataset and the UCE loci retained for extraction.
head -40 "$DATASET/all-taxa-incomplete.conf"
A simplified example looks like:
[Organisms] sample01 sample02 sample03 sample04 sample05 [Loci] uce-12 uce-31 uce-45 uce-108 uce-142 ...
6. Extract the UCE sequences
Now extract the corresponding UCE sequences from the SPAdes contigs:
phyluce_assembly_get_fastas_from_match_counts \ --contigs "$CONTIGS" \ --locus-db "$LOCUS_DB" \ --match-count-output "$DATASET/all-taxa-incomplete.conf" \ --output "$DATASET/all-taxa-incomplete.fasta" \ --incomplete-matrix "$DATASET/all-taxa-incomplete.incomplete" \ --log-path "$LOGS"
7. Expected output
taxon-sets/
└── all/
├── all-taxa-incomplete.conf
├── all-taxa-incomplete.fasta
├── all-taxa-incomplete.incomplete
└── log/
├── phyluce_assembly_get_match_counts.log
└── phyluce_assembly_get_fastas_from_match_counts.log8. Basic quality checks
Confirm that the FASTA contains sequences:
grep -c "^>" "$DATASET/all-taxa-incomplete.fasta"
Inspect the first few sequence headers:
grep "^>" "$DATASET/all-taxa-incomplete.fasta" | head
Inspect the missing-data record:
head "$DATASET/all-taxa-incomplete.incomplete"
At this stage we retain the broad UCE dataset. The next module aligns each locus, after which occupancy thresholds such as 50%, 75%, 90% or other project-specific values can be evaluated properly.
9. Why one monolithic FASTA?
The output FASTA contains sequences from many loci and samples in a single file. PHYLUCE uses the locus information encoded in the sequence headers to separate these records during the alignment step.
This file therefore serves as the bridge between UCE recovery and locus-by-locus multiple sequence alignment.
10. Pre-flight check
References and official documentation
PHYLUCE 1.7.3 — UCE processing for phylogenomics
PHYLUCE 1.7.3 — Tutorial I: match counts and FASTA extraction
The syntax in this module follows PHYLUCE 1.7.3. In particular,
--incomplete-matrix is intentionally used during match counting so
occupancy can be filtered later, after locus alignment.