text: user10240: I'm assuming we don't do pattern matching in DNA or RNA for the fun of it. So I'd like to know what are the applications of pattern matching or where does it fit in in larger applications?
  I'm a computer scientist and when studying certain topics in CS we see a lot of references to applying algorithms to areas of biology or genetics one of which is applying text pattern matching algorithms to DNA to find sub sequences. Whenever I see those kinds of examples I think "Oh that's pretty cool" but then I don't see how it's applied in the real world for benefit and I can't find anything to suggest where these algorithms are applied in these fields.
  
  user208: The applications can be categorized based on whether you study the sequence for analysis, or for DNA synthesis and assembly.
  In addition to TF patterns mentioned in this answer, other patterns for DNA binding proteins, enchancers, promoters, and the Kozak sequence (GCCGCC[A|G]CCATGG..) may also be useful for discovery of ORFs (genes) / regulation.
  Certain methylase enzymes recognize a DNA pattern. For example EcoKI methylates adenine in AACNNNNNNGTGC (2nd A) and its reverse complement, GCACNNNNNNGTT (3rd A). Another such enzyme is EcoBI. This is useful for finding methylation sites, which may interfere with DNA restriction or expression.
  Some restriction enzymes also recognize a DNA pattern: HinFI recognizes
  5'GANTC
  3'CTNAG
  
  Other such enzymes are EcoP15I, EcoRII. Finding these sites are very important for designing a DNA cloning or manipulation experiment.
  For DNA synthesis, it is useful to avoid homopolymers (N+) and repeated k-mers and hairpins (a sequence segment which has a reverse complement "nearby") as these can cause problems during synthesis.
  Direct, tandem or inverted repeats can cause problems during cloning.
  Finally, a perhaps trivial example is matching a polypeptide sequence, using DNA, as the genetic code is redundant. An example would be searching for target peptides in a protein.
  
  user7153: To extend on the existing answers I would say that pattern matching algorithms are at the core of bioinformatics, certainly any NGS realted bioinformatics. The Smith-Waterman algorithm and its variants are probably the most used https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm .
  Reference genome assembly (the human genome project for example) is based on kmer based sequence matching. Variant calling is based on mapping sequence to this reference, so thats pretty much all clinical bioinformatics. And a million other tools - one random example is dectecting horizontal gene transfer of antibiotic resistence genes.
  
  user776: One useful application of pattern matching is for DNA sequence motifs. As an example of a direct application, there is a class of proteins called transcription factors (TFs), which bind to DNA and regulate the expression of genes. There are many TFs. Each TF likes to bind to its particular conserved sequence of DNA, with some wiggle room for some parts of the sequence.
  Algorithms for finding and scoring these patterns (and mismatches in patterns) is important for identifying regions where regulation occurs, which proteins are involved, and for answering biological questions related to gene regulation and basic biological functionality — and malfunction, in case of disease.
  
  user1813: These algorithms are used quite a lot, and I will touch only a few aspects:
  
  Genetic sequence alignment. Different (but still closely related) organisms have very similar genetic sequences, which differ only at some positions due to point mutations, which can be nucleotide substitutions (another letter in a sequence) or insertion/deletion of a few nucleotides. Many biological questions such as studying new coronavirus strains, predicting genetic diseases, and identifying cancerous cells are based on such sequence comparisons. This requires aligning many sequences, using the appropriate algorithms. This may be not hard for two sequences, but for hundreds or thousands of them it may require serious computational effort.
  Sequencing reads mapping Much of the current progress in genetics is due to the advent of the next generation sequencing, also called massively parallel sequencing, as opposed to Sanger sequencing used in the first human genome project (see here, for example). The basis of this technology is splitting the genetic sequence (a few billion nucleotides in a human) into small fragments of a few hundred nucleotides long and sequencing them simultaneously. One then faces the problem of putting them back together, which can be achieved either via matching them to a known sequence for a similar organism (sequence mapping) or by putting the reads together on the basis of their similarity (sequence assembly). There exist multiple sophisticated bioinformatic tools for achieving this (BWA, bowtie2, TopHat, Megahit to name just a few, so that you can google them).
  Blasting Another application, closely related to my first point, is quickly identifying the sequence as belonging to a certain gene of a certain organism by comparing it to a large database. BLAST is one of the well-known collections of tools for doing this.
  Just to mention (only a bit) more exotic applications: the algorithms associated with parsing context free grammars are used for RNA structure prediction.
  
  Durbin's book is a good casual reading (for somebody with a computer science background) to get an overview without knowing too much biology.
  
original_text: 10240: <p>I'm assuming we don't do pattern matching in DNA or RNA for the fun of it. So I'd like to know what are the applications of pattern matching or where does it fit in in larger applications?</p>
  <p>I'm a computer scientist and when studying certain topics in CS we see a lot of references to applying algorithms to areas of biology or genetics one of which is applying text pattern matching algorithms to DNA to find sub sequences. Whenever I see those kinds of examples I think &quot;Oh that's pretty cool&quot; but then I don't see how it's applied in the real world for benefit and I can't find anything to suggest where these algorithms are applied in these fields.</p>
   208: <p>The applications can be categorized based on whether you study the sequence for analysis, or for DNA synthesis and assembly.</p>
  <p>In addition to TF patterns mentioned in <a href="https://bioinformatics.stackexchange.com/a/15156/208">this answer</a>, other patterns for <a href="https://en.wikipedia.org/wiki/DNA-binding_protein#Binding_to_specific_DNA_sequences" rel="nofollow noreferrer">DNA binding proteins</a>, enchancers, promoters, and the <a href="https://www.promega.co.uk/resources/pubhub/enotes/what-is-a-kozak-consensus-sequence/" rel="nofollow noreferrer">Kozak sequence</a> (<code>GCCGCC[A|G]CCATGG..</code>) may also be useful for discovery of ORFs (genes) / regulation.</p>
  <p>Certain methylase enzymes recognize a DNA pattern. For example EcoKI methylates adenine in <code>AACNNNNNNGTGC</code> (2nd A) and its reverse complement, <code>GCACNNNNNNGTT</code> (3rd A). Another such enzyme is EcoBI. This is useful for finding methylation sites, which may interfere with DNA restriction or expression.</p>
  <p>Some <a href="https://en.wikipedia.org/wiki/Restriction_enzyme#Examples" rel="nofollow noreferrer">restriction enzymes</a> also recognize a DNA pattern: HinFI recognizes</p>
  <pre><code>5'GANTC
  3'CTNAG
  </code></pre>
  <p>Other such enzymes are EcoP15I, EcoRII. Finding these sites are very important for designing a DNA cloning or manipulation experiment.</p>
  <p>For DNA synthesis, it is useful to avoid homopolymers (<code>N+</code>) and repeated k-mers and hairpins (a sequence segment which has a reverse complement &quot;nearby&quot;) as these can cause problems during synthesis.</p>
  <p><a href="https://en.wikipedia.org/wiki/Direct_repeat" rel="nofollow noreferrer">Direct</a>, <a href="https://en.wikipedia.org/wiki/Tandem_repeat" rel="nofollow noreferrer">tandem</a> or <a href="https://en.wikipedia.org/wiki/Inverted_repeat" rel="nofollow noreferrer">inverted</a> repeats can cause problems during cloning.</p>
  <p>Finally, a perhaps trivial example is matching a polypeptide sequence, using DNA, as the <a href="https://en.wikipedia.org/wiki/DNA_and_RNA_codon_tables" rel="nofollow noreferrer">genetic code is redundant</a>. An example would be searching for <a href="https://en.wikipedia.org/wiki/Target_peptide#Examples_of_target_peptides" rel="nofollow noreferrer">target peptides in a protein</a>.</p>
   7153: <p>To extend on the existing answers I would say that pattern matching algorithms are at the core of bioinformatics, certainly any NGS realted bioinformatics. The Smith-Waterman algorithm and its variants are probably the most used <a href="https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm</a> .</p>
  <p>Reference genome assembly (the human genome project for example) is based on kmer based sequence matching. Variant calling is based on mapping sequence to this reference, so thats pretty much all clinical bioinformatics. And a million other tools - one random example is dectecting horizontal gene transfer of antibiotic resistence genes.</p>
   776: <p>One useful application of pattern matching is for <a href="https://www.nature.com/articles/nbt0406-423" rel="nofollow noreferrer">DNA sequence motifs</a>. As an example of a direct application, there is a class of proteins called <a href="https://en.wikipedia.org/wiki/Transcription_factor" rel="nofollow noreferrer">transcription factors</a> (TFs), which bind to DNA and regulate the expression of genes. There are many TFs. Each TF likes to bind to its particular conserved sequence of DNA, with some wiggle room for some parts of the sequence.</p>
  <p>Algorithms for finding and scoring these patterns (and mismatches in patterns) is important for identifying regions where regulation occurs, which proteins are involved, and for answering biological questions related to gene regulation and basic biological functionality — and malfunction, in case of disease.</p>
   1813: <p>These algorithms are used quite a lot, and I will touch only a few aspects:</p>
  <ul>
  <li><strong>Genetic sequence alignment.</strong> Different (but still closely related) organisms have very similar genetic sequences, which differ only at some positions due to <em>point mutations</em>, which can be nucleotide substitutions (another letter in a sequence) or insertion/deletion of a few nucleotides. Many biological questions such as studying new coronavirus strains, predicting genetic diseases, and identifying cancerous cells are based on such sequence comparisons. This requires aligning many sequences, using the appropriate algorithms. This may be not hard for two sequences, but for hundreds or thousands of them it may require serious computational effort.</li>
  <li><strong>Sequencing reads mapping</strong> Much of the current progress in genetics is due to the advent of the <em>next generation sequencing</em>, also called <em>massively parallel sequencing</em>, as opposed to Sanger sequencing used in the first human genome project (<a href="https://discovernanotech.com/complete-genome-in-a-few-hours-the-application-of-nanotechnology-in-dna-sequencing/" rel="nofollow noreferrer">see here</a>, for example). The basis of this technology is splitting the genetic sequence (a few billion nucleotides in a human) into small fragments of a few hundred nucleotides long and sequencing them simultaneously. One then faces the problem of putting them back together, which can be achieved either via matching them to a known sequence for a similar organism (<em>sequence mapping</em>) or by putting the reads together on the basis of their similarity (<em>sequence assembly</em>). There exist multiple sophisticated bioinformatic tools for achieving this (BWA, bowtie2, TopHat, Megahit to name just a few, so that you can google them).</li>
  <li><strong>Blasting</strong> Another application, closely related to my first point, is quickly identifying the sequence as belonging to a certain gene of a certain organism by comparing it to a large database. BLAST is one of the well-known collections of tools for doing this.</li>
  <li>Just to mention (only a bit) more exotic applications: the algorithms associated with parsing context free grammars are used for <strong>RNA structure prediction</strong>.</li>
  </ul>
  <p><a href="https://www.amazon.fr/Biological-Sequence-Analysis-Probabilistic-Proteins/dp/0521629713" rel="nofollow noreferrer">Durbin's book</a> is a good casual reading (for somebody with a computer science background) to get an overview without knowing too much biology.</p>
  