<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>bio ∩ algos</title>
<link>https://njagi.me/</link>
<atom:link href="https://njagi.me/index.xml" rel="self" type="application/rss+xml"/>
<description>A research blog on computational biology.</description>
<generator>quarto-1.9.38</generator>
<lastBuildDate>Fri, 09 Sep 2022 00:00:00 GMT</lastBuildDate>
<item>
  <title>Resolving Edit Transcript Ambiguity in POA with Skips</title>
  <dc:creator>Njagi Mwaniki</dc:creator>
  <link>https://njagi.me/posts/skips/</link>
  <description><![CDATA[ 





<section id="sec-introduction" class="level2">
<h2 class="anchored" data-anchor-id="sec-introduction">Introduction</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Note</span>Publication Announcement
</div>
</div>
<div class="callout-body-container callout-body">
<p>An expanded version of this work has been peer-reviewed and officially published in <em>IEEE Access</em>. You can access the final, peer-reviewed version of record here: <a href="https://doi.org/10.1109/ACCESS.2025.3597547">https://doi.org/10.1109/ACCESS.2025.3597547</a>.</p>
</div>
</div>
<p>In bioinformatics, as well as in other applications of sequence alignment, insertions and deletions can involve fragments of different lengths, raising issues on how and how much to account for their costs. For example, a gap cost purely proportional to the gap length can erroneously discourage long gaps, and on the other hand a low cost for gaps can fragment the alignment into too many short gaps. This has motivated the definitions of various gap penalty functions such as, for example, the affine gap penalty score, introduced for genomic sequences <span class="citation" data-cites="smith_identification_1981">(F.Smith and S.Waterman 1981)</span>, that we will use in this post.</p>
<p>Multiple Sequence Alignments (MSA) are typically performed in a progressive manner by iteratively adding a new linear string to the MSA. To this purpose, the latter (the MSA) is often linearized into a lossy representation of the actual similarities and differences of the already aligned strings, and then the iterative, crucial, step of progressive MSA is brought down to a pairwise alignment of the new string against the MSA. This alignment involves two strings of different type, one linear and a more complex one, breaking up the traditional symmetry of pairwise alignments, and therefore suggesting new challenges that include re-opening the issue of how to account for gaps. Indeed, whereas in pairwise alignments an insertion is just the dual of a deletion and their cost is the same, here the insertion can mean two events that are substantially different: wherever the MSA has already located—and already accounted—a gap, then this insertion cost should not be accounted again and again to each new string; on the other hand, when the gap is an insertion that had not occurred yet in the MSA, or a deletion in the new string, then this is a new event, and it has to be penalized as such <span class="citation" data-cites="pnas05 feng_progressive_1987 higgins_clustal_1988">(L.Loytynoja and N.Goldman 2005; D.-F.Feng and F.Doolittle 1987; G.Higgins. and M.Sharp 1988)</span>.</p>
<p>An Elastic Degenerate String (ED-String), denoted <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D">, is a possible way to compactly represent the outcome of a Multiple Sequence Alignment (MSA) by collapsing common fragments into regular strings, and highlighting gaps and variants as list of strings that can have different size and that can include the empty string <span class="citation" data-cites="grossi_-line_2017 spire17 bernardini_approximate_2020">(R.Grossi et al. 2017; G.Bernardini et al. 2017, 2020)</span>.</p>
<p>For instance, consider the following MSA of three closely-related sequences:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cbegin%7Barray%7D%7Blllll%7D%0A%5Ctext%7BAC%7D%20&amp;%20%5Ccolor%7Bred%7D%5Ctext%7BTAG%7D%20&amp;%20%5Ctext%7BA%7D%20&amp;%20%5Ccolor%7Bred%7D%5Ctext%7BTA%7D%20&amp;%20%5Ctext%7BGG%7D%20%5C%5C%0A%5Ctext%7BAC%7D%20&amp;%20%5Ccolor%7Bred%7D%5Ctext%7BCA%20-%7D%20&amp;%20%5Ctext%7BA%7D%20&amp;%20%5Ccolor%7Bred%7D%5Ctext%7BAA%7D%20&amp;%20%5Ctext%7BGG%7D%20%5C%5C%0A%5Ctext%7BAC%7D%20&amp;%20%5Ccolor%7Bred%7D%5Ctext%7B-%20-%20-%7D%20&amp;%20%5Ctext%7BA%7D%20&amp;%20%5Ccolor%7Bred%7D%5Ctext%7BAT%7D%20&amp;%20%5Ctext%7BGG%7D%20%5C%5C%0A%5Cend%7Barray%7D%0A"></p>
<p>And its ED-string representation is as follows, where <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> denotes the empty string, and those in curly braces are called <em>degenerate positions</em>:</p>
<p><span id="eq-ed-string-example"><img src="https://latex.codecogs.com/png.latex?%0A%5Cwidetilde%7BT%7D%20=%0A%5Ctextcolor%7Bred%7D%7BAC%7D%0A%5CBigg%5C%7B%20%5Cbegin%7Barray%7D%7Bc%7D%0ATAG%20%5C%5C%0ACA%20%5C%5C%0A%5Ctextcolor%7Bred%7D%7B%5Cepsilon%7D%0A%5Cend%7Barray%7D%20%5CBigg%5C%7D%0A%5Ctextcolor%7Bred%7D%7BA%7D%0A%5CBigg%5C%7B%20%5Cbegin%7Barray%7D%7Bc%7D%0A%5Ctextcolor%7Bred%7D%7BT%7D%5Ctextcolor%7Bblue%7D%7BA%7D%20%5C%5C%0AAA%20%5C%5C%0AAT%20%5C%5C%0A%5Cend%7Barray%7D%20%5CBigg%5C%7D%0A%5Ctextcolor%7Bred%7D%7BGGGG%7D%5Ctextcolor%7Bgreen%7D%7BC%7D%5Ctextcolor%7Bred%7D%7BA%7D%0A%5Ctag%7B1%7D"></span></p>
<p>The variants represented by an ED-String introduce a partial order in its letters (as opposed to the total order of letters in a linear string, letters are ordered from left to right, but letters that belong to distinct strings of the same degenerate positions are not comparable), and therefore its edit distance can be computed using Partial Order Alignment (POA) <span class="citation" data-cites="lee_multiple_2002">(C.Lee et al. 2002)</span> (as shown in <span class="citation" data-cites="arxivpoawfa">(M.Mwaniki et al. 2022)</span> for the simpler case of D-strings).</p>
<p>However, POA alone does not yield the optimal edit transcript unless the empty string is not properly managed. We solve this problem by adding a new edit event: the <em>skip operation</em>. In this post we suggest a dynamic programming algorithm to optimally align a linear string <img src="https://latex.codecogs.com/png.latex?P"> and an ED-String <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D"> with <em>skips operations</em>.</p>
<p>For example, the optimal alignment of <img src="https://latex.codecogs.com/png.latex?P=ACATGGGGAAA"> to the ED-string <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D"> above involves the letters of <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D"> highlighted with colors with:</p>
<ol type="1">
<li>Red letters being matches.</li>
<li>A skip operation in that the <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> represents an existing gap locus in the MSA, and hence a free insertion.</li>
<li>The blue <img src="https://latex.codecogs.com/png.latex?A"> is instead a new insertion and therefore it has a cost.</li>
<li>The green letter <img src="https://latex.codecogs.com/png.latex?C"> is a mismatch.</li>
<li>The last letter of <img src="https://latex.codecogs.com/png.latex?P"> has been deleted (at a cost).</li>
</ol>
<p>Our aim is to compute the correct edit distance (the lowest number of operations needed to convert <img src="https://latex.codecogs.com/png.latex?P"> into <img src="https://latex.codecogs.com/png.latex?T"> with free cost of skips) and an unambiguous <em>edit transcript</em> (the sequences of actual edit events that convert <img src="https://latex.codecogs.com/png.latex?P"> into <img src="https://latex.codecogs.com/png.latex?T"> <span class="citation" data-cites="gusfield_algorithms_1997">(D.Gusfield 1997)</span>).</p>
<p>For example, the distance between <img src="https://latex.codecogs.com/png.latex?P"> and <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D"> above is 3 (1 insertion, 1 mismatch, 1 deletion), and the edit transcript representing the alignment is <code>MMSMMIMMMMXMD</code>, where <code>M</code> denotes a match, <code>S</code> is a skip, <code>X</code> is a mismatch, and <code>D</code> denotes a deletion.</p>
<p>The notion of ED-strings and, over them, the exact (that is, no edit operations are allowed) matching problem <em>elastic-degenerate string matching</em> (EDSM) problem has attracted some attention in the combinatorial pattern matching community. Since its introduction in <span class="citation" data-cites="iliopoulosLATA2017">(S.Iliopoulos et al. 2017)</span>, a series of results have been published both for the exact <span class="citation" data-cites="grossi_-line_2017 bernardini_even_2019 aoyama_faster_2018 sicomp">(R.Grossi et al. 2017; G.Bernardini et al. 2019, 2022; Aoyama et al. 2018)</span> as well as for the approximate version of the problem <span class="citation" data-cites="bernardini_approximate_2020 spire17">(G.Bernardini et al. 2020, 2017)</span>.</p>
<p>The algorithm we describe here is for a global alignment (the natural choice for the progressive MSA application mentioned above), but its extension to local and semiglobal alignment is straightforward. A semiglobal alignment could be used, for example, in computational pan-genomics, with the ED-string representing a pan-genome <span class="citation" data-cites="consortium_computational_2018 alzamel_degenerate_2018 alzamel_comparing_2020 graphrep">(Consortium 2018; M.Alzamel et al. 2018, 2020; V.Carletti et al. 2019)</span> and the pattern being a read to be mapped therein: this is currently one of the most relevant problems in bioinformatics <span class="citation" data-cites="minigraph graphaligner vargas vg2021 cislak_sopang_2018 cislak_sopang_2020">(H.Li et al. 2020; M.Rautiainen and T.Marschall 2020; A.Darby et al. 2020; M.Eizenga et al. 2021; A.Cisłak et al. 2018; A.Cisłak and S.Grabowski 2020)</span>.</p>
<p>In Section&nbsp;3 we explain how we propose to manage skips using the basic case of an elastic but not degenerate strings (which we define in Section&nbsp;2 with other preliminary definitions), and in Section&nbsp;4 we extend the idea to ED-strings.</p>
</section>
<section id="sec-prel" class="level2">
<h2 class="anchored" data-anchor-id="sec-prel">Preliminary Definitions</h2>
<p>A <em>string</em> <img src="https://latex.codecogs.com/png.latex?X"> is a sequence of elements on an alphabet <img src="https://latex.codecogs.com/png.latex?%5CSigma">, where the <em>alphabet</em> <img src="https://latex.codecogs.com/png.latex?%5CSigma"> is a non-empty finite set of letters of size <img src="https://latex.codecogs.com/png.latex?%7C%5CSigma%7C">. We denote with <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon"> the <em>empty character</em> (a character whose presence does not change the string it is in), and with <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> the <em>empty string</em>: a string made up of empty characters only.</p>
<p>A string <img src="https://latex.codecogs.com/png.latex?%5CUpsilon"> containing one or more empty characters is an <em>elastic string</em>. The set of all finite strings over an alphabet <img src="https://latex.codecogs.com/png.latex?%5CSigma">, including the <em>empty string</em> <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> of length <img src="https://latex.codecogs.com/png.latex?0">, is denoted by <img src="https://latex.codecogs.com/png.latex?%5CSigma%5E*">, while <img src="https://latex.codecogs.com/png.latex?%5CSigma%5E+"> denotes the set <img src="https://latex.codecogs.com/png.latex?%5CSigma%5E*%20%5Csetminus%20%5C%7B%5Cepsilon%5C%7D">. For any string <img src="https://latex.codecogs.com/png.latex?X">, we denote by <img src="https://latex.codecogs.com/png.latex?X%5Bi..j%5D"> the <em>substring</em> of <img src="https://latex.codecogs.com/png.latex?X"> that <em>starts</em> at position <img src="https://latex.codecogs.com/png.latex?i"> and <em>ends</em> at position <img src="https://latex.codecogs.com/png.latex?j">. In particular, <img src="https://latex.codecogs.com/png.latex?X%5B0..j%5D"> is the <em>prefix</em> of <img src="https://latex.codecogs.com/png.latex?X"> that ends at position <img src="https://latex.codecogs.com/png.latex?j">, and <img src="https://latex.codecogs.com/png.latex?X%5Bi..%7CX%7C%5D"> is the <em>suffix</em> of <img src="https://latex.codecogs.com/png.latex?X"> that starts at position <img src="https://latex.codecogs.com/png.latex?i">, where <img src="https://latex.codecogs.com/png.latex?%7CX%7C"> denotes the <em>length</em> of <img src="https://latex.codecogs.com/png.latex?X">.</p>
<div id="def-edstring" class="theorem definition">
<p><span class="theorem-title"><strong>Definition 1 (Elastic Degenerate String (ED-string))</strong></span> An <em>elastic degenerate string (ED-string)</em> <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BS%7D=%5Cwidetilde%7BS%7D%5C%7B1%5C%7D%5Cwidetilde%7BS%7D%5C%7B2%5C%7D%5Cdots%5Cwidetilde%7BS%7D%5C%7Bn%5C%7D"> of <em>length</em> <img src="https://latex.codecogs.com/png.latex?n"> over an alphabet <img src="https://latex.codecogs.com/png.latex?%5CSigma"> is a finite sequence of <img src="https://latex.codecogs.com/png.latex?n"> degenerate letters <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BS%7D%5C%7Bi%5C%7D">’s. Each <em>degenerate letter</em> <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BS%7D%5C%7Bi%5C%7D"> is a finite non-empty set of <img src="https://latex.codecogs.com/png.latex?s_i"> strings (also called variants) that can possibly properly include the empty string. We denote with <img src="https://latex.codecogs.com/png.latex?%5Cell_i"> the length of the longest string in <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BS%7D%5C%7Bi%5C%7D">.</p>
</div>
<p>When <img src="https://latex.codecogs.com/png.latex?s_i=1">, then <img src="https://latex.codecogs.com/png.latex?%5Cell_i=1"> as well, and in that case <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BS%7D%5C%7Bi%5C%7D"> is just a simple letter of <img src="https://latex.codecogs.com/png.latex?%5CSigma"> and we say that <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BS%7D%5C%7Bi%5C%7D"> is <em>solid</em>, and else we say that it is a degenerate position. The following parameters measure the degeneracy of an ED-string: the <em>total size</em> <img src="https://latex.codecogs.com/png.latex?N"> and <em>total width</em> <img src="https://latex.codecogs.com/png.latex?W"> of an ED-string <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BS%7D"> are respectively defined as <img src="https://latex.codecogs.com/png.latex?N=%5Csum_%7Bi=1%7D%5E%7Bn%7Ds_i%20%5Ccdot%20%5Cell_i"> and <img src="https://latex.codecogs.com/png.latex?W=%5Csum_%7Bi=1%7D%5E%7Bn%7D%5Cell_i">.</p>
<p>For example, <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D"> in Equation&nbsp;1 has length <img src="https://latex.codecogs.com/png.latex?n=11">, <img src="https://latex.codecogs.com/png.latex?W=14">, and <img src="https://latex.codecogs.com/png.latex?N=24">. Moreover, we have that all positions are solid except for <img src="https://latex.codecogs.com/png.latex?3"> and <img src="https://latex.codecogs.com/png.latex?5">, and hence all <img src="https://latex.codecogs.com/png.latex?%5Cell_i">’s are equal to <img src="https://latex.codecogs.com/png.latex?1"> except <img src="https://latex.codecogs.com/png.latex?%5Cell_3=3"> and <img src="https://latex.codecogs.com/png.latex?%5Cell_5=2">, and therein we have <img src="https://latex.codecogs.com/png.latex?s_3=s_5=3">.</p>
</section>
<section id="sec-skip" class="level2">
<h2 class="anchored" data-anchor-id="sec-skip">Edit Distance with Skips</h2>
<p>According to the traditional dynamic programming framework, we incrementally compute the optimal alignments of prefix <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D"> of <img src="https://latex.codecogs.com/png.latex?P"> against prefix (<img src="https://latex.codecogs.com/png.latex?T%5B0..i%5D">) of <img src="https://latex.codecogs.com/png.latex?T"> starting with <img src="https://latex.codecogs.com/png.latex?i"> and/or <img src="https://latex.codecogs.com/png.latex?j"> equal to <img src="https://latex.codecogs.com/png.latex?0"> up to the final lengths.</p>
<p>The affine gap penalty function in sequence alignments accounts to a gap of size <img src="https://latex.codecogs.com/png.latex?g"> the cost <img src="https://latex.codecogs.com/png.latex?w(g)=o+g%5Ccdot%20e">, where <img src="https://latex.codecogs.com/png.latex?o"> is the <em>opening cost</em>, and <img src="https://latex.codecogs.com/png.latex?e"> is the <em>extension</em> cost. The problem of computing the optimal alignment with such gap penalty function does not directly fulfill the requirement of having optimal substructure (needed to apply dynamic programming), and to overcome this limitation, the alignment is conceptually split in blocks grouping runs of edit events. To this purpose, the computation of an optimal alignment with affine gap penalty function requires to replicate the matrices: (<img src="https://latex.codecogs.com/png.latex?I">) for insertions, (<img src="https://latex.codecogs.com/png.latex?D">) for deletions, (<img src="https://latex.codecogs.com/png.latex?M">) for (mis)matches. Since the skip operation we want to implement raises a similar issue, we here add an additional matrix (<img src="https://latex.codecogs.com/png.latex?S">) for skips. The skip operation is contemplated when <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D%5Bi%5D"> includes the empty string, and it carries a cost of zero because it does not actually change <img src="https://latex.codecogs.com/png.latex?P"> and can be thought of as a free insertion.</p>
<p>Let us assume for now that we want to optimally align a string <img src="https://latex.codecogs.com/png.latex?P"> with <img src="https://latex.codecogs.com/png.latex?%7CP%7C=m"> with an elastic string <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%20%5Cin%20(%5CSigma%20%5Ccup%20%5Cvarepsilon)%5En"> using the scores: <img src="https://latex.codecogs.com/png.latex?a"> (match), <img src="https://latex.codecogs.com/png.latex?s"> (skip), <img src="https://latex.codecogs.com/png.latex?x"> (mismatch), <img src="https://latex.codecogs.com/png.latex?o"> (gap opening), <img src="https://latex.codecogs.com/png.latex?e"> (gap extend).</p>
<p>We extend the existing model by adding a skip (<code>S</code>) operation that inserts <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D"> at no cost when this is an empty character. We therefore end up having edit operations <code>M</code> (for match), <code>X</code> (for mismatch), <code>I</code> (for insertion of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon">), <code>D</code> (for deletion of <img src="https://latex.codecogs.com/png.latex?P%5Bj%5D">), and <code>S</code> (for skipping <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D=%5Cvarepsilon">), and with the dynamic programming matrices <img src="https://latex.codecogs.com/png.latex?M,S,I,D"> of size <img src="https://latex.codecogs.com/png.latex?(n+1)%5Ctimes(m+1)"> with the following meanings:</p>
<div id="tbl-dp-matrices" class="quarto-float quarto-figure quarto-figure-center anchored" data-tbl-colwidths="[15,85]">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-dp-matrices-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;1: Dynamic Programming Matrices
</figcaption>
<div aria-describedby="tbl-dp-matrices-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 15%">
<col style="width: 85%">
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">Matrix</th>
<th style="text-align: left;">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;"><img src="https://latex.codecogs.com/png.latex?M%5Bi,j%5D"></td>
<td style="text-align: left;">score of best alignment of <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D"> and <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0..i%5D"> ending with (mis)match</td>
</tr>
<tr class="even">
<td style="text-align: left;"><img src="https://latex.codecogs.com/png.latex?S%5Bi,j%5D"></td>
<td style="text-align: left;">score of best alignment of <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D"> and <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0..i%5D"> ending with a skip of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D"></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><img src="https://latex.codecogs.com/png.latex?I%5Bi,j%5D"></td>
<td style="text-align: left;">score of best alignment of <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D"> and <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0..i%5D"> ending with an insertion of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D"></td>
</tr>
<tr class="even">
<td style="text-align: left;"><img src="https://latex.codecogs.com/png.latex?D%5Bi,j%5D"></td>
<td style="text-align: left;">score of best alignment of <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D"> and <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0..i%5D"> ending with a deletion of <img src="https://latex.codecogs.com/png.latex?P%5Bj%5D"></td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>The initialization of all matrices is as follows:</p>
<ul>
<li><strong><img src="https://latex.codecogs.com/png.latex?M">:</strong> Like in traditional dynamic programming with affine gap penalty, we have <img src="https://latex.codecogs.com/png.latex?M%5B0,0%5D=0"> and <img src="https://latex.codecogs.com/png.latex?M%5Bi,0%5D=M%5B0,j%5D=%20%5Cinfty"> because no alignment of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0%5D%20=%20%5Cepsilon"> and <img src="https://latex.codecogs.com/png.latex?P=%5Cepsilon"> can end with a match or mismatch.</li>
<li><strong><img src="https://latex.codecogs.com/png.latex?D">:</strong> Again like in traditional dynamic programming with affine gap penalty, we have <img src="https://latex.codecogs.com/png.latex?D%5B0,%20j%5D%20=%20o+e%5Ccdot%20j"> because we align an empty prefix of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon"> with <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D">, while <img src="https://latex.codecogs.com/png.latex?D%5Bi,0%5D=%5Cinfty"> because no alignment of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0..i%5D"> and the empty prefix of <img src="https://latex.codecogs.com/png.latex?P"> can end with a deletion in <img src="https://latex.codecogs.com/png.latex?P">.</li>
<li><strong><img src="https://latex.codecogs.com/png.latex?I">:</strong> Dually, <img src="https://latex.codecogs.com/png.latex?I%5B0,j%5D=%5Cinfty"> because no alignment of an empty prefix of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon"> and <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D"> can end with an insertion of a letter of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon">. Let <img src="https://latex.codecogs.com/png.latex?i'"> be the smallest <img src="https://latex.codecogs.com/png.latex?i"> from <img src="https://latex.codecogs.com/png.latex?1"> to <img src="https://latex.codecogs.com/png.latex?n"> such that <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon">. Then we have:</li>
</ul>
<p><span id="eq-init-i"><img src="https://latex.codecogs.com/png.latex?%0AI%5Bi,0%5D%20=%20%5Cmin%20%5Cbegin%7Bcases%7D%0A%20%20%20%20%5Cinfty%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20I%5Bi-1,0%5D%20+%20o+e%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon%20%5Ctext%7B%20%5C&amp;%20%7D%20i=i'%20%5C%5C%0A%20%20%20%20I%5Bi-1,0%5D%20+%20e%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon%20%5Ctext%7B%20%5C&amp;%20%7D%20i%5Cneq%20i'%20%5C%5C%0A%20%20%20%20S%5Bi-1,0%5D+e%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon%20%5Ctext%7B%20%5C&amp;%20%7D%20i%5Cneq%20i'%0A%5Cend%7Bcases%7D%0A%5Ctag%7B2%7D"></span></p>
<p>we need to align <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0..i%5D"> and the empty prefix of <img src="https://latex.codecogs.com/png.latex?P"> ending with an insertion of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D">, and this is only possible if <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon">, and it either extends an existing gap that was already open at row <img src="https://latex.codecogs.com/png.latex?i-1">, or it extends one that was opened earlier and has included a skip.</p>
<ul>
<li><strong><img src="https://latex.codecogs.com/png.latex?S">:</strong> We have that <img src="https://latex.codecogs.com/png.latex?S%5B0,j%5D=%5Cinfty"> because no alignment of an empty prefix of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon"> and <img src="https://latex.codecogs.com/png.latex?P%5B0..j%5D"> can end with a skip of <img src="https://latex.codecogs.com/png.latex?%5CUpsilon">, while:</li>
</ul>
<p><span id="eq-init-s"><img src="https://latex.codecogs.com/png.latex?%0AS%5Bi,0%5D%20=%20%5Cbegin%7Bcases%7D%0A%20%20%20%20s+%5Cmin%5C%7BS%5Bi-1,0%5D,%20I%5Bi-1,0%5D%5C%7D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20%5Cinfty%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon%0A%5Cend%7Bcases%7D%0A%5Ctag%7B3%7D"></span></p>
<p>because we need to align <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5B0..i%5D"> and the empty prefix of <img src="https://latex.codecogs.com/png.latex?P"> ending with a skip, and this latter is not possible if <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon">. On the other hand, when <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D=%20%5Cvarepsilon">, then either a skip had occurred already at the previous row (in which case we inherit its score), or we have to inherit the score of an insertion gap.</p>
<p>We can then progressively fill in the matrices for <img src="https://latex.codecogs.com/png.latex?i,j%3E0"> as follows:</p>
<p><span id="eq-Mfill"><img src="https://latex.codecogs.com/png.latex?%0AM%5Bi,j%5D%20=%20%5Cmin%20%5Cbegin%7Bcases%7D%0A%20%20%20%20%5Cinfty%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20f(i,j)%20+%20M%5Bi-1,j-1%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20f(i,j)%20+%20S%5Bi-1,j-1%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20f(i,j)%20+%20D%5Bi-1,j-1%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20f(i,j)%20+%20I%5Bi-1,j-1%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon%0A%5Cend%7Bcases%7D%0A%5Ctag%7B4%7D"></span></p>
<p>where:</p>
<p><span id="eq-f"><img src="https://latex.codecogs.com/png.latex?%0Af(i,%20j)%20=%20%5Cbegin%7Bcases%7D%0A%20%20%20%20m,%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20=%20P%5Bj%5D%20%5C%5C%0A%20%20%20%20x,%20&amp;%20%5Ctext%7Botherwise%7D%0A%5Cend%7Bcases%7D%0A%5Ctag%7B5%7D"></span></p>
<p>The deletion matrix is the exact same as in traditional alignment:</p>
<p><span id="eq-dfill"><img src="https://latex.codecogs.com/png.latex?%0AD%5Bi,j%5D%20=%20%5Cmin%20%5Cbegin%7Bcases%7D%0A%20%20%20%20D%5Bi,%20j-1%5D%20+%20e%20%5C%5C%0A%20%20%20%20M%5Bi,%20j-1%5D%20+%20o%20+%20e%20%5C%5C%0A%20%20%20%20S%5Bi,%20j-1%5D%20+%20o%20+%20e%20%5C%5C%0A%20%20%20%20I%5Bi,%20j-1%5D%20+%20o%20+%20e%0A%5Cend%7Bcases%7D%0A%5Ctag%7B6%7D"></span></p>
<p>The insertion matrix is as follows:</p>
<p><span id="eq-ifill"><img src="https://latex.codecogs.com/png.latex?%0AI%5Bi,j%5D%20=%20%5Cmin%20%5Cbegin%7Bcases%7D%0A%20%20%20%20%5Cinfty%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20D%5Bi-1,%20j%5D%20+%20o+%20e%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20M%5Bi-1,%20j%5D%20+%20o%20+%20e%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20S%5Bi-1,%20j%5D%20+%20e%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20I%5Bi-1,%20j%5D%20+%20e%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%20%5Cneq%20%5Cvarepsilon%0A%5Cend%7Bcases%7D%0A%5Ctag%7B7%7D"></span></p>
<p>And finally, the skip matrix recurrences:</p>
<p><span id="eq-sfill"><img src="https://latex.codecogs.com/png.latex?%0AS%5Bi,j%5D%20=%20%5Cmin%20%5Cbegin%7Bcases%7D%0A%20%20%20%20s%20+%20S%5Bi-1,j%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20s%20+%20M%5Bi-1,j%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20s%20+%20I%5Bi-1,j%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20s%20+%20D%5Bi-1,j%5D%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20%5Cinfty%20&amp;%20%5Ctext%7Bif%20%7D%20%5CUpsilon%5Bi%5D%5Cneq%20%5Cvarepsilon%0A%5Cend%7Bcases%7D%0A%5Ctag%7B8%7D"></span></p>
<p>We then have that the final result is <img src="https://latex.codecogs.com/png.latex?%5Cmin%20(M%5Bn,%20m%5D,%20I%5Bn,%20m%5D,%20D%5Bn,%20m%5D,%20S%5Bn,%20m%5D)">.</p>
<section id="sec-correctness" class="level3">
<h3 class="anchored" data-anchor-id="sec-correctness">Correctness of the Recurrence</h3>
<div id="fig-basic-alignment" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-basic-alignment-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://njagi.me/posts/skips/Figures/alignment-basic.png" class="img-fluid figure-img" style="width:40.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-basic-alignment-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Basic Alignment Operations
</figcaption>
</figure>
</div>
<p>Using Figure&nbsp;1, and given the existing proofs apply for edit distance in general and cases: 1 (alignment ends in an insertion), 2 (alignment ends in a deletion), and 3 (alignment ends in a match or a mismatch) <span class="citation" data-cites="smith_identification_1981 gotoh_improved_1982 gusfield_algorithms_1997">(F.Smith and S.Waterman 1981; O.Gotoh 1982; D.Gusfield 1997)</span>.</p>
<p><strong>Lemma 1</strong> When <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%20=%20%5Cvarepsilon"> we can insert a skip for free.</p>
<div class="proof">
<p><span class="proof-title"><em>Proof</em>. </span>In case 4, when <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%20=%20%5Cvarepsilon">. If the last symbol in the edit transcript is <img src="https://latex.codecogs.com/png.latex?S">, inductively the alignment up to <img src="https://latex.codecogs.com/png.latex?i-1"> and <img src="https://latex.codecogs.com/png.latex?j"> computes the optimal edit distance between <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi-1%5D"> and <img src="https://latex.codecogs.com/png.latex?P%5Bj%5D">. Because <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%20=%20%5Cvarepsilon">, we can insert <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D"> after <img src="https://latex.codecogs.com/png.latex?P%5Bj%5D"> without actually changing <img src="https://latex.codecogs.com/png.latex?P">, then <img src="https://latex.codecogs.com/png.latex?E(i,j)%20=%20E%5Bi-1,j%5D+0">.</p>
</div>
</section>
</section>
<section id="sec-edskip" class="level2">
<h2 class="anchored" data-anchor-id="sec-edskip">Edit Distance with an Elastic Degenerate String</h2>
<p>Standard Partial Order Alignment (POA) collapses paths containing deletions, which hides the historical length differences of variants. This causes traceback ambiguity. By introducing a directed “Skip” edge (<img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon">), we preserve the exact variant topology without penalizing the alignment.</p>
<div id="fig-poa-vs-skips" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-poa-vs-skips-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell" data-layout-align="default">
<div class="cell-output-display">
<div>
<p></p><figure class="figure"><p></p>
<div>
<pre class="mermaid mermaid-js">graph LR
    %% Subgraph A: Standard POA
    subgraph A[" "]
        node1((A)) --&gt;|Match / Mismatch| node2((T))
        node1 --&gt;|Deletion Path Collapsed| node2
        
        %% Label pushed to the bottom of subgraph A
        labelA["&lt;b&gt;(a) Standard POA (Ambiguous)&lt;/b&gt;"]
    end

    %% Subgraph B: Skip-Enhanced POA
    subgraph B[" "]
        node3((A)) --&gt;|Match / Mismatch| node4((T))
        node3 -.-&gt;|0-cost Skip ε| skip[Skip State]
        skip --&gt; node4
        
        %% Label pushed to the bottom of subgraph B
        labelB["&lt;b&gt;(b) Skip-Enhanced POA (Resolved)&lt;/b&gt;"]
    end

    %% Styling to make labels look like clean captions and push them down
    style labelA fill:none,stroke:none,font-weight:bold
    style labelB fill:none,stroke:none,font-weight:bold
    style skip stroke-dasharray: 5 5, fill:#e1f5fe, stroke:#0288d1
</pre>
</div>
<p></p></figure><p></p>
</div>
</div>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-poa-vs-skips-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Comparison of Standard POA vs.&nbsp;Skip-Enhanced POA. (a) Standard POA merges states, making it impossible to distinguish if a path traversed a true deletion or a match. (b) Skip-Enhanced POA introduces an explicit, zero-cost skip edge (dotted blue line) to preserve the exact alignment transcript history.
</figcaption>
</figure>
</div>
<p>We can index an MSA column-wise, each column being one base wide, <img src="https://latex.codecogs.com/png.latex?0"> being the left-most and <img src="https://latex.codecogs.com/png.latex?n"> as the right-most column. After converting this MSA into an ED-String we can apply the same indexing. In this case, a position <img src="https://latex.codecogs.com/png.latex?i"> in an ED-String <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D">, denoted <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D%5Bi%5D"> is the set of characters at a locus <img src="https://latex.codecogs.com/png.latex?i"> if it were an MSA.</p>
<p>To align a string to an ED-String we pad shorter variants with <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon"> until all variants are of equal length.</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cwidetilde%7BT%7D%20=%0AAC%0A%5Cbegin%7Barray%7D%7Bc%7D%0A%5CBigg%5C%7B%20%5Cbegin%7Barray%7D%7Bl%7D%0ATAG%20%5C%5C%0AC%0A%5Cend%7Barray%7D%20%5CBigg%5C%7D%0A%5Cend%7Barray%7D%0AA%20%5Cimplies%20AC%0A%5Cbegin%7Barray%7D%7Bc%7D%0A%5CBigg%5C%7B%20%5Cbegin%7Barray%7D%7Bc%7D%0ATAG%20%5C%5C%0AC%5Cvarepsilon%5Cvarepsilon%5C%5C%0A%5Cend%7Barray%7D%20%5CBigg%5C%7D%0A%5Cend%7Barray%7D%0AA%0A"></p>
<p>The cells of the dynamic programming (DP) table are tuples of size <img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BT%7D%5Bi%5D"> which correspond to the <img src="https://latex.codecogs.com/png.latex?E(i,j)"> and functions <img src="https://latex.codecogs.com/png.latex?f"> (Equation&nbsp;5) and <img src="https://latex.codecogs.com/png.latex?a"> (which behaves similarly to the skip function in Equation&nbsp;8) would be extended to Equation&nbsp;9 and Equation&nbsp;10.</p>
<p><span id="eq-f-prime"><img src="https://latex.codecogs.com/png.latex?%0Af(i,%20j)%20=%20%5Cwidetilde%7BT%7D%5Bi%5D_%7Bk=0%7D%5E%7Bl%7D%20:%0A%5Cbegin%7Bcases%7D%0A%20%20%20%20%20%20m,%20&amp;%20%5Ctext%7Bif%20%7D%20%5Cwidetilde%7BT%7D%5Bi%5D%5Bk%5D%20=%20P%5Bj%5D%20%5C%5C%0A%20%20%20%20%20%20x,%20&amp;%20%5Ctext%7Botherwise%7D%0A%5Cend%7Bcases%7D%0A%5Ctag%7B9%7D"></span></p>
<p><span id="eq-a-prime"><img src="https://latex.codecogs.com/png.latex?%0Aa(i,%20j)%20=%20%5Cwidetilde%7BT%7D%5Bi%5D_%7Bk=0%7D%5E%7Bl%7D%20:%0A%5Cbegin%7Bcases%7D%0A%20%20%20%20%20%20s,%20&amp;%20%5Ctext%7Bif%20%7D%20%5Cwidetilde%7BT%7D%5Bi%5D%5Bk%5D%20=%20%5Cvarepsilon%20%5C%5C%0A%20%20%20%20%20%20%5Cinfty,%20&amp;%20%5Ctext%7Botherwise%7D%0A%5Cend%7Bcases%7D%0A%5Ctag%7B10%7D"></span></p>
<p>It then follows that the edit distance to position in a variant is given by <img src="https://latex.codecogs.com/png.latex?E(i,j)%5Bk%5D">. To get the edit transcript we traceback as usual.</p>
<div id="fig-alignment-skips" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-alignment-skips-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://njagi.me/posts/skips/Figures/alignment-skips.png" class="img-fluid figure-img" style="width:70.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-alignment-skips-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Alignment of a linear string query to an ED-string text making use of the skip operation with scoring scheme: insertion, +1; skip, 0; deletion, +1; match, 0; replacement, +1. The alignment to the left yielding the edit transcript <img src="https://latex.codecogs.com/png.latex?MR"> and the one to the right yielding the edit transcript is, <img src="https://latex.codecogs.com/png.latex?MSM">.
</figcaption>
</figure>
</div>
</section>
<section id="sec-complexity" class="level2">
<h2 class="anchored" data-anchor-id="sec-complexity">Complexity</h2>
<p>Given the size of the EDT is <img src="https://latex.codecogs.com/png.latex?N"> and the query is <img src="https://latex.codecogs.com/png.latex?m">, we have <img src="https://latex.codecogs.com/png.latex?O(W%20%5Ccdot%20m)"> space and time usage.</p>
</section>
<section id="sec-discussion" class="level2">
<h2 class="anchored" data-anchor-id="sec-discussion">Discussion</h2>
<p>The introduction of the skip operation (<strong>S</strong>) resolves a compromise in progressive Multiple Sequence Alignment (MSA) using Partial Order Alignment (POA). While standard POA successfully avoids collapsing alignments into a simple consensus string, its inability to trace distinct variant lengths introduces ambigiuty downstream.</p>
<section id="decoupling-topology-from-alignment-cost" class="level3">
<h3 class="anchored" data-anchor-id="decoupling-topology-from-alignment-cost">Decoupling Topology from Alignment Cost</h3>
<p>The core strength of our approach lies in decoupling the physical topology of the alignment graph from the mathematical cost of path traversal. In standard POA, when variants of different lengths are aligned, the shorter paths are effectively forced to collapse or take penalizing deletions. This creates a highly ambiguous traceback path where true deletions and matches become indistinguishable (as illustrated in Figure&nbsp;2(a)).</p>
<p>By explicitly mapping empty characters to a dedicated skip matrix (<img src="https://latex.codecogs.com/png.latex?S">) and introducing the zero-cost skip operation (<strong>S</strong>), we preserve the structural history of the variant. The skipa acts as a topological placeholder: it allows the alignment path to “skip” over pre-existing gap loci without triggering redundant gap-open or gap-extend penalties, while simultaneously generating a precise, unambiguous edit transcript (<code>MMSMMIMMMMXMD</code>).</p>
</section>
<section id="practical-trade-offs-and-complexity" class="level3">
<h3 class="anchored" data-anchor-id="practical-trade-offs-and-complexity">Practical Trade-offs and Complexity</h3>
<p>From a computational complexity standpoint, our algorithm operates in <img src="https://latex.codecogs.com/png.latex?O(W%20%5Ccdot%20m)"> time and space, where <img src="https://latex.codecogs.com/png.latex?W"> is the total width of the ED-String and <img src="https://latex.codecogs.com/png.latex?m"> is the query length. This matches the asymptotic bounds of standard pairwise alignment against an ED-String. However, the introduction of the fourth matrix (<img src="https://latex.codecogs.com/png.latex?S">) increases the constant factor of the state space.</p>
<p>In practice, this overhead is a necessary trade-off for obtaining a lossless edit transcript. In large-scale progressive MSA workflows—such as pan-genomic read mapping or deep phylogenetic reconstruction—the lack of an exact traceback transcript compounds error rates with each successive sequence added. Over multiple alignment generations, resolving this transcript ambiguity prevents the “drift” of gap boundaries, yielding significantly cleaner consensus graphs.</p>
</section>
<section id="simd-vectorization-potential" class="level3">
<h3 class="anchored" data-anchor-id="simd-vectorization-potential">SIMD Vectorization Potential</h3>
<p>Because our dynamic programming recurrences (Equations Equation&nbsp;4 to Equation&nbsp;8) maintain a regular grid-like structure similar to the classic Smith-Waterman-Gotoh formulation, they are highly amenable to parallelization.</p>
<p>Existing high-performance alignment libraries like <code>spoa</code> <span class="citation" data-cites="vaser_fast_2017">(R.Vaser et al. 2017)</span> and <code>abPOA</code> <span class="citation" data-cites="gao_abpoa_2020">(Y.Gao et al. 2020)</span> achieve extreme throughput by using Single Instruction, Multiple Data (SIMD) formulations (specifically, intra-sequence parallelization via SSE or AVX instructions). Our skip recurrences can be mapped to a SIMD layout by treating the skip matrix (<img src="https://latex.codecogs.com/png.latex?S">) updates as parallel vector shifts. Since the skip transition only depends on the state of the previous column (<img src="https://latex.codecogs.com/png.latex?i-1">) when <img src="https://latex.codecogs.com/png.latex?%5CUpsilon%5Bi%5D%20=%20%5Cvarepsilon">, the dependency graph remains highly local, allowing vector pipelines to remain fully saturated.</p>
</section>
</section>
<section id="sec-conclusions" class="level2">
<h2 class="anchored" data-anchor-id="sec-conclusions">Conclusion and Furture Directions</h2>
<p>In this work, we resolved a limitation of Partial Order Alignment (POA): the ambiguity of the edit transcript during progressive Multiple Sequence Alignment. By introducing the <strong>skip operation (<img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon">)</strong> with a zero-cost penalty, we successfully decoupled path traversal from distance calculations. This ensures that existing gaps are not penalized repeatedly while still preserving the exact, unambiguous edit transcript.</p>
<p>Ultimately, viewing an MSA as an Elastic Degenerate String (ED-string) allows for <strong>lossless POA</strong> with respect to the edit transcript, overcoming a long-standing compromise in progressive sequence alignment.</p>
<section id="future-directions" class="level3">
<h3 class="anchored" data-anchor-id="future-directions">Future Directions</h3>
<p>To build upon these foundational results, we identify two key avenues for future development:</p>
<ol type="1">
<li><p><strong>Software Integration and SIMD Acceleration:</strong> To make this method viable for high-throughput genomic pipelines, our next step is to implement and optimize the skip-enhanced DP recurrence using SIMD vectorization. This will allow direct integration into state-of-the-art POA libraries like <code>spoa</code> <span class="citation" data-cites="vaser_fast_2017">(R.Vaser et al. 2017)</span> and <code>abPOA</code> <span class="citation" data-cites="gao_abpoa_2020">(Y.Gao et al. 2020)</span>.</p></li>
<li><p><strong>Application to Large-Scale Progressive MSA:</strong> We plan to evaluate the practical impact of lossless traceback transcripts on downstream phylogenetic and variant calling workflows. Quantifying how the elimination of transcript ambiguity improves progressive MSA accuracy across highly polymorphic genomic regions remains a key goal.</p></li>
</ol>



</section>
</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-cislak_sopang_2020" class="csl-entry">
A.Cisłak, and S.Grabowski. 2020. <span>“<span>SOPanG</span>2: Online Searching over a Pan-Genome Without False Positives.”</span> <em>arXiv:2004.03033 [Cs]</em>.
</div>
<div id="ref-cislak_sopang_2018" class="csl-entry">
A.Cisłak, S.Grabowski, and J.Holub. 2018. <span>“<span>SOPanG</span>: Online Text Searching over a Pan-Genome.”</span> <em>Bioinformatics</em> 34: 4290–92.
</div>
<div id="ref-vargas" class="csl-entry">
A.Darby, C., R.Gaddipati, M. C.Schatz, and B.Langmead. 2020. <span>“Vargas: Heuristic-Free Alignment for Assessing Linear and Graph Read Aligners.”</span> <em>Bioinformatics</em> 36 (12): 3712–18.
</div>
<div id="ref-aoyama_faster_2018" class="csl-entry">
Aoyama, K., Y.Nakashima, T. I, S.Inenaga, H.Bannai, and M.Takeda. 2018. <span>“Faster <span>Online</span> <span>Elastic</span> <span>Degenerate</span> <span>String</span> <span>Matching</span>.”</span> <em>29th Annual <span>Symposium</span> on <span>Combinatorial</span> <span>Pattern</span> <span>Matching</span> (<span>CPM</span>)</em>, <span>LIPIcs</span>, vol. 105.
</div>
<div id="ref-lee_multiple_2002" class="csl-entry">
C.Lee, C.Grasso, and M. F.Sharlow. 2002. <span>“Multiple <span>Sequence</span> <span>Alignment</span> <span>Using</span> <span>Partial</span> <span>Order</span> <span>Graphs</span>.”</span> <em>Bioinformatics</em> 18 (3): 452–64.
</div>
<div id="ref-consortium_computational_2018" class="csl-entry">
Consortium, The Computational Pan-Genomics. 2018. <span>“Computational <span>Pan</span>-<span>Genomics</span>: <span>Status</span>, <span>Promises</span> and <span>Challenges</span>.”</span> <em>Briefings in Bioinformatics</em> 19 (1): 118–35.
</div>
<div id="ref-feng_progressive_1987" class="csl-entry">
D.-F.Feng, and R. F.Doolittle. 1987. <span>“Progressive Sequence Alignment as a Prerequisitet to Correct Phylogenetic Trees.”</span> <em>Journal of Molecular Evolution</em> 25 (4): 351–60.
</div>
<div id="ref-gusfield_algorithms_1997" class="csl-entry">
D.Gusfield. 1997. <em>Algorithms on <span>Strings</span>, <span>Trees</span>, and <span>Sequences</span>: <span>Computer</span> <span>Science</span> and <span>Computational</span> <span>Biology</span></em>. Cambridge University Press.
</div>
<div id="ref-smith_identification_1981" class="csl-entry">
F.Smith, T., and M. S.Waterman. 1981. <span>“Identification of <span>Common</span> <span>Molecular</span> <span>Subsequences</span>.”</span> <em>Journal of Molecular Biology</em> 147 (1): 195–97.
</div>
<div id="ref-spire17" class="csl-entry">
G.Bernardini, N.Pisanti, S. P.Pissis, and G.Rosone. 2017. <span>“Pattern Matching on Elastic-Degenerate Text with Errors.”</span> <em>24th Int. Symposium on <span>S</span>tring <span>P</span>rocessing and <span>I</span>nformation <span>R</span>etrieval (<span>SPIRE</span>)</em>, Springer LNCS, vol. 10508: 74–90.
</div>
<div id="ref-bernardini_approximate_2020" class="csl-entry">
G.Bernardini, N.Pisanti, S. P.Pissis, and G.Rosone. 2020. <span>“Approximate Pattern Matching on Elastic-Degenerate Text.”</span> <em>Theoretical Computer Science</em> 812: 109–22.
</div>
<div id="ref-bernardini_even_2019" class="csl-entry">
G.Bernardini, P.Gawrychowski, N.Pisanti, S. P.Pissis, and G.Rosone. 2019. <span>“Even <span>Faster</span> <span>Elastic</span>-<span>Degenerate</span> <span>String</span> <span>Matching</span> via <span>Fast</span> <span>Matrix</span> <span>Multiplication</span>.”</span> <em>46th <span>International</span> <span>Colloquium</span> on <span>Automata</span>, <span>Languages</span>, and <span>Programming</span> (<span>ICALP</span>)</em>, <span>LIPIcs</span>, vol. 132: 21:1–15.
</div>
<div id="ref-sicomp" class="csl-entry">
G.Bernardini, P.Gawrychowski, N.Pisanti, S. P.Pissis, and G.Rosone. 2022. <span>“<span>E</span>lastic-<span>D</span>egenerate <span>S</span>tring <span>M</span>atching via <span>F</span>ast <span>M</span>atrix <span>M</span>ultiplication.”</span> <em>SIAM Journal of Computing</em> 51 (3): 549–76.
</div>
<div id="ref-higgins_clustal_1988" class="csl-entry">
G.Higgins., D., and P. M.Sharp. 1988. <span>“<span>CLUSTAL</span>: A Package for Performing Multiple Sequence Alignment on a Microcomputer.”</span> <em>Gene</em> 73 (1): 237–44.
</div>
<div id="ref-minigraph" class="csl-entry">
H.Li, X.Feng, and C.Chu. 2020. <span>“The <span>Design</span> and <span>Construction</span> of <span>Reference</span> <span>Pangenome</span> <span>Graphs</span> with <span>Minigraph</span>.”</span> <em>Genome Biology</em> 21 (265).
</div>
<div id="ref-pnas05" class="csl-entry">
L.Loytynoja, A., and N.Goldman. 2005. <span>“An Algorithm for Progressive Multiple Alignment of Sequences with Insertions.”</span> <em>Proceedings of the National Academy of Science</em> 102 (30).
</div>
<div id="ref-alzamel_degenerate_2018" class="csl-entry">
M.Alzamel, L. A. K.Ayad, G.Bernardini, et al. 2018. <span>“Degenerate <span>S</span>tring <span>C</span>omparison and <span>A</span>pplications.”</span> <em>18th International Workshop on Algorithms in Bioinformatics (<span>WABI</span>)</em>, LIPIcs, vol. 113: 21:1–14.
</div>
<div id="ref-alzamel_comparing_2020" class="csl-entry">
M.Alzamel, L. A. K.Ayad, G.Bernardini, et al. 2020. <span>“Comparing <span>Degenerate</span> <span>Strings</span>.”</span> <em>Fundamenta Informaticae</em> 175 (1-4): 41–58.
</div>
<div id="ref-vg2021" class="csl-entry">
M.Eizenga, J., A. M.Novak, E.Kobayashi, et al. 2021. <span>“Efficient Dynamic Variation Graphs.”</span> <em>Bioinformatics</em> 36 (21): 5139–44.
</div>
<div id="ref-arxivpoawfa" class="csl-entry">
M.Mwaniki, N., E.Garrison, and N.Pisanti. 2022. <span>“Fast Exact String to d-Texts Alignments.”</span> <em>CoRR</em> abs/2206.03242.
</div>
<div id="ref-graphaligner" class="csl-entry">
M.Rautiainen, and T.Marschall. 2020. <span>“GraphAligner: Rapid and Versatile Sequence-to-Graph Alignment.”</span> <em>Genome Biology</em> 21 (253).
</div>
<div id="ref-gotoh_improved_1982" class="csl-entry">
O.Gotoh. 1982. <span>“An Improved Algorithm for Matching Biological Sequences.”</span> <em>Journal of Molecular Biology</em> 162 (3): 705–8.
</div>
<div id="ref-grossi_-line_2017" class="csl-entry">
R.Grossi, C. S.Iliopoulos, C.Liu, et al. 2017. <span>“On-<span>Line</span> <span>Pattern</span> <span>Matching</span> on <span>Similar</span> <span>Texts</span>.”</span> <em>28th <span>Annual</span> <span>Symposium</span> on <span>Combinatorial</span> <span>Pattern</span> <span>Matching</span> (<span>CPM</span>)</em>, <span>LIPIcs</span>, vol. 78: 9:1–14.
</div>
<div id="ref-vaser_fast_2017" class="csl-entry">
R.Vaser, I.Sović, N.Nagarajan, and M.Šikić. 2017. <span>“Fast and Accurate de Novo Genome Assembly from Long Uncorrected Reads.”</span> <em>Genome Research</em> 27 (5): 737–46.
</div>
<div id="ref-iliopoulosLATA2017" class="csl-entry">
S.Iliopoulos, C., R.Kundu, and S. P.Pissis. 2017. <span>“Efficient <span>Pattern</span> <span>Matching</span> in <span>Elastic</span>-<span>Degenerate</span> <span>Texts</span>.”</span> <em>11th International Conference on <span>L</span>anguage and <span>A</span>utomata <span>Theory</span> and <span>A</span>pplications (<span>LATA</span>)</em>, Springer LNCS, vol. 10168: 131–42.
</div>
<div id="ref-graphrep" class="csl-entry">
V.Carletti, P.Foggia, E.Garrison, L.Greco, P.Ritrovato, and M.Vento. 2019. <span>“Graph-Based Representations for Supporting Genome Data Analysis and Visualization: Opportunities and Challenges.”</span> <em>12th International Workshop on Graph-Based Representations in Pattern Recognition (<span>GbRPR</span>)</em>, Springer LNCS, vol. 11510: 237–46.
</div>
<div id="ref-gao_abpoa_2020" class="csl-entry">
Y.Gao, Y.Liu, Y.Ma, B.Liu, Y.Wang, and Y.Xing. 2020. <span>“<span class="nocase">abPOA</span>: <span>An</span> <span>SIMD</span>-<span>Based</span> <span>C</span> <span>Library</span> for <span>Fast</span> <span>Partial</span> <span>Order</span> <span>Alignment</span> <span>Using</span> <span>Adaptive</span> <span>Band</span>.”</span> <em>bioRxiv</em>.
</div>
</div></section></div> ]]></description>
  <category>partial order alignment</category>
  <category>sequence alignment</category>
  <category>alignment</category>
  <category>ED-strings</category>
  <category>strings</category>
  <category>skips</category>
  <guid>https://njagi.me/posts/skips/</guid>
  <pubDate>Fri, 09 Sep 2022 00:00:00 GMT</pubDate>
  <media:content url="https://njagi.me/posts/skips/header.png" medium="image" type="image/png" height="144" width="144"/>
</item>
</channel>
</rss>
