A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/blast__gapalign_8c_source.html below:

NCBI C++ ToolKit: src/algo/blast/core/blast_gapalign.c Source File

58 #define MININT INT4_MIN/2 61 #define CHUNKSIZE 2097152 83

retval->

length

= chunksize;

94

}

else if

(var->

used

== 0) {

110

retval->

length

= chunksize;

113  last

->next = retval;

117 #ifdef ERR_POST_EX_DEFINED 135

state_struct->

used

= 0;

136

state_struct = state_struct->

next

;

176  Int4

max_d_1, d_diff, max_cost, gd,

i

;

177  Int4

reward, penalty, gap_open, gap_extend;

178  Int4

Mis_cost, GE_cost;

180  if

(score_params ==

NULL

|| (!ext_params && !Xdrop))

183  if

(score_params->

reward

% 2 == 1) {

184

reward = 2*score_params->

reward

;

185

penalty = -2*score_params->

penalty

;

189

gap_open = 2*score_params->

gap_open

;

192

reward = score_params->

reward

;

193

penalty = -score_params->

penalty

;

197

gap_open = score_params->

gap_open

;

201  if

(gap_open == 0 && gap_extend == 0)

202

gap_extend = reward / 2 + penalty;

206

gamp->

xdrop

= Xdrop;

209

d_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);

233

Mis_cost = reward + penalty;

234

GE_cost = gap_extend+reward/2;

237

max_cost =

MAX

(Mis_cost, gap_open+GE_cost);

238

gd =

BLAST_Gdb3

(&Mis_cost, &gap_open, &GE_cost);

239

d_diff = (Xdrop+reward/2)/gd+1;

249  for

(

i

= 1;

i

<= max_cost;

i

++)

294  Uint4

max_subject_length,

300  if

(!gap_align_ptr || !sbp || !score_params || !ext_params)

305

*gap_align_ptr = gap_align;

307

gap_align->

sbp

= sbp;

330

max_subject_length, 0);

387  Int4

b_index, b_size, first_b_index, last_b_index, b_increment;

394  Int4

gap_open_extend;

408  Uint1

* edit_script_row;

409  Uint1

** edit_script;

410  Int4

*edit_start_offset;

411  Int4

edit_script_num_rows;

413  Uint1

script, next_script, script_row, script_col;

414  Int4

num_extra_cells;

423

gap_open = score_params->

gap_open

;

425

gap_open_extend = gap_open + gap_extend;

428  if

(x_dropoff < gap_open_extend)

429

x_dropoff = gap_open_extend;

431  if

(

N

<= 0 ||

M

<= 0)

448

edit_script_num_rows = 100;

449

edit_script = (

Uint1

**)

malloc

(

sizeof

(

Uint1

*) * edit_script_num_rows);

450

edit_start_offset = (

Int4

*)

malloc

(

sizeof

(

Int4

) * edit_script_num_rows);

458

num_extra_cells = x_dropoff / gap_extend + 3;

460

num_extra_cells =

N

+ 3;

473

edit_start_offset[0] = 0;

476

score = -gap_open_extend;

477

score_array = gap_align->

dp_mem

;

478

score_array[0].

best

= 0;

479

score_array[0].

best_gap

= -gap_open_extend;

481  for

(

i

= 1;

i

<=

N

;

i

++) {

482  if

(score < -x_dropoff)

485

score_array[

i

].

best

= score;

486

score_array[

i

].

best_gap

= score - gap_open_extend;

490

state_struct->

used

=

i

+ 1;

495  if

(reverse_sequence)

500  for

(a_index = 1; a_index <=

M

; a_index++) {

516

b_size - first_b_index + num_extra_cells);

519  N

+ 3 - first_b_index);

521  if

(a_index == edit_script_num_rows) {

522

edit_script_num_rows = edit_script_num_rows * 2;

523

edit_script = (

Uint1

**)realloc(edit_script,

524

edit_script_num_rows *

526

edit_start_offset = (

Int4

*)realloc(edit_start_offset,

527

edit_script_num_rows *

531

edit_script[a_index] = state_struct->

state_array

+

532

state_struct->

used

+ 1;

533

edit_start_offset[a_index] = first_b_index;

538

edit_script_row = edit_script[a_index] - first_b_index;

539

orig_b_index = first_b_index;

542  if

(reverse_sequence)

543

matrix_row = matrix[

A

[

M

- a_index ] ];

545

matrix_row = matrix[

A

[ a_index ] ];

548  if

(reversed || reverse_sequence)

549

matrix_row = pssm[

M

- a_index];

551

matrix_row = pssm[a_index + query_offset];

554  if

(reverse_sequence)

555

b_ptr = &

B

[

N

- first_b_index];

557

b_ptr = &

B

[first_b_index];

561

last_b_index = first_b_index;

563  for

(b_index = first_b_index; b_index < b_size; b_index++) {

564  int

matrix_index = 0;

566

b_ptr += b_increment;

567

score_gap_col = score_array[b_index].

best_gap

;

569

matrix_index = *b_ptr;

578

next_score = score_array[b_index].

best

+ matrix_row[ *b_ptr ];

592  if

(score < score_gap_col) {

594

score = score_gap_col;

596  if

(score < score_gap_row) {

598

score = score_gap_row;

601  if

(best_score - score > x_dropoff) {

603  if

(first_b_index == b_index)

609

last_b_index = b_index;

610  if

(score > best_score) {

616

score_gap_row -= gap_extend;

617

score_gap_col -= gap_extend;

618  if

(score_gap_col < (score - gap_open_extend)) {

619

score_array[b_index].

best_gap

= score - gap_open_extend;

622

score_array[b_index].

best_gap

= score_gap_col;

623

script += script_col;

626  if

(score_gap_row < (score - gap_open_extend))

627

score_gap_row = score - gap_open_extend;

629

script += script_row;

631

score_array[b_index].

best

= score;

635

edit_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

) {

645

score_array = (

BlastGapDP

*)realloc(score_array,

648

gap_align->

dp_mem

= score_array;

652  if

(last_b_index < b_size - 1) {

653

b_size = last_b_index + 1;

656  while

(score_gap_row >= (best_score - x_dropoff) && b_size <=

N

) {

658

score_array[b_size].

best

= score_gap_row;

659

score_array[b_size].

best_gap

= score_gap_row - gap_open_extend;

660

score_gap_row -= gap_extend;

669

state_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) {

696

edit_script[a_index][b_index - edit_start_offset[a_index]];

730  sfree

(edit_start_offset);

745  Int4

b_index, b_size, first_b_index, last_b_index, b_increment;

752  Int4

gap_open_extend;

764  Int4

num_extra_cells;

767  return ALIGN_EX

(

A

,

B

,

M

,

N

, a_offset, b_offset, edit_block, gap_align,

768

score_params, query_offset, reversed, reverse_sequence,

780

gap_open = score_params->

gap_open

;

782

gap_open_extend = gap_open + gap_extend;

785  if

(x_dropoff < gap_open_extend)

786

x_dropoff = gap_open_extend;

788  if

(

N

<= 0 ||

M

<= 0)

798

num_extra_cells = x_dropoff / gap_extend + 3;

800

num_extra_cells =

N

+ 3;

810

score_array = gap_align->

dp_mem

;

811

score = -gap_open_extend;

812

score_array[0].

best

= 0;

813

score_array[0].

best_gap

= -gap_open_extend;

815  for

(

i

= 1;

i

<=

N

;

i

++) {

816  if

(score < -x_dropoff)

819

score_array[

i

].

best

= score;

820

score_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)

841

matrix_row = matrix[

A

[

M

- a_index ] ];

843

matrix_row = matrix[

A

[ a_index ] ];

846  if

(reversed || reverse_sequence)

847

matrix_row = pssm[

M

- a_index];

849

matrix_row = pssm[a_index + query_offset];

852  if

(reverse_sequence)

853

b_ptr = &

B

[

N

- first_b_index];

855

b_ptr = &

B

[first_b_index];

860

last_b_index = first_b_index;

862  for

(b_index = first_b_index; b_index < b_size; b_index++) {

864

b_ptr += b_increment;

865

score_gap_col = score_array[b_index].

best_gap

;

866

next_score = score_array[b_index].

best

+ matrix_row[ *b_ptr ];

868  if

(score < score_gap_col)

869

score = score_gap_col;

871  if

(score < score_gap_row)

872

score = score_gap_row;

874  if

(best_score - score > x_dropoff) {

886  if

(b_index == first_b_index)

892

last_b_index = b_index;

893  if

(score > best_score) {

903

score_gap_row -= gap_extend;

904

score_gap_col -= gap_extend;

905

score_array[b_index].

best_gap

=

MAX

(score - gap_open_extend,

907

score_gap_row =

MAX

(score - gap_open_extend, score_gap_row);

908

score_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

) {

927

score_array = (

BlastGapDP

*)realloc(score_array,

930

gap_align->

dp_mem

= score_array;

933  if

(last_b_index < b_size - 1) {

938

b_size = last_b_index + 1;

946  while

(score_gap_row >= (best_score - x_dropoff) && b_size <=

N

) {

947

score_array[b_size].

best

= score_gap_row;

948

score_array[b_size].

best_gap

= score_gap_row - gap_open_extend;

949

score_gap_row -= gap_extend;

966 #define RESTRICT_SIZE 10 1001  Int4

b_index, b_size, first_b_index, last_b_index, b_increment;

1002  const Uint1

* b_ptr;

1009  Int4

gap_open_extend;

1021  Int4

num_extra_cells;

1029

gap_open = score_params->

gap_open

;

1031

gap_open_extend = gap_open + gap_extend;

1034  if

(x_dropoff < gap_open_extend)

1035

x_dropoff = gap_open_extend;

1037  if

(

N

<= 0 ||

M

<= 0)

1041

num_extra_cells = x_dropoff / gap_extend + 3;

1043

num_extra_cells =

N

+ 3;

1053

score_array = gap_align->

dp_mem

;

1054

score = -gap_open_extend;

1055

score_array[0].

best

= 0;

1056

score_array[0].

best_gap

= -gap_open_extend;

1058  for

(

i

= 1;

i

<=

N

;

i

++) {

1059  if

(score < -x_dropoff)

1062

score_array[

i

].

best

= score;

1063

score_array[

i

].

best_gap

= score - gap_open_extend;

1064

score -= gap_extend;

1071  if

(reverse_sequence)

1076  for

(a_index = 1; a_index <=

M

; a_index++) {

1079  if

(reverse_sequence)

1080

matrix_row = matrix[

A

[

M

- a_index ] ];

1082

matrix_row = matrix[

A

[ a_index ] ];

1085  if

(reverse_sequence)

1086

matrix_row = pssm[

M

- a_index];

1088

matrix_row = pssm[a_index + query_offset];

1091  if

(reverse_sequence)

1092

b_ptr = &

B

[

N

- first_b_index];

1094

b_ptr = &

B

[first_b_index];

1098

last_b_index = first_b_index;

1112  for

(b_index = first_b_index; b_index < b_size; b_index++) {

1114

b_ptr += b_increment;

1115

next_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)

1128

last_b_index = b_index;

1129  if

(score > best_score) {

1131

*a_offset = a_index;

1132

*b_offset = b_index;

1134

score_array[b_index].

best

= score;

1144

score_gap_col = score_array[b_index].

best_gap

;

1146  if

(score < score_gap_col)

1147

score = score_gap_col;

1149  if

(best_score - score > x_dropoff) {

1151  if

(b_index == first_b_index)

1155

last_b_index = b_index;

1156  if

(score > best_score) {

1158

*a_offset = a_index;

1159

*b_offset = b_index;

1162

score_gap_col -= gap_extend;

1164  MAX

(score - gap_open_extend, score_gap_col);

1165

score_array[b_index].

best

= score;

1171

score_gap_row = score;

1177  for

(b_index = first_b_index; b_index < b_size; b_index++) {

1179

b_ptr += b_increment;

1180

next_score = score_array[b_index].

best

+ matrix_row[ *b_ptr ];

1182  if

(b_index != b_gap) {

1187  if

(score < score_gap_row)

1188

score = score_gap_row;

1190  if

(best_score - score > x_dropoff) {

1192  if

(b_index == first_b_index)

1196

last_b_index = b_index;

1197  if

(score > best_score) {

1199

*a_offset = a_index;

1200

*b_offset = b_index;

1203

score_gap_row -= gap_extend;

1204

score_gap_row =

MAX

(score - gap_open_extend,

1206

score_array[b_index].

best

= score;

1217

score_gap_col = score_array[b_index].

best_gap

;

1219  if

(score < score_gap_col)

1220

score = score_gap_col;

1221  if

(score < score_gap_row)

1222

score = score_gap_row;

1224  if

(best_score - score > x_dropoff) {

1226  if

(b_index == first_b_index)

1230

last_b_index = b_index;

1231  if

(score > best_score) {

1233

*a_offset = a_index;

1234

*b_offset = b_index;

1237

score_gap_row -= gap_extend;

1238

score_gap_col -= gap_extend;

1240  MAX

(score - gap_open_extend, score_gap_col);

1241

score_gap_row =

MAX

(score - gap_open_extend,

1243

score_array[b_index].

best

= score;

1250  if

(first_b_index == b_size)

1257

b_gap = first_b_index;

1261  if

(last_b_index + num_extra_cells + 3 >= gap_align->

dp_mem_alloc

) {

1265

score_array = (

BlastGapDP

*)realloc(score_array,

1268

gap_align->

dp_mem

= score_array;

1271  if

(last_b_index < b_size - 1) {

1272

b_size = last_b_index + 1;

1284  while

(score_gap_row >= (best_score - x_dropoff) && b_size <=

N

) {

1285

score_array[b_size].

best

= score_gap_row;

1286

score_array[b_size].

best_gap

= score_gap_row - gap_open_extend;

1287

score_gap_row -= gap_extend;

1340  Int4

b_index, b_size, first_b_index, last_b_index;

1346  Int4

gap_open_extend;

1362  Int4

score_other_frame1;

1363  Int4

score_other_frame2;

1367  Uint1

** edit_script;

1368  Uint1

* edit_script_row;

1369  Int4

*edit_start_offset;

1370  Int4

edit_script_num_rows;

1372  Int1

script, next_script;

1373  Int4

num_extra_cells;

1383

gap_open = score_params->

gap_open

;

1385

gap_open_extend = gap_open + gap_extend;

1386

shift_penalty = score_params->

shift_pen

;

1389  if

(x_dropoff < gap_open_extend)

1390

x_dropoff = gap_open_extend;

1392  if

(

N

<= 0 ||

M

<= 0)

1409

edit_script_num_rows = 100;

1410

edit_script = (

Uint1

**)

malloc

(

sizeof

(

Uint1

*) * edit_script_num_rows);

1411

edit_start_offset = (

Int4

*)

malloc

(

sizeof

(

Int4

) * edit_script_num_rows);

1420

num_extra_cells =

CODON_LENGTH

* (x_dropoff / gap_extend + 5);

1422

num_extra_cells =

N

+ 5;

1435

edit_start_offset[0] = 0;

1438

score_array = gap_align->

dp_mem

;

1439

score = -gap_open_extend;

1440

score_array[0].

best

= 0;

1441

score_array[0].

best_gap

= -gap_open_extend;

1443  for

(

i

= 3;

i

<=

N

+ 2;

i

+= 3) {

1444

score_array[

i

].

best

= score;

1445

score_array[

i

].

best_gap

= score - gap_open_extend;

1456  if

(score < -x_dropoff)

1458

score -= gap_extend;

1467

state_struct->

used

= b_size + 1;

1480  for

(a_index = 1; a_index <=

M

; a_index++) {

1496

b_size - first_b_index + num_extra_cells);

1499  N

+ 5 - first_b_index);

1501  if

(a_index == edit_script_num_rows) {

1502

edit_script_num_rows = edit_script_num_rows * 2;

1503

edit_script = (

Uint1

**)realloc(edit_script,

1504

edit_script_num_rows *

1506

edit_start_offset = (

Int4

*)realloc(edit_start_offset,

1507

edit_script_num_rows *

1511

edit_script[a_index] = state_struct->

state_array

+

1512

state_struct->

used

+ 1;

1513

edit_start_offset[a_index] = first_b_index;

1518

edit_script_row = edit_script[a_index] - first_b_index;

1519

orig_b_index = first_b_index;

1522

matrix_row = matrix[

A

[ a_index * increment ] ];

1526

matrix_row = pssm[

M

- a_index];

1528

matrix_row = pssm[a_index + query_offset];

1539

score_other_frame1 =

MININT

;

1540

score_other_frame2 =

MININT

;

1541

last_b_index = first_b_index;

1542

b_index = first_b_index;

1547  while

(b_index < b_size) {

1551

score =

MAX

(score_other_frame1, score_other_frame2) - shift_penalty;

1552

score =

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)

1568

score += matrix_row[

B

[ b_index * increment ] ];

1570

score_other_frame1 =

MAX

(score_col1, score_array[b_index].best);

1571

score_col1 = score_array[b_index].

best

;

1572

score_gap_col = score_array[b_index].

best_gap

;

1574  if

(score <

MAX

(score_gap_col, score_row1)) {

1575  if

(score_gap_col > score_row1) {

1576

score = score_gap_col;

1584  if

(best_score - score > x_dropoff) {

1585  if

(first_b_index == b_index)

1586

first_b_index = b_index + 1;

1591

last_b_index = b_index;

1592

score_array[b_index].

best

= score;

1593

score_array[b_index].

best_gap

= score_gap_col - gap_extend;

1594

score_row1 -= gap_extend;

1598  if

(best_score - score > x_dropoff) {

1599  if

(first_b_index == b_index)

1600

first_b_index = b_index + 1;

1605

last_b_index = b_index;

1606

score_array[b_index].

best

= score;

1607  if

(score > best_score) {

1609

*a_offset = a_index;

1610

*b_offset = b_index;

1613

score -= gap_open_extend;

1614

score_row1 -= gap_extend;

1615  if

(score > score_row1)

1620

score_gap_col -= gap_extend;

1621  if

(score < score_gap_col) {

1622

score_array[b_index].

best_gap

= score_gap_col;

1626

score_array[b_index].

best_gap

= score;

1631

edit_script_row[b_index++] = script;

1632  if

(b_index >= b_size) {

1634

score_row1 = score_row2;

1635

score_row2 = score_row3;

1642

score =

MAX

(score_other_frame1, score_other_frame2) - shift_penalty;

1643

score =

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)

1659

score += matrix_row[

B

[ b_index * increment ] ];

1660

score_other_frame2 =

MAX

(score_col2, score_array[b_index].best);

1661

score_col2 = score_array[b_index].

best

;

1662

score_gap_col = score_array[b_index].

best_gap

;

1664  if

(score <

MAX

(score_gap_col, score_row2)) {

1665

score =

MAX

(score_gap_col, score_row2);

1666  if

(best_score - score > x_dropoff) {

1667  if

(first_b_index == b_index)

1668

first_b_index = b_index + 1;

1673  if

(score == score_gap_col)

1678

last_b_index = b_index;

1679

score_array[b_index].

best

= score;

1680

score_array[b_index].

best_gap

= score_gap_col - gap_extend;

1681

score_row2 -= gap_extend;

1685  if

(best_score - score > x_dropoff) {

1686  if

(first_b_index == b_index)

1687

first_b_index = b_index + 1;

1692

last_b_index = b_index;

1693

score_array[b_index].

best

= score;

1694  if

(score > best_score) {

1696

*a_offset = a_index;

1697

*b_offset = b_index;

1699

score -= gap_open_extend;

1700

score_row2 -= gap_extend;

1701  if

(score > score_row2)

1706

score_gap_col -= gap_extend;

1707  if

(score < score_gap_col) {

1708

score_array[b_index].

best_gap

= score_gap_col;

1712

score_array[b_index].

best_gap

= score;

1717

edit_script_row[b_index++] = script;

1718  if

(b_index >= b_size) {

1720

score_row2 = score_row1;

1721

score_row1 = score_row3;

1728

score =

MAX

(score_other_frame1, score_other_frame2) - shift_penalty;

1729

score =

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)

1745

score += matrix_row[

B

[ b_index * increment ] ];

1746

score_other_frame1 = score_other_frame2;

1747

score_other_frame2 =

MAX

(score_col3, score_array[b_index].best);

1748

score_col3 = score_array[b_index].

best

;

1749

score_gap_col = score_array[b_index].

best_gap

;

1751  if

(score <

MAX

(score_gap_col, score_row3)) {

1752

score =

MAX

(score_gap_col, score_row3);

1753  if

(best_score - score > x_dropoff) {

1754  if

(first_b_index == b_index)

1755

first_b_index = b_index + 1;

1760  if

(score == score_gap_col)

1765

last_b_index = b_index;

1766

score_array[b_index].

best

= score;

1767

score_array[b_index].

best_gap

= score_gap_col - gap_extend;

1768

score_row3 -= gap_extend;

1772  if

(best_score - score > x_dropoff) {

1773  if

(first_b_index == b_index)

1774

first_b_index = b_index + 1;

1779

last_b_index = b_index;

1780

score_array[b_index].

best

= score;

1781  if

(score > best_score) {

1783

*a_offset = a_index;

1784

*b_offset = b_index;

1786

score -= gap_open_extend;

1787

score_row3 -= gap_extend;

1788  if

(score > score_row3)

1793

score_gap_col -= gap_extend;

1794  if

(score < score_gap_col) {

1795

score_array[b_index].

best_gap

= score_gap_col;

1799

score_array[b_index].

best_gap

= score;

1803

edit_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

) {

1819

score_array = (

BlastGapDP

*)realloc(score_array,

1822

gap_align->

dp_mem

= score_array;

1825  if

(last_b_index < b_size - 1) {

1830

b_size = last_b_index + 1;

1841

score =

MAX

(score_row1, score_row2);

1842

score =

MAX

(score, score_row3);

1843  while

(score >= (best_score - x_dropoff) && b_size <

N

+ 1) {

1845

score_array[b_size].

best

= score_row1;

1846

score_array[b_size].

best_gap

= score_row1 - gap_open_extend;

1847

score_row1 -= gap_extend;

1851

score_array[b_size+1].

best

= score_row2;

1852

score_array[b_size+1].

best_gap

= score_row2 - gap_open_extend;

1853

score_row2 -= gap_extend;

1857

score_array[b_size+2].

best

= score_row3;

1858

score_array[b_size+2].

best_gap

= score_row3 - gap_open_extend;

1859

score_row3 -= gap_extend;

1863

score -= gap_extend;

1870

b_size =

MIN

(b_size,

N

+ 1);

1871

state_struct->

used

+=

MAX

(b_index, b_size) - orig_b_index + 1;

1875

last_b_index =

MIN

(b_size + 4,

N

+ 3);

1876  while

(b_size < last_b_index) {

1883

a_index = *a_offset;

1884

b_index = *b_offset;

1887  while

(a_index > 0 || b_index > 0) {

1894

edit_script[a_index][b_index - edit_start_offset[a_index]];

1923  sfree

(edit_start_offset);

1924  sfree

(edit_script);

1957  Int4

b_index, b_size, first_b_index, last_b_index;

1961  Int4

gap_open_extend;

1966  Int4

num_extra_cells;

1980  Int4

score_other_frame1;

1981  Int4

score_other_frame2;

1986

edit_block, gap_align,

1987

score_params, query_offset,

1999

gap_open = score_params->

gap_open

;

2001

gap_open_extend = gap_open + gap_extend;

2002

shift_penalty = score_params->

shift_pen

;

2005  if

(x_dropoff < gap_open_extend)

2006

x_dropoff = gap_open_extend;

2008  if

(

N

<= 0 ||

M

<= 0)

2018

num_extra_cells =

CODON_LENGTH

* (x_dropoff / gap_extend + 5);

2020

num_extra_cells =

N

+ 5;

2030

score_array = gap_align->

dp_mem

;

2031

score = -gap_open_extend;

2032

score_array[0].

best

= 0;

2033

score_array[0].

best_gap

= -gap_open_extend;

2035  for

(

i

= 3;

i

<=

N

+ 2;

i

+= 3) {

2036

score_array[

i

].

best

= score;

2037

score_array[

i

].

best_gap

= score - gap_open_extend;

2042  if

(score < -x_dropoff)

2044

score -= gap_extend;

2065  for

(a_index = 1; a_index <=

M

; a_index++) {

2071

matrix_row = matrix[

A

[ a_index * increment ] ];

2075

matrix_row = pssm[

M

- a_index];

2077

matrix_row = pssm[a_index + query_offset];

2089

score_other_frame1 =

MININT

;

2090

score_other_frame2 =

MININT

;

2091

last_b_index = first_b_index;

2092

b_index = first_b_index;

2094  while

(b_index < b_size) {

2099

score =

MAX

(score_other_frame1, score_other_frame2) - shift_penalty;

2100

score =

MAX

(score, score_col1) +

2101

matrix_row[

B

[ b_index * increment ] ];

2102

score_other_frame1 =

MAX

(score_col1, score_array[b_index].best);

2103

score_col1 = score_array[b_index].

best

;

2104

score_gap_col = score_array[b_index].

best_gap

;

2109  if

(score <

MAX

(score_gap_col, score_row1)) {

2110

score =

MAX

(score_gap_col, score_row1);

2111  if

(best_score - score > x_dropoff) {

2123  if

(first_b_index == b_index)

2124

first_b_index = b_index + 1;

2130

last_b_index = b_index;

2131

score_array[b_index].

best

= score;

2132

score_array[b_index].

best_gap

= score_gap_col - gap_extend;

2133

score_row1 -= gap_extend;

2137  if

(best_score - score > x_dropoff) {

2142  if

(first_b_index == b_index)

2143

first_b_index = b_index + 1;

2152

last_b_index = b_index;

2153

score_array[b_index].

best

= score;

2154  if

(score > best_score) {

2156

*a_offset = a_index;

2157

*b_offset = b_index;

2163

score -= gap_open_extend;

2164

score_row1 -= gap_extend;

2165

score_row1 =

MAX

(score, score_row1);

2167

score_gap_col - gap_extend);

2175  if

(++b_index >= b_size) {

2177

score_row1 = score_row2;

2178

score_row2 = score_row3;

2189

score =

MAX

(score_other_frame1, score_other_frame2) - shift_penalty;

2190

score =

MAX

(score, score_col2) +

2191

matrix_row[

B

[ b_index * increment ] ];

2192

score_other_frame2 =

MAX

(score_col2, score_array[b_index].best);

2193

score_col2 = score_array[b_index].

best

;

2194

score_gap_col = score_array[b_index].

best_gap

;

2196  if

(score <

MAX

(score_gap_col, score_row2)) {

2197

score =

MAX

(score_gap_col, score_row2);

2198  if

(best_score - score > x_dropoff) {

2199  if

(first_b_index == b_index)

2200

first_b_index = b_index + 1;

2205

last_b_index = b_index;

2206

score_array[b_index].

best

= score;

2207

score_array[b_index].

best_gap

= score_gap_col - gap_extend;

2208

score_row2 -= gap_extend;

2212  if

(best_score - score > x_dropoff) {

2213  if

(first_b_index == b_index)

2214

first_b_index = b_index + 1;

2219

last_b_index = b_index;

2220

score_array[b_index].

best

= score;

2221  if

(score > best_score) {

2223

*a_offset = a_index;

2224

*b_offset = b_index;

2226

score -= gap_open_extend;

2227

score_row2 -= gap_extend;

2228

score_row2 =

MAX

(score, score_row2);

2230

score_gap_col - gap_extend);

2234  if

(++b_index >= b_size) {

2236

score_row2 = score_row1;

2237

score_row1 = score_row3;

2244

score =

MAX

(score_other_frame1, score_other_frame2) - shift_penalty;

2245

score =

MAX

(score, score_col3) +

2246

matrix_row[

B

[ b_index * increment ] ];

2247

score_other_frame1 = score_other_frame2;

2248

score_other_frame2 =

MAX

(score_col3, score_array[b_index].best);

2249

score_col3 = score_array[b_index].

best

;

2250

score_gap_col = score_array[b_index].

best_gap

;

2252  if

(score <

MAX

(score_gap_col, score_row3)) {

2253

score =

MAX

(score_gap_col, score_row3);

2254  if

(best_score - score > x_dropoff) {

2255  if

(first_b_index == b_index)

2256

first_b_index = b_index + 1;

2261

last_b_index = b_index;

2262

score_array[b_index].

best

= score;

2263

score_array[b_index].

best_gap

= score_gap_col - gap_extend;

2264

score_row3 -= gap_extend;

2268  if

(best_score - score > x_dropoff) {

2269  if

(first_b_index == b_index)

2270

first_b_index = b_index + 1;

2275

last_b_index = b_index;

2276

score_array[b_index].

best

= score;

2277  if

(score > best_score) {

2279

*a_offset = a_index;

2280

*b_offset = b_index;

2282

score -= gap_open_extend;

2283

score_row3 -= gap_extend;

2284

score_row3 =

MAX

(score, score_row3);

2286

score_gap_col - gap_extend);

2296  if

(first_b_index == b_size)

2301  if

(b_size + num_extra_cells + 5 >= gap_align->

dp_mem_alloc

) {

2305

score_array = (

BlastGapDP

*)realloc(score_array,

2308

gap_align->

dp_mem

= score_array;

2311  if

(last_b_index < b_size - 1) {

2316

b_size = last_b_index + 1;

2327

score =

MAX

(score_row1, score_row2);

2328

score =

MAX

(score, score_row3);

2329  while

(score >= (best_score - x_dropoff) && b_size <

N

+ 1) {

2331

score_array[b_size].

best

= score_row1;

2332

score_array[b_size].

best_gap

= score_row1 - gap_open_extend;

2333

score_row1 -= gap_extend;

2335

score_array[b_size+1].

best

= score_row2;

2336

score_array[b_size+1].

best_gap

= score_row2 - gap_open_extend;

2337

score_row2 -= gap_extend;

2339

score_array[b_size+2].

best

= score_row3;

2340

score_array[b_size+2].

best_gap

= score_row3 - gap_open_extend;

2341

score_row3 -= gap_extend;

2344

score -= gap_extend;

2349

b_size =

MIN

(b_size,

N

+ 1);

2350

last_b_index =

MIN

(b_size + 4,

N

+ 3);

2351  while

(b_size < last_b_index) {

2409  Int4

query_length = 0;

2413  Int4

query_end_pt = 0;

2420

query_length = query_end_pt - *query_start;

2429

single_query->

length

= query_length;

2452  Int4

query_start = 0;

2464

query_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

++) {

2513

esp->

num

[index] = op->

num

;

2517  if

(fwd_prelim_tback->

num_ops

== 0)

2521

esp->

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

--) {

2532

esp->

num

[index] = op->

num

;

2555  Int4

q_seed_start,

Int4

s_seed_start,

2564

gap_align->

score

= score;

2579  if

(--op < 0)

return

;

2582

qd -= esp->

num

[op];

2583

sd -= esp->

num

[op];

2586

qd -= esp->

num

[op];

2589

sd -= esp->

num

[op];

2593

}

while

(qd > 0 || sd > 0);

2595

esp->

num

[op] = -

MAX

(qd, sd);

2597  for

(; op < pos-1; op++) esp->

num

[op] = 0;

2598

esp->

num

[pos] += bf;

2601

esp->

num

[pos-1] = (qd>0) ? qd : -qd;

2608  if

(++op >= esp->

size

)

return

;

2611

qd -= esp->

num

[op];

2612

sd -= esp->

num

[op];

2615

qd -= esp->

num

[op];

2618

sd -= esp->

num

[op];

2622

}

while

(qd > 0 || sd > 0);

2624

esp->

num

[op] = -

MAX

(qd, sd);

2626  for

(; op > pos+1; op--) esp->

num

[op] = 0;

2627

esp->

num

[pos] += af;

2630

esp->

num

[pos+1] = (qd>0) ? qd : -qd;

2636  for

(

i

=0, j=-1;

i

<esp->

size

;

i

++) {

2637  if

(esp->

num

[

i

] == 0)

continue

;

2639

esp->

num

[j] += esp->

num

[

i

];

2643

esp->

num

[j] = esp->

num

[

i

];

2645  int

d = esp->

num

[j] - esp->

num

[

i

];

2647

esp->

num

[j-1] += esp->

num

[

i

];

2651  if

(j == 0 &&

i

- j > 0) {

2656

esp->

num

[j-1] += esp->

num

[j];

2661

esp->

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;

2682

q1 += esp->

num

[

i

];

2683

s1 += esp->

num

[

i

];

2685  if

(i < esp->

size

-1) {

2686  while

((q1+1<qf) && (s1+1<sf) && (*(q1++) == *(s1++))) ++nm2;

2691

q1 += esp->

num

[

i

];

2692

s1 += esp->

num

[

i

];

2695

q1 += esp->

num

[

i

];

2697

s1 += esp->

num

[

i

];

2702  for

(

i

=0;

i

<esp->

size

;

i

++) {

2704

q += esp->

num

[

i

];

2705

s += esp->

num

[

i

];

2709

&& esp->

num

[

i

-2] > 0) {

2710

d = 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) {

2726

q -= esp->

num

[

i

-1];

2727

s -= 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;

2753

q += esp->

num

[

i

];

2755

s += esp->

num

[

i

];

2772  Int4

q_avail, s_avail;

2773  Int4

q_ext_l, q_ext_r, s_ext_l, s_ext_r;

2780  Int4

q_seed_start = q_off;

2781  Int4

s_seed_start = s_off;

2783

q_avail = query_length - q_off;

2784

s_avail = subject_length - s_off;

2787  if

(!compressed_subject) {

2807  Int4

new_dist, xdrop;

2812

fwd_prelim_tback, rem, fence_hit, &fwd_start_point);

2814  if

(fence_hit && *fence_hit) {

2818  if

(score >=0)

break

;

2833  if

(compressed_subject)

2838  Int4

new_dist, xdrop, score1;

2844

rev_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  Int4

q_box_l = q_off - q_ext_l;

2891  Int4

s_box_l = s_off - s_ext_l;

2892  Int4

q_box_r = q_off + q_ext_r;

2893  Int4

s_box_r = s_off + s_ext_r;

2894  Int4

q_seed_start_l = q_off - rev_start_point.

start_q

;

2895  Int4

s_seed_start_l = s_off - rev_start_point.

start_s

;

2896  Int4

q_seed_start_r = q_off + fwd_start_point.

start_q

;

2897  Int4

s_seed_start_r = s_off + fwd_start_point.

start_s

;

2898  Int4

valid_seed_len_l = 0;

2899  Int4

valid_seed_len_r = 0;

2901  if

(q_seed_start_r < q_box_r && s_seed_start_r < s_box_r) {

2902

valid_seed_len_r =

MIN

(q_box_r - q_seed_start_r,

2903

s_box_r - s_seed_start_r);

2904

valid_seed_len_r =

MIN

(valid_seed_len_r,

2907

q_seed_start_r = q_off;

2908

s_seed_start_r = s_off;

2911  if

(q_seed_start_l > q_box_l && s_seed_start_l > s_box_l) {

2912

valid_seed_len_l =

MIN

(q_seed_start_l - q_box_l,

2913

s_seed_start_l - s_box_l);

2914

valid_seed_len_l =

MIN

(valid_seed_len_l,

2917

q_seed_start_l = q_off;

2918

s_seed_start_l = s_off;

2921  if

(valid_seed_len_r > valid_seed_len_l) {

2922

q_seed_start = q_seed_start_r + valid_seed_len_r;

2923

s_seed_start = s_seed_start_r + valid_seed_len_r;

2926

q_seed_start = q_seed_start_l - valid_seed_len_l;

2927

s_seed_start = s_seed_start_l - valid_seed_len_l;

2932

q_off-q_ext_l, s_off-s_ext_l,

2933

q_off+q_ext_r, s_off+s_ext_r,

2934

q_seed_start, s_seed_start,

2953  Int4

q_length, s_length;

2954  Int4

private_q_start, private_s_start;

2955  Int4

score_right = 0, score_left = 0;

2956  Uint1

offset_adjustment;

2980  if

(q_length > query_blk->

length

|| s_length > subject_blk->

length

)

2988

&private_q_start, &private_s_start, gap_align,

2989

score_params,

TRUE

, x_dropoff);

2992

gap_align->

query_start

= q_length - private_q_start;

2996  if

(q_length < query_blk->length &&

2997

s_length < subject_blk->length)

3001

query_blk->

length

-q_length,

3004  if

(score_right < 0)

3014

gap_align->

score

= score_right+score_left;

3041  Int4

a_index, a_base_pair;

3042  Int4

b_index, b_size, first_b_index, last_b_index, b_increment;

3046  Int4

num_extra_cells;

3050  Int4

gap_open_extend;

3066

gap_open = score_params->

gap_open

;

3068

gap_open_extend = gap_open + gap_extend;

3070  if

(x_dropoff < gap_open_extend)

3071

x_dropoff = gap_open_extend;

3073  if

(

N

<= 0 ||

M

<= 0)

3083

num_extra_cells = x_dropoff / gap_extend + 3;

3085

num_extra_cells =

N

+ 3;

3095

score_array = gap_align->

dp_mem

;

3096

score = -gap_open_extend;

3097

score_array[0].

best

= 0;

3098

score_array[0].

best_gap

= -gap_open_extend;

3100  for

(

i

= 1;

i

<=

N

;

i

++) {

3101  if

(score < -x_dropoff)

3104

score_array[

i

].

best

= score;

3105

score_array[

i

].

best_gap

= score - gap_open_extend;

3106

score -= gap_extend;

3115  if

(reverse_sequence)

3120  for

(a_index = 1; a_index <=

M

; a_index++) {

3125  if

(reverse_sequence) {

3128

matrix_row = matrix[a_base_pair];

3132

(3-((a_index-1)%4)));

3133

matrix_row = matrix[a_base_pair];

3136  if

(reverse_sequence)

3137

b_ptr = &

B

[

N

- first_b_index];

3139

b_ptr = &

B

[first_b_index];

3144

last_b_index = first_b_index;

3146  for

(b_index = first_b_index; b_index < b_size; b_index++) {

3148

b_ptr += b_increment;

3149

score_gap_col = score_array[b_index].

best_gap

;

3150

next_score = score_array[b_index].

best

+ matrix_row[ *b_ptr ];

3152  if

(score < score_gap_col)

3153

score = score_gap_col;

3155  if

(score < score_gap_row)

3156

score = score_gap_row;

3158  if

(best_score - score > x_dropoff) {

3170  if

(b_index == first_b_index)

3176

last_b_index = b_index;

3177  if

(score > best_score) {

3179

*a_offset = a_index;

3180

*b_offset = b_index;

3187

score_gap_row -= gap_extend;

3188

score_gap_col -= gap_extend;

3189

score_array[b_index].

best_gap

=

MAX

(score - gap_open_extend,

3191

score_gap_row =

MAX

(score - gap_open_extend, score_gap_row);

3193

score_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

) {

3210

score_array = (

BlastGapDP

*)realloc(score_array,

3213

gap_align->

dp_mem

= score_array;

3216  if

(last_b_index < b_size - 1) {

3221

b_size = last_b_index + 1;

3229  while

(score_gap_row >= (best_score - x_dropoff) && b_size <=

N

) {

3230

score_array[b_size].

best

= score_gap_row;

3231

score_array[b_size].

best_gap

= score_gap_row - gap_open_extend;

3232

score_gap_row -= gap_extend;

3251  Int4

index1, 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;

3266

query_var =

query

+ q_start;

3267

subject_var =

subject

+ s_start;

3269  for

(index1=q_start; index1<hsp_end; index1++) {

3270  if

(!(positionBased))

3271

score += sbp->

matrix

->

data

[*query_var][*subject_var];

3274

query_var++; subject_var++;

3277

max_offset = hsp_end - 1;

3278

hsp_end = q_start +

MIN

(q_length, s_length);

3279  for

(index1=q_start +

HSP_MAX_WINDOW

; index1<hsp_end; index1++) {

3280  if

(!(positionBased)) {

3282

score += sbp->

matrix

->

data

[*query_var][*subject_var];

3287  if

(score > max_score) {

3289

max_offset = index1;

3291

query_var++; subject_var++;

3296

*q_retval = max_offset;

3297

*s_retval = (max_offset - q_start) + s_start;

3306  if

(!(positionBased))

3307

score += sbp->

matrix

->

data

[*query_var][*subject_var];

3310

query_var++; subject_var++;

3327  int

hspMaxIdentRun = 10;

3329  Int4

index, max_offset, score, max_score, q_start, s_start, q_len;

3337

q =

query

+ q_start;

3340  while

((q-

query

< q_len) && (*q++ == *s++)) {

3342  if

(score > hspMaxIdentRun)

return

;

3344

q =

query

+ q_start;

3346  while

((q-

query

>= 0) && (*q-- == *s--)) {

3348  if

(score > hspMaxIdentRun)

return

;

3350

hspMaxIdentRun *= 1.5;

3355

q =

query

+ q_start;

3358

max_offset = q_start;

3361

prev_match =

FALSE

;

3362  for

(index = q_start; index < q_start + q_len; index++) {

3363  match

= (*q++ == *s++);

3364  if

(

match

!= prev_match) {

3365

prev_match =

match

;

3368

}

else if

(score > max_score) {

3370

max_offset = index - score/2;

3372

}

else if

(

match

) {

3374  if

(score > hspMaxIdentRun) {

3375

max_offset = index - hspMaxIdentRun/2;

3382  if

(

match

&& score > max_score) {

3384

max_offset = index - score/2;

3386  if

(max_score > 0) {

3397  Int4

index1, max_offset, score, max_score, hsp_end;

3398  const Uint1

* query_var,* subject_var;

3402

max_offset = q_start + q_length/2;

3407

query_var =

query

+ q_start;

3408

subject_var =

subject

+ s_start;

3410  for

(index1=q_start; index1<hsp_end; index1++) {

3411  if

(!(positionBased))

3412

score += sbp->

matrix

->

data

[*query_var][*subject_var];

3415

query_var++; subject_var++;

3418

max_offset = hsp_end - 1;

3419

hsp_end = q_start +

MIN

(q_length, s_length);

3420  for

(index1=q_start +

HSP_MAX_WINDOW

; index1<hsp_end; index1++) {

3421  if

(!(positionBased)) {

3423

score += sbp->

matrix

->

data

[*query_var][*subject_var];

3428  if

(score > max_score) {

3430

max_offset = index1;

3432

query_var++; subject_var++;

3437

max_offset = q_start;

3463  if

(!retval->

nodes

) {

3535  while

(i < init_hitlist->total) {

3542

context <= query_info->last_context) {

3545  ASSERT

(context <= query_info->last_context);

3551

nodes[num_nodes].

init_hsp

= &init_array[

i

];

3557  while

((i < init_hitlist->total) &&

3576

nodes[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++) {

3600

new_score = self_score + nodes[j].

best_score

;

3604

new_score +=

MIN

(

MIN

(q_diff, s_diff) * 3,

3609

new_score -=

MAX

(

abs

(q_diff - s_diff), 1) + score_params->

gap_open

;

3611  if

(new_score > nodes[k].best_score) {

3613

nodes[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 &&

3641

init_hitlist->

total

--;

3643  for

(k = 0;k < init_hitlist->

total

- 1;k++) {

3648

init_hitlist->

total

--;

3649  while

(init_hitlist->

total

- 1 > k &&

3651

init_hitlist->

total

--;

3679  Int4

q_start, s_start, q_end, s_end;

3686  Int4

rps_cutoff_index = 0;

3698  const double

kRestrictedMult = 0.68;

3700  Int4

redo_index = -1;

3701  Int4

redo_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)

3722

hit_params, word_params, init_hitlist);

3740

restricted_align_array =

3743

program_number) + 1,

3748  for

(

i

= 0;

i

< init_hitlist->

total

;

i

++) {

3750  int

query_index = -1;

3757

contxt <= query_info->last_context; contxt++) {

3760

q_off < query_info->contexts[contxt].query_offset +

3768  ASSERT

(query_index >= 0);

3771  if

(found[query_index]) {

3775

found[query_index] =

TRUE

;

3780

(

Int4

)(kRestrictedMult *

3783

restricted_align_array[query_index] =

TRUE

;

3786

restricted_align_array[query_index] =

FALSE

;

3797

rps_cutoff_index =

subject

->oid;

3806  if

(*hsp_list_ptr ==

NULL

)

3809

hsp_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])

3846

found_high_score[query_index] = 1;

3850  for

(index=0; index<init_hitlist->

total

; index++)

3860

tmp_init_hsp = init_hsp_array[index];

3862

tmp_ungapped_data = *(init_hsp_array[index].

ungapped_data

);

3865

init_hsp = &tmp_init_hsp;

3878  if

(index < redo_index && query_index != redo_query) {

3882  if

(restricted_align_array && restricted_align_array[query_index]) {

3883

restricted_alignment =

TRUE

;

3888  if

(!found_high_score[query_index])

3908

tmp_hsp.

score

= score;

3922  Int4

cutoff, restricted_cutoff = 0;

3929  if

(restricted_alignment)

3930

restricted_cutoff = (

Int4

)(kRestrictedMult * cutoff);

3951

score_params, init_hsp,

3952

restricted_alignment,

3955  if

(restricted_alignment &&

3956

gap_align->

score

< cutoff &&

3957

gap_align->

score

>= restricted_cutoff) {

3972  ASSERT

(restricted_align_array);

3973

restricted_align_array[query_index] =

FALSE

;

3978  for

(index2 = 0; index2 < hsp_list->

hspcnt

; index2++) {

3983  if

(q_index2 != query_index) {

4003

hsp_list = new_hsp_list;

4008

redo_query = query_index;

4012

}

else if

(is_greedy) {

4022

gap_align, score_params,

4046

gap_align, score_params, init_hsp);

4050  if

(rpsblast_pssms) {

4053  sfree

(found_high_score);

4058  if

(gap_align->

score

>= cutoff) {

4059  Int2

query_frame = 0;

4066

query_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  Int4

s_off,

Int4

* private_q_start,

Int4

* private_s_start,

4143

private_s_start, private_q_start, score_only, edit_block,

4144

gap_align, score_params, psi_offset, reversed);

4147

private_q_start, private_s_start, score_only, edit_block,

4148

gap_align, score_params, psi_offset, reversed);

4155 #define MAX_SUBJECT_OFFSET 90000 4160 #define MAX_TOTAL_GAPS 3000 4164  Int4

query_offset,

Int4

query_length,

Int4

* start_shift)

4167  Int4

subject_length = *subject_length_ptr;

4168  Int4

max_extension_left, max_extension_right;

4176

s_offset = *subject_offset_ptr;

4180

max_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  Boolean

found_start, found_end;

4217  Int4

q_length=0, s_length=0, score_right, score_left;

4218  Int4

private_q_start, private_s_start;

4223  Int4

subject_shift = 0;

4226  if

(gap_align ==

NULL

)

4260

found_start =

FALSE

;

4265  if

(q_length != 0 && s_length != 0) {

4266

found_start =

TRUE

;

4270

&private_q_start, &private_s_start,

TRUE

,

NULL

,

4271

gap_align, score_params, q_length,

TRUE

, switch_seq);

4273  if

(restricted_alignment) {

4276

&private_q_start, &private_s_start,

4277

gap_align, score_params,

4283

&private_q_start, &private_s_start,

TRUE

,

4284  NULL

, gap_align, score_params,

4290

gap_align->

query_start

= q_length - private_q_start;

4291

gap_align->

subject_start

= s_length - private_s_start + subject_shift;

4295  if

(q_length < query_length && s_length < subject_length) {

4300

query_length-q_length+1, subject_length-s_length+1,

4307  if

(restricted_alignment) {

4311

query_length-q_length,

4312

subject_length-s_length,

4315

gap_align, score_params,

4322

query_length-q_length,

4323

subject_length-s_length,

4326  TRUE

,

NULL

, gap_align, score_params,

4338  if

(found_start ==

FALSE

) {

4342  if

(found_end ==

FALSE

) {

4347

gap_align->

score

= score_right+score_left;

4364  Int4

nucl_align_length,

4383  for

(

i

= 0;

i

< rev_prelim_tback->

num_ops

;

i

++) {

4388  if

(next_op == last_op) {

4392

last_num += next_num;

4416

last_num = next_num;

4435  for

(

i

= fwd_prelim_tback->

num_ops

- 1;

i

>= 0;

i

--) {

4457

new_script->

num

--;

4458  if

(new_script->

num

== 0)

4463

fwd_prelim_tback->

num_ops

=

i

+ 1;

4472  for

(

i

=0;

i

<e_script->

size

;

i

++)

4474  int

total_actions=0;

4481

last_op = e_script->

op_type

[

i

];

4486

total_actions = last_op * e_script->

num

[

i

];

4488  if

(num_nuc + total_actions >= nucl_align_length) {

4489

e_script->

num

[

i

] = (nucl_align_length - num_nuc +

4490

last_op - 1) / last_op;

4494

num_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) {

4503

extra_needed += e_script->

num

[

i

] - 1;

4511  for

(

i

=0;

i

<e_script->

size

;

i

++)

4515

new_esp->

num

[new_esp_i] = e_script->

num

[

i

];

4518

last_op = e_script->

op_type

[

i

];

4519  if

(last_op % 3 != 0 && e_script->

num

[

i

] > 1) {

4520  Int4

num_ops = e_script->

num

[

i

];

4522

new_esp->

num

[new_esp_i-1] = 1;

4523  for

(esp_index = 1; esp_index < num_ops; esp_index++) {

4524

new_esp->

num

[new_esp_i] = 1;

4525

new_esp->

op_type

[new_esp_i] = last_op;

4533

*edit_script_ptr = e_script;

4537

last_op = e_script->

op_type

[0];

4538  for

(

i

=1;

i

<e_script->

size

;

i

++)

4541

(e_script->

num

[

i

])++;

4543

last_op = e_script->

op_type

[

i

];

4556  Int4

score_right, score_left, private_q_length, private_s_length;

4557  Int4

q_length, s_length;

4564  if

(gap_align ==

NULL

)

4574

q_length = query_length;

4575

s_length = subject_length;

4595

q_start, s_start, &private_q_length, &private_s_length,

4596  FALSE

, rev_prelim_tback, gap_align, score_params, q_start,

4598

gap_align->

query_start

= q_start - private_q_length;

4609

score_left =

ALIGN_EX

(

query

,

subject

, q_start+1, s_start+1, &private_q_length, &private_s_length, rev_prelim_tback,

4614

gap_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)) {

4628

q_length-q_start, s_length-s_start,

4629

&private_q_length, &private_s_length,

FALSE

, fwd_prelim_tback,

4630

gap_align, score_params, q_start,

FALSE

, switch_seq);

4640

q_length-q_start-1, s_length-s_start-1, &private_q_length,

4641

&private_s_length, fwd_prelim_tback, gap_align,

4646

gap_align->

query_stop

= q_start + private_q_length + 1;

4647

gap_align->

subject_stop

= s_start + private_s_length + 1;

4650  if

(found_end ==

FALSE

) {

4656  Int4

nucl_align_length;

4666

fwd_prelim_tback, nucl_align_length,

4684

score_left += score_params->

gap_open

+

4692  for

(

i

= 1;

i

< esp->

size

;

i

++) {

4694

esp->

num

[

i

-1] = esp->

num

[

i

];

4700

score_right += score_params->

gap_open

+

4715

gap_align->

score

= score_right + score_left;

4731  if

(*hsp_list_ptr !=

NULL

)

4732

hsp_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