Hidden Markov Model for tagging genes