Longest Common Subsequence LCS Scoring - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Longest Common Subsequence LCS Scoring

Description:

Hydrophobicity Sliding Window Program Using Functions (1) #include iostream #include string ... program will compute the hydrophobicity of an sequence of ... – PowerPoint PPT presentation

Number of Views:135
Avg rating:3.0/5.0
Slides: 10
Provided by: lanct
Category:

less

Transcript and Presenter's Notes

Title: Longest Common Subsequence LCS Scoring


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

2
Hydrophobicity Sliding Window Program Using
Functions (1)
  • include ltiostreamgt
  • include ltstringgt
  • using namespace std
  • double hydro25 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 ltlt "This program will compute the
    hydrophobicity of an sequence of amino acids.\n
  • cout ltlt "Please enter the sequence "ltlt
    flush cin gtgt seq
  • cout ltlt "Please enter the window size "ltlt
    flush cin gtgt ws
  • compute_hydro(seq, ws)

3
Hydrophobicity Sliding Window Program Using
Functions (2)
  • void compute_hydro(string seq, int ws)
  • int i double sum 0
  • cout ltlt "\n\nThe hydrophocity values are" ltlt
    endl
  • for(i 0 i lt seq.size() i)
  • if((seq.data()i gt 'a') (seq.data()i
    lt 'z'))
  • seq.at(i) seq.data()i - 32
  • for(i 0 i lt ws i)
  • sum hydroseq.data()i - 'A'
  • for(i 1 i lt seq.size() - ws i)
  • cout ltlt "Hydrophocity value\t" ltlt sum/ws
    ltlt endl
  • sum sum - hydroseq.data()i-1 - 'A'
    hydroseq.data()iws-1 - 'A'
  • cout ltlt "Hydrophocity value\t" ltlt sum/ws ltlt
    endl

4
Reference
  • Computational Molecular Biology An Algorithmic
    Approach, Pavel Pevzner

5
Longest Common Subsequence (LCS) Problem
  • Can have insertion and deletions but no
    substitutions (no mismatches)
  • Ex V ATCTGAT
  • W TGCATA
  • LCS TCTA

6
LCS Problem (cont.)
  • Similarity score
  • si-1,j
  • si,j max si,j-1
  • si-1,j-1 1, if vi wj
  • On board example Pevzner Fig 6.1

7
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
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 gt si,j-1
  • si,j si-1,j bi,j UP
  • else
  • si,j si,j-1 bi,j LEFT

9
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
Write a Comment
User Comments (0)
About PowerShow.com