comapring 2 sequences of DNA ouput the silent and non mutations

Maxime S maxischmeii at gmail.com
Sun Oct 30 05:01:30 EDT 2016


2016-10-29 21:38 GMT+02:00 <dishaacharya96 at gmail.com>:
>
> Code:
>
> [...]
>
> for i in range (len(protein) & len(seq1)) :
>
>         if protein[i] != mutantPRO[i] :
>            print (protein[i] + str(i) + mutantPRO[i])
>            A+= 1
>         else:
>                 if seq1[i:i+3] != mutant[i:i+3]:
>                          print(protein[i] + str(i) + mutantPRO[i] +'
Silent mutation ')
>                          print(seq1[i:i+3] + mutant[i:i+3])
>                          B+= 1

Hi,

The problem here is that you try to mix two different index in one
variable. Instead, you need to do something like this:

#i index protein
#j index DNA
for i in range (len(protein)) :
    j = i*3
    if protein[i] != mutantPRO[i] :
       print (protein[i] + str(i) + mutantPRO[i])
       A+= 1
    else:
        if seq1[j:j+3] != mutant[j:j+3]:
             print(protein[i] + str(i) + mutantPRO[i] +' Silent mutation ')
             print(seq1[j:j+3] + mutant[j:j+3])
             B+=1



More information about the Python-list mailing list