text: user96: Hidden Markov models (HMMs) are used extensively in bioinformatics, and have been adapted for gene prediction, protein family classification, and a variety of other problems. Indeed, the treatise by Durbin, Eddy and colleagues is one of the defining volumes in this field.
  Although the details of each of these different applications of HMMs differ, the core mathematical model remains unchanged, and there are efficient algorithms for computing the probability of the observed sequence given the model, or (perhaps more useful) the most likely hidden sequence given the sequence of observed states.
  Accordingly, it seems plausible that there could be a generic software library for solving HMMs. As far as I can tell that's not the case, and most bioinformaticians end up writing HMMs from scratch. Perhaps there's a good reason for this? (Aside from the obvious fact that it's already difficult, nigh impossible, to get funding to build and provide long-term support for open source science software. Academic pressures incentivize building a new tool that you can publish a paper on much more than building on and extending existing tools.)
  Do any generic HMM solver libraries exist? If so, would this be tempting enough for bioinformaticians to use rather than writing their own from scratch?
  
  user1769: If I remember correctly Ewan Birney's Dynamite (a compiler-compiler) as presented at ISMB 1997 had this functionality, there is also some code here on GitHub https://github.com/birney/wise3 which at least mentions Dynamite.  Suspect Ewan is too busy these days to work on this, although he has tweeted about blowing dust of his old Dynamite, sorry Dynamite code: https://twitter.com/ewanbirney/status/788121636973142016
  
  user29: There are certainly software libraries for working with HMMs. For a general-purpose implementation in C++, take a look at the SeqAn HMM algorithms.
  For your purposes, i.e. “computing … the most likely hidden sequence given the sequence of observed states”, you’d invoke viterbiAlgorithm with your observed sequence and the HMM graph.
  More fundamentally I think that most existing, mature implementations are probably found in the domain of signal processing, which has been using them longer than biology, and where most of the underlying theory was developed.
  
  user81: I would also recommend to take a look at pomegranate, a nice Python package for probabilistic graphical models. It includes solvers for HMMs and much more. Under the hood it uses Cythonised code, so it's also quite fast.
  
original_text: 96: <p>Hidden Markov models (HMMs) are used extensively in bioinformatics, and have been adapted for gene prediction, protein family classification, and a variety of other problems. Indeed, <a href="http://www.cambridge.org/gb/academic/subjects/life-sciences/genomics-bioinformatics-and-systems-biology/biological-sequence-analysis-probabilistic-models-proteins-and-nucleic-acids" rel="noreferrer">the treatise by Durbin, Eddy and colleagues</a> is one of the defining volumes in this field.</p>
  
  <p>Although the details of each of these different applications of HMMs differ, the core mathematical model remains unchanged, and there are efficient algorithms for computing the probability of the observed sequence given the model, or (perhaps more useful) the most likely hidden sequence given the sequence of observed states.</p>
  
  <p>Accordingly, it seems plausible that there could be a generic software library for solving HMMs. As far as I can tell that's not the case, and most bioinformaticians end up writing HMMs from scratch. Perhaps there's a good reason for this? (Aside from the obvious fact that it's already difficult, nigh impossible, to get funding to build and provide long-term support for open source science software. Academic pressures incentivize building a new tool that you can publish a paper on much more than building on and extending existing tools.)</p>
  
  <p>Do any generic HMM solver libraries exist? If so, would this be tempting enough for bioinformaticians to use rather than writing their own from scratch?</p>
   1769: <p>If I remember correctly Ewan Birney's Dynamite (a <a href="https://en.wikipedia.org/wiki/Compiler-compiler" rel="nofollow noreferrer">compiler-compiler</a>) as presented at <a href="https://pdfs.semanticscholar.org/2345/f68bb0b2f079f9f201034da462d69a7817b1.pdf" rel="nofollow noreferrer">ISMB 1997</a> had this functionality, there is also some code here on GitHub <a href="https://github.com/birney/wise3" rel="nofollow noreferrer">https://github.com/birney/wise3</a> which at least mentions Dynamite.  Suspect Ewan is too busy these days to work on this, although he has tweeted about blowing dust of his old Dynamite, sorry Dynamite code: <a href="https://twitter.com/ewanbirney/status/788121636973142016" rel="nofollow noreferrer">https://twitter.com/ewanbirney/status/788121636973142016</a></p>
   29: <p>There are certainly software libraries for working with HMMs. For a general-purpose implementation in C++, take a look at the <a href="http://docs.seqan.de/seqan/2.1.1/group_HmmAlgorithms.html" rel="noreferrer">SeqAn HMM algorithms</a>.</p>
  
  <p>For your purposes, i.e. “computing … the most likely hidden sequence given the sequence of observed states”, you’d invoke <code>viterbiAlgorithm</code> with your observed sequence and the HMM graph.</p>
  
  <p>More fundamentally I think that most existing, mature implementations are probably found in the domain of signal processing, which has been using them longer than biology, and where most of the underlying theory was developed.</p>
   81: <p>I would also recommend to take a look at <a href="https://pomegranate.readthedocs.io/en/latest/" rel="noreferrer">pomegranate</a>, a nice Python package for probabilistic graphical models. It includes solvers for HMMs and much more. Under the hood it uses Cythonised code, so it's also quite fast.</p>
  