ok...here's the function I've written so far.
def padWithGaps(seq):
for letter in seq:
letter="-"
line=len(seq)
dashline=line*letter
return dashline
def replace(someString,position,letter):
first=someString[0:position]
second=letter
third=someString[position+1:len(someString)]
newString=first+second+third
return newString
##findScore("MPFVS","MS-V-") would return a score of 2
def findScore(first,second):
count=0
for position in range(0,len(first)):
if first[position]==second[position]:
count=count+1
position=position+1
return count
#shorter is a 3 amino acid sequence
##longer is any length sequence greater than 3
###i=first amino acid; j=second amino acid; k=third amino acid
def findAlignment(shorter,longer):
for i in range(0,len(longer)-2):
for j in range(1,len(longer)-1):
for k in range(2,len(longer)):
dashline=padWithGaps(longer)
nextLine=replace(dashline,i,shorter[0])
nextNext=replace(nextLine,j,shorter[1])
alignment=replace(nextNext,k,shorter[2])
score=findScore(longer,alignment)
don't know what to do here
print longer
print alignment
print "Score = " + str(score)
I don't know what to do at the end of my loop but what I'm trying to do in
pseudocode is:
"if that alignment has the best score seen so far
save the score and the alignment
print the best score and the best alignment"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor