retval->
length= chunksize;
94}
else if(var->
used== 0) {
110retval->
length= chunksize;
113 last->next = retval;
117 #ifdef ERR_POST_EX_DEFINED 135state_struct->
used= 0;
136state_struct = state_struct->
next;
176 Int4max_d_1, d_diff, max_cost, gd,
i;
177 Int4reward, penalty, gap_open, gap_extend;
178 Int4Mis_cost, GE_cost;
180 if(score_params ==
NULL|| (!ext_params && !Xdrop))
183 if(score_params->
reward% 2 == 1) {
184reward = 2*score_params->
reward;
185penalty = -2*score_params->
penalty;
189gap_open = 2*score_params->
gap_open;
192reward = score_params->
reward;
193penalty = -score_params->
penalty;
197gap_open = score_params->
gap_open;
201 if(gap_open == 0 && gap_extend == 0)
202gap_extend = reward / 2 + penalty;
206gamp->
xdrop= Xdrop;
209d_diff = (Xdrop+reward/2)/(penalty+reward)+1;
219 #ifdef ERR_POST_EX_DEFINED 221 "Failed to allocate %ld bytes for greedy alignment",
222(max_d + max_d + 6) *
sizeof(
Int4) * 2);
233Mis_cost = reward + penalty;
234GE_cost = gap_extend+reward/2;
237max_cost =
MAX(Mis_cost, gap_open+GE_cost);
238gd =
BLAST_Gdb3(&Mis_cost, &gap_open, &GE_cost);
239d_diff = (Xdrop+reward/2)/gd+1;
249 for(
i= 1;
i<= max_cost;
i++)
294 Uint4max_subject_length,
300 if(!gap_align_ptr || !sbp || !score_params || !ext_params)
305*gap_align_ptr = gap_align;
307gap_align->
sbp= sbp;
330max_subject_length, 0);
387 Int4b_index, b_size, first_b_index, last_b_index, b_increment;
394 Int4gap_open_extend;
408 Uint1* edit_script_row;
409 Uint1** edit_script;
410 Int4*edit_start_offset;
411 Int4edit_script_num_rows;
413 Uint1script, next_script, script_row, script_col;
414 Int4num_extra_cells;
423gap_open = score_params->
gap_open;
425gap_open_extend = gap_open + gap_extend;
428 if(x_dropoff < gap_open_extend)
429x_dropoff = gap_open_extend;
431 if(
N<= 0 ||
M<= 0)
448edit_script_num_rows = 100;
449edit_script = (
Uint1**)
malloc(
sizeof(
Uint1*) * edit_script_num_rows);
450edit_start_offset = (
Int4*)
malloc(
sizeof(
Int4) * edit_script_num_rows);
458num_extra_cells = x_dropoff / gap_extend + 3;
460num_extra_cells =
N+ 3;
473edit_start_offset[0] = 0;
476score = -gap_open_extend;
477score_array = gap_align->
dp_mem;
478score_array[0].
best= 0;
479score_array[0].
best_gap= -gap_open_extend;
481 for(
i= 1;
i<=
N;
i++) {
482 if(score < -x_dropoff)
485score_array[
i].
best= score;
486score_array[
i].
best_gap= score - gap_open_extend;
490state_struct->
used=
i+ 1;
495 if(reverse_sequence)
500 for(a_index = 1; a_index <=
M; a_index++) {
516b_size - first_b_index + num_extra_cells);
519 N+ 3 - first_b_index);
521 if(a_index == edit_script_num_rows) {
522edit_script_num_rows = edit_script_num_rows * 2;
523edit_script = (
Uint1**)realloc(edit_script,
524edit_script_num_rows *
526edit_start_offset = (
Int4*)realloc(edit_start_offset,
527edit_script_num_rows *
531edit_script[a_index] = state_struct->
state_array+
532state_struct->
used+ 1;
533edit_start_offset[a_index] = first_b_index;
538edit_script_row = edit_script[a_index] - first_b_index;
539orig_b_index = first_b_index;
542 if(reverse_sequence)
543matrix_row = matrix[
A[
M- a_index ] ];
545matrix_row = matrix[
A[ a_index ] ];
548 if(reversed || reverse_sequence)
549matrix_row = pssm[
M- a_index];
551matrix_row = pssm[a_index + query_offset];
554 if(reverse_sequence)
555b_ptr = &
B[
N- first_b_index];
557b_ptr = &
B[first_b_index];
561last_b_index = first_b_index;
563 for(b_index = first_b_index; b_index < b_size; b_index++) {
564 intmatrix_index = 0;
566b_ptr += b_increment;
567score_gap_col = score_array[b_index].
best_gap;
569matrix_index = *b_ptr;
578next_score = score_array[b_index].
best+ matrix_row[ *b_ptr ];
592 if(score < score_gap_col) {
594score = score_gap_col;
596 if(score < score_gap_row) {
598score = score_gap_row;
601 if(best_score - score > x_dropoff) {
603 if(first_b_index == b_index)
609last_b_index = b_index;
610 if(score > best_score) {
616score_gap_row -= gap_extend;
617score_gap_col -= gap_extend;
618 if(score_gap_col < (score - gap_open_extend)) {
619score_array[b_index].
best_gap= score - gap_open_extend;
622score_array[b_index].
best_gap= score_gap_col;
623script += script_col;
626 if(score_gap_row < (score - gap_open_extend))
627score_gap_row = score - gap_open_extend;
629script += script_row;
631score_array[b_index].
best= score;
635edit_script_row[b_index] = script;
638 if(first_b_index == b_size || (fence_hit && *fence_hit))
641 if(last_b_index + num_extra_cells + 3 >= gap_align->
dp_mem_alloc) {
645score_array = (
BlastGapDP*)realloc(score_array,
648gap_align->
dp_mem= score_array;
652 if(last_b_index < b_size - 1) {
653b_size = last_b_index + 1;
656 while(score_gap_row >= (best_score - x_dropoff) && b_size <=
N) {
658score_array[b_size].
best= score_gap_row;
659score_array[b_size].
best_gap= score_gap_row - gap_open_extend;
660score_gap_row -= gap_extend;
669state_struct->
used+=
MAX(b_index, b_size) - orig_b_index + 1;
686 if(fence_hit && *fence_hit)
689 while(a_index > 0 || b_index > 0) {
696edit_script[a_index][b_index - edit_start_offset[a_index]];
730 sfree(edit_start_offset);
745 Int4b_index, b_size, first_b_index, last_b_index, b_increment;
752 Int4gap_open_extend;
764 Int4num_extra_cells;
767 return ALIGN_EX(
A,
B,
M,
N, a_offset, b_offset, edit_block, gap_align,
768score_params, query_offset, reversed, reverse_sequence,
780gap_open = score_params->
gap_open;
782gap_open_extend = gap_open + gap_extend;
785 if(x_dropoff < gap_open_extend)
786x_dropoff = gap_open_extend;
788 if(
N<= 0 ||
M<= 0)
798num_extra_cells = x_dropoff / gap_extend + 3;
800num_extra_cells =
N+ 3;
810score_array = gap_align->
dp_mem;
811score = -gap_open_extend;
812score_array[0].
best= 0;
813score_array[0].
best_gap= -gap_open_extend;
815 for(
i= 1;
i<=
N;
i++) {
816 if(score < -x_dropoff)
819score_array[
i].
best= score;
820score_array[
i].
best_gap= score - gap_open_extend;
830 if(reverse_sequence)
835 for(a_index = 1; a_index <=
M; a_index++) {
840 if(reverse_sequence)
841matrix_row = matrix[
A[
M- a_index ] ];
843matrix_row = matrix[
A[ a_index ] ];
846 if(reversed || reverse_sequence)
847matrix_row = pssm[
M- a_index];
849matrix_row = pssm[a_index + query_offset];
852 if(reverse_sequence)
853b_ptr = &
B[
N- first_b_index];
855b_ptr = &
B[first_b_index];
860last_b_index = first_b_index;
862 for(b_index = first_b_index; b_index < b_size; b_index++) {
864b_ptr += b_increment;
865score_gap_col = score_array[b_index].
best_gap;
866next_score = score_array[b_index].
best+ matrix_row[ *b_ptr ];
868 if(score < score_gap_col)
869score = score_gap_col;
871 if(score < score_gap_row)
872score = score_gap_row;
874 if(best_score - score > x_dropoff) {
886 if(b_index == first_b_index)
892last_b_index = b_index;
893 if(score > best_score) {
903score_gap_row -= gap_extend;
904score_gap_col -= gap_extend;
905score_array[b_index].
best_gap=
MAX(score - gap_open_extend,
907score_gap_row =
MAX(score - gap_open_extend, score_gap_row);
908score_array[b_index].
best= score;
918 if(first_b_index == b_size)
923 if(last_b_index + num_extra_cells + 3 >= gap_align->
dp_mem_alloc) {
927score_array = (
BlastGapDP*)realloc(score_array,
930gap_align->
dp_mem= score_array;
933 if(last_b_index < b_size - 1) {
938b_size = last_b_index + 1;
946 while(score_gap_row >= (best_score - x_dropoff) && b_size <=
N) {
947score_array[b_size].
best= score_gap_row;
948score_array[b_size].
best_gap= score_gap_row - gap_open_extend;
949score_gap_row -= gap_extend;
966 #define RESTRICT_SIZE 10 1001 Int4b_index, b_size, first_b_index, last_b_index, b_increment;
1002 const Uint1* b_ptr;
1009 Int4gap_open_extend;
1021 Int4num_extra_cells;
1029gap_open = score_params->
gap_open;
1031gap_open_extend = gap_open + gap_extend;
1034 if(x_dropoff < gap_open_extend)
1035x_dropoff = gap_open_extend;
1037 if(
N<= 0 ||
M<= 0)
1041num_extra_cells = x_dropoff / gap_extend + 3;
1043num_extra_cells =
N+ 3;
1053score_array = gap_align->
dp_mem;
1054score = -gap_open_extend;
1055score_array[0].
best= 0;
1056score_array[0].
best_gap= -gap_open_extend;
1058 for(
i= 1;
i<=
N;
i++) {
1059 if(score < -x_dropoff)
1062score_array[
i].
best= score;
1063score_array[
i].
best_gap= score - gap_open_extend;
1064score -= gap_extend;
1071 if(reverse_sequence)
1076 for(a_index = 1; a_index <=
M; a_index++) {
1079 if(reverse_sequence)
1080matrix_row = matrix[
A[
M- a_index ] ];
1082matrix_row = matrix[
A[ a_index ] ];
1085 if(reverse_sequence)
1086matrix_row = pssm[
M- a_index];
1088matrix_row = pssm[a_index + query_offset];
1091 if(reverse_sequence)
1092b_ptr = &
B[
N- first_b_index];
1094b_ptr = &
B[first_b_index];
1098last_b_index = first_b_index;
1112 for(b_index = first_b_index; b_index < b_size; b_index++) {
1114b_ptr += b_increment;
1115next_score = score_array[b_index].
best+ matrix_row[ *b_ptr ];
1117 if(b_index != b_gap) {
1122 if(best_score - score > x_dropoff) {
1124 if(b_index == first_b_index)
1128last_b_index = b_index;
1129 if(score > best_score) {
1131*a_offset = a_index;
1132*b_offset = b_index;
1134score_array[b_index].
best= score;
1144score_gap_col = score_array[b_index].
best_gap;
1146 if(score < score_gap_col)
1147score = score_gap_col;
1149 if(best_score - score > x_dropoff) {
1151 if(b_index == first_b_index)
1155last_b_index = b_index;
1156 if(score > best_score) {
1158*a_offset = a_index;
1159*b_offset = b_index;
1162score_gap_col -= gap_extend;
1164 MAX(score - gap_open_extend, score_gap_col);
1165score_array[b_index].
best= score;
1171score_gap_row = score;
1177 for(b_index = first_b_index; b_index < b_size; b_index++) {
1179b_ptr += b_increment;
1180next_score = score_array[b_index].
best+ matrix_row[ *b_ptr ];
1182 if(b_index != b_gap) {
1187 if(score < score_gap_row)
1188score = score_gap_row;
1190 if(best_score - score > x_dropoff) {
1192 if(b_index == first_b_index)
1196last_b_index = b_index;
1197 if(score > best_score) {
1199*a_offset = a_index;
1200*b_offset = b_index;
1203score_gap_row -= gap_extend;
1204score_gap_row =
MAX(score - gap_open_extend,
1206score_array[b_index].
best= score;
1217score_gap_col = score_array[b_index].
best_gap;
1219 if(score < score_gap_col)
1220score = score_gap_col;
1221 if(score < score_gap_row)
1222score = score_gap_row;
1224 if(best_score - score > x_dropoff) {
1226 if(b_index == first_b_index)
1230last_b_index = b_index;
1231 if(score > best_score) {
1233*a_offset = a_index;
1234*b_offset = b_index;
1237score_gap_row -= gap_extend;
1238score_gap_col -= gap_extend;
1240 MAX(score - gap_open_extend, score_gap_col);
1241score_gap_row =
MAX(score - gap_open_extend,
1243score_array[b_index].
best= score;
1250 if(first_b_index == b_size)
1257b_gap = first_b_index;
1261 if(last_b_index + num_extra_cells + 3 >= gap_align->
dp_mem_alloc) {
1265score_array = (
BlastGapDP*)realloc(score_array,
1268gap_align->
dp_mem= score_array;
1271 if(last_b_index < b_size - 1) {
1272b_size = last_b_index + 1;
1284 while(score_gap_row >= (best_score - x_dropoff) && b_size <=
N) {
1285score_array[b_size].
best= score_gap_row;
1286score_array[b_size].
best_gap= score_gap_row - gap_open_extend;
1287score_gap_row -= gap_extend;
1340 Int4b_index, b_size, first_b_index, last_b_index;
1346 Int4gap_open_extend;
1362 Int4score_other_frame1;
1363 Int4score_other_frame2;
1367 Uint1** edit_script;
1368 Uint1* edit_script_row;
1369 Int4*edit_start_offset;
1370 Int4edit_script_num_rows;
1372 Int1script, next_script;
1373 Int4num_extra_cells;
1383gap_open = score_params->
gap_open;
1385gap_open_extend = gap_open + gap_extend;
1386shift_penalty = score_params->
shift_pen;
1389 if(x_dropoff < gap_open_extend)
1390x_dropoff = gap_open_extend;
1392 if(
N<= 0 ||
M<= 0)
1409edit_script_num_rows = 100;
1410edit_script = (
Uint1**)
malloc(
sizeof(
Uint1*) * edit_script_num_rows);
1411edit_start_offset = (
Int4*)
malloc(
sizeof(
Int4) * edit_script_num_rows);
1420num_extra_cells =
CODON_LENGTH* (x_dropoff / gap_extend + 5);
1422num_extra_cells =
N+ 5;
1435edit_start_offset[0] = 0;
1438score_array = gap_align->
dp_mem;
1439score = -gap_open_extend;
1440score_array[0].
best= 0;
1441score_array[0].
best_gap= -gap_open_extend;
1443 for(
i= 3;
i<=
N+ 2;
i+= 3) {
1444score_array[
i].
best= score;
1445score_array[
i].
best_gap= score - gap_open_extend;
1456 if(score < -x_dropoff)
1458score -= gap_extend;
1467state_struct->
used= b_size + 1;
1480 for(a_index = 1; a_index <=
M; a_index++) {
1496b_size - first_b_index + num_extra_cells);
1499 N+ 5 - first_b_index);
1501 if(a_index == edit_script_num_rows) {
1502edit_script_num_rows = edit_script_num_rows * 2;
1503edit_script = (
Uint1**)realloc(edit_script,
1504edit_script_num_rows *
1506edit_start_offset = (
Int4*)realloc(edit_start_offset,
1507edit_script_num_rows *
1511edit_script[a_index] = state_struct->
state_array+
1512state_struct->
used+ 1;
1513edit_start_offset[a_index] = first_b_index;
1518edit_script_row = edit_script[a_index] - first_b_index;
1519orig_b_index = first_b_index;
1522matrix_row = matrix[
A[ a_index * increment ] ];
1526matrix_row = pssm[
M- a_index];
1528matrix_row = pssm[a_index + query_offset];
1539score_other_frame1 =
MININT;
1540score_other_frame2 =
MININT;
1541last_b_index = first_b_index;
1542b_index = first_b_index;
1547 while(b_index < b_size) {
1551score =
MAX(score_other_frame1, score_other_frame2) - shift_penalty;
1552score =
MAX(score, score_col1);
1553 if(score == score_col1) {
1556 else if(score + shift_penalty == score_other_frame1) {
1557 if(score_other_frame1 == score_col2)
1563 if(score_other_frame2 == score_col3)
1568score += matrix_row[
B[ b_index * increment ] ];
1570score_other_frame1 =
MAX(score_col1, score_array[b_index].best);
1571score_col1 = score_array[b_index].
best;
1572score_gap_col = score_array[b_index].
best_gap;
1574 if(score <
MAX(score_gap_col, score_row1)) {
1575 if(score_gap_col > score_row1) {
1576score = score_gap_col;
1584 if(best_score - score > x_dropoff) {
1585 if(first_b_index == b_index)
1586first_b_index = b_index + 1;
1591last_b_index = b_index;
1592score_array[b_index].
best= score;
1593score_array[b_index].
best_gap= score_gap_col - gap_extend;
1594score_row1 -= gap_extend;
1598 if(best_score - score > x_dropoff) {
1599 if(first_b_index == b_index)
1600first_b_index = b_index + 1;
1605last_b_index = b_index;
1606score_array[b_index].
best= score;
1607 if(score > best_score) {
1609*a_offset = a_index;
1610*b_offset = b_index;
1613score -= gap_open_extend;
1614score_row1 -= gap_extend;
1615 if(score > score_row1)
1620score_gap_col -= gap_extend;
1621 if(score < score_gap_col) {
1622score_array[b_index].
best_gap= score_gap_col;
1626score_array[b_index].
best_gap= score;
1631edit_script_row[b_index++] = script;
1632 if(b_index >= b_size) {
1634score_row1 = score_row2;
1635score_row2 = score_row3;
1642score =
MAX(score_other_frame1, score_other_frame2) - shift_penalty;
1643score =
MAX(score, score_col2);
1644 if(score == score_col2) {
1647 else if(score + shift_penalty == score_other_frame1) {
1648 if(score_other_frame1 == score_col1)
1654 if(score_other_frame2 == score_col3)
1659score += matrix_row[
B[ b_index * increment ] ];
1660score_other_frame2 =
MAX(score_col2, score_array[b_index].best);
1661score_col2 = score_array[b_index].
best;
1662score_gap_col = score_array[b_index].
best_gap;
1664 if(score <
MAX(score_gap_col, score_row2)) {
1665score =
MAX(score_gap_col, score_row2);
1666 if(best_score - score > x_dropoff) {
1667 if(first_b_index == b_index)
1668first_b_index = b_index + 1;
1673 if(score == score_gap_col)
1678last_b_index = b_index;
1679score_array[b_index].
best= score;
1680score_array[b_index].
best_gap= score_gap_col - gap_extend;
1681score_row2 -= gap_extend;
1685 if(best_score - score > x_dropoff) {
1686 if(first_b_index == b_index)
1687first_b_index = b_index + 1;
1692last_b_index = b_index;
1693score_array[b_index].
best= score;
1694 if(score > best_score) {
1696*a_offset = a_index;
1697*b_offset = b_index;
1699score -= gap_open_extend;
1700score_row2 -= gap_extend;
1701 if(score > score_row2)
1706score_gap_col -= gap_extend;
1707 if(score < score_gap_col) {
1708score_array[b_index].
best_gap= score_gap_col;
1712score_array[b_index].
best_gap= score;
1717edit_script_row[b_index++] = script;
1718 if(b_index >= b_size) {
1720score_row2 = score_row1;
1721score_row1 = score_row3;
1728score =
MAX(score_other_frame1, score_other_frame2) - shift_penalty;
1729score =
MAX(score, score_col3);
1730 if(score == score_col3) {
1733 else if(score + shift_penalty == score_other_frame1) {
1734 if(score_other_frame1 == score_col1)
1740 if(score_other_frame2 == score_col2)
1745score += matrix_row[
B[ b_index * increment ] ];
1746score_other_frame1 = score_other_frame2;
1747score_other_frame2 =
MAX(score_col3, score_array[b_index].best);
1748score_col3 = score_array[b_index].
best;
1749score_gap_col = score_array[b_index].
best_gap;
1751 if(score <
MAX(score_gap_col, score_row3)) {
1752score =
MAX(score_gap_col, score_row3);
1753 if(best_score - score > x_dropoff) {
1754 if(first_b_index == b_index)
1755first_b_index = b_index + 1;
1760 if(score == score_gap_col)
1765last_b_index = b_index;
1766score_array[b_index].
best= score;
1767score_array[b_index].
best_gap= score_gap_col - gap_extend;
1768score_row3 -= gap_extend;
1772 if(best_score - score > x_dropoff) {
1773 if(first_b_index == b_index)
1774first_b_index = b_index + 1;
1779last_b_index = b_index;
1780score_array[b_index].
best= score;
1781 if(score > best_score) {
1783*a_offset = a_index;
1784*b_offset = b_index;
1786score -= gap_open_extend;
1787score_row3 -= gap_extend;
1788 if(score > score_row3)
1793score_gap_col -= gap_extend;
1794 if(score < score_gap_col) {
1795score_array[b_index].
best_gap= score_gap_col;
1799score_array[b_index].
best_gap= score;
1803edit_script_row[b_index++] = script;
1810 if(first_b_index == b_size)
1815 if(last_b_index + num_extra_cells + 5 >= gap_align->
dp_mem_alloc) {
1819score_array = (
BlastGapDP*)realloc(score_array,
1822gap_align->
dp_mem= score_array;
1825 if(last_b_index < b_size - 1) {
1830b_size = last_b_index + 1;
1841score =
MAX(score_row1, score_row2);
1842score =
MAX(score, score_row3);
1843 while(score >= (best_score - x_dropoff) && b_size <
N+ 1) {
1845score_array[b_size].
best= score_row1;
1846score_array[b_size].
best_gap= score_row1 - gap_open_extend;
1847score_row1 -= gap_extend;
1851score_array[b_size+1].
best= score_row2;
1852score_array[b_size+1].
best_gap= score_row2 - gap_open_extend;
1853score_row2 -= gap_extend;
1857score_array[b_size+2].
best= score_row3;
1858score_array[b_size+2].
best_gap= score_row3 - gap_open_extend;
1859score_row3 -= gap_extend;
1863score -= gap_extend;
1870b_size =
MIN(b_size,
N+ 1);
1871state_struct->
used+=
MAX(b_index, b_size) - orig_b_index + 1;
1875last_b_index =
MIN(b_size + 4,
N+ 3);
1876 while(b_size < last_b_index) {
1883a_index = *a_offset;
1884b_index = *b_offset;
1887 while(a_index > 0 || b_index > 0) {
1894edit_script[a_index][b_index - edit_start_offset[a_index]];
1923 sfree(edit_start_offset);
1924 sfree(edit_script);
1957 Int4b_index, b_size, first_b_index, last_b_index;
1961 Int4gap_open_extend;
1966 Int4num_extra_cells;
1980 Int4score_other_frame1;
1981 Int4score_other_frame2;
1986edit_block, gap_align,
1987score_params, query_offset,
1999gap_open = score_params->
gap_open;
2001gap_open_extend = gap_open + gap_extend;
2002shift_penalty = score_params->
shift_pen;
2005 if(x_dropoff < gap_open_extend)
2006x_dropoff = gap_open_extend;
2008 if(
N<= 0 ||
M<= 0)
2018num_extra_cells =
CODON_LENGTH* (x_dropoff / gap_extend + 5);
2020num_extra_cells =
N+ 5;
2030score_array = gap_align->
dp_mem;
2031score = -gap_open_extend;
2032score_array[0].
best= 0;
2033score_array[0].
best_gap= -gap_open_extend;
2035 for(
i= 3;
i<=
N+ 2;
i+= 3) {
2036score_array[
i].
best= score;
2037score_array[
i].
best_gap= score - gap_open_extend;
2042 if(score < -x_dropoff)
2044score -= gap_extend;
2065 for(a_index = 1; a_index <=
M; a_index++) {
2071matrix_row = matrix[
A[ a_index * increment ] ];
2075matrix_row = pssm[
M- a_index];
2077matrix_row = pssm[a_index + query_offset];
2089score_other_frame1 =
MININT;
2090score_other_frame2 =
MININT;
2091last_b_index = first_b_index;
2092b_index = first_b_index;
2094 while(b_index < b_size) {
2099score =
MAX(score_other_frame1, score_other_frame2) - shift_penalty;
2100score =
MAX(score, score_col1) +
2101matrix_row[
B[ b_index * increment ] ];
2102score_other_frame1 =
MAX(score_col1, score_array[b_index].best);
2103score_col1 = score_array[b_index].
best;
2104score_gap_col = score_array[b_index].
best_gap;
2109 if(score <
MAX(score_gap_col, score_row1)) {
2110score =
MAX(score_gap_col, score_row1);
2111 if(best_score - score > x_dropoff) {
2123 if(first_b_index == b_index)
2124first_b_index = b_index + 1;
2130last_b_index = b_index;
2131score_array[b_index].
best= score;
2132score_array[b_index].
best_gap= score_gap_col - gap_extend;
2133score_row1 -= gap_extend;
2137 if(best_score - score > x_dropoff) {
2142 if(first_b_index == b_index)
2143first_b_index = b_index + 1;
2152last_b_index = b_index;
2153score_array[b_index].
best= score;
2154 if(score > best_score) {
2156*a_offset = a_index;
2157*b_offset = b_index;
2163score -= gap_open_extend;
2164score_row1 -= gap_extend;
2165score_row1 =
MAX(score, score_row1);
2167score_gap_col - gap_extend);
2175 if(++b_index >= b_size) {
2177score_row1 = score_row2;
2178score_row2 = score_row3;
2189score =
MAX(score_other_frame1, score_other_frame2) - shift_penalty;
2190score =
MAX(score, score_col2) +
2191matrix_row[
B[ b_index * increment ] ];
2192score_other_frame2 =
MAX(score_col2, score_array[b_index].best);
2193score_col2 = score_array[b_index].
best;
2194score_gap_col = score_array[b_index].
best_gap;
2196 if(score <
MAX(score_gap_col, score_row2)) {
2197score =
MAX(score_gap_col, score_row2);
2198 if(best_score - score > x_dropoff) {
2199 if(first_b_index == b_index)
2200first_b_index = b_index + 1;
2205last_b_index = b_index;
2206score_array[b_index].
best= score;
2207score_array[b_index].
best_gap= score_gap_col - gap_extend;
2208score_row2 -= gap_extend;
2212 if(best_score - score > x_dropoff) {
2213 if(first_b_index == b_index)
2214first_b_index = b_index + 1;
2219last_b_index = b_index;
2220score_array[b_index].
best= score;
2221 if(score > best_score) {
2223*a_offset = a_index;
2224*b_offset = b_index;
2226score -= gap_open_extend;
2227score_row2 -= gap_extend;
2228score_row2 =
MAX(score, score_row2);
2230score_gap_col - gap_extend);
2234 if(++b_index >= b_size) {
2236score_row2 = score_row1;
2237score_row1 = score_row3;
2244score =
MAX(score_other_frame1, score_other_frame2) - shift_penalty;
2245score =
MAX(score, score_col3) +
2246matrix_row[
B[ b_index * increment ] ];
2247score_other_frame1 = score_other_frame2;
2248score_other_frame2 =
MAX(score_col3, score_array[b_index].best);
2249score_col3 = score_array[b_index].
best;
2250score_gap_col = score_array[b_index].
best_gap;
2252 if(score <
MAX(score_gap_col, score_row3)) {
2253score =
MAX(score_gap_col, score_row3);
2254 if(best_score - score > x_dropoff) {
2255 if(first_b_index == b_index)
2256first_b_index = b_index + 1;
2261last_b_index = b_index;
2262score_array[b_index].
best= score;
2263score_array[b_index].
best_gap= score_gap_col - gap_extend;
2264score_row3 -= gap_extend;
2268 if(best_score - score > x_dropoff) {
2269 if(first_b_index == b_index)
2270first_b_index = b_index + 1;
2275last_b_index = b_index;
2276score_array[b_index].
best= score;
2277 if(score > best_score) {
2279*a_offset = a_index;
2280*b_offset = b_index;
2282score -= gap_open_extend;
2283score_row3 -= gap_extend;
2284score_row3 =
MAX(score, score_row3);
2286score_gap_col - gap_extend);
2296 if(first_b_index == b_size)
2301 if(b_size + num_extra_cells + 5 >= gap_align->
dp_mem_alloc) {
2305score_array = (
BlastGapDP*)realloc(score_array,
2308gap_align->
dp_mem= score_array;
2311 if(last_b_index < b_size - 1) {
2316b_size = last_b_index + 1;
2327score =
MAX(score_row1, score_row2);
2328score =
MAX(score, score_row3);
2329 while(score >= (best_score - x_dropoff) && b_size <
N+ 1) {
2331score_array[b_size].
best= score_row1;
2332score_array[b_size].
best_gap= score_row1 - gap_open_extend;
2333score_row1 -= gap_extend;
2335score_array[b_size+1].
best= score_row2;
2336score_array[b_size+1].
best_gap= score_row2 - gap_open_extend;
2337score_row2 -= gap_extend;
2339score_array[b_size+2].
best= score_row3;
2340score_array[b_size+2].
best_gap= score_row3 - gap_open_extend;
2341score_row3 -= gap_extend;
2344score -= gap_extend;
2349b_size =
MIN(b_size,
N+ 1);
2350last_b_index =
MIN(b_size + 4,
N+ 3);
2351 while(b_size < last_b_index) {
2409 Int4query_length = 0;
2413 Int4query_end_pt = 0;
2420query_length = query_end_pt - *query_start;
2429single_query->
length= query_length;
2452 Int4query_start = 0;
2464query_out, &query_start);
2491 if(rev_prelim_tback ==
NULL|| fwd_prelim_tback ==
NULL)
2498 if(fwd_prelim_tback->
num_ops> 0 && rev_prelim_tback->
num_ops> 0 &&
2510 for(
i=0;
i< rev_prelim_tback->
num_ops;
i++) {
2513esp->
num[index] = op->
num;
2517 if(fwd_prelim_tback->
num_ops== 0)
2521esp->
num[index-1] += fwd_prelim_tback->
edit_ops[(fwd_prelim_tback->
num_ops)-1].num;
2525 i= fwd_prelim_tback->
num_ops- 2;
2527 i= fwd_prelim_tback->
num_ops- 1;
2529 for(;
i>= 0;
i--) {
2532esp->
num[index] = op->
num;
2555 Int4q_seed_start,
Int4s_seed_start,
2564gap_align->
score= score;
2579 if(--op < 0)
return;
2582qd -= esp->
num[op];
2583sd -= esp->
num[op];
2586qd -= esp->
num[op];
2589sd -= esp->
num[op];
2593}
while(qd > 0 || sd > 0);
2595esp->
num[op] = -
MAX(qd, sd);
2597 for(; op < pos-1; op++) esp->
num[op] = 0;
2598esp->
num[pos] += bf;
2601esp->
num[pos-1] = (qd>0) ? qd : -qd;
2608 if(++op >= esp->
size)
return;
2611qd -= esp->
num[op];
2612sd -= esp->
num[op];
2615qd -= esp->
num[op];
2618sd -= esp->
num[op];
2622}
while(qd > 0 || sd > 0);
2624esp->
num[op] = -
MAX(qd, sd);
2626 for(; op > pos+1; op--) esp->
num[op] = 0;
2627esp->
num[pos] += af;
2630esp->
num[pos+1] = (qd>0) ? qd : -qd;
2636 for(
i=0, j=-1;
i<esp->
size;
i++) {
2637 if(esp->
num[
i] == 0)
continue;
2639esp->
num[j] += esp->
num[
i];
2643esp->
num[j] = esp->
num[
i];
2645 intd = esp->
num[j] - esp->
num[
i];
2647esp->
num[j-1] += esp->
num[
i];
2651 if(j == 0 &&
i- j > 0) {
2656esp->
num[j-1] += esp->
num[j];
2661esp->
num[j-1] += esp->
num[j];
2671 int i, j, nm1, nm2, d;
2672 const Uint1*q1, *s1;
2674 for(q1=q, s1=s,
i=0;
i<esp->
size;
i++) {
2675 if(esp->
num[
i] == 0)
continue;
2677 if(esp->
num[
i] >= 12) {
2680 while(q1-nm1>=q && (*(q1-nm1) == *(s1-nm1))) ++nm1;
2682q1 += esp->
num[
i];
2683s1 += esp->
num[
i];
2685 if(i < esp->
size-1) {
2686 while((q1+1<qf) && (s1+1<sf) && (*(q1++) == *(s1++))) ++nm2;
2691q1 += esp->
num[
i];
2692s1 += esp->
num[
i];
2695q1 += esp->
num[
i];
2697s1 += esp->
num[
i];
2702 for(
i=0;
i<esp->
size;
i++) {
2704q += esp->
num[
i];
2705s += esp->
num[
i];
2709&& esp->
num[
i-2] > 0) {
2710d = esp->
num[
i] + esp->
num[
i-1] + esp->
num[
i-2];
2713(esp->
num[
i-2]) = 0;
2714(esp->
num[
i-1]) = 2;
2715(esp->
num[
i]) = 0;
2721}
else if(d < 12) {
2726q -= esp->
num[
i-1];
2727s -= esp->
num[
i-1];
2735 for(j=0; j<esp->
num[
i-1]; ++j, ++q1, ++s1, ++q, ++s) {
2736 if(*q1 == *s1) nm1++;
2737 if(*q == *s) nm2++;
2739 for(j=0; j<d; ++j, ++q, ++s) {
2740 if(*q == *s) nm2++;
2742 if(nm2 >= nm1 - d) {
2743(esp->
num[
i-2]) -= d;
2744(esp->
num[
i-1]) += d;
2745(esp->
num[
i]) -= d;
2753q += esp->
num[
i];
2755s += esp->
num[
i];
2772 Int4q_avail, s_avail;
2773 Int4q_ext_l, q_ext_r, s_ext_l, s_ext_r;
2780 Int4q_seed_start = q_off;
2781 Int4s_seed_start = s_off;
2783q_avail = query_length - q_off;
2784s_avail = subject_length - s_off;
2787 if(!compressed_subject) {
2807 Int4new_dist, xdrop;
2812fwd_prelim_tback, rem, fence_hit, &fwd_start_point);
2814 if(fence_hit && *fence_hit) {
2818 if(score >=0)
break;
2833 if(compressed_subject)
2838 Int4new_dist, xdrop, score1;
2844rev_prelim_tback, rem, fence_hit, &rev_start_point);
2845 if(fence_hit && *fence_hit) {
2870(q_ext_r + s_ext_r + q_ext_l + s_ext_l)*score_params->
reward/2 -
2872}
else if(score_params->
reward% 2 == 1) {
2880 ASSERT(!compressed_subject);
2890 Int4q_box_l = q_off - q_ext_l;
2891 Int4s_box_l = s_off - s_ext_l;
2892 Int4q_box_r = q_off + q_ext_r;
2893 Int4s_box_r = s_off + s_ext_r;
2894 Int4q_seed_start_l = q_off - rev_start_point.
start_q;
2895 Int4s_seed_start_l = s_off - rev_start_point.
start_s;
2896 Int4q_seed_start_r = q_off + fwd_start_point.
start_q;
2897 Int4s_seed_start_r = s_off + fwd_start_point.
start_s;
2898 Int4valid_seed_len_l = 0;
2899 Int4valid_seed_len_r = 0;
2901 if(q_seed_start_r < q_box_r && s_seed_start_r < s_box_r) {
2902valid_seed_len_r =
MIN(q_box_r - q_seed_start_r,
2903s_box_r - s_seed_start_r);
2904valid_seed_len_r =
MIN(valid_seed_len_r,
2907q_seed_start_r = q_off;
2908s_seed_start_r = s_off;
2911 if(q_seed_start_l > q_box_l && s_seed_start_l > s_box_l) {
2912valid_seed_len_l =
MIN(q_seed_start_l - q_box_l,
2913s_seed_start_l - s_box_l);
2914valid_seed_len_l =
MIN(valid_seed_len_l,
2917q_seed_start_l = q_off;
2918s_seed_start_l = s_off;
2921 if(valid_seed_len_r > valid_seed_len_l) {
2922q_seed_start = q_seed_start_r + valid_seed_len_r;
2923s_seed_start = s_seed_start_r + valid_seed_len_r;
2926q_seed_start = q_seed_start_l - valid_seed_len_l;
2927s_seed_start = s_seed_start_l - valid_seed_len_l;
2932q_off-q_ext_l, s_off-s_ext_l,
2933q_off+q_ext_r, s_off+s_ext_r,
2934q_seed_start, s_seed_start,
2953 Int4q_length, s_length;
2954 Int4private_q_start, private_s_start;
2955 Int4score_right = 0, score_left = 0;
2956 Uint1offset_adjustment;
2980 if(q_length > query_blk->
length|| s_length > subject_blk->
length)
2988&private_q_start, &private_s_start, gap_align,
2989score_params,
TRUE, x_dropoff);
2992gap_align->
query_start= q_length - private_q_start;
2996 if(q_length < query_blk->length &&
2997s_length < subject_blk->length)
3001query_blk->
length-q_length,
3004 if(score_right < 0)
3014gap_align->
score= score_right+score_left;
3041 Int4a_index, a_base_pair;
3042 Int4b_index, b_size, first_b_index, last_b_index, b_increment;
3046 Int4num_extra_cells;
3050 Int4gap_open_extend;
3066gap_open = score_params->
gap_open;
3068gap_open_extend = gap_open + gap_extend;
3070 if(x_dropoff < gap_open_extend)
3071x_dropoff = gap_open_extend;
3073 if(
N<= 0 ||
M<= 0)
3083num_extra_cells = x_dropoff / gap_extend + 3;
3085num_extra_cells =
N+ 3;
3095score_array = gap_align->
dp_mem;
3096score = -gap_open_extend;
3097score_array[0].
best= 0;
3098score_array[0].
best_gap= -gap_open_extend;
3100 for(
i= 1;
i<=
N;
i++) {
3101 if(score < -x_dropoff)
3104score_array[
i].
best= score;
3105score_array[
i].
best_gap= score - gap_open_extend;
3106score -= gap_extend;
3115 if(reverse_sequence)
3120 for(a_index = 1; a_index <=
M; a_index++) {
3125 if(reverse_sequence) {
3128matrix_row = matrix[a_base_pair];
3132(3-((a_index-1)%4)));
3133matrix_row = matrix[a_base_pair];
3136 if(reverse_sequence)
3137b_ptr = &
B[
N- first_b_index];
3139b_ptr = &
B[first_b_index];
3144last_b_index = first_b_index;
3146 for(b_index = first_b_index; b_index < b_size; b_index++) {
3148b_ptr += b_increment;
3149score_gap_col = score_array[b_index].
best_gap;
3150next_score = score_array[b_index].
best+ matrix_row[ *b_ptr ];
3152 if(score < score_gap_col)
3153score = score_gap_col;
3155 if(score < score_gap_row)
3156score = score_gap_row;
3158 if(best_score - score > x_dropoff) {
3170 if(b_index == first_b_index)
3176last_b_index = b_index;
3177 if(score > best_score) {
3179*a_offset = a_index;
3180*b_offset = b_index;
3187score_gap_row -= gap_extend;
3188score_gap_col -= gap_extend;
3189score_array[b_index].
best_gap=
MAX(score - gap_open_extend,
3191score_gap_row =
MAX(score - gap_open_extend, score_gap_row);
3193score_array[b_index].
best= score;
3203 if(first_b_index == b_size)
3206 if(last_b_index + num_extra_cells + 3 >= gap_align->
dp_mem_alloc) {
3210score_array = (
BlastGapDP*)realloc(score_array,
3213gap_align->
dp_mem= score_array;
3216 if(last_b_index < b_size - 1) {
3221b_size = last_b_index + 1;
3229 while(score_gap_row >= (best_score - x_dropoff) && b_size <=
N) {
3230score_array[b_size].
best= score_gap_row;
3231score_array[b_size].
best_gap= score_gap_row - gap_open_extend;
3232score_gap_row -= gap_extend;
3251 Int4index1, max_offset, score, max_score, hsp_end;
3252 const Uint1* query_var,* subject_var;
3260*q_retval = q_start + q_length/2;
3261*s_retval = s_start + q_length/2;
3266query_var =
query+ q_start;
3267subject_var =
subject+ s_start;
3269 for(index1=q_start; index1<hsp_end; index1++) {
3270 if(!(positionBased))
3271score += sbp->
matrix->
data[*query_var][*subject_var];
3274query_var++; subject_var++;
3277max_offset = hsp_end - 1;
3278hsp_end = q_start +
MIN(q_length, s_length);
3279 for(index1=q_start +
HSP_MAX_WINDOW; index1<hsp_end; index1++) {
3280 if(!(positionBased)) {
3282score += sbp->
matrix->
data[*query_var][*subject_var];
3287 if(score > max_score) {
3289max_offset = index1;
3291query_var++; subject_var++;
3296*q_retval = max_offset;
3297*s_retval = (max_offset - q_start) + s_start;
3306 if(!(positionBased))
3307score += sbp->
matrix->
data[*query_var][*subject_var];
3310query_var++; subject_var++;
3327 inthspMaxIdentRun = 10;
3329 Int4index, max_offset, score, max_score, q_start, s_start, q_len;
3337q =
query+ q_start;
3340 while((q-
query< q_len) && (*q++ == *s++)) {
3342 if(score > hspMaxIdentRun)
return;
3344q =
query+ q_start;
3346 while((q-
query>= 0) && (*q-- == *s--)) {
3348 if(score > hspMaxIdentRun)
return;
3350hspMaxIdentRun *= 1.5;
3355q =
query+ q_start;
3358max_offset = q_start;
3361prev_match =
FALSE;
3362 for(index = q_start; index < q_start + q_len; index++) {
3363 match= (*q++ == *s++);
3364 if(
match!= prev_match) {
3365prev_match =
match;
3368}
else if(score > max_score) {
3370max_offset = index - score/2;
3372}
else if(
match) {
3374 if(score > hspMaxIdentRun) {
3375max_offset = index - hspMaxIdentRun/2;
3382 if(
match&& score > max_score) {
3384max_offset = index - score/2;
3386 if(max_score > 0) {
3397 Int4index1, max_offset, score, max_score, hsp_end;
3398 const Uint1* query_var,* subject_var;
3402max_offset = q_start + q_length/2;
3407query_var =
query+ q_start;
3408subject_var =
subject+ s_start;
3410 for(index1=q_start; index1<hsp_end; index1++) {
3411 if(!(positionBased))
3412score += sbp->
matrix->
data[*query_var][*subject_var];
3415query_var++; subject_var++;
3418max_offset = hsp_end - 1;
3419hsp_end = q_start +
MIN(q_length, s_length);
3420 for(index1=q_start +
HSP_MAX_WINDOW; index1<hsp_end; index1++) {
3421 if(!(positionBased)) {
3423score += sbp->
matrix->
data[*query_var][*subject_var];
3428 if(score > max_score) {
3430max_offset = index1;
3432query_var++; subject_var++;
3437max_offset = q_start;
3463 if(!retval->
nodes) {
3535 while(i < init_hitlist->total) {
3542context <= query_info->last_context) {
3545 ASSERT(context <= query_info->last_context);
3551nodes[num_nodes].
init_hsp= &init_array[
i];
3557 while((i < init_hitlist->total) &&
3576nodes[num_nodes].
init_hsp= &init_array[
i];
3584 for(k = num_nodes - 1;k >= 0;k--) {
3587 for(j = k + 1;j < num_nodes;j++) {
3600new_score = self_score + nodes[j].
best_score;
3604new_score +=
MIN(
MIN(q_diff, s_diff) * 3,
3609new_score -=
MAX(
abs(q_diff - s_diff), 1) + score_params->
gap_open;
3611 if(new_score > nodes[k].best_score) {
3613nodes[k].
next= &nodes[j];
3620 for(k = 0;k < num_nodes;k++) {
3630 if(nodes[k].init_hsp->ungapped_data) {
3631 free(nodes[k].init_hsp->ungapped_data);
3639 while(init_hitlist->
total> 0 &&
3641init_hitlist->
total--;
3643 for(k = 0;k < init_hitlist->
total- 1;k++) {
3648init_hitlist->
total--;
3649 while(init_hitlist->
total- 1 > k &&
3651init_hitlist->
total--;
3679 Int4q_start, s_start, q_end, s_end;
3686 Int4rps_cutoff_index = 0;
3698 const doublekRestrictedMult = 0.68;
3700 Int4redo_index = -1;
3701 Int4redo_query = -1;
3703 if(!
query|| !
subject|| !gap_align || !score_params || !ext_params ||
3704!hit_params || !init_hitlist || !hsp_list_ptr)
3707 if(init_hitlist->
total== 0)
3722hit_params, word_params, init_hitlist);
3740restricted_align_array =
3743program_number) + 1,
3748 for(
i= 0;
i< init_hitlist->
total;
i++) {
3750 intquery_index = -1;
3757contxt <= query_info->last_context; contxt++) {
3760q_off < query_info->contexts[contxt].query_offset +
3768 ASSERT(query_index >= 0);
3771 if(found[query_index]) {
3775found[query_index] =
TRUE;
3780(
Int4)(kRestrictedMult *
3783restricted_align_array[query_index] =
TRUE;
3786restricted_align_array[query_index] =
FALSE;
3797rps_cutoff_index =
subject->oid;
3806 if(*hsp_list_ptr ==
NULL)
3809hsp_list = *hsp_list_ptr;
3841 for(index=0; index<init_hitlist->
total; index++)
3845 if(init_hsp_array[index].ungapped_data->score > hit_params->
low_score[query_index])
3846found_high_score[query_index] = 1;
3850 for(index=0; index<init_hitlist->
total; index++)
3860tmp_init_hsp = init_hsp_array[index];
3862tmp_ungapped_data = *(init_hsp_array[index].
ungapped_data);
3865init_hsp = &tmp_init_hsp;
3878 if(index < redo_index && query_index != redo_query) {
3882 if(restricted_align_array && restricted_align_array[query_index]) {
3883restricted_alignment =
TRUE;
3888 if(!found_high_score[query_index])
3908tmp_hsp.
score= score;
3922 Int4cutoff, restricted_cutoff = 0;
3929 if(restricted_alignment)
3930restricted_cutoff = (
Int4)(kRestrictedMult * cutoff);
3951score_params, init_hsp,
3952restricted_alignment,
3955 if(restricted_alignment &&
3956gap_align->
score< cutoff &&
3957gap_align->
score>= restricted_cutoff) {
3972 ASSERT(restricted_align_array);
3973restricted_align_array[query_index] =
FALSE;
3978 for(index2 = 0; index2 < hsp_list->
hspcnt; index2++) {
3983 if(q_index2 != query_index) {
4003hsp_list = new_hsp_list;
4008redo_query = query_index;
4012}
else if(is_greedy) {
4022gap_align, score_params,
4046gap_align, score_params, init_hsp);
4050 if(rpsblast_pssms) {
4053 sfree(found_high_score);
4058 if(gap_align->
score>= cutoff) {
4059 Int2query_frame = 0;
4066query_frame = -query_frame;
4080 sfree(found_high_score);
4103 sfree(found_high_score);
4104 if(restricted_align_array) {
4105 sfree(restricted_align_array);
4108 if(rpsblast_pssms) {
4112*hsp_list_ptr = hsp_list;
4135 Int4s_off,
Int4* private_q_start,
Int4* private_s_start,
4143private_s_start, private_q_start, score_only, edit_block,
4144gap_align, score_params, psi_offset, reversed);
4147private_q_start, private_s_start, score_only, edit_block,
4148gap_align, score_params, psi_offset, reversed);
4155 #define MAX_SUBJECT_OFFSET 90000 4160 #define MAX_TOTAL_GAPS 3000 4164 Int4query_offset,
Int4query_length,
Int4* start_shift)
4167 Int4subject_length = *subject_length_ptr;
4168 Int4max_extension_left, max_extension_right;
4176s_offset = *subject_offset_ptr;
4180max_extension_right = query_length - query_offset +
MAX_TOTAL_GAPS;
4182 if(s_offset <= max_extension_left) {
4185*start_shift = s_offset - max_extension_left;
4186*subject_offset_ptr = max_extension_left;
4189*subject_length_ptr =
4190 MIN(subject_length, s_offset + max_extension_right) - *start_shift;
4216 Booleanfound_start, found_end;
4217 Int4q_length=0, s_length=0, score_right, score_left;
4218 Int4private_q_start, private_s_start;
4223 Int4subject_shift = 0;
4226 if(gap_align ==
NULL)
4260found_start =
FALSE;
4265 if(q_length != 0 && s_length != 0) {
4266found_start =
TRUE;
4270&private_q_start, &private_s_start,
TRUE,
NULL,
4271gap_align, score_params, q_length,
TRUE, switch_seq);
4273 if(restricted_alignment) {
4276&private_q_start, &private_s_start,
4277gap_align, score_params,
4283&private_q_start, &private_s_start,
TRUE,
4284 NULL, gap_align, score_params,
4290gap_align->
query_start= q_length - private_q_start;
4291gap_align->
subject_start= s_length - private_s_start + subject_shift;
4295 if(q_length < query_length && s_length < subject_length) {
4300query_length-q_length+1, subject_length-s_length+1,
4307 if(restricted_alignment) {
4311query_length-q_length,
4312subject_length-s_length,
4315gap_align, score_params,
4322query_length-q_length,
4323subject_length-s_length,
4326 TRUE,
NULL, gap_align, score_params,
4338 if(found_start ==
FALSE) {
4342 if(found_end ==
FALSE) {
4347gap_align->
score= score_right+score_left;
4364 Int4nucl_align_length,
4383 for(
i= 0;
i< rev_prelim_tback->
num_ops;
i++) {
4388 if(next_op == last_op) {
4392last_num += next_num;
4416last_num = next_num;
4435 for(
i= fwd_prelim_tback->
num_ops- 1;
i>= 0;
i--) {
4457new_script->
num--;
4458 if(new_script->
num== 0)
4463fwd_prelim_tback->
num_ops=
i+ 1;
4472 for(
i=0;
i<e_script->
size;
i++)
4474 inttotal_actions=0;
4481last_op = e_script->
op_type[
i];
4486total_actions = last_op * e_script->
num[
i];
4488 if(num_nuc + total_actions >= nucl_align_length) {
4489e_script->
num[
i] = (nucl_align_length - num_nuc +
4490last_op - 1) / last_op;
4494num_nuc += total_actions;;
4500 for(
i=0;
i<e_script->
size;
i++)
4502 if(e_script->
op_type[
i] % 3 != 0 && e_script->
num[
i] > 1) {
4503extra_needed += e_script->
num[
i] - 1;
4511 for(
i=0;
i<e_script->
size;
i++)
4515new_esp->
num[new_esp_i] = e_script->
num[
i];
4518last_op = e_script->
op_type[
i];
4519 if(last_op % 3 != 0 && e_script->
num[
i] > 1) {
4520 Int4num_ops = e_script->
num[
i];
4522new_esp->
num[new_esp_i-1] = 1;
4523 for(esp_index = 1; esp_index < num_ops; esp_index++) {
4524new_esp->
num[new_esp_i] = 1;
4525new_esp->
op_type[new_esp_i] = last_op;
4533*edit_script_ptr = e_script;
4537last_op = e_script->
op_type[0];
4538 for(
i=1;
i<e_script->
size;
i++)
4541(e_script->
num[
i])++;
4543last_op = e_script->
op_type[
i];
4556 Int4score_right, score_left, private_q_length, private_s_length;
4557 Int4q_length, s_length;
4564 if(gap_align ==
NULL)
4574q_length = query_length;
4575s_length = subject_length;
4595q_start, s_start, &private_q_length, &private_s_length,
4596 FALSE, rev_prelim_tback, gap_align, score_params, q_start,
4598gap_align->
query_start= q_start - private_q_length;
4609score_left =
ALIGN_EX(
query,
subject, q_start+1, s_start+1, &private_q_length, &private_s_length, rev_prelim_tback,
4614gap_align->
query_start= q_start - private_q_length + 1;
4620 if((! (fence_hit && *fence_hit)) &&
4621(q_start < q_length) &&
4622(s_start < s_length)) {
4628q_length-q_start, s_length-s_start,
4629&private_q_length, &private_s_length,
FALSE, fwd_prelim_tback,
4630gap_align, score_params, q_start,
FALSE, switch_seq);
4640q_length-q_start-1, s_length-s_start-1, &private_q_length,
4641&private_s_length, fwd_prelim_tback, gap_align,
4646gap_align->
query_stop= q_start + private_q_length + 1;
4647gap_align->
subject_stop= s_start + private_s_length + 1;
4650 if(found_end ==
FALSE) {
4656 Int4nucl_align_length;
4666fwd_prelim_tback, nucl_align_length,
4684score_left += score_params->
gap_open+
4692 for(
i= 1;
i< esp->
size;
i++) {
4694esp->
num[
i-1] = esp->
num[
i];
4700score_right += score_params->
gap_open+
4715gap_align->
score= score_right + score_left;
4731 if(*hsp_list_ptr !=
NULL)
4732hsp_list = *hsp_list_ptr;
4734 if(!init_hitlist) {
4736*hsp_list_ptr =
NULL;
4742 for(index = 0; index < init_hitlist->
total; ++index) {
4752*hsp_list_ptr = hsp_list;
#define COMPRESSION_RATIO
Compression ratio of nucleotide bases (4 bases in 1 byte)
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
#define CODON_LENGTH
Codons are always of length 3.
#define NUM_FRAMES
Number of frames to which we translate in translating searches.
void Blast_InitHitListSortByScore(BlastInitHitList *init_hitlist)
Sort array of initial HSPs by score.
Boolean Blast_InitHitListIsSortedByScore(BlastInitHitList *init_hitlist)
Check if array of initial HSPs is sorted by score.
Boolean BlastGetOffsetsForGappedAlignment(const Uint1 *query, const Uint1 *subject, const BlastScoreBlk *sbp, BlastHSP *hsp, Int4 *q_retval, Int4 *s_retval)
Function to look for the highest scoring window (of size HSP_MAX_WINDOW) in an HSP and return the mid...
Int2 BLAST_GappedAlignmentWithTraceback(EBlastProgramType program, const Uint1 *query, const Uint1 *subject, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 q_start, Int4 s_start, Int4 query_length, Int4 subject_length, Boolean *fence_hit)
Perform a gapped alignment with traceback.
static void s_SetUpLocalBlastSequenceBlk(const BLAST_SequenceBlk *concatenated_query, const BlastQueryInfo *query_info, Int4 context, BLAST_SequenceBlk *single_query, Int4 *query_start)
Set up a BLAST_SequenceBlk structure for a single query sequence.
static Int2 s_BlastOOFTracebackToGapEditScript(GapPrelimEditBlock *rev_prelim_tback, GapPrelimEditBlock *fwd_prelim_tback, Int4 nucl_align_length, GapEditScript **edit_script_ptr)
Converts OOF traceback from a gapped alignment to a GapEditScript.
Int4 BlastGetStartForGappedAlignment(const Uint1 *query, const Uint1 *subject, const BlastScoreBlk *sbp, Uint4 q_start, Uint4 q_length, Uint4 s_start, Uint4 s_length)
Function to look for the highest scoring window (of size HSP_MAX_WINDOW) in an HSP and return the mid...
#define RESTRICT_SIZE
For restricted gapped alignment, gaps may only start once in this many sequence offsets.
static NCBI_INLINE void s_AdjustInitialHSPOffsets(BlastInitHSP *init_hsp, Int4 query_start)
Adjust the HSP offsets in the initial ungapped HSP structure given the query start.
#define MININT
Lower bound for scores.
static Boolean s_GapPurgeState(GapStateArrayStruct *state_struct)
Remove a state from a state structure.
Int4 Blast_SemiGappedAlign(const Uint1 *A, const Uint1 *B, Int4 M, Int4 N, Int4 *a_offset, Int4 *b_offset, Boolean score_only, GapPrelimEditBlock *edit_block, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 query_offset, Boolean reversed, Boolean reverse_sequence, Boolean *fence_hit)
Low level function to perform gapped extension in one direction with or without traceback.
Int2 BLAST_GetGappedScore(EBlastProgramType program_number, BLAST_SequenceBlk *query, BlastQueryInfo *query_info, BLAST_SequenceBlk *subject, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, const BlastExtensionParameters *ext_params, const BlastHitSavingParameters *hit_params, const BlastInitialWordParameters *word_params, BlastInitHitList *init_hitlist, BlastHSPList **hsp_list_ptr, BlastGappedStats *gapped_stats, Boolean *fence_hit)
Performs gapped extension for all non-Mega BLAST programs, given that ungapped extension has been don...
#define CHUNKSIZE
Minimal size of a chunk for state array allocation.
static void s_UpdateEditScript(GapEditScript *esp, int pos, int bf, int af)
static SGreedyAlignMem * s_BlastGreedyAlignsFree(SGreedyAlignMem *gamp)
Deallocate the memory for greedy gapped alignment.
static Int2 s_BlastGreedyGapAlignStructFill(BlastGapAlignStruct *gap_align, Int4 q_start, Int4 s_start, Int4 q_end, Int4 s_end, Int4 q_seed_start, Int4 s_seed_start, Int4 score, GapEditScript *esp)
Fills the BlastGapAlignStruct structure with the results of a greedy gapped extension.
static int s_CompareInitHSPsByQueryOffsetScore(const void *v1, const void *v2)
Int2 BLAST_GetUngappedHSPList(BlastInitHitList *init_hitlist, BlastQueryInfo *query_info, BLAST_SequenceBlk *subject, const BlastHitSavingOptions *hit_options, BlastHSPList **hsp_list_ptr)
Convert initial HSP list to an HSP list: to be used in ungapped search.
static void s_ReduceGaps(GapEditScript *esp, const Uint1 *q, const Uint1 *s, const Uint1 *qf, const Uint1 *sf)
static Int2 s_BlastProtGappedAlignment(EBlastProgramType program, BLAST_SequenceBlk *query_in, BLAST_SequenceBlk *subject_in, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, BlastInitHSP *init_hsp, Boolean restricted_alignment, Boolean *fence_hit)
Performs gapped extension for protein sequences, given two sequence blocks, scoring and extension opt...
Int4 ALIGN_EX(const Uint1 *A, const Uint1 *B, Int4 M, Int4 N, Int4 *a_offset, Int4 *b_offset, GapPrelimEditBlock *edit_block, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 query_offset, Boolean reversed, Boolean reverse_sequence, Boolean *fence_hit)
Low level function to perform dynamic programming gapped extension with traceback.
#define MAX_SUBJECT_OFFSET
Maximal subject length after which the offsets are adjusted to a subsequence.
static Int4 s_OutOfFrameGappedAlign(const Uint1 *A, const Uint1 *B, Int4 M, Int4 N, Int4 *a_offset, Int4 *b_offset, Boolean score_only, GapPrelimEditBlock *edit_block, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 query_offset, Boolean reversed)
Low level function to perform gapped extension with out-of-frame gapping with or without traceback.
static NCBI_INLINE Int4 s_GetUngappedHSPContext(const BlastQueryInfo *query_info, const BlastInitHSP *init_hsp)
Simple wrapper around binary search function for BlastQueryInfo structure to obtain the context in wh...
GapEditScript * Blast_PrelimEditBlockToGapEditScript(GapPrelimEditBlock *rev_prelim_tback, GapPrelimEditBlock *fwd_prelim_tback)
Convert the initial list of traceback actions from a non-OOF gapped alignment into a blast edit scrip...
static Int4 s_BlastAlignPackedNucl(Uint1 *B, Uint1 *A, Int4 N, Int4 M, Int4 *pej, Int4 *pei, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Boolean reverse_sequence, Int4 x_dropoff)
Aligns two nucleotide sequences, one (A) should be packed in the same way as the BLAST databases,...
static Int4 s_OutOfFrameSemiGappedAlignWrap(const Uint1 *query, const Uint1 *subject, Int4 q_off, Int4 s_off, Int4 *private_q_start, Int4 *private_s_start, Boolean score_only, GapPrelimEditBlock *edit_block, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 psi_offset, Boolean reversed, Boolean switch_seq)
Out-of-frame gapped alignment wrapper function.
ChainingStruct * ChainingStructFree(ChainingStruct *ch)
@ SCRIPT_SUB
Substitution.
@ SCRIPT_GAP_IN_A
Deletion.
@ SCRIPT_GAP_IN_B
Insertion.
@ SCRIPT_EXTEND_GAP_B
continue a gap in B
@ SCRIPT_EXTEND_GAP_A
continue a gap in A
@ SCRIPT_OP_MASK
Mask for edit script operations.
static SGreedyAlignMem * s_BlastGreedyAlignMemAlloc(const BlastScoringParameters *score_params, const BlastExtensionParameters *ext_params, Int4 max_d, Int4 Xdrop)
Allocate memory for the greedy gapped alignment algorithm.
@ SCRIPT_AHEAD_ONE_FRAME
Shift 1 frame in sequence A (gap 2 nucleotides)
@ SCRIPT_NEXT_IN_FRAME
Shift to next base (substitution)
@ SCRIPT_OOF_OPEN_GAP
Opening a gap.
@ SCRIPT_AHEAD_TWO_FRAMES
Shift 2 frames in sequence A (gap 1 nucleotide)
@ SCRIPT_NEXT_PLUS_TWO_FRAMES
Shift to next base plus 2 frames (gap 2 nucleotides in sequence B)
@ SCRIPT_NEXT_PLUS_ONE_FRAME
Shift to next base plus 1 frame (gap 1 nucleotide in sequence B)
Int2 BLAST_GreedyGappedAlignment(const Uint1 *query, const Uint1 *subject, Int4 query_length, Int4 subject_length, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 q_off, Int4 s_off, Boolean compressed_subject, Boolean do_traceback, Boolean *fence_hit)
Greedy gapped alignment, with or without traceback.
void AdjustSubjectRange(Int4 *subject_offset_ptr, Int4 *subject_length_ptr, Int4 query_offset, Int4 query_length, Int4 *start_shift)
Adjusts range of subject sequence to be passed for gapped extension, taking into account the length a...
static Int2 s_BlastDynProgNtGappedAlignment(BLAST_SequenceBlk *query_blk, BLAST_SequenceBlk *subject_blk, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, BlastInitHSP *init_hsp)
Performs dynamic programming style gapped extension, given an initial HSP (offset pair),...
static Int2 s_ChainingAlignment(BlastQueryInfo *query_info, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, const BlastHitSavingParameters *hit_params, const BlastInitialWordParameters *word_params, BlastInitHitList *init_hitlist)
Approximate gapped alignment score by chaining co-linear ungapped alignments.
static void s_AdjustHspOffsetsAndGetQueryData(const BLAST_SequenceBlk *query, const BlastQueryInfo *query_info, BlastInitHSP *init_hsp, BLAST_SequenceBlk *query_out, Int4 *context)
Find the HSP offsets relative to the individual query sequence instead of the concatenated sequence a...
void BlastGetStartForGappedAlignmentNucl(const Uint1 *query, const Uint1 *subject, BlastHSP *hsp)
Function to look for the longest identity match run (up to size HSP_MAX_IDENT_RUN) in an HSP and retu...
static GapStateArrayStruct * s_GapGetState(GapStateArrayStruct **head, Int4 length)
Retrieve the state structure corresponding to a given length.
#define MAX_TOTAL_GAPS
Approximate upper bound on a number of gaps in an HSP, needed to determine the length of the subject ...
Int2 BLAST_GapAlignStructNew(const BlastScoringParameters *score_params, const BlastExtensionParameters *ext_params, Uint4 max_subject_length, BlastScoreBlk *sbp, BlastGapAlignStruct **gap_align_ptr)
Initializes the BlastGapAlignStruct structure.
static void s_RebuildEditScript(GapEditScript *esp)
static Int4 s_OutOfFrameAlignWithTraceback(const Uint1 *A, const Uint1 *B, Int4 M, Int4 N, Int4 *a_offset, Int4 *b_offset, GapPrelimEditBlock *edit_block, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 query_offset, Boolean reversed)
Low level function to perform gapped extension with out-of-frame gapping with traceback.
BlastGapAlignStruct * BLAST_GapAlignStructFree(BlastGapAlignStruct *gap_align)
Deallocates memory in the BlastGapAlignStruct structure.
static Int4 s_RestrictedGappedAlign(const Uint1 *A, const Uint1 *B, Int4 M, Int4 N, Int4 *a_offset, Int4 *b_offset, BlastGapAlignStruct *gap_align, const BlastScoringParameters *score_params, Int4 query_offset, Boolean reverse_sequence)
Low level function to perform score-only gapped extension in one direction.
ChainingStruct * ChainingStructNew(void)
Structures and functions prototypes used for BLAST gapped extension.
#define MAX_DBSEQ_LEN
Split subject sequences if longer than this.
Private interface for blast_gapalign.c.
#define HSP_MAX_WINDOW
Window size used to scan HSP for highest score region, where gapped extension starts.
Int2 Blast_HSPInit(Int4 query_start, Int4 query_end, Int4 subject_start, Int4 subject_end, Int4 query_gapped_start, Int4 subject_gapped_start, Int4 query_context, Int2 query_frame, Int2 subject_frame, Int4 score, GapEditScript **gap_edit, BlastHSP **ret_hsp)
Allocates BlastHSP and inits with information from input.
Int4 BlastHspNumMax(Boolean gapped_calculation, const BlastHitSavingOptions *options)
Calculated the number of HSPs that should be saved.
BlastHSPList * Blast_HSPListNew(Int4 hsp_max)
Creates HSP list structure with a default size HSP array.
BlastHSP * Blast_HSPFree(BlastHSP *hsp)
Deallocate memory for an HSP structure.
Int2 Blast_HSPListSaveHSP(BlastHSPList *hsp_list, BlastHSP *hsp)
Saves HSP information into a BlastHSPList structure.
BlastHSPList * Blast_HSPListFree(BlastHSPList *hsp_list)
Deallocate memory for an HSP list structure as well as all it's components.
void Blast_HSPListSortByScore(BlastHSPList *hsp_list)
Sort the HSPs in an HSP list by score.
Utilities for dealing with BLAST HSPs in the core of BLAST.
Boolean BlastIntervalTreeContainsHSP(const BlastIntervalTree *tree, const BlastHSP *hsp, const BlastQueryInfo *query_info, Int4 min_diag_separation)
Determine whether an interval tree contains an HSP that envelops an input HSP.
void Blast_IntervalTreeReset(BlastIntervalTree *tree)
Empty an interval tree structure but do not free it.
BlastIntervalTree * Blast_IntervalTreeInit(Int4 q_start, Int4 q_end, Int4 s_start, Int4 s_end)
Initialize an interval tree structure.
Int2 BlastIntervalTreeAddHSP(BlastHSP *hsp, BlastIntervalTree *tree, const BlastQueryInfo *query_info, EITreeIndexMethod index_method)
Add an HSP to an existing interval tree.
BlastIntervalTree * Blast_IntervalTreeFree(BlastIntervalTree *tree)
Deallocate an interval tree structure.
Interface for an interval tree, used for fast HSP containment tests.
@ eQueryAndSubject
Index by query and then by subject offset.
#define BLASTERR_MEMORY
System error: out of memory condition.
@ eJumperWithTraceback
Jumper extension (mapping)
@ eDynProgScoreOnly
standard affine gapping
@ eGreedyScoreOnly
Greedy extension (megaBlast)
Boolean Blast_ProgramIsRpsBlast(EBlastProgramType p)
Returns true if program is RPS-BLAST (i.e.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
Boolean Blast_SubjectIsTranslated(EBlastProgramType p)
Returns true if the subject is translated.
Int4 Blast_GetQueryIndexFromQueryOffset(Int4 query_offset, EBlastProgramType program, const BlastQueryInfo *query_info)
Return the query index (zero based), given the query offset in the initial HSP as the program.
Int4 Blast_GetQueryIndexFromContext(Int4 context, EBlastProgramType program)
Given a context from BLAST engine core, return the query index.
Int4 BSearchContextInfo(Int4 n, const BlastQueryInfo *A)
Search BlastContextInfo structures for the specified offset.
Various auxiliary BLAST utility functions.
Int4 BLAST_FrameToContext(Int2 frame, EBlastProgramType program)
Convert translation frame or strand into a context number suitable for indexing into the BlastQueryIn...
#define FENCE_SENTRY
This sentry value is used as a 'fence' around the valid portions of partially decoded sequences.
#define NCBI2NA_UNPACK_BASE(x, N)
Macro to extract base N from a byte x (N >= 0, N < 4)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
void GapPrelimEditBlockAdd(GapPrelimEditBlock *edit_block, EGapAlignOpType op_type, Int4 num_ops)
Add a new operation to a preliminary edit block, possibly combining it with the last operation if the...
GapPrelimEditBlock * GapPrelimEditBlockFree(GapPrelimEditBlock *edit_block)
Frees a preliminary edit block structure.
GapStateArrayStruct * GapStateFree(GapStateArrayStruct *state_struct)
Free the gap state structure.
EGapAlignOpType
Operation types within the edit script.
@ eGapAlignIns
Insertion: a gap in subject.
@ eGapAlignSub
Substitution.
@ eGapAlignDel
Deletion: a gap in query.
GapEditScript * GapEditScriptNew(Int4 size)
Initialize the edit script structure.
GapEditScript * GapEditScriptDelete(GapEditScript *esp)
Free edit script structure.
GapPrelimEditBlock * GapPrelimEditBlockNew(void)
Allocates a preliminary edit block structure.
void GapPrelimEditBlockReset(GapPrelimEditBlock *edit_block)
Reset a preliminary edit block without freeing it.
Prototypes and structures for greedy gapped alignment.
struct SGreedyOffset SGreedyOffset
Bookkeeping structure for greedy alignment.
void MBSpaceFree(SMBSpace *sp)
Free the space structure.
Int4 BLAST_AffineGreedyAlign(const Uint1 *seq1, Int4 len1, const Uint1 *seq2, Int4 len2, Boolean reverse, Int4 xdrop_threshold, Int4 match_cost, Int4 mismatch_cost, Int4 in_gap_open, Int4 in_gap_extend, Int4 *seq1_align_len, Int4 *seq2_align_len, SGreedyAlignMem *aux_data, GapPrelimEditBlock *edit_block, Uint1 rem, Boolean *fence_hit, SGreedySeed *seed)
Perform the greedy extension algorithm with affine gap penalties.
SMBSpace * MBSpaceNew(int num_space_arrays)
Allocate a space structure for greedy alignment At least num_space_arrays will be allocated,...
#define GREEDY_MAX_COST_FRACTION
sequence_length / (this number) is a measure of how hard the alignment code will work to find the opt...
#define GREEDY_MAX_COST
The largest distance to be examined for an optimal alignment.
uint8_t Uint1
1-byte (8-bit) unsigned integer
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
int8_t Int1
1-byte (8-bit) signed integer
JumperGapAlign * JumperGapAlignNew(Int4 size)
JumperGapAlign * JumperGapAlignFree(JumperGapAlign *jgap_align)
if(yy_accept[yy_current_state])
const struct ncbi::grid::netcache::search::fields::SIZE size
int strcmp(const char *str1, const char *str2)
Prototypes for portable math library (ported from C Toolkit)
Int4 BLAST_Gdb3(Int4 *a, Int4 *b, Int4 *c)
Divide 3 numbers by their greatest common divisor.
#define MIN(a, b)
returns smaller of a and b.
#define NCBI_INLINE
"inline" seems to work on our remaining in-house compilers (WorkShop, Compaq, ICC,...
Uint1 Boolean
bool replacment for C
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
#define ASSERT
macro for assert.
#define INT4_MIN
Smallest (most negative) number represented by signed int.
#define MAX(a, b)
returns larger of a and b.
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
static PCRE2_SIZE * offsets
Structure to hold a sequence.
Int4 length
Length of sequence.
Int2 frame
Frame of the query, needed for translated searches.
Uint1 * sequence
Sequence used for search (could be translation).
Uint1 * oof_sequence
Mixed-frame protein representation of a nucleotide sequence for out-of-frame alignment.
The context related information.
Int4 query_length
Length of this query, strand or frame.
Int4 query_offset
Offset of this query, strand or frame in the concatenated super-query.
Int1 frame
Frame number (-1, -2, -3, 0, 1, 2, or 3)
Int4 max_mismatches
Maximum number of mismatches allowed for Jumper.
Boolean chaining
Use chaining for fast approximate gapped extension.
Int4 mismatch_window
Widnow for counting mismatches for Jumper.
EBlastPrelimGapExt ePrelimGapExt
type of preliminary gapped extension (normally) for calculating score.
Computed values used as parameters for gapped alignments.
BlastExtensionOptions * options
The original (unparsed) options.
Int4 gap_x_dropoff_final
X-dropoff value for the final gapped extension (raw)
Int4 gap_x_dropoff
X-dropoff value for gapped extension (raw)
Structure supporting the gapped alignment.
GapPrelimEditBlock * fwd_prelim_tback
traceback from right extensions
Int4 gap_x_dropoff
X-dropoff parameter to use.
GapPrelimEditBlock * rev_prelim_tback
traceback from left extensions
Boolean positionBased
Is this PSI-BLAST?
Int4 query_stop
query end offseet of current alignment
ChainingStruct * chaining
data for chaining
Int4 dp_mem_alloc
current number of structures allocated
Int4 subject_start
subject start offset current alignment
Int4 greedy_subject_seed_start
for greedy alignments, the subject offset of the gapped start point
BlastScoreBlk * sbp
Pointer to the scoring information block.
SGreedyAlignMem * greedy_align_mem
Preallocated memory for the greedy gapped extension.
GapStateArrayStruct * state_struct
Structure to keep extension state information.
Int4 query_start
query start offset of current alignment
Int4 subject_stop
subject end offset of current alignment
Int4 max_mismatches
Max number of mismatches for jumper.
Int4 greedy_query_seed_start
for greedy alignments, the query offset of the gapped start point
Int4 mismatch_window
Window sie for mismatches for jumper.
BlastGapDP * dp_mem
scratch structures for dynamic programming
JumperGapAlign * jumper
data for jumper alignment
Int4 score
Return value: alignment score.
GapEditScript * edit_script
The traceback (gap) information.
Auxiliary structure for dynamic programming gapped extension.
Int4 best_gap
score of best path that ends in a gap at this position
Int4 best
score of best path that ends in a match at this position
Int4 cutoff_score
Raw cutoff score corresponding to the e-value provided by the user if no sum stats,...
Structure containing hit counts from the gapped stage of a BLAST search.
Int4 extensions
Total number of gapped extensions performed.
The structure to hold all HSPs for a given sequence after the gapped alignment.
Int4 hspcnt
Number of HSPs saved.
BlastHSP ** hsp_array
Array of pointers to individual HSPs.
Structure holding all information about an HSP.
BlastSeg query
Query sequence info.
Int4 context
Context number of query.
BlastSeg subject
Subject sequence info.
Int4 score
This HSP's raw score.
Options used when evaluating and saving hits These include: a.
Int4 min_diag_separation
How many diagonals separate a hit from a substantial alignment before it's not blocked out.
Parameter block that contains a pointer to BlastHitSavingOptions and the values derived from it.
BlastGappedCutoffs * cutoffs
per-context gapped cutoff information
Boolean restricted_align
TRUE if approximate score-only gapped alignment is used.
Int4 * low_score
lowest ungapped score that can trigger a gapped alignment if the histlist is already full.
BlastHitSavingOptions * options
The original (unparsed) options.
A node in a path through blast unagpped alignments.
struct BlastInitHSPNode * next
Next node in the path.
BlastInitHSP * init_hsp
Ungapped alignment.
int best_score
Best score for paths that start at this node.
Structure to hold the initial HSP information.
BlastUngappedData * ungapped_data
Pointer to a structure holding ungapped alignment information.
BlastOffsetPair offsets
Offsets in query and subject, or, in PHI BLAST, start and end of pattern in subject.
Structure to hold all initial HSPs for a given subject sequence.
Int4 total
Total number of hits currently saved.
BlastInitHSP * init_hsp_array
Array of offset pairs, possibly with scores.
Parameter block that contains a pointer to BlastInitialWordOptions and the values derived from it.
BlastUngappedCutoffs * cutoffs
cutoff values (one per context)
Main structure describing an interval tree.
The query related information.
Int4 first_context
Index of the first element of the context array.
BlastContextInfo * contexts
Information per context.
int num_queries
Number of query sequences.
Int4 last_context
Index of the last element of the context array.
Structure used for scoring calculations.
SPsiBlastScoreMatrix * psi_matrix
PSSM and associated data.
SBlastScoreMatrix * matrix
scoring matrix data
Scoring options block Used to produce the BlastScoreBlk structure This structure may be needed for lo...
char * matrix
Name of the matrix containing all scores: needed for finding neighboring words.
Boolean is_ooframe
Should out-of-frame gapping be used in a translated search?
Scoring parameters block Contains scoring-related information that is actually used for the blast sea...
Int4 gap_extend
Penalty for each gap residue (scaled version)
Int2 penalty
Penalty for a mismatch.
Int4 shift_pen
Penalty for shifting a frame in out-of-frame gapping (scaled version)
Int4 gap_open
Extra penalty for starting a gap (scaled version)
BlastScoringOptions * options
User-provided values for these params.
Int2 reward
Reward for a match.
Int4 gapped_start
Where the gapped extension started.
Int2 frame
Translation frame.
Int4 offset
Start of hsp.
Int4 cutoff_score
Cutoff score for saving ungapped hits.
Structure to hold ungapped alignment information.
Int4 score
Score of the ungapped alignment.
Int4 length
Length of the ungapped alignment.
Int4 q_start
Start of the ungapped alignment in query.
Int4 s_start
Start of the ungapped alignment in subject.
Workspace used for chaining.
Edit script: linked list of correspondencies between two sequences.
Int4 * num
Array of number of operations.
Int4 size
Size of above arrays.
EGapAlignOpType * op_type
Array of type of operation.
Preliminary version of GapEditBlock, used directly by the low- level dynamic programming routines.
GapPrelimEditScript * edit_ops
array of edit operations
Int4 num_ops
number of edit ops presently in use
A version of GapEditScript used to store initial results from the gapped alignment routines.
Int4 num
Number of operations.
EGapAlignOpType op_type
Type of operation.
Structure to keep memory for state structure.
struct GapStateArrayStruct * next
Next link in the list.
Int4 used
how much of length is used.
Int4 length
length of the state_array.
Uint1 * state_array
array to be used.
int ** data
actual scoring matrix data, stored in row-major form
All auxiliary memory needed for the greedy extension algorithm.
SGreedyOffset ** last_seq2_off_affine
Like last_seq2_off but for affine searches.
Int4 * max_score
array of maximum scores
SMBSpace * space
local memory pool for SGreedyOffset structs
Int4 max_dist
max distance to search
Int4 * diag_bounds
bounds on ranges of diagonals
Int4 ** last_seq2_off
2-D array of distances
Bookkeeping structure for greedy alignment.
Structure for locating high-scoring seeds for greedy alignment.
Int4 start_q
query offset of start of run of matches
Int4 match_length
length of run of matches
Int4 start_s
subject offset of start of run of matches
SBlastScoreMatrix * pssm
position-specific score matrix
Uint4 q_off
Query offset.
Uint4 s_off
Subject offset.
struct BlastOffsetPair::@6 qs_offsets
Query/subject offset pair.
static CS_CONTEXT * context
voidp calloc(uInt items, uInt size)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4