{"id":"smith_waterman_similarity","title":"Local sequence alignment","family":"elastic","definition":"reference","intro_en":"Smith-Waterman allows an alignment to restart at zero, so it can select matching internal subsequences while leaving unrelated ends unused. This explicit numerical example uses the same threshold substitution scores as the global card. The best cell may occur anywhere, and traceback stops when the score returns to zero.","intro_zh":"Smith-Waterman 允许分数从零重新开始，因此能选择内部匹配子序列，并不使用无关的两端。本数值示例采用与全局卡片相同的阈值替换计分。最优单元格可以位于任意位置，回溯在零分处停止。","steps_en":["Set the stated local scoring rule, tolerance and boundary conditions.","Maximize the score with an additional zero restart option at every cell.","Start at the maximum score and stop traceback at zero.","Read the final score with the normalization explicitly stated below."],"steps_zh":["设置明确的局部计分规则、容差与边界条件。","在每个单元格增加从零开始选项，并最大化分数。","从最大分数处开始回溯，在零分处停止。","按下方明确的归一化约定读取最终分数。"],"formula":"S_ij=max(0,S_(i-1,j-1)+s_ij,S_(i-1,j)-0.5,S_(i,j-1)-0.5); result=max_ij S_ij","caveats_en":["A high local alignment score does not establish whole-series similarity. Substitution and gap choices determine which segment wins.","The small arrays are an algorithm illustration, not evidence of retrieval or classification quality."],"caveats_zh":["较高的局部对齐分数不能证明整段序列相似；替换与间隙设定决定获选片段。","这些小数组用于解释计算过程，不构成检索或分类性能证据。"],"sources":[{"label":"Biopython: global and local sequence alignment","url":"https://biopython.org/docs/latest/Tutorial/chapter_pairwise.html"},{"label":"EchoTime imported atlas: named formula conventions","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/data/ts_similarity_package_v2_registry.csv"}],"x":[0.2,0.4,1.1,2.4,3.2,2.5,1.2,0.3,-0.4,-0.1],"y":[0.1,0.3,0.5,1.2,2.6,3.1,2.3,1.1,0.2,-0.3],"input_label":"Deterministic illustrative arrays; no benchmark data","parameters":{"normalization":"none","local_norm":"absolute difference","epsilon":0.35,"match_reward":2.0,"gap_score":-0.5,"mismatch_score":-1.0},"result":{"label":"alignment score","value":18.0,"detail":"The explicit definition and parameters shown on this card."},"frames":[{"phase":0,"caption":"Compare samples to construct the local table","panel":{"kind":"matrix","title":"Local match scores","z":[[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[2,0]}},{"phase":0,"caption":"Compare samples to construct the local table","panel":{"kind":"matrix","title":"Local match scores","z":[[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,2.0,-1.0,2.0,-1.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,-1.0],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[4,0]}},{"phase":0,"caption":"Compare samples to construct the local table","panel":{"kind":"matrix","title":"Local match scores","z":[[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,2.0,-1.0,2.0,-1.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,2.0,-1.0,2.0,-1.0,-1.0,-1.0],[-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0],[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[7,0]}},{"phase":0,"caption":"Compare samples to construct the local table","panel":{"kind":"matrix","title":"Local match scores","z":[[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,2.0,-1.0,2.0,-1.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,-1.0],[-1.0,-1.0,-1.0,-1.0,2.0,-1.0,2.0,-1.0,-1.0,-1.0],[-1.0,-1.0,-1.0,2.0,-1.0,-1.0,-1.0,2.0,-1.0,-1.0],[2.0,2.0,2.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,-1.0],[-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0],[2.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,2.0,2.0]],"row_label":"x index","col_label":"y index","cursor":[9,0]}},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[0,9]},"value":1.5,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[1,9]},"value":1.5,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[2,9]},"value":3.0,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[3,9]},"value":5.5,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[4,9]},"value":8.0,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[5,9]},"value":10.5,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[6,9]},"value":13.0,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[7,9]},"value":15.5,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[1.5,1.5,3.0,3.0,5.5,8.0,10.5,13.0,15.5,18.0],[null,null,null,null,null,null,null,null,null,null]],"row_label":"x index","col_label":"y index","cursor":[8,9]},"value":18.0,"value_label":"prefix cost"},{"phase":1,"caption":"Extend solved prefixes using the stated recurrence","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[1.5,1.5,3.0,3.0,5.5,8.0,10.5,13.0,15.5,18.0],[2.0,1.5,2.5,2.5,5.0,7.5,10.0,12.5,15.0,17.5]],"row_label":"x index","col_label":"y index","cursor":[9,9]},"value":17.5,"value_label":"prefix cost"},{"phase":2,"caption":"Follow the chosen predecessor decisions","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[1.5,1.5,3.0,3.0,5.5,8.0,10.5,13.0,15.5,18.0],[2.0,1.5,2.5,2.5,5.0,7.5,10.0,12.5,15.0,17.5]],"row_label":"x index","col_label":"y index","path":[[7,8],[8,9]]},"value":18.0,"value_label":"alignment score"},{"phase":2,"caption":"Follow the chosen predecessor decisions","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[1.5,1.5,3.0,3.0,5.5,8.0,10.5,13.0,15.5,18.0],[2.0,1.5,2.5,2.5,5.0,7.5,10.0,12.5,15.0,17.5]],"row_label":"x index","col_label":"y index","path":[[5,6],[6,7],[7,8],[8,9]]},"value":18.0,"value_label":"alignment score"},{"phase":2,"caption":"Follow the chosen predecessor decisions","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[1.5,1.5,3.0,3.0,5.5,8.0,10.5,13.0,15.5,18.0],[2.0,1.5,2.5,2.5,5.0,7.5,10.0,12.5,15.0,17.5]],"row_label":"x index","col_label":"y index","path":[[3,4],[4,5],[5,6],[6,7],[7,8],[8,9]]},"value":18.0,"value_label":"alignment score"},{"phase":2,"caption":"Follow the chosen predecessor decisions","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[1.5,1.5,3.0,3.0,5.5,8.0,10.5,13.0,15.5,18.0],[2.0,1.5,2.5,2.5,5.0,7.5,10.0,12.5,15.0,17.5]],"row_label":"x index","col_label":"y index","path":[[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9]]},"value":18.0,"value_label":"alignment score"},{"phase":2,"caption":"Follow the chosen predecessor decisions","panel":{"kind":"matrix","title":"Best prefix scores","z":[[2.0,2.0,2.0,1.5,1.0,0.5,0.0,0.0,2.0,1.5],[2.0,4.0,4.0,3.5,3.0,2.5,2.0,1.5,2.0,1.5],[1.5,3.5,3.5,6.0,5.5,5.0,4.5,4.0,3.5,3.0],[1.0,3.0,3.0,5.5,8.0,7.5,7.0,6.5,6.0,5.5],[0.5,2.5,2.5,5.0,7.5,10.0,9.5,9.0,8.5,8.0],[0.0,2.0,2.0,4.5,7.0,9.5,12.0,11.5,11.0,10.5],[0.0,1.5,1.5,4.0,6.5,9.0,11.5,14.0,13.5,13.0],[2.0,2.0,3.5,3.5,6.0,8.5,11.0,13.5,16.0,15.5],[1.5,1.5,3.0,3.0,5.5,8.0,10.5,13.0,15.5,18.0],[2.0,1.5,2.5,2.5,5.0,7.5,10.0,12.5,15.0,17.5]],"row_label":"x index","col_label":"y index","path":[[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9]]},"value":18.0,"value_label":"alignment score"},{"phase":3,"caption":"Inspect the selected correspondences and final score","panel":{"kind":"alignment","title":"Chosen pairs (gaps remain unlinked)","a":[0.2,0.4,1.1,2.4,3.2,2.5,1.2,0.3,-0.4,-0.1],"b":[0.1,0.3,0.5,1.2,2.6,3.1,2.3,1.1,0.2,-0.3],"pairs":[[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9]]},"value":18.0,"value_label":"alignment score"}],"animation_steps_en":["Define tolerance-based match scores and linear gap costs.","Allow every prefix score to restart at zero.","Trace from the best cell until the score returns to zero.","Report the highest-scoring local alignment."],"echotime_status":"Possible addition","echotime_api":""}
