I want to read a sequence Amino Acid Sequence ("ACDEFGHIKL") in a pair of predefined motif length lets say 3 and print it. output will be [ACD,EFG,HIK]. but next time I want to increase its base by 1 so next output should be [CDE,FGH,IKL].
I wrote the following python code which works absolutely fine. I just want to explore if there is any other option to write it to make it simple.
motif_len=int(motif_len)
if len(AA_seq)>=motif_len:
for i in range(len(AA_seq)-motif_len+1):
a=i
b=i+motif_len
# print(a,b)
print(AA_seq[a:b])
Any comment or suggestion will be appreciated. I was wondering if Python has any prebuild library for this kind of function. Thanks