Monday, April 18, 2011

Mistakes were found in the second round of test

My first test ran without error is because there was an error in my script. Since k+1 was written as i+1, loop2 which was supposed to check the uniqueness of the primer did not run at all.

for k in range(0,len(genome)): #this loop1 is to suggest a primer for genome[k] and store in primer[].
    primer.append(substring(genome[k]))
    for j in range(k+1,len(genome)): # this loop2 is to check if the primer is unique to genome[j]
        if genome[j].find(primer[-1])!=-1:
            del primer[-1] #if primer[-1] is also present in other genomes, remove it!

But after I corrected it, another error came up.
Traceback (most recent call last):
  File "./primer.py", line 34, in <module>
    if genome[j].find(primer[-1])!=-1:
IndexError: list index out of range

Besides that, I found loop2 was wrong to check if the primer is unique. It always delete the last element of the list primer[] each time the primer was found in other genome. I will work on the problem.

No comments:

Post a Comment