 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT Answers &#187; Bioinformatics</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/tag/bioinformatics/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers</link>
	<description></description>
	<lastBuildDate>Mon, 20 May 2013 00:58:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Needleman-Wunsch Algorithm</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/needleman-wunsch-algorithm/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/needleman-wunsch-algorithm/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 08:38:38 +0000</pubDate>
		<dc:creator>Ubuntuuser</dc:creator>
				<category><![CDATA[Bioinformatics]]></category>
		<category><![CDATA[Needleman-Wunsch Algorithm]]></category>
		<category><![CDATA[sequence alignment]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I am trying to implement Needleman-Wunsch algorithm in VB. unfortunately I get lot of runtime errors. could someone help me to solve this. The code is given below. Public Class SequenceAlignment     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As  _                               System.EventArgs) Handles Button1.Click         &#8216;declare Score variables         Dim MatchScore As Integer [...]]]></description>
				<content:encoded><![CDATA[<p>I am trying to implement Needleman-Wunsch algorithm in VB. unfortunately I get lot of runtime errors. could someone help me to solve this. The code is given below.</p>
<p>Public Class SequenceAlignment</p>
<p>    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As  _<br />
                              System.EventArgs) Handles Button1.Click<br />
        &#8216;declare Score variables<br />
        Dim MatchScore As Integer = 5<br />
        Dim MisMatchScore As Integer = 0.5<br />
        Dim GapScore As Integer = -2</p>
<p>        &#8216;+======================================================================================+<br />
        &#8216;initialization; set initial Score and get initial Pointer ‘left’ or ‘up’<br />
        &#8216;on top columns and Rows on the left respectively<br />
        &#8216;+======================================================================================+</p>
<p>        Dim Matrix(,) As Integer = New Integer(,) {} &#8216;Created a matrix to fill the score<br />
        Dim RowColpointer(,) As String = New String(,) {} &#8216;Created another matrix<br />
        &#8216;for the pointer to the left and up</p>
<p>        Dim J As Integer = 1 &#8216;matrix index j<br />
        Dim I As Integer = 1 &#8216;matrix index i</p>
<p>        &#8216;(0, 0) of the matrix is score is set to 0 and pointer to ‘none’.<br />
        &#8216;This position is the end during trace back.<br />
        &#8216;Matrix(1, 0) = 0 &#8216;run time error<br />
        &#8216;RowColpointer(1, 0) = &#8220;none&#8221; &#8216; I am getting run time error!!!<br />
        &#8216;Index was outside the bounds of the array!!!.</p>
<p>        &#8216;creates values for each column on top of the matrix except the 0,0<br />
        For J = 1 To J &lt;= Seq1.Text.Length<br />
            Matrix(0, J) = GapScore * J &#8216;creates score on each column<br />
            RowColpointer(0, J) = &#8220;left&#8221; &#8216;creates pointer on each column<br />
        Next J</p>
<p>        &#8216;creates pointer for each row on the left except 0,0<br />
        For I = 1 To J &lt;= Seq2.Text.Length<br />
            Matrix(I, 0) = GapScore * I &#8216;creates score on each row<br />
            RowColpointer(I, 0) = &#8220;up&#8221; &#8216;creates pointer on each column<br />
        Next I</p>
<p>        &#8216;==============================================================================+<br />
        &#8216;fill matrix with scores and pointers<br />
        &#8216;==============================================================================+<br />
        Dim diagonal_score As Integer<br />
        Dim left_score As Integer<br />
        Dim up_score As Integer<br />
        Dim letter1 As Integer<br />
        Dim letter2 As Integer</p>
<p>        For I = 1 To I &lt;= Seq2.Text.Length &#8216;looping through the entire matrix<br />
            For J = 1 To Seq1.Text.Length</p>
<p>                &#8216;Calculate matchScore<br />
                letter1 = Mid(Seq1.Text, J &#8211; 1, 1)<br />
                letter2 = Mid(Seq2.Text, I &#8211; 1, 1)</p>
<p>                &#8216;condition set to generate diagonal score<br />
                If letter1 = letter2 Then<br />
                    diagonal_score = Matrix(I &#8211; 1, J &#8211; 1) + MatchScore<br />
                Else : diagonal_score = Matrix(I &#8211; 1, J &#8211; 1) + MisMatchScore<br />
                End If</p>
<p>                &#8216;Calculate gap scores<br />
                up_score = Matrix(I &#8211; 1, J) + GapScore<br />
                left_score = Matrix(I, J &#8211; 1) + GapScore</p>
<p>                &#8216;conditions to generate best score and pointers the entire matrix<br />
                If diagonal_score &gt;= up_score Then<br />
                    If diagonal_score &gt;= left_score Then<br />
                        Matrix(I, J) = diagonal_score<br />
                        RowColpointer(I, J) = &#8220;diagonal&#8221;<br />
                    Else : Matrix(I, J) = left_score<br />
                        RowColpointer(I, J) = &#8220;left&#8221;<br />
                    End If</p>
<p>                    If up_score &gt;= left_score Then<br />
                        Matrix(I, J) = up_score<br />
                        RowColpointer(I, J) = &#8220;up&#8221;<br />
                    Else : Matrix(I, J) = left_score<br />
                        RowColpointer(I, J) = &#8220;left&#8221;<br />
                    End If<br />
                End If<br />
            Next J<br />
        Next I</p>
<p>        &#8216;=======================================================================================+<br />
        &#8216;trace back      <br />
        &#8216;=======================================================================================+</p>
<p>        Dim align1 As String = &#8221; &#8221;<br />
        Dim align2 As String = &#8221; &#8221;</p>
<p>        &#8216;starts at the last cell of the matrix<br />
        J = Seq1.Text.Length &#8216;|<br />
        I = Seq2.Text.Length &#8216;| to select the last cell in the matrix</p>
<p>        &#8216;when the trace back reaches &#8216;none&#8217; it stops<br />
        While (1)<br />
            If RowColpointer(I, J) = &#8220;none&#8221; Then &#8216;//run time error<br />
                &#8216;//Index was outside the bounds of the array.<br />
            End If<br />
        End While</p>
<p>        If RowColpointer(I, J) = &#8220;Diagonal&#8221; Then &#8216;//run time error<br />
            &#8216;//Index was outside the bounds of the array.<br />
            align1 = Mid(Seq1.Text, J &#8211; 1, 1)<br />
            align2 = Mid(Seq2.Text, I &#8211; 2, 1)<br />
            I -= 1<br />
            J -= 1<br />
        ElseIf RowColpointer(I, J) = &#8220;left&#8221; Then &#8216;//run time error<br />
            &#8216;//Index was outside the bounds of the array.<br />
            align1 = Mid(Seq1.Text, J &#8211; 1, 1)<br />
            align2 = &#8220;-&#8221;<br />
            J -= 1<br />
        ElseIf Matrix(I, J) = &#8220;up&#8221; Then &#8216;//run time error<br />
            &#8216;//Index was outside the bounds of the array.<br />
            align1 = &#8220;-&#8221;<br />
            align2 = Mid(Seq1.Text, I &#8211; 1, 1)<br />
            I -= 1<br />
        End If</p>
<p>        &#8216;since the trace back is performed backwards thorugh the sequence, the string is<br />
        &#8216;generated in a reverse order. so the sequence should be arranged in a correct order<br />
        StrReverse(align1)<br />
        StrReverse(align2)</p>
<p>        &#8216;Disply in message box<br />
        MessageBox.Show(align1 + &#8220;n&#8221;, align2 + &#8220;n&#8221;)</p>
<p>    End Sub</p>
<p>Private Sub Button2_Click(ByVal sender As System.Object, ByVal e _<br />
                          As System.EventArgs) Handles Button2.Click<br />
    Me.Close()</p>
<p>End Sub<br />
End Class</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/needleman-wunsch-algorithm/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/14 queries in 0.018 seconds using memcached
Object Caching 312/332 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-20 03:32:19 -->