added user parameter num_ambig, the number of ambiguous characters that may be tolerated in a sequence