how can I calculate the number of gaps in sequences:
for example:
s1='G _ A A T T C A G T T A'
s2='G G _ A _ T C _ G _ _ A'
s3='G A A T T C A G T _ T _'
her the number of '_'
is 8
I try the following:
def count():
gap=0
for i in range(0, len(s1), 3):
for x,y,z in zip(s1,s2,s3):
if (x=='_') or (y=='_')or (z=='_') :
gap=gap+1
return gap
it gives 6 not 8
Strings have a count() method:
s1.count('_') + s2.count('_') + s3.count('_')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With