Skip to content

Read-through and mate overlap for an insert length

ngs_insert_read_overlap

Works out how far paired reads overlap, read into adapter or leave the middle of an insert unsequenced.

Runs
On the server
Level
Checked against a reference: integer geometry from Turner 2014's figures, by formula and by position sets, with hand-worked cases
Ask your assistant

What it is

Returns how far paired reads overlap, how far each reads past the insert into adapter, and any unsequenced middle. Use when choosing read lengths for an insert size, or checking whether mates will merge or need adapter trimming. Not for finding an adapter in a sequence: use `seq_motif_search`; for depth use `ngs_coverage_depth`. Lengths in whole bp are required, the insert between the adapters; refuses lengths above 100,000 bp.

Field: Sequencing and genomics.

What it does

You give

  • insertLength (required): The insert: the fragment between the adapters, whole bp. Must be above 0 bp.
  • read1Length (required): Read 1 length, sequenced cycles, whole bp. Must be above 0 bp.
  • read2Length (required): Read 2 length, sequenced cycles, whole bp. Must be above 0 bp.

No request is recorded for this tool.

Limits

  • Research arithmetic for planning sequencing libraries and runs and for genomic coordinate bookkeeping; it does arithmetic on the inputs it receives, and does not measure the library, the instrument or the data.
  • Lengths only: the insert is the fragment between the adapters, not a sizing-trace library size, which includes them; read lengths are sequenced cycles before trimming; read-through counts the bases past the insert's end (adapter and whatever follows); the merged length is insertLength, the span of the mates after adapter trimming; a merger run on untrimmed read-through pairs reports read1Length + read2Length − insertLength instead, and whether a merger joins the mates depends on its own settings.
  • Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.

It will not answer when

  • a length is above the method's length cap.
Every input, with its units3 inputs
  • insertLength (required): The insert: the fragment between the adapters, whole bp. Must be above 0 bp.
  • read1Length (required): Read 1 length, sequenced cycles, whole bp. Must be above 0 bp.
  • read2Length (required): Read 2 length, sequenced cycles, whole bp. Must be above 0 bp.
Every refusal, with its code1 refusal
CodeWhen
LENGTH_ABOVE_RANGEa length is above the method's length cap.

The calculation

The method's equations, constants and worked example.

Read-through and mate overlap for an insert length and two read lengthsngs-insert-read-overlap@1.0.2

overlap = max(0, min(r1, i) + min(r2, i) - i)

read-through_k = max(0, r_k - i)

middle = max(0, i - r1 - r2), the source's inner distance clipped at 0 (programs that report a signed inner distance give i - r1 - r2, negative when the mates overlap): these three are the record's derivation from Turner 2014 Figs 1 and 2 (drawn, not printed)

merged length = i when overlap > 0: for overlapping mates (Turner 2014 Fig. 2A) as the source states

for read-through (Fig. 2B) the source measures i = (r1 + r2) - c, with c the contig built from the untrimmed reads, so c = r1 + r2 - i, and the record reports i, the span of the mates after adapter trimming, as its own reading (Results, Measurement of insert size)

relation: read-through when either read-through is above 0, else mates-overlap when overlap > 0, else mates-meet when i = r1 + r2, else gap-between-mates

order of checks: the kit's checks of each length in the order insert, read 1, read 2 (a length of 0 or below is the kit's OUT_OF_RANGE), then each length's cap of 100,000 bp (LENGTH_ABOVE_RANGE), then the whole-number test of all three (NOT_AN_INTEGER), so 100000.5 bp is refused LENGTH_ABOVE_RANGE

SymbolMeaning
iinsert length between the adapters, bp
r1read 1 length, sequenced cycles, bp
r2read 2 length, bp

Source 1.

A definition, not a model: the equation states what the quantity means. A different convention gives a different number.

Worked example

Worked example: one case of ngs-insert-read-overlap@1.0.2, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.

Inputs

  • insertLength = 250 bp
  • read1Length = 150 bp
  • read2Length = 150 bp

Steps

  1. ov = 50 bp, from read1Length, read2Length, insertLength; by the equation above; gives result.mateOverlap.

The working, as the case writes it:

overlap = max(0, min(150,250) + min(150,250) - 250) = 50, equal to |[1, 150] ∩ [101, 250]|

read-through = max(0, r - i) = 0, 0

middle = 0

Answer

result.mateOverlap = 50 bp

Where these values came from: our own exact-arithmetic script and a hand-worked case; Turner 2014 (Front Genet 5:5, PMC3906532); exact integers by the formula and by enumerating the positions each read covers.

At build the tool returned this answer within the tolerance the file states: exact: lengths, relations, withheld rules, statuses and codes.

Sources

  1. Turner FS (2014), Assessment of insert sizes and adapter content in fastq data from NexteraXT libraries, Frontiers in Genetics 5:5

    Used for: Read-through and mate overlap for an insert length and two read lengths. At: section Introduction, Figures 1 and 2 (drawn: overlapping mates, the inner distance, adapter read-through by insert length); Results, Measurement of insert size (i = (r1 + r2) − c, c the length of the contig FLASH produces).

    Read in full, 11 November 2026

How it is checked

Level

Checked against a reference.

Checked against

Our own exact-arithmetic script and a hand-worked case.

Cases

No case set is linked to this version.

Not checked

Whether a merger joins the mates (its minimum overlap and mismatch settings); adapter sequences; trimmed read lengths; library sizes that include the adapters.

Changes to its methods0 changes

No change is logged for these method versions.