import regex,re
sequence = 'aaaaaaaaaaaabbbbbbbbbbbbcccccccccccc'
query = 'aaabbbbbbbbbbbbccc'
query_1 = 'aaaabbbbbbbbcbbbcccc'
query_2 = 'aaabbbbcbbbbbcbccc'
threshold = .95
error = len(query_1) - (len(query_1)*threshold)
print regex.search(query_1 + '{e<={}}'.format(error),sequence).group(0)
I am trying to add additional parameters to the search for regular expressions, so it only works if a certain percentage of the query is in the search.
For example, if I wanted it to occupy at least 95%, it would work for query_1, but it would not work forquery_2
O.rka source
share