Mencocokkan pola dalam python
pattern = "F-x-([EK])-x-S-([GT])-R-T"
pattern=pattern.replace("-","")
pattern=pattern.replace("x","[GPAVLIMCFYWHKRQNEDST]")
count=0
for sequence in source:
count += 1
sequence=sequence.replace(" ","")
result = re.finditer(pattern, sequence)
print(">sequence ",count)
print(sequence)
for match in result:
print("found ",match.group()," at position",match.span()," third position =", match.group(2))
Aggressive Addax