Home › Bioinformatics Tutorial › Genome Assembly and Comparative Genomics

Genome Assembly and Comparative Genomics

⏱ 16 min read Updated: 23 Oct 2026

Introduction

Genome assembly is the process of joining DNA sequencing reads to reconstruct a longer DNA sequence. A DNA sequencer produces many short or long reads rather than a complete genome. Assembly tools identify overlaps and connections between these reads to build contigs and scaffolds.

Comparative genomics is the study of similarities and differences between the genomes of different organisms or strains. It helps researchers identify shared genes, genetic variations, genome rearrangements, and genes associated with specific traits.

Genome assembly provides the sequence data needed for many comparative genomics studies.

What Is Genome Assembly?

Genome assembly combines DNA sequencing reads to reconstruct a genome. The process can be performed with the help of an existing reference genome or without one.

There are two main approaches:

  • Reference-based assembly: Uses an existing genome as a guide.
  • De novo assembly: Reconstructs a genome directly from sequencing reads without using a reference genome.

The choice depends on whether a suitable reference is available, the type of sequencing data, and the purpose of the study.

Important Terms in Genome Assembly

TermDefinition
ReadA short or long DNA sequence produced by a sequencing machine.
ContigA continuous DNA sequence assembled from overlapping reads, without gaps.
ScaffoldA group of contigs arranged in an estimated order and orientation, sometimes with gaps between them.
CoverageThe average number of times each position in a genome is represented by sequencing reads.
RepeatA DNA sequence that occurs multiple times in a genome and can make assembly difficult.
k-merA short sequence of k nucleotides extracted from a DNA read. For example, the 3-mers in GATTACA are GAT, ATT, TTA, TAC, and ACA.

Reference-Based Assembly

Reference-based assembly uses an existing genome as a guide to analyze new sequencing reads. The reads are aligned to the reference using tools such as BWA or Bowtie2. Researchers can then identify differences between the sample and the reference.

Advantages

  • It is generally faster and requires fewer computing resources than de novo assembly.
  • It can be useful when studying known organisms.
  • It helps identify small genetic variations, including single-nucleotide polymorphisms (SNPs).

Limitations

  • A suitable reference genome is required.
  • DNA regions absent from the reference may be missed.
  • Large structural differences can be difficult to identify accurately if they are not represented in the reference.

Example

A laboratory sequences a virus and wants to identify genetic differences from a known reference strain. By aligning the reads to the reference genome, researchers can locate changes in the DNA sequence.

De Novo Assembly

De novo assembly reconstructs a genome directly from sequencing reads without using an existing reference genome. Assembly software uses sequence overlaps and other relationships between reads to build longer DNA sequences.

Advantages

  • It can be used for organisms without an available reference genome.
  • It can help identify previously unknown genes and DNA regions.
  • It can reveal structural changes that reference-based methods may miss.

Limitations

  • It may require more memory and processing time.
  • It depends on read quality and sufficient sequencing coverage.
  • Repeated DNA regions can make it difficult to determine the correct sequence and arrangement.

Example

A researcher discovers a bacterial species in a soil sample that has no reference genome. De novo assembly can help reconstruct its genome so that its genes and other genomic features can be studied.

Reference-Based vs De Novo Assembly

FeatureReference-Based AssemblyDe Novo Assembly
Reference genomeRequiredNot required
Computing requirementsGenerally lowerCan be higher
Main purposeAnalyze known genomes and identify variantsReconstruct genomes without a reference
Novel DNA regionsMay miss regions absent from the referenceCan recover new regions if supported by the reads
Common toolsBWA, Bowtie2SPAdes, Flye

Short-Read and Long-Read Sequencing

Genome assembly methods depend partly on the type of sequencing data.

Short-read sequencing produces relatively short DNA reads. Illumina is a commonly used short-read sequencing platform. These reads generally have high base-level accuracy, but they may not span long repeated regions.

Long-read sequencing produces longer DNA reads using platforms such as PacBio and Oxford Nanopore. Long reads can span repeated regions and help produce more continuous assemblies. Their accuracy depends on the platform, sequencing chemistry, and data processing.

Hybrid assembly combines short and long reads. Long reads help connect difficult regions, while accurate short reads can help correct smaller sequence errors.

Genome Assembly Tools

Two commonly used genome assemblers are SPAdes and Flye. SPAdes is widely used for short-read data, especially bacterial genomes, while Flye is designed primarily for long-read data.

SPAdes for Short-Read Assembly

SPAdes is a genome assembly tool commonly used with Illumina paired-end reads. It is suitable for many bacterial genome projects.

How SPAdes Works

SPAdes uses a de Bruijn graph to assemble DNA reads. It divides reads into smaller sequences called k-mers and connects these sequences based on their overlaps. The resulting graph represents possible paths through the genome.

SPAdes uses multiple k-mer sizes to help assemble regions with different levels of coverage and complexity. Repeated sequences or ambiguous connections can still cause breaks in the assembly.

How to Run SPAdes

The following command uses paired-end reads that have already been cleaned and trimmed.

spades.py \
 -1 clean_R1.fastq.gz \
 -2 clean_R2.fastq.gz \
 -o spades_out \
 -t 4 \
 -m 16

Command options:

OptionDescription
-1First paired-end read file.
-2Second paired-end read file.
-oOutput directory.
-tNumber of CPU threads.
-mMemory limit in gigabytes.

SPAdes also provides options for specific types of data:

  • --isolate: For data from a single, well-defined organism, such as a bacterial isolate.
  • --careful: Attempts to reduce certain small assembly errors. It should not be combined with --isolate.
  • --meta: Selects the metagenomic assembly mode for samples containing multiple organisms.
  • --nanopore or --pacbio: Can be used with supported long-read data for hybrid assembly, depending on the SPAdes version and input requirements.

SPAdes Output Files

FilePurpose
contigs.fastaContains assembled contigs.
scaffolds.fastaContains scaffolds constructed using available linking information.
assembly_graph.fastgStores the assembly graph.
spades.logRecords information about the assembly process.

Example

A researcher assembles a bacterial genome using Illumina reads. SPAdes produces around 100 contigs rather than one complete chromosome. This can happen when short reads cannot resolve repeated DNA regions. The resulting assembly may still be useful for gene annotation and other analyses, but its quality must be assessed.

Flye for Long-Read Assembly

Flye is a genome assembler designed mainly for long reads from Oxford Nanopore and PacBio sequencing. Long reads can span repeated regions that often break short-read assemblies.

How Flye Works

Flye builds a repeat graph to represent relationships between genomic regions and repeated sequences. It uses information from long reads to resolve connections and construct longer contigs.

The final assembly can be highly continuous, although the result depends on read quality, coverage, genome complexity, and the organism being studied.

How to Run Flye

The following example assembles standard Oxford Nanopore reads.

flye \
 --nano-raw nanopore_reads.fastq.gz \
 --out-dir flye_out \
 --threads 8

Choose the input option that matches the sequencing data:

OptionData type
--nano-rawStandard Oxford Nanopore reads.
--nano-hqHigh-quality Oxford Nanopore reads.
--pacbio-rawRaw PacBio reads.
--pacbio-hifiPacBio HiFi reads.
--metaMetagenomic assembly mode for suitable datasets.

Check the installed Flye version for supported options and input requirements before running an analysis.

Flye Output Files

FilePurpose
assembly.fastaContains the final assembled contigs.
assembly_graph.gfaStores the assembly graph.
assembly_info.txtProvides information about contig length, coverage, and other assembly features.
flye.logRecords details of the assembly process.

Example

A bacterial genome assembled from long Nanopore reads may produce a small number of contigs. If a contig forms a complete circular chromosome or plasmid, it may represent a complete DNA molecule. However, circularity alone does not confirm that an assembly is correct; additional quality checks are needed.

SPAdes vs Flye

FeatureSPAdesFlye
Main inputShort readsLong reads
Common platformIlluminaOxford Nanopore and PacBio
Assembly approachDe Bruijn graphRepeat graph
Main advantageUseful for accurate short-read assemblyLong reads can resolve many repeated regions
Typical resultMay contain multiple contigsCan produce fewer, longer contigs
Quality checkingRequires independent assessmentRequires independent assessment

How to Evaluate Genome Assembly Quality

An assembly should be evaluated for continuity, completeness, and possible errors. A small number of long contigs does not automatically mean that the genome has been assembled correctly.

Three commonly used measures and tools are N50, BUSCO, and QUAST.

N50 and L50

N50 is a measure of assembly continuity. It is the contig length at which contigs of that length or longer account for at least half of the total assembly length.

How to Calculate N50

  1. Sort all contigs from longest to shortest.
  2. Calculate the total length of all contigs.
  3. Calculate half of the total assembly length.
  4. Add contig lengths from longest to shortest until the cumulative length reaches or exceeds half of the total.
  5. The length of the contig that crosses this point is the N50.

N50 Example

Consider an assembly containing five contigs:

ContigLength
180 kb
270 kb
350 kb
430 kb
520 kb
Total250 kb

Half of the total assembly length is 125 kb. The first contig contributes 80 kb, which is below 125 kb. Adding the second contig gives 150 kb, which passes the halfway point.

Therefore:

  • N50: 70 kb
  • L50: 2, because two contigs are needed to reach at least half of the total assembly length.

Limitations of N50

  • A higher N50 generally indicates greater continuity, but it does not prove that the assembly is correct.
  • Incorrectly joined sequences can produce a high N50.
  • N50 does not measure gene completeness.
  • NG50 uses an expected genome size as the reference for the halfway calculation.

N50 should be interpreted alongside other quality measures.

BUSCO for Gene Completeness

BUSCO stands for Benchmarking Universal Single-Copy Orthologs. It evaluates genome completeness by checking for expected genes that are commonly found in a particular group of organisms.

If many expected genes are missing or incomplete, the assembly may be incomplete. The appropriate BUSCO lineage dataset should be selected for the organism being studied.

How to Run BUSCO

busco \
 -i flye_out/assembly.fasta \
 -l bacteria_odb10 \
 -m genome \
 -o busco_flye \
 -c 4

Command options:

OptionDescription
-iInput genome assembly.
-lBUSCO lineage dataset.
-m genomeSpecifies that the input is a genome assembly.
-oOutput name or directory.
-cNumber of CPU cores.

Understanding BUSCO Results

CategoryMeaning
Complete (C)The expected gene was found in full.
Single-copy (S)The complete gene was found once.
Duplicated (D)The complete gene was found more than once.
Fragmented (F)Only part of the expected gene was found.
Missing (M)The expected gene was not detected.

For example, a BUSCO result with a high percentage of complete genes suggests that most expected genes were recovered. However, the interpretation depends on the organism, lineage dataset, and assembly characteristics.

QUAST for Assembly Assessment

QUAST stands for Quality Assessment Tool for Genome Assemblies. It summarizes assembly statistics and can compare multiple assemblies. When a suitable reference genome is provided, it can also report reference-based measures, including possible misassemblies.

How to Run QUAST

quast.py \
 spades_out/contigs.fasta \
 flye_out/assembly.fasta \
 -r reference.fasta \
 -o quast_out \
 -t 4

The -r option specifies the reference genome, while -o specifies the output directory. The reference is optional, but using one enables additional comparisons.

Common QUAST Metrics

MetricMeaning
Number of contigsThe number of assembled DNA sequences.
Largest contigLength of the longest contig.
Total lengthCombined length of the assembled sequences.
N50 and L50Measures of assembly continuity.
GC percentagePercentage of guanine (G) and cytosine (C) bases.
Genome fractionPercentage of the reference genome covered by the assembly, when a reference is used.
MisassembliesPotential assembly inconsistencies identified during reference-based comparison.
Number of N basesIndicates unknown bases or gaps in the assembly.

N50, BUSCO, and QUAST Comparison

Tool or metricMain purposeMain question
N50Measures continuityHow long are the assembled contigs?
BUSCOEstimates gene completenessAre the expected genes present?
QUASTReports assembly statistics and comparisonsWhat are the main characteristics and potential problems in the assembly?

Using these checks together gives a more balanced assessment than relying on a single metric.

Comparative Genomics and Synteny

Comparative genomics examines genomes to identify shared and different DNA sequences, genes, and genomic structures. It helps researchers study evolution, identify related genes, and investigate differences between species or strains.

One important concept in genome comparison is synteny.

What Is Synteny?

Synteny describes the conservation of gene order or genomic regions between chromosomes or genomes. When related genomes contain genes in similar arrangements, those regions may show conserved synteny.

Synteny analysis can help researchers:

  • Identify corresponding genomic regions between related organisms.
  • Detect inversions, insertions, deletions, duplications, and other structural changes.
  • Study genome evolution.
  • Investigate unusual regions in an assembly.

What Is a Dot Plot?

A dot plot is a visual method for comparing two DNA sequences or genomes. Matching regions are displayed as points, allowing researchers to identify similar sequences and possible structural differences.

Common patterns include:

  • Diagonal line: Similar sequences with matching order and orientation.
  • Reverse diagonal: A possible inversion.
  • Breaks or jumps: Possible rearrangements, insertions, deletions, or differences in sequence coverage.

These patterns need to be checked against the data because assembly errors can also create unusual alignments.

Genome Comparison Using MUMmer

MUMmer is a toolkit used to align and compare DNA sequences. The nucmer program aligns two genomes, while show-coords reports matching regions and mummerplot creates a visual comparison.

# Align the query assembly against a reference nucmer --prefix=strain_vs_ref reference.fasta flye_out/assembly.fasta # Export matching regions show-coords -rcl strain_vs_ref.delta > strain_vs_ref.coords # Generate a dot plot mummerplot --png --layout --filter \  -p strain_vs_ref strain_vs_ref.delta

Other tools used for genome comparison and synteny analysis include minimap2, Mauve, and MCScanX. Their suitability depends on the type of comparison and the data available.

Example of Synteny Analysis

A researcher compares a newly assembled E. coli strain with a reference strain. The dot plot shows a long diagonal line and a smaller reverse-oriented section. This pattern may indicate an inversion in that genomic region. The researcher can examine the sequencing reads and additional evidence to determine whether the change is biological or caused by an assembly error.

What Is a Pan-Genome?

A pan-genome is the complete collection of genes identified across all strains or members included in a species-level analysis. It helps researchers understand which genes are shared by all strains and which occur only in some of them.

The pan-genome is commonly divided into three groups.

ComponentDefinitionExample
Core genomeGenes found in all or nearly all strains, depending on the study's definitionGenes involved in essential cellular functions
Accessory genomeGenes found in some, but not all, strainsGenes that provide particular metabolic abilities
Unique genesGenes found in only one or a few strains in the datasetGenes that may be associated with a specific strain

These categories depend on the strains included and the gene-identification methods used.

Open and Closed Pan-Genomes

An open pan-genome continues to gain new genes as additional strains are sampled. This pattern is often found in species with substantial genetic diversity and frequent DNA exchange.

A closed pan-genome adds relatively few new genes as more strains are analyzed. This can occur in species with more limited genetic diversity, although the result also depends on sampling and analysis methods.

Pan-Genome Analysis Workflow

A typical bacterial pan-genome workflow includes the following steps:

  1. Assemble the genomes: Use an appropriate assembler, such as SPAdes or Flye.
  2. Check assembly quality: Assess the assemblies using tools such as QUAST and BUSCO.
  3. Annotate the genomes: Identify genes and other genomic features. Prokka is one tool used for bacterial genome annotation.
  4. Group related genes: Use tools such as Roary or Panaroo to group similar genes across strains.
  5. Analyze gene groups: Identify core, accessory, and strain-specific genes.

Annotating a Genome with Prokka

prokka \
 --outdir prokka_strain1 \
 --prefix strain1 \
 --cpus 4 \
 flye_out/assembly.fasta

This command annotates the assembly and writes the results to the specified output directory. Repeat the process for each strain being analyzed.

Building a Pan-Genome with Roary

After annotating the genomes, Roary can group gene sequences from compatible GFF files.

roary -e -n -p 4 -f roary_out prokka_*/ *.gff

Note: In a shell command, the GFF file pattern must match the actual paths of the Prokka output files. For a typical set of files inside separate annotation directories, a suitable pattern may be prokka_*/*.gff; confirm the file locations before running the command.

Roary requires at least two annotated genomes. One of its main outputs is gene_presence_absence.csv, which records gene presence and absence across the analyzed strains.

The -e and -n options are used for core-gene alignment in supported Roary workflows. These results can support further analyses, including comparisons of strains and construction of phylogenetic trees.

Example of Pan-Genome Analysis

A public health laboratory compares several strains of a bacterial species. The analysis identifies genes shared across all strains and other genes found only in a subset. Researchers can investigate whether these differences are associated with traits such as antibiotic resistance or adaptation to particular environments. The presence of a gene alone does not prove that it causes a specific trait; further analysis is required.

Genome Assembly and Comparative Genomics Workflow

The following example shows how different tools can be combined in a bacterial genome project. Use the commands that match the sequencing data and research objective.

1. Assemble Short Reads

spades.py --isolate \
 -1 trimmed/sample_R1.fastq.gz \
 -2 trimmed/sample_R2.fastq.gz \
 -o spades_out \
 -t 4

2. Assemble Long Reads

flye --nano-raw nanopore/sample.fastq.gz \
 --out-dir flye_out \
 --threads 4

3. Compare the Assemblies

quast.py \
 spades_out/contigs.fasta \
 flye_out/assembly.fasta \
 -r reference.fasta \
 -o quast_out \
 -t 4

4. Check Gene Completeness

busco \
 -i flye_out/assembly.fasta \
 -l bacteria_odb10 \
 -m genome \
 -o busco_flye \
 -c 4

5. Compare the Genome with a Reference

nucmer \
 --prefix=flye_vs_ref \
 reference.fasta \
 flye_out/assembly.fasta

mummerplot \
 --png \
 --layout \
 --filter \
 -p flye_vs_ref \
 flye_vs_ref.delta

These commands are examples, not a universal pipeline. Input paths, software versions, reference genomes, and parameters must be adjusted to match the dataset.

Best Practices for Genome Assembly

  • Check sequencing quality first: Inspect raw reads and perform trimming or filtering when needed.
  • Choose the appropriate assembler: Match the software to the sequencing platform and data type.
  • Use multiple quality checks: Evaluate continuity, gene completeness, and assembly statistics together.
  • Keep a record of the analysis: Save software versions, commands, parameters, and output files.
  • Investigate unexpected results: Check unusual contigs, missing genes, and alignment patterns against the original reads and other available evidence.

Conclusion

Genome assembly reconstructs DNA sequences from sequencing reads, while comparative genomics examines similarities and differences between genomes. Reference-based assembly is useful when a suitable reference is available, whereas de novo assembly can reconstruct genomes without one.

SPAdes is commonly used for short-read assembly, and Flye is designed primarily for long-read data. N50 measures assembly continuity, BUSCO estimates gene completeness, and QUAST summarizes assembly statistics. Synteny analysis helps identify conserved gene order and possible structural changes, while pan-genome analysis identifies genes shared across strains and genes found in only some of them.