I have two examples of a pair of strings
YHFLSPYVY
LSPYVYSPR
+++******ooo
YHFLSPYVS
VEYHFLSPY
oo*******++
As stated above, I would like to find the overlapping region ( *) and the disjoint region in the answer ( +) and the prediction ( o).
How can I do this in Python?
I'm stuck with this
import re
ans = "YHFLSPYVY"
pred= "LSPYVYSPR"
matches = re.finditer(r'(?=(%s))' % re.escape(pred), ans)
print [m.start(1) for m in matches]
The answer I hope to get, for example, is 1:
plus_len = 3
star_len = 6
ooo_len = 3
source
share