1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Sep 11 03:19:52 BRT 2003 -->
<TITLE>
NeedlemanWunsch (NeoBio API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="NeedlemanWunsch (NeoBio API)";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<B><EM>NeoBio</EM> API</B></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../neobio/alignment/LocalAlignmentBlock.html"><B>PREV CLASS</B></A>
<A HREF="../../neobio/alignment/OutMatrix.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="NeedlemanWunsch.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
neobio.alignment</FONT>
<BR>
Class NeedlemanWunsch</H2>
<PRE>
java.lang.Object
|
+--<A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">neobio.alignment.PairwiseAlignmentAlgorithm</A>
|
+--<B>neobio.alignment.NeedlemanWunsch</B>
</PRE>
<HR>
<DL>
<DT>public class <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.83"><B>NeedlemanWunsch</B></A><DT>extends <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">PairwiseAlignmentAlgorithm</A></DL>
<P>
This class implements the classic global alignment algorithm (with linear gap penalty
function) due to S.B.Needleman and C.D.Wunsch (1970).
<P>It is based on a dynamic programming approach. The idea consists of, given two
sequences A and B of sizes n and m, respectively, building an (n+1 x m+1) matrix M that
contains the similarity of prefixes of A and B. Every position M[i,j] in the matrix
holds the score between the subsequences A[1..i] and B[1..j]. The first row and column
represent alignments with spaces.</P>
<P>Starting from row 0, column 0, the algorithm computes each position M[i,j] with the
following recurrence:</P>
<CODE><BLOCKQUOTE><PRE>
M[0,0] = 0
M[i,j] = max { M[i,j-1] + scoreInsertion (B[j]),
M[i-1,j-1] + scoreSubstitution (A[i], B[j]),
M[i-1,j] + scoreDeletion(A[i]) }
</PRE></BLOCKQUOTE></CODE>
<P>In the end, the value at the last position (last row, last column) will contain
the similarity between the two sequences. This part of the algorithm is accomplished
by the <A HREF="../../neobio/alignment/NeedlemanWunsch.html#computeMatrix()"><CODE>computeMatrix</CODE></A> method. It has quadratic space complexity
since it needs to keep an (n+1 x m+1) matrix in memory. And since the work of computing
each cell is constant, it also has quadratic time complexity.</P>
<P>After the matrix has been computed, the alignment can be retrieved by tracing a path
back in the matrix from the last position to the first. This step is performed by
the <A HREF="../../neobio/alignment/NeedlemanWunsch.html#buildOptimalAlignment()"><CODE>buildOptimalAlignment</CODE></A> method, and since the path can
be roughly as long as (m + n), this method has O(n) time complexity.</P>
<P>If the similarity value only is needed (and not the alignment itself), it is easy to
reduce the space requirement to O(n) by keeping just the last row or column in memory.
This is precisely what is done by the <A HREF="../../neobio/alignment/NeedlemanWunsch.html#computeScore()"><CODE>computeScore</CODE></A> method. Note
that it still requires O(n<SUP>2</SUP>) time.</P>
<P>For a more efficient approach to the global alignment problem, see the
<A HREF="../../neobio/alignment/CrochemoreLandauZivUkelson.html">CrochemoreLandauZivUkelson</A> algorithm. For local alignment, see the
<A HREF="../../neobio/alignment/SmithWaterman.html">SmithWaterman</A> algorithm.</P>
<P>
<P>
<DL>
<DT><B>Author:</B><DD>Sergio A. de Carvalho Jr.</DD>
</DD>
<DT><B>See Also:</B><DD><A HREF="../../neobio/alignment/SmithWaterman.html"><CODE>SmithWaterman</CODE></A>,
<A HREF="../../neobio/alignment/CrochemoreLandauZivUkelson.html"><CODE>CrochemoreLandauZivUkelson</CODE></A>,
<A HREF="../../neobio/alignment/CrochemoreLandauZivUkelsonLocalAlignment.html"><CODE>CrochemoreLandauZivUkelsonLocalAlignment</CODE></A>,
<A HREF="../../neobio/alignment/CrochemoreLandauZivUkelsonGlobalAlignment.html"><CODE>CrochemoreLandauZivUkelsonGlobalAlignment</CODE></A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected int[][]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#matrix">matrix</A></B></CODE>
<BR>
The dynamic programming matrix. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../neobio/alignment/CharSequence.html">CharSequence</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#seq1">seq1</A></B></CODE>
<BR>
The first sequence of an alignment.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../neobio/alignment/CharSequence.html">CharSequence</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#seq2">seq2</A></B></CODE>
<BR>
The second sequence of an alignment.</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_neobio.alignment.PairwiseAlignmentAlgorithm"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class neobio.alignment.<A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">PairwiseAlignmentAlgorithm</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#alignment">alignment</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#APPROXIMATE_MATCH_TAG">APPROXIMATE_MATCH_TAG</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#GAP_CHARACTER">GAP_CHARACTER</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#GAP_TAG">GAP_TAG</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#MATCH_TAG">MATCH_TAG</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#MISMATCH_TAG">MISMATCH_TAG</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#score">score</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#score_computed">score_computed</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#scoring">scoring</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#sequences_loaded">sequences_loaded</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#use_match_tag">use_match_tag</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#NeedlemanWunsch()">NeedlemanWunsch</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../neobio/alignment/PairwiseAlignment.html">PairwiseAlignment</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#buildOptimalAlignment()">buildOptimalAlignment</A></B>()</CODE>
<BR>
Builds an optimal global alignment between the loaded sequences. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#computeMatrix()">computeMatrix</A></B>()</CODE>
<BR>
Computes the dynamic programming matrix.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../neobio/alignment/PairwiseAlignment.html">PairwiseAlignment</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#computePairwiseAlignment()">computePairwiseAlignment</A></B>()</CODE>
<BR>
Builds an optimal global alignment between the loaded sequences after computing the
dynamic programming matrix. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#computeScore()">computeScore</A></B>()</CODE>
<BR>
Computes the score of the best global alignment between the two sequences using the
scoring scheme previously set. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#loadSequencesInternal(java.io.Reader, java.io.Reader)">loadSequencesInternal</A></B>(java.io.Reader input1,
java.io.Reader input2)</CODE>
<BR>
Loads sequences into <A HREF="../../neobio/alignment/CharSequence.html">CharSequence</A> instances. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neobio/alignment/NeedlemanWunsch.html#unloadSequencesInternal()">unloadSequencesInternal</A></B>()</CODE>
<BR>
Frees pointers to loaded sequences and the dynamic programming matrix so that their
data can be garbage collected.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_neobio.alignment.PairwiseAlignmentAlgorithm"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class neobio.alignment.<A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">PairwiseAlignmentAlgorithm</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#getPairwiseAlignment()">getPairwiseAlignment</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#getScore()">getScore</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#loadSequences(java.io.Reader, java.io.Reader)">loadSequences</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#max(int, int)">max</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#max(int, int, int)">max</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#max(int, int, int, int)">max</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#scoreDeletion(char)">scoreDeletion</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#scoreInsertion(char)">scoreInsertion</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#scoreSubstitution(char, char)">scoreSubstitution</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#setScoringScheme(neobio.alignment.ScoringScheme)">setScoringScheme</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#unloadSequences()">unloadSequences</A>, <A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#useMatchTag()">useMatchTag</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="seq1"><!-- --></A><H3>
seq1</H3>
<PRE>
protected <A HREF="../../neobio/alignment/CharSequence.html">CharSequence</A> <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.88"><B>seq1</B></A></PRE>
<DL>
<DD>The first sequence of an alignment.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="seq2"><!-- --></A><H3>
seq2</H3>
<PRE>
protected <A HREF="../../neobio/alignment/CharSequence.html">CharSequence</A> <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.93"><B>seq2</B></A></PRE>
<DL>
<DD>The second sequence of an alignment.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="matrix"><!-- --></A><H3>
matrix</H3>
<PRE>
protected int[][] <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.100"><B>matrix</B></A></PRE>
<DL>
<DD>The dynamic programming matrix. Each position (i, j) represents the best score
between the firsts i characters of <CODE>seq1</CODE> and j characters of
<CODE>seq2</CODE>.
<P>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="NeedlemanWunsch()"><!-- --></A><H3>
NeedlemanWunsch</H3>
<PRE>
public <B>NeedlemanWunsch</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="loadSequencesInternal(java.io.Reader, java.io.Reader)"><!-- --></A><H3>
loadSequencesInternal</H3>
<PRE>
protected void <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.113"><B>loadSequencesInternal</B></A>(java.io.Reader input1,
java.io.Reader input2)
throws java.io.IOException,
<A HREF="../../neobio/alignment/InvalidSequenceException.html">InvalidSequenceException</A></PRE>
<DL>
<DD>Loads sequences into <A HREF="../../neobio/alignment/CharSequence.html">CharSequence</A> instances. In case of any error,
an exception is raised by the constructor of <CODE>CharSequence</CODE> (please
check the specification of that class for specific requirements).
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#loadSequencesInternal(java.io.Reader, java.io.Reader)">loadSequencesInternal</A></CODE> in class <CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">PairwiseAlignmentAlgorithm</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>input1</CODE> - Input for first sequence<DD><CODE>input2</CODE> - Input for second sequence
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - If an I/O error occurs when reading the sequences
<DD><CODE><A HREF="../../neobio/alignment/InvalidSequenceException.html">InvalidSequenceException</A></CODE> - If the sequences are not valid<DT><B>See Also:</B><DD><A HREF="../../neobio/alignment/CharSequence.html"><CODE>CharSequence</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="unloadSequencesInternal()"><!-- --></A><H3>
unloadSequencesInternal</H3>
<PRE>
protected void <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.125"><B>unloadSequencesInternal</B></A>()</PRE>
<DL>
<DD>Frees pointers to loaded sequences and the dynamic programming matrix so that their
data can be garbage collected.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#unloadSequencesInternal()">unloadSequencesInternal</A></CODE> in class <CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">PairwiseAlignmentAlgorithm</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#unloadSequences()"><CODE>PairwiseAlignmentAlgorithm.unloadSequences()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="computePairwiseAlignment()"><!-- --></A><H3>
computePairwiseAlignment</H3>
<PRE>
protected <A HREF="../../neobio/alignment/PairwiseAlignment.html">PairwiseAlignment</A> <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.144"><B>computePairwiseAlignment</B></A>()
throws <A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></PRE>
<DL>
<DD>Builds an optimal global alignment between the loaded sequences after computing the
dynamic programming matrix. It calls the <CODE>buildOptimalAlignment</CODE> method
after the <CODE>computeMatrix</CODE> method computes the dynamic programming
matrix.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#computePairwiseAlignment()">computePairwiseAlignment</A></CODE> in class <CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">PairwiseAlignmentAlgorithm</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>an optimal global alignment between the loaded sequences
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></CODE> - If the scoring scheme is not compatible
with the loaded sequences.<DT><B>See Also:</B><DD><A HREF="../../neobio/alignment/NeedlemanWunsch.html#computeMatrix()"><CODE>computeMatrix()</CODE></A>,
<A HREF="../../neobio/alignment/NeedlemanWunsch.html#buildOptimalAlignment()"><CODE>buildOptimalAlignment()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="computeMatrix()"><!-- --></A><H3>
computeMatrix</H3>
<PRE>
protected void <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.165"><B>computeMatrix</B></A>()
throws <A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></PRE>
<DL>
<DD>Computes the dynamic programming matrix.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></CODE> - If the scoring scheme is not compatible
with the loaded sequences.</DL>
</DD>
</DL>
<HR>
<A NAME="buildOptimalAlignment()"><!-- --></A><H3>
buildOptimalAlignment</H3>
<PRE>
protected <A HREF="../../neobio/alignment/PairwiseAlignment.html">PairwiseAlignment</A> <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.207"><B>buildOptimalAlignment</B></A>()
throws <A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></PRE>
<DL>
<DD>Builds an optimal global alignment between the loaded sequences. Before it is
executed, the dynamic programming matrix must already have been computed by
the <CODE>computeMatrix</CODE> method.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>an optimal global alignment between the loaded sequences
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></CODE> - If the scoring scheme
is not compatible with the loaded sequences.<DT><B>See Also:</B><DD><A HREF="../../neobio/alignment/NeedlemanWunsch.html#computeMatrix()"><CODE>computeMatrix()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="computeScore()"><!-- --></A><H3>
computeScore</H3>
<PRE>
protected int <A HREF="../../src-html\neobio\alignment\NeedlemanWunsch.html#line.283"><B>computeScore</B></A>()
throws <A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></PRE>
<DL>
<DD>Computes the score of the best global alignment between the two sequences using the
scoring scheme previously set. This method calculates the similarity value only
(doesn't build the whole matrix so the alignment cannot be recovered, however it
has the advantage of requiring O(n) space only).
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#computeScore()">computeScore</A></CODE> in class <CODE><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html">PairwiseAlignmentAlgorithm</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>score of the best global alignment between the loaded sequences
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../neobio/alignment/IncompatibleScoringSchemeException.html">IncompatibleScoringSchemeException</A></CODE> - If the scoring scheme is not compatible
with the loaded sequences.<DT><B>See Also:</B><DD><A HREF="../../neobio/alignment/PairwiseAlignmentAlgorithm.html#getScore()"><CODE>PairwiseAlignmentAlgorithm.getScore()</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<A TARGET="_blank" HREF="http://sourceforge.net"><IMG SRC="http://sourceforge.net/sflogo.php?group_id=87937&type=2" WIDTH="125" HEIGHT="37" BORDER="0" ALT="SourceForge.net" /></A></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../neobio/alignment/LocalAlignmentBlock.html"><B>PREV CLASS</B></A>
<A HREF="../../neobio/alignment/OutMatrix.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="NeedlemanWunsch.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<FONT SIZE=-1><script language="JavaScript" type="text/javascript" src="http://m1.nedstatbasic.net/basic.js"></script><script language="JavaScript" type="text/javascript" ><!--
nedstatbasic("ACZ/LArmjx/k+DNHUelcrNt5+qIQ", 0);
--></script><noscript><a target="_blank" href="http://v1.nedstatbasic.net/stats?ACZ/LArmjx/k+DNHUelcrNt5+qIQ"><img src="http://m1.nedstatbasic.net/n?id=ACZ/LArmjx/k+DNHUelcrNt5+qIQ" border="0" nosave width="18" height="18" alt="Nedstat Basic - Free web site statistics"></a></noscript><A TARGET="_blank" HREF="http://neobio.sourceforge.net">http://neobio.sourceforge.net</A><BR><EM>NeoBio</EM> is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. <EM>NeoBio</EM> is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NeoBio; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.</FONT><BR>
</BODY>
</HTML>
|