Probabilistic Model and Algorithms Design for Motif Detection