Sequence Alignment
Mark Voorhies 5/29/2013
Mark Voorhies Sequence Alignment
Sequence Alignment Mark Voorhies 5/29/2013 Mark Voorhies Sequence - - PowerPoint PPT Presentation
Sequence Alignment Mark Voorhies 5/29/2013 Mark Voorhies Sequence Alignment Exercise: Scoring an ungapped alignment Given two sequences and a scoring matrix, find the offset that yields the best scoring ungapped alignment. Mark Voorhies
Mark Voorhies Sequence Alignment
Mark Voorhies Sequence Alignment
def s c o r e (S , x , y ) : " " " Ret urn al i gnment scor e f or subsequences x and y f or scor i n g m at r i x S ( r ep r esen t ed as a d i c t ) " " " a s s e r t ( l e n ( x ) == l e n ( y )) r et u r n sum(S [ i ] [ j ] f o r ( i , j ) i n z i p ( x , y ) ) def subseqs ( x , y , i ) : " " " Ret urn subsequences
x and y f or
i . " " " i f ( i > 0 ) : y = y [ i : ] e l i f ( i < 0 ) : x = x[− i : ] L = min ( l e n ( x ) , l e n ( y ) ) r et u r n x [ : L ] , y [ : L ] def ungapped (S , x , y ) : " " " Ret urn best
scor e , and al i gnment bet ween sequences x and y f or m at r i x S. " " " best = None b e s t s c o r e = None f o r i i n range(−l e n ( x )+1 , l e n ( y ) ) : ( sx , sy ) = subseqs ( x , y , i ) s = s c o r e (S , sx , sy ) i f ( s > b e s t s c o r e ) : b e s t s c o r e = s best = i r et u r n best , b e s t s c o r e , subseqs ( x , y , best ) Mark Voorhies Sequence Alignment
1
1
2
Mark Voorhies Sequence Alignment