Scaffolding and Gap Filling

  • Scaffolding and gap filling are important stages of genome assembly that help transform fragmented genome assemblies into longer, more continuous, and biologically useful representations. Genome assembly initially produces contigs, which are continuous DNA sequences reconstructed from overlapping sequencing reads. Although contigs represent assembled genomic regions, they may not cover entire chromosomes or genomic molecules because of repetitive sequences, insufficient sequencing coverage, heterozygosity, sequencing errors, and limitations of assembly algorithms. Scaffolding uses additional information to determine the relative order, orientation, and approximate distance between contigs, while gap filling attempts to reconstruct the missing DNA sequences between adjacent contigs.
  • A contig is a continuous assembled sequence without internal gaps represented by unknown nucleotides. A scaffold is a larger assembly structure containing one or more contigs arranged in an estimated order and orientation. Gaps may be represented by stretches of the character N, indicating that the length or sequence of the intervening region is uncertain. For example, a scaffold may contain one contig followed by 100 unknown nucleotide positions and then another contig. The contigs provide the known sequence, while the gap represents an unresolved region between them. Scaffolding therefore improves structural continuity without necessarily recovering the missing nucleotide sequence.
  • Scaffolding is based on information that connects different contigs. Paired-end sequencing reads, mate-pair libraries, long sequencing reads, linked-read data, Hi-C sequencing, optical maps, and genetic linkage information can provide evidence about the relationships between assembled regions. These technologies differ in the distance over which they can connect sequences, their accuracy, and the type of information they provide. The choice of scaffolding method depends on the sequencing data available, the organism being studied, the complexity of its genome, and the desired assembly resolution.
  • Paired-end sequencing is one of the commonly used sources of scaffolding information. In paired-end sequencing, both ends of a DNA fragment are sequenced, producing two reads that originate from approximately known positions and orientations within the same fragment. If the two reads map to different contigs, their positions and orientations can provide evidence that the contigs are adjacent or belong to the same genomic region. The expected insert-size distribution helps estimate the distance between them. However, paired-end reads generally provide relatively short-range linking information, and their usefulness may be reduced in highly repetitive or complex genomic regions.
  • Mate-pair sequencing can provide longer-range information than conventional paired-end sequencing. It uses DNA fragments that are substantially longer than typical short-read library inserts, allowing reads from distant genomic positions to be linked. Mate-pair data can help connect contigs separated by repetitive sequences and support the construction of larger scaffolds. However, mate-pair libraries may contain chimeric fragments, unexpected orientation patterns, and other technical artifacts. Their reliability depends on library preparation, insert-size distribution, sequencing quality, and the accuracy of read mapping.
  • Long-read sequencing technologies provide particularly useful information for scaffolding because individual reads can span long genomic regions. PacBio HiFi and Oxford Nanopore Technologies reads can connect contigs across repetitive regions, structural variants, and other complex genomic sequences. When a long read overlaps or maps consistently to two different contigs, it can provide direct evidence of their relative order and orientation. Long reads can also support local assembly across gaps, making them useful for both scaffolding and gap filling. The ability to span a repeat depends on read length, repeat length, sequence similarity, and the availability of unique flanking regions.
  • Hi-C sequencing provides information about the spatial proximity of genomic regions within the nucleus. DNA segments that are physically close to each other in the three-dimensional chromosome structure are more likely to produce Hi-C interaction signals. These contacts can be used to organize contigs and scaffolds into chromosome-scale structures. Hi-C-based scaffolding is particularly valuable for large eukaryotic genomes, including animal and plant genomes, where chromosome-level assemblies are often required. However, Hi-C contact information reflects physical proximity rather than direct sequence continuity. Incorrectly interpreted contacts can produce misjoins, and additional evidence is often required to validate chromosome-scale arrangements.
  • Optical mapping provides long-range structural information by measuring patterns of labelled DNA molecules. These patterns can be compared with corresponding patterns predicted from assembled sequences to identify possible relationships between contigs. Optical maps can help detect large structural differences, support scaffold construction, and identify assembly errors. Genetic linkage maps provide another source of information, using recombination patterns observed in populations or experimental crosses to infer the relative positions of genetic markers. Such maps can help assign scaffolds to chromosomes and estimate their order, although their resolution depends on marker density and the available genetic data.
  • During scaffolding, software evaluates the evidence connecting contigs and constructs relationships among them. The process commonly involves mapping linking reads to contigs, identifying links supported by multiple independent observations, estimating contig orientation, calculating approximate distances, and constructing scaffold structures. The software may represent these relationships as a graph in which contigs are nodes and supporting links are edges. Graph-based approaches help identify consistent connections, alternative arrangements, and potential conflicts. A scaffold is constructed when the available evidence supports a particular sequence of contigs with sufficient confidence.
  • Scaffolding algorithms must distinguish genuine genomic connections from misleading links. Repetitive DNA is a major source of ambiguity because reads originating from one repeat copy may map equally well to several genomic locations. This can create false connections between unrelated contigs. Other sources of error include contamination, chimeric sequencing reads, incorrect read mapping, structural variation, collapsed repeats, and differences between haplotypes. A reliable scaffolding workflow should therefore use appropriate mapping parameters, filtering criteria, evidence thresholds, and independent validation wherever possible.
  • Gap filling is the process of attempting to reconstruct DNA sequences between contigs that have been joined into scaffolds. Unlike scaffolding, which primarily determines the order and orientation of existing contigs, gap filling aims to recover the missing nucleotide sequence. The missing region may be short or long and may contain repetitive DNA, low-complexity sequences, structural variations, or regions that were difficult to sequence or assemble. Gap filling can improve assembly completeness, reduce the number of unknown bases, and provide more continuous genomic sequences.
  • Several types of evidence can be used for gap filling. Long reads that span the gap and extend into the flanking contigs provide particularly strong evidence because they can directly connect the known sequences on both sides. Short reads may also be used when the missing region is small and the surrounding sequences provide reliable mapping locations. Local de novo assembly can reconstruct the gap from reads that map near the flanking contigs. Reference genomes from closely related organisms may provide additional guidance, although reference-based reconstruction must be used cautiously because genomic regions may differ between species, strains, individuals, or populations.
  • A common gap-filling strategy begins by identifying the sequences on either side of an unresolved region. Reads are then selected or mapped based on their similarity to the flanking regions. Reads that connect both sides can be used to construct a local assembly or extend the existing contigs. If a reliable sequence is reconstructed, it can replace some or all of the unknown nucleotides. If the available evidence is insufficient, the gap may remain represented by N characters rather than being filled with an uncertain sequence. Retaining an explicit unresolved gap is preferable to introducing unsupported nucleotide information.
  • Gap filling can be performed using local assembly methods. In this approach, sequencing reads associated with the region around a gap are extracted and assembled independently. The resulting local contigs are then evaluated for consistency with the sequences flanking the gap. A successful local assembly should connect both flanks in the correct orientation and should be supported by sufficient read coverage. Ambiguous or repetitive regions may produce multiple alternative local assemblies, so the selected sequence must be assessed carefully. Local assembly is especially useful when the missing region is not too long and the available reads provide adequate coverage.
  • Long-read-based gap filling uses reads that span the unresolved region or connect its flanking sequences. These reads can provide direct evidence for the sequence and structure of the gap. Long-read assemblers and polishing tools may be used to reconstruct or correct the sequence. The accuracy of the result depends on the sequencing platform, read quality, coverage, and consistency among supporting reads. PacBio HiFi reads generally provide high per-read accuracy, while Oxford Nanopore reads can provide very long sequences but may require additional consensus correction depending on the technology and basecalling workflow.
  • Reference-guided gap filling uses a related reference genome to estimate or reconstruct missing regions. The corresponding genomic region is identified by aligning the flanking sequences or assembled contigs to the reference. The reference sequence may then be used to propose a gap-filling sequence. This method can be useful when a closely related reference genome is available, but it can also introduce errors if the reference differs structurally from the target genome. Insertions, deletions, duplications, inversions, and other structural differences may cause the reconstructed sequence to be incorrect. Reference-derived gap sequences should therefore be distinguished from sequences directly supported by the target organism’s sequencing reads.
  • Several bioinformatics tools support scaffolding and gap filling. SSPACE is a scaffolding program designed to use paired-end and mate-pair read information to connect contigs. BESST uses paired-end read information and probabilistic approaches to estimate scaffold relationships. OPERA and OPERA-LG provide scaffolding methods that can use linking information from sequencing libraries, including long-range data. LINKS uses long-read information to connect contigs and construct larger scaffolds. RagTag supports reference-guided scaffolding and correction by comparing a query assembly with a reference genome. Its output depends on the quality and suitability of the reference, so reference-guided results should not automatically be treated as experimentally confirmed chromosome structures.
  • For long-read and chromosome-scale assembly workflows, tools such as YaHS and SALSA2 can use Hi-C data to scaffold contigs. Hi-C scaffolding tools generally require appropriate alignment and contact information, and their results should be examined for possible misjoins. ALLMAPS can use genetic and physical maps to help order and orient scaffolds. Tools such as LR_Gapcloser and related gap-closing programs have been developed to use long-read information to resolve gaps, while other workflows perform local assembly or polishing to improve unresolved regions. Tool availability, maintenance, supported input formats, and recommended parameters change over time, so users should consult the documentation for the particular software version being used.
  • A basic scaffolding workflow begins with an assembled set of contigs and the sequencing data that provide linking information. For example, paired-end reads can be mapped to the contigs using BWA-MEM. The resulting alignment file can be sorted and indexed with SAMtools before being supplied to a scaffolding program. The following commands illustrate read alignment and preparation of a BAM file:

bwa index contigs.fasta

bwa mem -t 16 contigs.fasta \

    reads_R1.fastq.gz reads_R2.fastq.gz \

    > reads.sam

samtools view -@ 8 -bS reads.sam \

    | samtools sort -@ 8 -o reads.sorted.bam

samtools index reads.sorted.bam

  • The resulting BAM file contains read alignments against the assembly. It can be used by compatible scaffolding tools, provided that the library type, insert-size information, read orientation, and expected input format are correctly specified. The following is an illustrative SSPACE command; exact options should be checked against the installed version:

perl SSPACE_Standard_v3.0.pl \

    -l libraries.txt \

    -s contigs.fasta \

    -b scaffolding_output

  • The library configuration file describes the sequencing library, including the read files and relevant insert-size information. Its required structure depends on the SSPACE version. The scaffolding output should be inspected to identify newly constructed scaffolds, unresolved gaps, and possible changes in contig order or orientation.
  • Reference-guided scaffolding can be performed using RagTag when a suitable reference genome is available. A simplified example is:

ragtag.py scaffold reference.fasta contigs.fasta \

    -o ragtag_output \

    -t 16

  • This command uses the reference genome to propose the placement and orientation of query contigs. It does not prove that every proposed arrangement is correct. Reference-guided scaffolding should be evaluated using independent evidence, particularly when the target genome may contain substantial structural variation relative to the reference.
  • Long-read gap filling may involve extracting reads that align to regions around unresolved gaps and performing local assembly or consensus correction. The exact workflow depends on the assembler and the type of long-read data. For example, minimap2 can be used to align long reads against an assembly:

minimap2 -t 16 -ax map-ont \

    assembly.fasta long_reads.fastq.gz \

    | samtools sort -@ 8 -o long_reads.sorted.bam

samtools index long_reads.sorted.bam

  • The map-ont preset is intended for Oxford Nanopore reads. PacBio HiFi reads require an appropriate mapping preset, such as map-hifi. The resulting alignments can help identify regions where long reads span gaps or support connections between contigs. A dedicated gap-closing or local assembly workflow is then needed to reconstruct the missing sequence.
  • After scaffolding and gap filling, the assembly should be evaluated to determine whether continuity and accuracy have improved. Common assembly statistics include the number of contigs and scaffolds, total assembly length, N50, L50, maximum scaffold length, percentage of unknown bases, and the number of remaining gaps. N50 describes the length at which half of the assembled sequence is contained in scaffolds or contigs of that length or longer. It is a measure of continuity, not a direct measure of sequence accuracy. An assembly with a high N50 may still contain incorrect joins or misassembled regions.
  • QUAST is commonly used to evaluate genome assembly statistics and compare assemblies. BUSCO assesses the presence and completeness of expected conserved single-copy orthologous genes for a selected lineage. Read mapping can help determine whether the original sequencing reads support the reconstructed sequences and scaffold connections. For chromosome-scale assemblies, Hi-C contact maps can be inspected for patterns consistent with chromosome organization. Optical maps and genetic linkage maps may provide additional independent validation. No single metric is sufficient to establish that an assembly is complete and correct.
  • A simplified evaluation command using QUAST is:

quast.py scaffolds.fasta \

    -o quast_results \

    -t 16

  • The percentage of unknown nucleotides can be calculated using basic sequence-processing tools or a custom script. The following Python example counts unknown N bases in a FASTA assembly:

from Bio import SeqIO

total_bases = 0

unknown_bases = 0

sequence_count = 0

for record in SeqIO.parse(“scaffolds.fasta”, “fasta”):

    sequence = str(record.seq).upper()

    total_bases += len(sequence)

    unknown_bases += sequence.count(“N”)

    sequence_count += 1

if total_bases:

    percentage_unknown = (unknown_bases / total_bases) * 100

else:

    percentage_unknown = 0

print(“Number of sequences:”, sequence_count)

print(“Total bases:”, total_bases)

print(“Unknown bases:”, unknown_bases)

print(“Percentage of unknown bases:”, percentage_unknown)

  • A successful scaffolding and gap-filling process should improve the representation of the genome while preserving the accuracy of the underlying sequence. However, greater continuity does not always mean greater biological correctness. Incorrect scaffolding can join sequences from different chromosomes, reverse contigs, or create false chromosome-scale structures. Gap filling can introduce unsupported bases when reads are ambiguous or when a reference genome is incorrectly assumed to match the target. It is therefore important to compare the improved assembly with the original contigs and retain records of all modifications.
  • Scaffolding and gap filling are particularly important for complex eukaryotic genomes, including animal and plant genomes, which often contain large repetitive regions, duplicated genes, heterozygous sequences, and extensive structural variation. Chromosome-level assemblies are useful for studying genome organization, gene location, synteny, structural variation, and evolutionary relationships. In microbial genomics, scaffolding can help reconstruct complete bacterial chromosomes and plasmids, while gap filling can improve genome completeness and support the identification of genes and regulatory regions. In metagenomics, these processes may improve the continuity of metagenome-assembled genomes, although mixed species, strain variation, and uneven coverage make reliable reconstruction particularly challenging.
  • The distinction between scaffolding and gap filling is essential when interpreting genome assemblies. Scaffolding determines how existing contigs should be ordered and oriented and estimates the distances between them. Gap filling attempts to recover the missing nucleotide sequences within those estimated intervals. Both processes contribute to improved genome continuity, but they rely on different types of evidence and may have different levels of confidence. A high-quality genome assembly should combine accurate sequence reconstruction, reliable long-range organization, appropriate validation, and transparent documentation of unresolved regions.
  • For reproducible genome assembly, researchers should preserve the original contig assembly, the sequencing data used for scaffolding and gap filling, software names and versions, command-line parameters, reference genomes, and intermediate files. They should document whether scaffolding was based on paired-end reads, mate-pair reads, long reads, Hi-C data, optical maps, or genetic maps. Gap-filling procedures should also be recorded, including whether the reconstructed sequences were supported by target-organism reads or inferred from a reference genome. Reporting the number of gaps before and after processing, the amount of sequence filled, and the evidence supporting major scaffold joins helps other researchers evaluate the reliability of the final assembly.
  • Scaffolding and gap filling are therefore essential components of modern genome assembly pipelines. Scaffolding connects fragmented contigs into larger structures, while gap filling attempts to reconstruct the missing DNA between them. Together with accurate sequencing, assembly algorithms, polishing, and independent validation, these methods help produce more continuous and informative genome assemblies for research in genomics, evolution, medicine, agriculture, biotechnology, and microbial ecology.
Author:

Leave a Reply

Your email address will not be published. Required fields are marked *