The megaprior heuristic for discovering protein sequence patterns