FactorialHMM: Fast and exact inference in factorial hidden Markov models

Motivation Hidden Markov models (HMMs) are powerful tools for modeling processes along the genome. In a standard genomic HMM, observations are drawn, at each genomic position, from a distribution whose parameters depend on a hidden state; the hidden states evolve along the genome as a Markov chain. Often, the hidden state is the Cartesian product of multiple processes, each evolving independently along the genome. Inference in these so-called Factorial HMMs has a naïve running time that scales as the square of the number of possible states, which by itself increases exponentially with the number of subchains; such a running time scaling is impractical for many applications. While faster algorithms exist, there is no available implementation suitable for developing bioinformatics applications. Results We developed FactorialHMM, a Python package for fast exact inference in Factorial HMMs. Our package allows simulating either directly from the model or from the posterior distribution of states given the observations. Additionally, we allow the inference of all key quantities related to HMMs: (1) the (Viterbi) sequence of states with the highest posterior probability; (2) the likelihood of the data; and (3) the posterior probability (given all observations) of the marginal and pairwise state probabilities. The running time and space requirement of all procedures is linearithmic in the number of possible states. Our package is highly modular, providing the user with maximal flexibility for developing downstream applications. Availability https://github.com/regevs/factorialhmm

[1]  Sean R. Eddy,et al.  Biological Sequence Analysis: Probabilistic Models of Proteins and Nucleic Acids , 1998 .

[2]  V. Mootha,et al.  Expansion of Biological Pathways Based on Evolutionary Inference , 2014, Cell.

[3]  E. Lander,et al.  Construction of multilocus genetic linkage maps in humans. , 1987, Proceedings of the National Academy of Sciences of the United States of America.

[4]  Matthew J. Johnson,et al.  Bayesian nonparametric hidden semi-Markov models , 2012, J. Mach. Learn. Res..

[5]  Serafim Batzoglou,et al.  Reconstruction of genealogical relationships with applications to Phase III of HapMap , 2011, Bioinform..

[6]  Pedro C. Avila,et al.  Fast and accurate inference of local ancestry in Latino populations , 2012, Bioinform..

[7]  Tom R. Gaunt,et al.  Predicting the Functional, Molecular, and Phenotypic Consequences of Amino Acid Substitutions using Hidden Markov Models , 2012, Human mutation.

[8]  F. Agakov,et al.  Extending Admixture Mapping to Nuclear Pedigrees: Application to Sarcoidosis , 2013, Genetic epidemiology.

[9]  Serafim Batzoglou,et al.  Ancestry Inference in Complex Admixtures via Variable-Length Markov Chain Linkage Models , 2012, RECOMB.

[10]  Michael I. Jordan,et al.  Factorial Hidden Markov Models , 1995, Machine Learning.

[11]  Yufeng Wu,et al.  Inferring the ancestry of parents and grandparents from genetic data , 2018, bioRxiv.

[12]  Manolis Kellis,et al.  ChromHMM: automating chromatin-state discovery and characterization , 2012, Nature Methods.

[13]  Dirk Husmeier,et al.  Discriminating between rate heterogeneity and interspecific recombination in DNA sequence alignments with phylogenetic factorial hidden Markov models , 2005, ECCB/JBI.

[14]  Christopher Meek,et al.  Estimating genome-wide IBD sharing from SNP data via an efficient hidden Markov model of LD with application to gene mapping , 2010, Bioinform..