= 'a') && (seq.data()[i] <= 'z')) seq.at(i) = seq.data()[i] - 32; for(i = 0; i < ws; i++) { sum += hydro[seq.data()[i] - 'A']; } for(i = 1; i <= seq.size() - ws; i++) { cout << "Hydrophocity value:\t" << sum/ws << endl; sum = sum - hydro[seq.data()[i-1] - 'A'] + hydro[seq.data()[i+ws-1] - 'A']; } cout << "Hydrophocity value:\t" << sum/ws << endl; }"> = 'a') && (seq.data()[i] <= 'z')) seq.at(i) = seq.data()[i] - 32; for(i = 0; i < ws; i++) { sum += hydro[seq.data()[i] - 'A']; } for(i = 1; i <= seq.size() - ws; i++) { cout << "Hydrophocity value:\t" << sum/ws << endl; sum = sum - hydro[seq.data()[i-1] - 'A'] + hydro[seq.data()[i+ws-1] - 'A']; } cout << "Hydrophocity value:\t" << sum/ws << endl; }">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

Longest Common Subsequence (LCS) - Scoring Dr. Nancy Warter-Perez June 25, 2003.

Similar presentations


Presentation on theme: "Longest Common Subsequence (LCS) - Scoring Dr. Nancy Warter-Perez June 25, 2003."— Presentation transcript:

1 Longest Common Subsequence (LCS) - Scoring Dr. Nancy Warter-Perez June 25, 2003

2 LCS Scoring2 Hydrophobicity Sliding Window Program Using Functions (1) #include using namespace std; double hydro[25] = {1.8,0,2.5,-3.5,-3.5,2.8,-0.4,-3.2,4.5,0,-3.9,3.8,1.9,-3.5,0, -1.6,-3.5,-4.5,-0.8,-0.7,0,4.2,-0.9,0,-1.3}; void compute_hydro(string seq, int ws); void main () { string seq;int ws; cout << "This program will compute the hydrophobicity of an sequence of amino acids.\n”; cout > seq; cout > ws; compute_hydro(seq, ws); }

3 June 25, 2003LCS Scoring3 Hydrophobicity Sliding Window Program Using Functions (2) void compute_hydro(string seq, int ws) { int i; double sum = 0; cout << "\n\nThe hydrophocity values are:" << endl; for(i = 0; i <= seq.size(); i++) if((seq.data()[i] >= 'a') && (seq.data()[i] <= 'z')) seq.at(i) = seq.data()[i] - 32; for(i = 0; i < ws; i++) { sum += hydro[seq.data()[i] - 'A']; } for(i = 1; i <= seq.size() - ws; i++) { cout << "Hydrophocity value:\t" << sum/ws << endl; sum = sum - hydro[seq.data()[i-1] - 'A'] + hydro[seq.data()[i+ws-1] - 'A']; } cout << "Hydrophocity value:\t" << sum/ws << endl; }

4 June 25, 2003LCS Scoring4 Reference Computational Molecular Biology – An Algorithmic Approach, Pavel Pevzner

5 June 25, 2003LCS Scoring5 Longest Common Subsequence (LCS) Problem Can have insertion and deletions but no substitutions (no mismatches) Ex: V: ATCTGAT W:TGCATA LCS:TCTA

6 June 25, 2003LCS Scoring6 LCS Problem (cont.) Similarity score s i-1,j s i,j = max { s i,j-1 s i-1,j-1 + 1, if vi = wj On board example: Pevzner Fig 6.1

7 June 25, 2003LCS Scoring7 Indels – insertions and deletions (e.g., gaps) alignment of V and W V = rows of similarity matrix (vertical axis) W = columns of similarity matrix (horizontal axis) Space (gap) in W  (UP) insertion Space (gap) in V  (LEFT) deletion Match (no mismatch in LCS) (DIAG)

8 June 25, 2003LCS Scoring8 LCS(V,W) Algorithm for i = 1 to n si,0 = 0 for j = 1 to n s0,j = 0 for i = 1 to n for j = 1 to m if vi = wj si,j = si-1,j-1 + 1; bi,j = DIAG else if si-1,j >= si,j-1 si,j = si-1,j; bi,j = UP else si,j = si,j-1; bi,j = LEFT

9 June 25, 2003LCS Scoring9 Programming Workshop 5 Implement the LCS scoring algorithm as a function Inputs: 2 strings to score Outputs: Scoring matrix and traceback matrix (these can be global variables) Write a main functions to prompt the user for 2 sequences call the scoring function print the 2 matrices


Download ppt "Longest Common Subsequence (LCS) - Scoring Dr. Nancy Warter-Perez June 25, 2003."

Similar presentations


Ads by Google