Algorithms for path-constrained sequence alignment

Tamar Pinhas, Nimrod Milo, Gregory Kucherov, Michal Ziv-Ukelson

Research output: Contribution to journalArticlepeer-review

1 Scopus citations


We define a novel variation on the constrained sequence alignment problem in which the constraint is given in the form of a regular expression. Given two sequences, an alphabet Γ describing pairwise sequence alignment operations, and a regular expression R over Γ, the problem is to compute the highest scoring sequence alignment A of the given sequences, such that A∈ Γ(R)Γa*. Two algorithms are given for solving this problem. The first basic algorithm is general and solves the problem in O(nmrlog2r) time and O(min{n,m}r) space, where m and n are the lengths of the two sequences and r is the size of the NFA for R. The second algorithm is restricted to rigid patterns and exploits this restriction to reduce the NFA size factor r in the time complexity to a smaller factor corresponding to the length of the rigid pattern. A rigid pattern P is a regular expression of the form P=P1⋯Pk, where P i does not contain the Kleene-closure star or union. |P| is compacted by supporting alignment patterns P that do not contain the Kleene-closure star, and exploits this constraint to reduce the NFA size factor r in the time complexity to a smaller factor |P|. |P| is compacted by supporting alignment patterns extended by meta-characters including general insertion, deletion and match operations, as well as some cases of substitutions. meta-characters used in P. {m,i}* or P ∈(Γ U {m,d})*, the problem can be solved in time O(nm), while for a pattern P ∈(Γ U {m,i,d})*, the problem can be solved in time O(nmlog|P|). For a pattern P ∈(Γ {m,s,i,d})*, the problem can be solved in time O(nmlog|P|) in some cases: one case is for scoring functions Score for which there exists Score:Σ→R such that Score(ν,σ)=Score′(ν) +Score′(σ) for every ν≠σ, and the other is when occs(P)=O(log(max{n,m})). For a rigid pattern P=P 1⋯Pk, these time bounds range from O(knm) to O(knmlog(max{|Pi|})), depending on the meta-characters used in P. An additional result obtained along the way is an extension of the algorithm of Fischer and Paterson for String Matching with Wildcards. Our extension allows the input strings to include "negation symbols" (that match all letters but a specific one) while retaining the original time complexity. We implemented both algorithms and applied them to data-mine new miRNA seeding patterns in C. elegans Clip-seq experimental data.

Original languageEnglish
Pages (from-to)48-58
Number of pages11
JournalJournal of Discrete Algorithms
StatePublished - 1 Jan 2014


  • Dynamic programming
  • Regular expressions
  • Sequence alignment
  • miRNA

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Discrete Mathematics and Combinatorics
  • Computational Theory and Mathematics


Dive into the research topics of 'Algorithms for path-constrained sequence alignment'. Together they form a unique fingerprint.

Cite this