Friday, December 4, 2026
SAVED POSTS
  • Login
  • Register
RathBiotaClan
No Result
View All Result
  • HOME
  • HEALTH SCIENCE

    TRENDING ON HEALTH (TOP)

    A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

    Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer

    Laughter therapy may help people with a common form of lung disease

    Mindfulness Therapy Offers New Hope for People Stuck in Depression

    NOW ON AIR (RBC)

    fruitfully remove the head, then touch the wing
    NEUROSCIENCE

    Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It

    November 30, 2026
    HEALTH SCIENCE

    A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

    November 29, 2026
    prostate-cancer
    CANCER

    Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer

    November 27, 2026
    BIOTECHNOLOGY

    Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

    November 26, 2026
  • NEUROSCIENCE
    • PHYSIOLOGY
    • IMMUNOLOGY
    • CANCER
  • DISCOVERIES
    • SPOTLIGHTS
    • STUDENT PORTAL
    • SCIENCE FEATURED
  • MOLECULAR BIOLOGY
    • GENETICS
    • BIOTECHNOLOGY
    • BIOINFORMATICS
    • BIOCHEMISTRY
    • BIOPHYSICS
  • ZOOLOGY & ECOLOGY
    • ENVIRONMENTAL SCIENCE
    • ECOLOGY
    • EVOLUTION
  • MICRO & PLANT SCIENCE
    • MICROBIOLOGY
    • CELL BIOLOGY
    • DEVELOPMENTAL BIOLOGY
  • PSYCHOLOGY
RathBiotaClan
Loading…
RathBiotaClan
No Result
View All Result
Home BIOINFORMATICS

Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

Shibasis Rath by Shibasis Rath
July 4, 2026 - Updated on November 14, 2026
in BIOINFORMATICS, STUDENT PORTAL
Reading Time: 9 mins read
11
A A
0
Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment
ADVERTISEMENT

In alignment problems, the use of gaps in the objective function helps in finding alignments that satisfy an expected shape, as seen in examples like cDNA matching. However, the effectiveness of the gap concept depends critically on how gaps are weighted. There are four general types of gap weights: constant, affine, convex, and arbitrary.

1. Constant Gap Weight

This is the simplest choice of gap weight. Here, each individual space is free, and each gap (regardless of the number of spaces in it) is given a fixed weight of Wg.

If Wm and Wms denote the weights for matches and mismatches respectively, the operator-weight version of the problem is stated as:

Advertisement

Find an alignment A to maximize [Wm(# matches) − Wms(# mismatches) − Wg(# gaps)].

If alphabet-dependent weights are used instead (a similarity function for matches/mismatches), the objective becomes maximizing the sum of similarity scores s(x, y) over aligned characters, minus Wg times the number of gaps, where s(x, −) = s(−, x) = 0 for every character x.

READ ALSO

Multiple alignment with sum of pairs and consensus objective functions

Why Is Multiple String Alignment Harder Than Pairwise Alignment?

2. Affine Gap Weight

This is a generalization of the constant gap model, obtained by adding a weight Ws for each space within the gap.

  • Wg is called the gap initiation weight — it represents the cost of starting a gap.
  • Ws is called the gap extension weight — it represents the cost of extending the gap by one space.

The operator-weight version of the objective becomes:

Advertisement

Find an alignment to maximize [Wm(# matches) − Wms(# mismatches) − Wg(# gaps) − Ws(# spaces)].

This model is called the affine gap weight model because the weight contributed by a single gap of length q is given by the affine function:

Wg + qWs

The constant gap weight model is simply the affine model with Ws = 0. (The affine model is sometimes also called the linear weight model.)

The alphabet-weight version again sets s(x, −) = s(−, x) = 0, with the objective of maximizing the sum of similarity scores minus Wg(# gaps) minus Ws(# spaces).

Advertisement

The affine gap weight model is the most commonly used gap model in molecular biology literature, although there is considerable disagreement about the correct values of Wg and Ws (and also Wm and Wms). For example, the widely used search program FASTA uses default settings of Wg = 10 and Ws = 2 for aligning amino acid strings.

3. Convex Gap Weight

It has been suggested that certain biological phenomena are better modeled by a gap weight function where each additional space in a gap contributes less to the total weight than the preceding space — that is, a function with a negative second derivative. Such a function is called convex (some call it concave), as opposed to affine.

An example of such a function is:

Wg + logₑ q

where q is the length of the gap. Some biologists have further suggested that a gap function which initially increases to a maximum value and then decreases to near zero would best reflect a combination of different biological phenomena responsible for insertion or deletion of DNA.

4. Arbitrary Gap Weight

This is the most general gap weight model, where the weight of a gap is an arbitrary function w(q) of its length q. The constant, affine, and convex weight models are all special cases of this arbitrary weight model.

Time Bounds for Gap Choices

The time needed to solve the alignment problem optimally depends on the type of gap weight chosen:

  • If w(q) is a totally arbitrary function of gap length, the optimal alignment can be found in O(nm² + n²m) time, where n and m (m ≥ n) are the lengths of the two strings.
  • If w(q) is convex, the time can be reduced to O(nm log m).
  • If w(q) is affine (or constant), the time bound reduces to O(nm) — the same time bound as for alignment without any gap concept at all.

Recurrences for Arbitrary Gap Weights

To align strings S1 and S2, prefixes S1[1..i] and S2[1..j] are considered. Any alignment of these two prefixes falls into one of three types:

  1. Alignments where S1(i) is aligned to a character strictly to the left of S2(j) — the alignment ends with a gap in S1.
  2. Alignments where S1(i) is aligned strictly to the right of S2(j) — the alignment ends with a gap in S2.
  3. Alignments where S1(i) and S2(j) are aligned directly opposite each other (whether matching or mismatching).

These three cases cover all possibilities. Accordingly:

  • E(i, j) = maximum value of any type 1 alignment
  • F(i, j) = maximum value of any type 2 alignment
  • G(i, j) = maximum value of any type 3 alignment
  • V(i, j) = maximum of E(i, j), F(i, j), G(i, j)

The recurrences are:

V(i, j) = max[E(i, j), F(i, j), G(i, j)]

G(i, j) = V(i−1, j−1) + s(S1(i), S2(j))

E(i, j) = max₀≤k<j [V(i, k) − w(j − k)]

F(i, j) = max₀≤k<i [V(k, j) − w(i − k)]

Base cases — if all spaces (including end spaces) are counted in the objective function, the optimal value is found in cell (n, m), with:

V(i, 0) = −w(i), V(0, j) = −w(j) E(i, 0) = −w(i), F(0, j) = −w(j)

Here G(0,0) = 0, but G(i, j) is undefined when exactly one of i or j is zero, and V(0,0) is naturally taken as zero.

When end gaps are free, the optimal alignment value is the maximum value found in row n or column m, with base case V(0, j) = V(i, 0) = 0.

Time Analysis: Filling the (n+1) × (m+1) table row by row, evaluating G(i, j) requires examining one cell, evaluating E(i, j) requires examining j cells of row i, and evaluating F(i, j) requires examining i cells of column j. This gives O(m²) work per row for E-values and O(n²) work per column for F-values, leading to an overall time bound of O(nm² + n²m).

This increase over the gap-free case (O(nm)) occurs because V(i, j) now depends on looking j cells to the left and i cells above, rather than just the three adjacent cells.

Recurrences for Affine (and Constant) Gap Weights

The key insight for greater efficiency in the affine case is that the increase in gap weight contributed by each additional space is a constant Ws, independent of the gap’s length so far — that is, w(q+1) − w(q) = Ws for any gap length q > 0. This differs from the arbitrary case, where no such fixed relationship exists between w(q) and w(q+1).

Because of this, when evaluating E(i, j) or F(i, j), it is not necessary to track exactly where the gap began — only whether a gap has already started or a new one is being initiated.

Base cases — when end gaps are included:

V(i, 0) = E(i, 0) = −Wg − iWs

V(0, j) = F(0, j) = −Wg − jWs

When end gaps are free: V(i, 0) = V(0, j) = 0.

General recurrences:

V(i, j) = max[E(i, j), F(i, j), G(i, j)]

G(i, j) = V(i−1, j−1) + Wm (score depending on match/mismatch)

E(i, j) = max[E(i, j−1), V(i, j−1) − Wg] − Ws

F(i, j) = max[F(i−1, j), V(i−1, j) − Wg] − Ws

Explanation of E(i, j): Since S1(i) is aligned to the left of S2(j), either:

  • S1(i) is exactly one place to the left of S2(j), so a new gap begins opposite S2(j), giving E(i, j) = V(i, j−1) − Wg − Ws, or
  • S1(i) is to the left of S2(j−1), so the same gap already in progress is now opposite S2(j) as well, giving E(i, j) = E(i, j−1) − Ws.

F(i, j) is explained analogously, and G(i, j) simply represents aligning S1(i) directly opposite S2(j).

The optimal alignment value is found in cell (n, m) if end spaces are counted; otherwise it is the maximum value in row n or column m.

Note: It may be asked why V(i, j−1), and not G(i, j−1), is used in the recurrence for E(i, j). Using G(i, j−1) − Wg would miss alignments having a gap in S2 ending opposite character i of S1, followed immediately by a gap in S1. Although the fully expanded recurrence — max[E(i, j−1), G(i, j−1) − Wg, V(i, j−1) − Wg] − Ws — would also be correct, the middle term is redundant since it is already covered by V(i, j−1) − Wg.

Time Analysis: Since V(i, j), E(i, j), F(i, j), and G(i, j) at each cell are each evaluated using only a constant number of references to previously computed values, arithmetic operations, and comparisons, the entire (n+1) × (m+1) table can be filled in O(nm) time — the same as the gap-free alignment model.

Conclusion

Thus, gap weighting in alignment problems ranges from the simplest constant model to the most general arbitrary model, with affine weights forming the standard choice in practice due to their balance between biological interpretability and computational efficiency. While arbitrary and convex gap weights allow more flexible modeling of biological insertion/deletion phenomena, they come at increased computational cost, whereas the affine (and constant) model achieves the same O(nm) time bound as alignment without gaps at all.


Discover more from RathBiotaClan

Subscribe to get the latest posts sent to your email.

Previous Post

Gaps in Sequence Alignment and Their Role in cDNA Matching

Next Post

Scientists say cockroach milk is 3x more nutritious than human breast milk

Shibasis Rath

Shibasis Rath

Shibasis Rath is the founder and editor of RathBiotaClan. He holds a B.Sc. in Zoology and a master's degree in Bioinformatics, and writes about genetics, evolution, zoology and the wider life sciences, turning peer-reviewed research into clear, accurate news for general readers.

Every article links to the original study, and health stories are written as research summaries, not medical advice.

RathBiotaClan: Connecting research to reality.

Related Posts

Multiple alignment with sum of pairs and consensus objective functions
BIOINFORMATICS

Multiple alignment with sum of pairs and consensus objective functions

November 19, 2026
Why Is Multiple String Alignment Harder Than Pairwise Alignment?
BIOINFORMATICS

Why Is Multiple String Alignment Harder Than Pairwise Alignment?

November 19, 2026
Multiple Sequence Comparasion For Structural Interference
BIOINFORMATICS

Multiple Sequence Comparasion For Structural Interference

November 19, 2026

POPULAR NEWS

man in black shirt holding black smartphone

Watching TikTok and Instagram Reels Videos Deactivates the Brain’s Cognitive Control Network, Study Finds

by Shibasis Rath
August 20, 2026
1

Millions of people finish short video after short video every day; a new brain-scan study shows that the very act...

Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

Choices for Gap Weights: Constant, Affine & Arbitrary Gap Weights in Sequence Alignment

by Shibasis Rath
July 4, 2026 - Updated on November 14, 2026
0

In alignment problems, the use of gaps in the objective function helps in finding alignments that satisfy an expected shape,...

Scientists Have a Fascinating Hypothesis About Why Smart People Should Spend Less Time With Friends

Scientists Have a Fascinating Hypothesis About Why Smart People Should Spend Less Time With Friends

by Shibasis Rath
August 15, 2026
0

Higher intelligence links to lower life satisfaction when people socialize more often with friends. Researchers found this pattern in data...

Chewing gum releases thousands of microplastic particles directly into your mouth with every piece you chew

Chewing gum releases thousands of microplastic particles directly into your mouth with every piece you chew

by Shibasis Rath
May 8, 2026 - Updated on July 2, 2026
0

Microplastics are turning up in places researchers never expected: deep-sea sediments, Arctic ice, and human blood. Now, a UCLA pilot...

a group of gen Z kids walking down a street

Is Gen Z the First Generation Less Intelligent Than Their Parents?

by Shibasis Rath
February 5, 2026 - Updated on March 14, 2026
0

Gen Z intelligence decline is emerging as a serious concern among neuroscientists and education researchers. For over a century, each...

EDITOR CHOICE‘S

  • All
  • NEWS
  • SPOTLIGHTS
Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It

Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It

by Shibasis Rath
November 30, 2026
0

Touch the wing of a fruit fly with no head, and its back legs still sweep the wing clean. That...

A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy

by Shibasis Rath
November 29, 2026
0

T cell engagers, lab-made antibodies that steer immune cells against rogue B cells, are drawing interest as a new lupus...

prostate-cancer

Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer

by Shibasis Rath
November 27, 2026
0

A targeted radioactive therapy may give men with advanced prostate cancer more time before their disease worsens. In a phase...

Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

by Gupteswar Acharya
November 26, 2026
0

Cryo-EM reveals how CRISPR-associated transposases recruit proteins and activate precise DNA insertion in bacteria. Researchers captured three structural stages of...

ADVERTISEMENT

Google News

Get RathBiotaClan stories in your Google News feed.

Add to Google News

RathBiotaClan – RBC

RathBiotaClan

Connecting Research to Reality.

Trusted life science news and biology research for students, researchers, and science enthusiasts.

About Us

Privacy Policies

Contact Us

Editorial Standard

Latest Posts

  • Fruit Flies Without Heads Keep Cleaning Their Wings, Scientists Found the Cells Behind It
  • A New Lupus Drug Is Being Tested as a Simpler Alternative to CAR-T Cell Therapy
  • Targeted Radiation Therapy Slows Disease Progression in Advanced Prostate Cancer
  • Scientists Reveal How CRISPR Systems Recruit Enzymes for Precise DNA Insertion

SHIBASIS RATH

Contact Mail

rathbiotaclan@gmail.com

No Result
View All Result
MSME (Udyam) Certified Science Platform
Govt. of India

Get Us On PlayStore

playstore app for rathbiotaclan
  • About RathBiotaClan | Life Science & Biology Research
  • Advertise With Us
  • Cancellation and Refund Policy
  • Contact Us
  • Contribute
  • Editorial Standards
  • Home
  • Pricing Details
  • Privacy Policies
  • Shipping Policy
  • Terms & Conditions

© 2026 RathBiotaClan. All rights reserved.

Welcome Back!

Sign In with Google
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Google
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • HOME
  • HEALTH SCIENCE
  • NEUROSCIENCE
    • PHYSIOLOGY
    • IMMUNOLOGY
    • CANCER
  • DISCOVERIES
    • SPOTLIGHTS
    • STUDENT PORTAL
    • SCIENCE FEATURED
  • MOLECULAR BIOLOGY
    • GENETICS
    • BIOTECHNOLOGY
    • BIOINFORMATICS
    • BIOCHEMISTRY
    • BIOPHYSICS
  • ZOOLOGY & ECOLOGY
    • ENVIRONMENTAL SCIENCE
    • ECOLOGY
    • EVOLUTION
  • MICRO & PLANT SCIENCE
    • MICROBIOLOGY
    • CELL BIOLOGY
    • DEVELOPMENTAL BIOLOGY
  • PSYCHOLOGY
  • Login
  • Sign Up
SAVED POSTS

© 2026 RathBiotaClan. All rights reserved.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.

Discover more from RathBiotaClan

Subscribe now to keep reading and get access to the full archive.

Continue reading