De novo assembly
Assemble the cleaned paired-end reads into contigs using SPAdes through the
phyluce_assembly_assemblo_spades wrapper. This module follows the
illumiprocessor route established in the previous step.
Objective
Convert the cleaned reads from each sample into a de novo contig assembly. These contigs will later be searched against the UCE probe set to identify the targeted loci.
PHYLUCE 1.7.3 supports SPAdes, ABySS and Velvet. The official tutorial recommends SPAdes for most applications, and this tutorial follows that recommendation.
1. Confirm the illumiprocessor output
The assembly wrapper expects paired reads named READ1 and
READ2, with an optional READ-singleton file.
Following the illumiprocessor route, each sample should contain:
clean_reads/ ├── sample01/ │ └── split-adapter-quality-trimmed/ │ ├── sample01-READ1.fastq.gz │ ├── sample01-READ2.fastq.gz │ └── sample01-READ-singleton.fastq.gz │ ├── sample02/ │ └── split-adapter-quality-trimmed/ │ ├── sample02-READ1.fastq.gz │ ├── sample02-READ2.fastq.gz │ └── sample02-READ-singleton.fastq.gz │ └── ...
We will point the assembly configuration directly to each
split-adapter-quality-trimmed/ directory. Therefore, the assembly
command does not need a --subfolder argument.
2. Activate PHYLUCE 1.7.3
conda activate phyluce-1.7.3
On Apple Silicon, activate the x86 environment created in Module 01:
conda activate phyluce-1.7.3-x86
Confirm that the SPAdes wrapper is available:
phyluce_assembly_assemblo_spades --help
3. Define project variables
PROJECT="/path/to/my_UCE_project" CLEAN="$PROJECT/clean_reads" ASSEMBLY="$PROJECT/spades-assemblies" LOGS="$PROJECT/logs/assembly" THREADS=8 MEMORY=16 mkdir -p "$LOGS"
PHYLUCE defaults to 8 GB of RAM for this wrapper and the official tutorial notes
that more memory is usually preferable. Set THREADS and
MEMORY according to the physical resources actually available on
your computer.
4. Create the assembly configuration
Create a simple INI-style file in which each sample identifier points to the
corresponding split-adapter-quality-trimmed/ directory generated by
illumiprocessor.
[samples] sample01:/absolute/path/to/my_UCE_project/clean_reads/sample01/split-adapter-quality-trimmed sample02:/absolute/path/to/my_UCE_project/clean_reads/sample02/split-adapter-quality-trimmed sample03:/absolute/path/to/my_UCE_project/clean_reads/sample03/split-adapter-quality-trimmed
Save the file as assembly.conf and inspect it before running the assembly:
ASSEMBLY_CONF="$PROJECT/assembly.conf" cat "$ASSEMBLY_CONF"
Every expected sample should appear exactly once, and each path should point to an
existing split-adapter-quality-trimmed/ directory.
5. Run SPAdes through PHYLUCE
phyluce_assembly_assemblo_spades \ --config "$ASSEMBLY_CONF" \ --output "$ASSEMBLY" \ --cores "$THREADS" \ --memory "$MEMORY" \ --log-path "$LOGS"
Our assembly.conf already points directly to each
split-adapter-quality-trimmed/ directory. The alternative is to
point to each sample directory and use
--subfolder split-adapter-quality-trimmed. Do one or the other,
not both.
6. What the PHYLUCE wrapper does
In PHYLUCE 1.7.3, the SPAdes wrapper identifies the paired reads and singleton reads, creates one assembly directory per sample, runs SPAdes, and creates standardized symbolic links to the final contigs.
The wrapper invokes SPAdes in careful, single-cell mode. The single-cell mode is used because target-capture datasets can have strongly heterogeneous coverage among loci.
Unless --no-clean is supplied, PHYLUCE removes intermediate SPAdes files
after a successful assembly and retains the principal assembly outputs.
7. Expected output
The PHYLUCE 1.7.3 source creates sample-specific directories ending in
_spades. A simplified result is:
spades-assemblies/
├── contigs/
│ ├── sample01.contigs.fasta -> ../sample01_spades/contigs.fasta
│ ├── sample02.contigs.fasta -> ../sample02_spades/contigs.fasta
│ └── sample03.contigs.fasta -> ../sample03_spades/contigs.fasta
│
├── sample01_spades/
│ ├── contigs.fasta
│ ├── scaffolds.fasta
│ └── spades.log
│
├── sample02_spades/
│ ├── contigs.fasta
│ ├── scaffolds.fasta
│ └── spades.log
│
└── sample03_spades/
├── contigs.fasta
├── scaffolds.fasta
└── spades.log
spades-assemblies/contigs/ provides a standardized collection of
one contig FASTA per sample. The next PHYLUCE step can operate on this single
directory when matching assembled contigs to the UCE probe set.
8. Check whether all assemblies were created
Count the standardized contig files:
find "$ASSEMBLY/contigs" \ -maxdepth 1 \ -name "*.contigs.fasta" \ | wc -l
Check for empty or failed contig files:
for F in "$ASSEMBLY"/contigs/*.contigs.fasta
do
if [[ ! -s "$F" ]]
then
echo "Empty or missing assembly: $F"
fi
doneIf no filenames are printed, every standardized contig FASTA exists and contains data.
9. Assembly quality control
PHYLUCE provides phyluce_assembly_get_fasta_lengths to summarize an
assembled FASTA. As a simple example, inspect one assembly:
phyluce_assembly_get_fasta_lengths \ --input "$ASSEMBLY/contigs/sample01.contigs.fasta" \ --csv
The output summarizes properties such as the number of contigs, total assembled bases, mean and median contig length, minimum and maximum contig length, and the number of contigs longer than 1 kb.
Use this command as a basic assembly diagnostic. Later, the same type of summary can be applied to all samples to identify strong outliers before UCE identification.
10. Troubleshooting
“Expected assembly files were not found in output”
This message usually means that SPAdes did not successfully produce the expected
contigs.fasta, scaffolds.fasta and
spades.log files. Inspect the sample-specific
spades.log and the PHYLUCE log first.
Insufficient memory
Reduce the number of simultaneous resources requested or increase
--memory only when that amount of RAM is physically available.
Requesting more memory than the machine can provide does not increase performance
and can cause failure.
Rerunning an interrupted assembly
Do not overwrite a partially completed assembly directory blindly. Preserve the logs, identify the failed sample, and either use a new output directory or remove only the incomplete output after confirming what failed.
Need SPAdes intermediate files?
Add --no-clean when troubleshooting if you need PHYLUCE to retain the
intermediate SPAdes files. The default behavior cleans those files after successful
assembly.
11. Pre-flight check
References and official documentation
PHYLUCE 1.7.3 — Tutorial I: Assemble the data
PHYLUCE v1.7.3 — phyluce_assembly_assemblo_spades source
PHYLUCE v1.7.3 — Official release
Software citation
Bankevich A, Nurk S, Antipov D, et al. 2012. SPAdes: a new genome assembly algorithm and its applications to single-cell sequencing. Journal of Computational Biology 19:455–477. doi:10.1089/cmb.2012.0021
Command syntax and output naming in this module were checked against the official PHYLUCE 1.7.3 documentation and the v1.7.3 source code. This is particularly important because some older documentation examples retain legacy Trinity-related directory names that are not produced by the current SPAdes wrapper.