;
70 const intkNumLists = 3;
71 const intkMaxHspCount = 6;
72 const intkHspCounts[kNumLists] = { 6, 6, 4 };
73 const intkSubjectOffsets[kNumLists][kMaxHspCount] =
74{ { 100, 9950, 5000, 9850, 3000, 9970 },
75{ 9950, 9902, 9970, 10400, 19750, 19820 },
76{ 19805, 25000, 19820, 22000 } };
77 const intkQueryOffsets[kNumLists][kMaxHspCount] =
78{ { 100, 200, 300, 400, 500, 600 },
79{ 200, 452, 600, 100, 200, 300 },
80{ 255, 100, 300, 200 } };
81 const intkLengths[kNumLists][kMaxHspCount] =
82{ { 100, 45, 100, 100, 100, 28 },
83{ 100, 48, 100, 100, 100, 60 },
84{ 45, 200, 60, 200} };
85 const intkScores[kNumLists][kMaxHspCount] =
86{ { 60, 30, 70, 75, 65, 28 },
87{ 80, 40, 62, 77, 72, 44 },
88{ 32, 120, 44, 111 } };
89 const intcontexts[kNumLists][kMaxHspCount] =
90{ { 0, 1, 2, 1, 3, 1 },
96hsp_list->
hspcnt= kHspCounts[chunk];
97 for(index = 0; index < kHspCounts[chunk]; ++index) {
103kQueryOffsets[chunk][index] + kLengths[chunk][index];
105kSubjectOffsets[chunk][index] + kLengths[chunk][index];
138BOOST_REQUIRE_EQUAL(0, status);
139BOOST_REQUIRE(target_t);
143BOOST_REQUIRE(null_sequence ==
NULL);
145 const intkNumTests = 6;
147 Blast_HSPInit(1, 2000, 2000, 3000, 1, 2000, 0, 0, -3, 2000,
NULL, &hsp);
149 const intkMaxTranslation = 99;
150 const intkMaxDiv3 = kMaxTranslation / 3;
153 const intkLength[kNumTests] = {3199, 3399, 3600, 3800, 3999, 4199};
154 const intkValues[2*kNumTests] = {6, 16, 18, 10, 10, 6, 8, 4, 18, 17, 1, 6};
156 for(index=0; index<kNumTests; index++)
162BOOST_REQUIRE_EQUAL(kValues[2*index], (
int) sequence[hsp->
subject.
offset+5]);
166 if(sequence[
i] == 201) ++
n;
168BOOST_REQUIRE(
n!=0);
170 for(;
i< hsp->
subject.
end+ (kMaxDiv3 - 7); ++
i) {
171 if(sequence[
i] == 201) ++
n;
173BOOST_REQUIRE(
n==0);
175 for(;
i< hsp->
subject.
end+ (kMaxDiv3 + 1) &&
n== 0; ++
i) {
176 if(sequence[
i] == 201) ++
n;
178BOOST_REQUIRE(
n!=0);
183BOOST_REQUIRE_EQUAL(kLength[index] + kMaxDiv3, length);
184BOOST_REQUIRE_EQUAL(kValues[2*index+1], (
int) sequence[hsp->
subject.
offset+5]);
188 if(sequence[
i] == 201) ++
n;
190BOOST_REQUIRE(
n!=0);
192 for(;
i< hsp->
subject.
end+ (kMaxDiv3 - 7); ++
i) {
193 if(sequence[
i] == 201) ++
n;
195BOOST_REQUIRE(
n==0);
197 for(;
i< hsp->
subject.
end+ (kMaxDiv3 + 1) &&
n== 0; ++
i) {
198 if(sequence[
i] == 201) ++
n;
200BOOST_REQUIRE(
n!=0);
207 for(
i=0;
i< length; ++
i) {
208 if(sequence[
i] == 201) ++
n;
210BOOST_REQUIRE(
n==0);
216BOOST_REQUIRE(hsp ==
NULL);
218BOOST_REQUIRE(subject_blk ==
NULL);
220BOOST_REQUIRE(target_t ==
NULL);
225 const intkNumChunks = 3;
226 const intkOffsetIncrement = 9900;
227 const intkTotalNumHsps = 12;
228 const intkFinalScores[kTotalNumHsps] =
229{ 120, 111, 80, 77, 75, 72, 70, 70, 65, 60, 44, 40 };
230 const intkFinalOffsets[kTotalNumHsps] =
231{ 25000, 22000, 9950, 10400, 9850, 19750, 5000, 9970, 3000, 100,
233 const intkFinalLengths[kTotalNumHsps] =
234{ 200, 200, 100, 100, 100, 100, 100, 100, 100, 100, 60, 48 };
239 for(chunk = 0; chunk < kNumChunks; ++chunk) {
245 offset+= kOffsetIncrement;
248BOOST_REQUIRE_EQUAL(kTotalNumHsps, combined_hsp_list->
hspcnt);
252 for(index = 0; index < kTotalNumHsps; ++index) {
254BOOST_REQUIRE_EQUAL(kFinalScores[index], hsp->
score);
255BOOST_REQUIRE_EQUAL(kFinalOffsets[index], hsp->
subject.
offset);
256BOOST_REQUIRE_EQUAL(kFinalLengths[index],
261BOOST_REQUIRE(combined_hsp_list ==
NULL);
269BOOST_REQUIRE_EQUAL(0, hsp_list->
hspcnt);
271BOOST_REQUIRE(hsp_list ==
NULL);
278 const intkNumNullHsps=5;
279hsp_list->
hspcnt= kNumNullHsps;
282BOOST_REQUIRE_EQUAL(0, hsp_list->
hspcnt);
284BOOST_REQUIRE(hsp_list ==
NULL);
290 const intkNumHsps=25;
291 for(
intindex=0; index<kNumHsps; index++)
294 Blast_HSPInit(index, index+20, index+30, index+40, index+10, index+35,
2950, 0, 0, 10*index,
NULL, &new_hsp);
300BOOST_REQUIRE_EQUAL(kNumHsps, hsp_list->
hspcnt);
302BOOST_REQUIRE(hsp_list ==
NULL);
308 const intkNumHsps=5;
312 Blast_HSPInit(100, 100, 100, 100, 100, 100, 0, 0, 0,
kScore,
NULL, &new_hsp);
314 for(
intindex=0; index<kNumHsps; index++)
317 Blast_HSPInit(index, index+20, index+30, index+40, index+10, index+35,
321 Blast_HSPInit(0, 19, 29, 40, 10, 35, 0, 0, 0,
kScore,
NULL, &new_hsp);
329BOOST_REQUIRE_EQUAL(kNumHsps, hsp_list->
hspcnt);
331BOOST_REQUIRE(hsp_list ==
NULL);
337 const intkNumHsps=25;
338 for(
intindex=0; index<kNumHsps; index++)
341 Blast_HSPInit(index, index+20, index+30, index+40, index+10, index+35,
3420, 0, 0, 10*index,
NULL, &new_hsp);
355BOOST_REQUIRE_EQUAL(kNumHsps-4, hsp_list->
hspcnt);
362 for(
intindex=kNumHsps-4; index<kNumHsps; index++)
368BOOST_REQUIRE(hsp_list ==
NULL);
381&edit_script, &new_hsp);
382BOOST_REQUIRE_EQUAL((
Int2)0, rv);
386BOOST_REQUIRE_EQUAL(kPtrValue, new_hsp->
gap_info);
394BOOST_REQUIRE(new_hsp ==
NULL);
403BOOST_REQUIRE_EQUAL((
Int2)-1, rv);
406BOOST_REQUIRE(new_hsp ==
NULL);
425*query_info_ptr = query_info;
430 boolgapped,
boolis_prot)
445*options_ptr = options;
453 if(*hsp_ptr !=
NULL) {
468 Uint1* * subject_seq_ptr)
470 const intkLength = 22;
471 const Uint1kQuerySeq[kLength+2] = { 15, 0, 1, 2, 3, 0, 0, 1, 1, 2, 2, 3,
4723, 3, 3, 0, 1, 2, 2, 1, 1, 0, 0, 15 };
473 const Uint1kSubjectSeq[kLength] = { 0, 1, 2, 2, 14, 14, 1, 1, 2, 2, 3,
4743, 3, 3, 0, 1, 8, 2, 1, 1, 14, 0 };
487 const intkQueryStart = 6;
488 const intkQueryEnd = 20;
489 const intkSubjectStart = 6;
490 const intkSubjectEnd = 20;
493BOOST_REQUIRE_EQUAL(kQueryStart, hsp->
query.
offset);
494BOOST_REQUIRE_EQUAL(kQueryEnd, hsp->
query.
end);
496BOOST_REQUIRE_EQUAL(kSubjectEnd, hsp->
subject.
end);
501 const intkWordCutoff = 3;
502 const intkHitCutoff = 11;
504 const Uint4kSubjLength = 100000;
505 const Uint4kDbLength = 100000000;
520query_blk, kDbLength, &query_info);
524BOOST_REQUIRE_EQUAL(0,
526scoring_options, program_number,
527&sbp, 1.0, &blast_msg,
530BOOST_REQUIRE(blast_msg ==
NULL);
539kDbLength, 0, &hit_params);
552BOOST_REQUIRE(query_options ==
NULL);
555lookup_wrap, sbp, query_info, kSubjLength, &word_params);
558BOOST_REQUIRE(blast_seq_loc ==
NULL);
560BOOST_REQUIRE(lookup_wrap ==
NULL);
562BOOST_REQUIRE(lookup_options ==
NULL);
569query_blk->
sequence, subject_seq, word_params,
600(*hsplist_ptr)->hsp_array[0] = hsp;
601(*hsplist_ptr)->hspcnt = 1;
609 const intkLength = 12;
610 const Uint1kQuerySeq[kLength + 2] =
611{ 0, 11, 19, 13, 1, 9, 22, 6, 10, 7, 12, 20, 10, 0 };
612 const Uint1kSubjectSeq[3*kLength] =
613{ 2, 8, 4, 4, 8, 4, 1, 1, 10, 8, 15, 2, 1, 8, 1, 8, 8, 15, 8, 8, 8,
6141, 5, 1, 4, 4, 2, 1, 1, 1, 8, 4, 4, 4, 1, 4 };
624(*subject_blk)->sequence = (*subject_blk)->sequence_start;
631 const intkQueryStart = 0;
632 const intkQueryEnd = 12;
633 const intkSubjectStart = 0;
634 const intkSubjectEnd = 12;
639BOOST_REQUIRE_EQUAL(kQueryStart, hsp->
query.
offset);
640BOOST_REQUIRE_EQUAL(kQueryEnd, hsp->
query.
end);
642BOOST_REQUIRE_EQUAL(kSubjectEnd, hsp->
subject.
end);
649 const intkWordCutoff = 37;
650 const intkHitCutoff = 51;
651 const Uint4kSubjLength = 50000;
652 const Uint4kDbLength = 100000000;
667query_blk, kDbLength, &query_info);
672score_params->
options= scoring_options;
675BOOST_REQUIRE_EQUAL(0,
677scoring_options, program_number,
678&sbp, 1.0, &blast_msg,
688kDbLength, 0, &hit_params);
701BOOST_REQUIRE(query_options ==
NULL);
704lookup_wrap, sbp, query_info, kSubjLength, &word_params);
707BOOST_REQUIRE(blast_seq_loc ==
NULL);
709BOOST_REQUIRE(lookup_wrap ==
NULL);
711BOOST_REQUIRE(lookup_options ==
NULL);
721hsp_list, query_blk, subject_blk,
722word_params, hit_params, query_info, sbp,
723score_params,
NULL, gen_code_string);
735 sfree(gen_code_string);
753 const intkNumSegs = 5;
757 const Int4kEditScriptNum[kNumSegs] = { 4, 1, 11, 1, 5 };
762 if(*hsp_ptr !=
NULL) {
779 for(index = 0; index < kNumSegs; ++index) {
780esp->
op_type[index] = kEditScriptOpType[index];
781esp->
num[index] = kEditScriptNum[index];
787 Uint1* * subject_seq_ptr,
790 const intkQueryLength = 20;
791 const intkSubjectLength = 25;
792 const Uint1kQuerySeq[kQueryLength+2] = { 15, 0, 1, 2, 3, 0, 0, 1, 1,
7932, 2, 3, 3, 3, 3, 2, 2, 1, 1,
795 const Uint1kSubjectSeq[kSubjectLength] = { 1, 2, 0, 1, 2, 3, 3, 2,
79614, 1, 1, 2, 2, 3, 3, 3, 3,
7972, 0, 2, 1, 14, 0, 0, 3 };
803*subj_length = kSubjectLength;
811 const intkQueryStart = 6;
812 const intkQueryEnd = 20;
813 const intkSubjectStart = 9;
814 const intkSubjectEnd = 24;
815 const intkNumSegs = 3;
816 const Uint1kEditScriptOpType[kNumSegs] =
818 const Uint1kEditScriptNum[kNumSegs] = { 9, 1, 5 };
821BOOST_REQUIRE_EQUAL(kQueryStart, hsp->
query.
offset);
822BOOST_REQUIRE_EQUAL(kQueryEnd, hsp->
query.
end);
824BOOST_REQUIRE_EQUAL(kSubjectEnd, hsp->
subject.
end);
829 for(index = 0, esp = hsp->
gap_info; index < esp->
size; ++index) {
830BOOST_REQUIRE_EQUAL((
int)kEditScriptOpType[index], (
int)esp->
op_type[index]);
831BOOST_REQUIRE_EQUAL((
int)kEditScriptNum[index], (
int)esp->
num[index]);
833BOOST_REQUIRE_EQUAL(kNumSegs, index);
849 Uint4subj_length = 0;
854query_blk, subj_length, &query_info);
863BOOST_REQUIRE_EQUAL(0,
865scoring_options, program_number,
866&sbp, 1.0, &blast_message,
868BOOST_REQUIRE_EQUAL(0,
875BOOST_REQUIRE(query_blk);
876BOOST_REQUIRE(sbp->
kbp_gap[0]);
881hit_params->
options= hit_options;
888subject_seq, subj_length, hit_params, scoring_params, sbp);
903subject_seq, subj_length, hit_params, scoring_params, sbp);
911BOOST_REQUIRE_EQUAL(0,
913hsp, query_blk->
sequence, subject_seq,
917BOOST_REQUIRE_EQUAL(1,
919hsp, query_blk->
sequence, subject_seq,
938 const intkLength = 22;
939 const intkGappedStart = 1;
940 const intkCutoff = 4;
941 Uint1 query[kLength] = { 2, 0, 1, 3, 2, 0, 2, 1, 2, 0, 1, 3, 3, 1, 0, 1,
943 Uint1 subject[kLength] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
94414, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 };
966hit_params->
options= hit_opts;
974hit_params, score_params,
976BOOST_REQUIRE(delete_hsp ==
TRUE);
979BOOST_REQUIRE(hsp ==
NULL);
981BOOST_REQUIRE(sbp ==
NULL);
983BOOST_REQUIRE(score_params ==
NULL);
985BOOST_REQUIRE(ext_options ==
NULL);
987BOOST_REQUIRE(score_opts ==
NULL);
989BOOST_REQUIRE(hit_params ==
NULL);
991BOOST_REQUIRE(hit_opts ==
NULL);
996 const char*
query=
"ADADADADADBADADADADADADADAADADAD";
998 "ABCDBCABCDBCEABCDBCABCDBCABCDBCABCDBCABCDBABCDBCABCDABCDBCABCDBCFFABCDBCABCDBCABCDBCABCDBCGBCDBC";
999 const intkNumSegs = 13;
1005 const intkEditScriptNum[kNumSegs] = { 4, 1, 6, 1, 4, 1, 4, 1, 4, 1, 4, 1, 6 };
1006 const intkGoodNumIdent = 30;
1007 const intkGoodAlignLength = 34;
1009 Int4num_ident = 0, align_length = 0;
1019 for(index = 0; index < kNumSegs; ++index) {
1020esp->
op_type[index] = kEditScriptOp[index];
1021esp->
num[index] = kEditScriptNum[index];
1029scoring_opts, &align_length);
1033BOOST_REQUIRE_EQUAL(kGoodNumIdent, num_ident);
1034BOOST_REQUIRE_EQUAL(kGoodAlignLength, align_length);
1043 const intkHspCount = 16;
1044 const intkScores[kHspCount] = {
104510, 20, 15, 100, 21, 40, 55, 30, 90, 40,
1046150, 40, 100, 200, 250,
1049 const doublekEvalues[kHspCount] = {
10501, 0.1, 0.5, 0, 0.11, 0.01, 0.001, 0.05, 0, 0.01,
10511.0e-181, 1.0e-140, 1.0e-250, 2.0e-180, 5.0e-181,
1055 const intkScoresSorted[kHspCount] = {
1057100, 90, 55, 45, 40, 40, 40, 30, 21, 20, 15, 10
1059 const doublekEvaluesSorted[kHspCount] = {
10605.0e-181, 1.0e-181, 1.0e-250,
10640.001, 0.01, 0.01, 0.05, 0.1, 0.11, 0.5, 1
1070hsp_list->
hspcnt= kHspCount;
1072 for(index = 0; index < kHspCount; ++index) {
1078kHspCount - index + kScores[index];
1084 for(index = 0; index < kHspCount; ++index) {
1085BOOST_REQUIRE_EQUAL(kScoresSorted[index],
1089 for(index = 0; index < kHspCount; ++index) {
1090BOOST_REQUIRE_EQUAL(kEvaluesSorted[index],
1109hsp->
score= score = (31 * score) % 100;
1115 const intkHspNumMax = 250;
1123BOOST_REQUIRE_EQUAL(100, hsp_list->
allocated);
1125 for(index = 0; index < kHspNumMax; ++index) {
1128BOOST_REQUIRE_EQUAL(hsp_list->
hspcnt, kHspNumMax);
1129BOOST_REQUIRE_EQUAL(hsp_list->
allocated, kHspNumMax);
1133BOOST_REQUIRE_EQUAL(hsp_list->
hspcnt, kHspNumMax);
1134BOOST_REQUIRE_EQUAL(hsp_list->
allocated, kHspNumMax);
1139 for(index1 = 1; index1 < kHspNumMax; ++index1) {
1144 for(++index; index <
kTotal; ++index) {
1148 for(index = 1, index1 = 0; index < kHspNumMax; ++index) {
1156BOOST_REQUIRE_EQUAL(89, hsp_list->
hsp_array[kHspNumMax-1]->
score);
1158BOOST_REQUIRE_EQUAL(100, index1);
1164 const intkHspCountStart = 9;
1165 const intkHspCountEnd = 3;
1166 const intkScores[kHspCountStart] =
1167{ 1044, 995, 965, 219, 160, 125, 110, 107, 103 };
1168 const intkQueryOffsets[kHspCountStart] =
1169{ 2, 2, 2, 236, 88, 259, 278, 259, 278 };
1170 const intkQueryEnds[kHspCountStart] =
1171{ 322, 336, 300, 322, 182, 322, 341, 341, 341 };
1172 const intkSubjectOffsets[kHspCountStart] =
1173{ 7, 7, 7, 194, 2, 194, 197, 194, 197 };
1174 const intkSubjectEnds[kHspCountStart] =
1175{ 292, 293, 301, 292, 96, 292, 260, 260, 266 };
1176 const intkSurvivingIndices[kHspCountEnd] = { 4, 0, 6 };
1181 for(
intindex = 0; index < kHspCountStart; ++index) {
1184kSubjectOffsets[index], kSubjectEnds[index],
1187kScores[index],
NULL, &hsp);
1194BOOST_REQUIRE_EQUAL(kHspCountStart,
1200BOOST_REQUIRE_EQUAL(kHspCountEnd,
1205 for(
intindex = 0; index < kHspCountEnd; ++index) {
1206 intindex_orig = kSurvivingIndices[index];
1207BOOST_REQUIRE_EQUAL(kScores[index_orig], hsp_array[index]->score);
1208BOOST_REQUIRE_EQUAL(kQueryOffsets[index_orig],
1209hsp_array[index]->
query.offset);
1210BOOST_REQUIRE_EQUAL(kSubjectOffsets[index_orig],
1211hsp_array[index]->
subject.offset);
1212BOOST_REQUIRE_EQUAL(kQueryEnds[index_orig],
1213hsp_array[index]->
query.end);
1214BOOST_REQUIRE_EQUAL(kSubjectEnds[index_orig],
1215hsp_array[index]->
subject.end);
1216 sfree(hsp_array[index]);
1220BOOST_REQUIRE(hsp_list ==
NULL);
1243BOOST_REQUIRE(scoring_options ==
NULL);
1245BOOST_REQUIRE(ext_options ==
NULL);
1251BOOST_REQUIRE(ext_options ==
NULL);
1253BOOST_REQUIRE(blasthit_params ==
NULL);
1255BOOST_REQUIRE(hit_options ==
NULL);
1279BOOST_REQUIRE(scoring_options ==
NULL);
1281BOOST_REQUIRE(ext_options ==
NULL);
1287BOOST_REQUIRE(ext_options ==
NULL);
1289BOOST_REQUIRE(blasthit_params ==
NULL);
1291BOOST_REQUIRE(hit_options ==
NULL);
1317BOOST_REQUIRE(scoring_options ==
NULL);
1319BOOST_REQUIRE(ext_options ==
NULL);
1325BOOST_REQUIRE(ext_options ==
NULL);
1327BOOST_REQUIRE(blasthit_params ==
NULL);
1329BOOST_REQUIRE(hit_options ==
NULL);
1333 const intkHspCnt = 10;
1334 const boolkGapped =
TRUE;
1348 for(
intindex = 0; index < kHspCnt; ++index) {
1354hsp->
score= 100 - index;
1357hsp_list->
hspcnt= kHspCnt;
1361 for(
intindex = 0; index < kHspCnt; ++index)
1375BOOST_REQUIRE_EQUAL(0, (
int) status);
1378BOOST_REQUIRE_EQUAL(kBig, (
int) hit_list->
hsplist_max);
1379BOOST_REQUIRE_EQUAL(60, (
int) hit_list->
low_score);
1382BOOST_REQUIRE(hit_list ==
NULL);
1389 for(
unsigned int i= 0;
i< 4;
i++ ){
1390 unsigned intfactor =
i+1;
1398hsp->
score= 45/factor;
1399(*hsplist_ptr)->hsp_array[
i] = hsp;
1400(*hsplist_ptr)->hspcnt ++;
1412 const Uint4kDbLength = 100000000;
1418query_blk, kDbLength, &query_info);
1428BOOST_REQUIRE_EQUAL(4, (
int) hsp_list->
hspcnt);
1431BOOST_REQUIRE_EQUAL(3, (
int) hsp_list->
hspcnt);
1434BOOST_REQUIRE_EQUAL(2, (
int) hsp_list->
hspcnt);
1458 const Uint4kDbLength = 100000000;
1464query_blk, kDbLength, &query_info);
1474BOOST_REQUIRE_EQUAL(4, (
int) hsp_list->
hspcnt);
1477BOOST_REQUIRE_EQUAL(2, (
int) hsp_list->
hspcnt);
1480BOOST_REQUIRE_EQUAL(2, (
int) hsp_list->
hspcnt);
1483BOOST_REQUIRE_EQUAL(1, (
int) hsp_list->
hspcnt);
1498 for(
unsigned int i= 0;
i< 4;
i++ ){
1499 unsigned intfactor =
i+1;
1508hsp->
score= 45/factor;
1509(*hsplist_ptr)->hsp_array[
i] = hsp;
1510(*hsplist_ptr)->hspcnt ++;
1520 const Uint4kDbLength = 100000000;
1529BOOST_REQUIRE_EQUAL(1, (
int) hsp_list->
hspcnt);
1534BOOST_REQUIRE_EQUAL(1, (
int) hsp_list->
hspcnt);
Definitions used throughout BLAST.
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
Declarations of static arrays used to define some NCBI encodings to be used in a toolkit independent ...
BlastSeqLoc * BlastSeqLocFree(BlastSeqLoc *loc)
Deallocate all BlastSeqLoc objects in a chain.
BlastSeqLoc * BlastSeqLocNew(BlastSeqLoc **head, Int4 from, Int4 to)
Create and initialize a new sequence interval.
Structures and API used for saving BLAST hits.
void Blast_HSPListSortByEvalue(BlastHSPList *hsp_list)
Sort the HSPs in an HSP list by e-value, with scores and other criteria used to resolve ties.
BlastHSP * Blast_HSPNew(void)
Allocate and zeros out memory for an HSP structure.
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.
BlastHitList * Blast_HitListFree(BlastHitList *hitlist)
Deallocate memory for the hit list.
Boolean Blast_HSPTestIdentityAndLength(EBlastProgramType program_number, BlastHSP *hsp, const Uint1 *query, const Uint1 *subject, const BlastScoringOptions *score_options, const BlastHitSavingOptions *hit_options)
Calculates number of identities and alignment lengths of an HSP via Blast_HSPGetNumIdentities and det...
Int4 Blast_HSPListSubjectBestHit(EBlastProgramType program, const BlastHSPSubjectBestHitOptions *subject_besthit_opts, const BlastQueryInfo *query_info, BlastHSPList *hsp_list)
BlastHitList * Blast_HitListNew(Int4 hitlist_size)
Allocate memory for a hit list of a given size.
Int4 Blast_HSPListPurgeHSPsWithCommonEndpoints(EBlastProgramType program, BlastHSPList *hsp_list, Boolean purge)
Check for an overlap of two different alignments and remove redundant HSPs.
BlastHSPList * Blast_HSPListNew(Int4 hsp_max)
Creates HSP list structure with a default size HSP array.
Int2 Blast_HSPGetNumIdentities(const Uint1 *query, const Uint1 *subject, BlastHSP *hsp, const BlastScoringOptions *score_options, Int4 *align_length_ptr)
Calculate number of identities in an HSP and set the BlastHSP::num_ident field (unconditionally)
Int2 Blast_HSPListPurgeNullHSPs(BlastHSPList *hsp_list)
Cleans out the NULLed out HSP's from the HSP array that is part of the BlastHSPList.
#define DBSEQ_CHUNK_OVERLAP
By how much should the chunks of a subject sequence overlap if it is too long and has to be split.
Int2 Blast_HSPListsMerge(BlastHSPList **hsp_list, BlastHSPList **combined_hsp_list_ptr, Int4 hsp_num_max, Int4 *split_points, Int4 contexts_per_query, Int4 chunk_overlap_size, Boolean allow_gap, Boolean short_reads)
Merge an HSP list from a chunk of the subject sequence into a previously computed HSP list.
Int2 Blast_HSPListReevaluateUngapped(EBlastProgramType program, BlastHSPList *hsp_list, BLAST_SequenceBlk *query_blk, BLAST_SequenceBlk *subject_blk, const BlastInitialWordParameters *word_params, const BlastHitSavingParameters *hit_params, const BlastQueryInfo *query_info, BlastScoreBlk *sbp, const BlastScoringParameters *score_params, const BlastSeqSrc *seq_src, const Uint1 *gen_code_string)
Reevaluate all ungapped HSPs in an HSP list.
Boolean Blast_HSPQueryCoverageTest(BlastHSP *hsp, double min_query_coverage_pct, Int4 query_length)
Calculate query coverage percentage of an hsp.
Int2 Blast_TrimHSPListByMaxHsps(BlastHSPList *hsp_list, const BlastHitSavingOptions *hit_options)
SBlastHitsParameters * SBlastHitsParametersFree(SBlastHitsParameters *param)
Deallocated SBlastHitsParameters.
void Blast_HSPListAdjustOddBlastnScores(BlastHSPList *hsp_list, Boolean gapped_calculation, const BlastScoreBlk *sbp)
For nucleotide BLAST, if the match reward score is equal to 2, random alignments are dominated by run...
Int2 Blast_HSPListReapByQueryCoverage(BlastHSPList *hsp_list, const BlastHitSavingOptions *hit_options, const BlastQueryInfo *query_info, EBlastProgramType program_number)
Discard the HSPs below the min query coverage pct from the HSP list.
BlastHSP * Blast_HSPFree(BlastHSP *hsp)
Deallocate memory for an HSP structure.
Boolean Blast_HSPListIsSortedByScore(const BlastHSPList *hsp_list)
Check if HSP list is sorted by score.
const Uint1 * Blast_HSPGetTargetTranslation(SBlastTargetTranslation *target_t, const BlastHSP *hsp, Int4 *translated_length)
Returns a buffer with a protein translated from nucleotide.
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.
double Blast_HSPGetQueryCoverage(const BlastHSP *hsp, Int4 query_length)
Calculate query coverage percentage of an hsp.
Boolean Blast_HSPReevaluateWithAmbiguitiesUngapped(BlastHSP *hsp, const Uint1 *query_start, const Uint1 *subject_start, const BlastInitialWordParameters *word_params, BlastScoreBlk *sbp, Boolean translated)
Reevaluate the HSP's score and percent identity after taking into account the ambiguity information.
Int2 SBlastHitsParametersNew(const BlastHitSavingOptions *hit_options, const BlastExtensionOptions *ext_options, const BlastScoringOptions *scoring_options, SBlastHitsParameters **retval)
Sets up small structures used by blast_hit.c for saving HSPs.
void Blast_HSPListSortByScore(BlastHSPList *hsp_list)
Sort the HSPs in an HSP list by score.
Boolean Blast_HSPReevaluateWithAmbiguitiesGapped(BlastHSP *hsp, const Uint1 *query_start, const Int4 query_length, const Uint1 *subject_start, const Int4 subject_length, const BlastHitSavingParameters *hit_params, const BlastScoringParameters *score_params, const BlastScoreBlk *sbp)
Reevaluate the HSP's score and percent identity after taking into account the ambiguity information.
Int2 Blast_HitListUpdate(BlastHitList *hit_list, BlastHSPList *hsp_list)
Insert a new HSP list into the hit list.
Utilities for dealing with BLAST HSPs in the core of BLAST.
Blast_Message * Blast_MessageFree(Blast_Message *blast_msg)
Deallocates message memory.
Definitions which are dependant on the NCBI C++ Object Manager.
BlastHitSavingOptions * BlastHitSavingOptionsFree(BlastHitSavingOptions *options)
Deallocate memory for BlastHitSavingOptions.
Int2 BlastQuerySetUpOptionsNew(QuerySetUpOptions **options)
Allocate memory for QuerySetUpOptions and fill with default values.
BlastHSPSubjectBestHitOptions * BlastHSPSubjectBestHitOptionsFree(BlastHSPSubjectBestHitOptions *subject_besthit_opts)
Deallocates subject besthit structure.
BlastInitialWordOptions * BlastInitialWordOptionsFree(BlastInitialWordOptions *options)
Deallocate memory for BlastInitialWordOptions.
Int2 BlastScoringOptionsNew(EBlastProgramType program, BlastScoringOptions **options)
Allocate memory for BlastScoringOptions and fill with default values.
Int2 LookupTableOptionsNew(EBlastProgramType program, LookupTableOptions **options)
Allocate memory for lookup table options and fill with default values.
BlastExtensionOptions * BlastExtensionOptionsFree(BlastExtensionOptions *options)
Deallocate memory for BlastExtensionOptions.
Int2 BlastHitSavingOptionsNew(EBlastProgramType program, BlastHitSavingOptions **options, Boolean gapped_calculation)
Allocate memory for BlastHitSavingOptions.
BlastHSPSubjectBestHitOptions * BlastHSPSubjectBestHitOptionsNew(Boolean isProtein)
Allocate a new object for subject besthit options.
Int2 BlastInitialWordOptionsNew(EBlastProgramType program, BlastInitialWordOptions **options)
Allocate memory for BlastInitialWordOptions and fill with default values.
BlastScoringOptions * BlastScoringOptionsFree(BlastScoringOptions *options)
Deallocate memory for BlastScoringOptions.
LookupTableOptions * LookupTableOptionsFree(LookupTableOptions *options)
Deallocates memory for LookupTableOptions*.
QuerySetUpOptions * BlastQuerySetUpOptionsFree(QuerySetUpOptions *options)
Deallocate memory for QuerySetUpOptions.
Int2 BlastExtensionOptionsNew(EBlastProgramType program, BlastExtensionOptions **options, Boolean gapped)
Allocate memory for BlastExtensionOptions and fill with default values.
BlastHitSavingParameters * BlastHitSavingParametersFree(BlastHitSavingParameters *parameters)
Deallocate memory for BlastHitSavingOptions*.
BlastInitialWordParameters * BlastInitialWordParametersFree(BlastInitialWordParameters *parameters)
Deallocate memory for BlastInitialWordParameters.
Int2 BlastScoringParametersNew(const BlastScoringOptions *options, BlastScoreBlk *sbp, BlastScoringParameters **parameters)
Calculate scaled cutoff scores and gap penalties.
Int2 BlastInitialWordParametersNew(EBlastProgramType program_number, const BlastInitialWordOptions *word_options, const BlastHitSavingParameters *hit_params, const LookupTableWrap *lookup_wrap, const BlastScoreBlk *sbp, BlastQueryInfo *query_info, Uint4 subject_length, BlastInitialWordParameters **parameters)
Allocate memory for BlastInitialWordParameters and set x_dropoff.
Int2 BlastHitSavingParametersNew(EBlastProgramType program_number, const BlastHitSavingOptions *options, const BlastScoreBlk *sbp, const BlastQueryInfo *query_info, Int4 avg_subject_length, Int4 compositionBasedStats, BlastHitSavingParameters **parameters)
Allocate memory and initialize the BlastHitSavingParameters structure.
BlastScoringParameters * BlastScoringParametersFree(BlastScoringParameters *parameters)
Deallocate memory for BlastScoringParameters.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
BlastQueryInfo * BlastQueryInfoFree(BlastQueryInfo *query_info)
Deallocate memory for query information structure.
BlastQueryInfo * BlastQueryInfoNew(EBlastProgramType program, int num_queries)
Allocate memory for query information structure.
Utilities initialize/setup BLAST.
Int2 BlastSetup_ScoreBlkInit(BLAST_SequenceBlk *query_blk, const BlastQueryInfo *query_info, const BlastScoringOptions *scoring_options, EBlastProgramType program_number, BlastScoreBlk **sbpp, double scale_factor, Blast_Message **blast_message, GET_MATRIX_PATH get_path)
Initializes the score block structure.
Int2 Blast_ScoreBlkMatrixInit(EBlastProgramType program_number, const BlastScoringOptions *scoring_options, BlastScoreBlk *sbp, GET_MATRIX_PATH get_path)
Initializes the substitution matrix in the BlastScoreBlk according to the scoring options specified.
Internal auxiliary setup classes/functions for C++ BLAST APIs.
BlastScoreBlk * BlastScoreBlkFree(BlastScoreBlk *sbp)
Deallocates BlastScoreBlk as well as all associated structures.
Int2 BLAST_Cutoffs(Int4 *S, double *E, Blast_KarlinBlk *kbp, Int8 searchsp, Boolean dodecay, double gap_decay_rate)
Calculate the cutoff score from the expected number of HSPs or vice versa.
BlastScoreBlk * BlastScoreBlkNew(Uint1 alphabet, Int4 number_of_contexts)
Allocates and initializes BlastScoreBlk.
Various auxiliary BLAST utility functions.
BLAST_SequenceBlk * BlastSequenceBlkFree(BLAST_SequenceBlk *seq_blk)
Deallocate memory for a sequence block.
Int2 BlastSeqBlkSetSequence(BLAST_SequenceBlk *seq_blk, const Uint1 *sequence, Int4 seqlen)
Stores the sequence in the sequence block structure.
Int2 BlastTargetTranslationNew(BLAST_SequenceBlk *subject_blk, const Uint1 *gen_code_string, EBlastProgramType program_number, Boolean is_ooframe, SBlastTargetTranslation **target)
Sets up structure for target translation.
SBlastTargetTranslation * BlastTargetTranslationFree(SBlastTargetTranslation *target_t)
Free SBlastTargetTranslation.
Int2 BlastSeqBlkNew(BLAST_SequenceBlk **retval)
Allocates a new sequence block structure.
static void checkReevaluateResultsGapped(BlastHSP *hsp)
static void s_SetupHSPForGappedReevaluateTest(BlastHSP **hsp_ptr)
int h_score_compare_hsps(const void *v1, const void *v2)
static void s_SetupSequencesForUngappedReevaluateTransl(BLAST_SequenceBlk **query_blk, BLAST_SequenceBlk **subject_blk)
static void s_SetupHSPListBlastn(BlastHSPList **hsplist_ptr)
static void s_AddNextHSP(BlastHSPList *hsp_list, int &score)
static void s_SetupHSPForUngappedReevaluateNucl(BlastHSP **hsp_ptr)
BOOST_AUTO_TEST_CASE(BlastTargetSequence)
static void s_SetupSequencesForGappedReevaluateTest(BLAST_SequenceBlk **query_blk, Uint1 **subject_seq_ptr, Uint4 *subj_length)
static void s_SetupHSPListTransl(BlastHSPList **hsplist_ptr)
static void checkReevaluateResultsUngappedNucl(BlastHSP *hsp)
static void s_SetupQueryInfoForReevaluateTest(EBlastProgramType program_number, BLAST_SequenceBlk *query_blk, Uint4 subj_length, BlastQueryInfo **query_info_ptr)
static void s_SetupSequencesForUngappedReevaluateNucl(BLAST_SequenceBlk **query_blk, Uint1 **subject_seq_ptr)
static void checkReevaluateResultsUngappedTransl(BlastHSPList *hsp_list)
static void s_SetupScoringOptionsForReevaluateHSP(BlastScoringOptions **options_ptr, bool gapped, bool is_prot)
void setupHSPList(BlastHSPList **hsp_list_ptr, int chunk)
static void s_SetupHSPListForUngappedReevaluateTransl(BlastHSPList **hsplist_ptr)
BOOST_AUTO_TEST_SUITE_END() static int s_GetSegmentFlags(const CBioseq &bioseq)
Initializes and uninitializes the genetic code singleton as if it was an automatic variable (to facil...
static CTestObjMgr & Instance()
EGapAlignOpType
Operation types within the edit script.
@ eGapAlignDel2
Frame shift deletion of two nucleotides.
@ eGapAlignIns2
Frame shift insertion of two nucleotides.
@ eGapAlignIns1
Frame shift insertion of one nucleotide.
@ eGapAlignIns
Insertion: a gap in subject.
@ eGapAlignDel1
Frame shift deletion of one nucleotide.
@ 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.
Defines the interface to interact with the genetic code singleton object.
Uint1 * GenCodeSingletonFind(Uint4 gen_code_id)
Returns the genetic code string for the requested genetic code id.
TAutoUint1ArrayPtr FindGeneticCode(int genetic_code)
Retrieves the requested genetic code in Ncbistdaa format.
#define BLASTNA_SEQ_CODE
Identifies the blastna alphabet, for use in blast only.
TAutoUint1Ptr data
Sequence data.
char * BlastFindMatrixPath(const char *matrix_name, Boolean is_prot)
Returns the path to a specified matrix.
SBlastSequence GetSequence(const objects::CSeq_loc &sl, EBlastEncoding encoding, objects::CScope *scope, objects::ENa_strand strand=objects::eNa_strand_plus, ESentinelType sentinel=eSentinels, std::string *warnings=NULL)
Retrieves a sequence using the object manager.
@ eBlastEncodingNcbi4na
NCBI4na.
@ eSentinels
Use sentinel bytes.
element_type * get(void) const
Get pointer.
element_type * release(void)
Release will release ownership of pointer to caller.
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
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
int64_t Int8
8-byte (64-bit) signed integer
for(len=0;yy_str[len];++len)
LookupTableWrap * LookupTableWrapFree(LookupTableWrap *lookup)
Deallocate memory for the lookup table.
Int2 LookupTableWrapInit(BLAST_SequenceBlk *query, const LookupTableOptions *lookup_options, const QuerySetUpOptions *query_options, BlastSeqLoc *lookup_segments, BlastScoreBlk *sbp, LookupTableWrap **lookup_wrap_ptr, const BlastRPSInfo *rps_info, Blast_Message **error_msg, BlastSeqSrc *seqsrc)
Create the lookup table for all query words.
const struct ncbi::grid::netcache::search::fields::SIZE size
Magic spell ;-) needed for some weird compilers... very empiric.
#define INT4_MAX
largest nubmer represented by signed int
void * BlastMemDup(const void *orig, size_t size)
Copies memory using memcpy and malloc.
Uint1 Boolean
bool replacment for C
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
#define INT4_MIN
Smallest (most negative) number represented by signed int.
BOOST_AUTO_TEST_SUITE(psiblast_iteration)
static const char * kScore
static const char * kTotal
static const char * kMaxScore
static const char * kEvalue
Structure to hold a sequence.
Int4 length
Length of sequence.
Uint1 * sequence
Sequence used for search (could be translation).
Int4 query_length
Length of this query, strand or frame.
Boolean is_valid
Determine if this context is valid or not.
Int8 eff_searchsp
Effective search space for this context.
Options used for gapped extension These include: a.
Int4 compositionBasedStats
mode of compositional adjustment to use; if zero then compositional adjustment is not used
All the gapped cutoff values that can change from context to context.
Int4 cutoff_score
Raw cutoff score corresponding to the e-value provided by the user if no sum stats,...
The structure to hold all HSPs for a given sequence after the gapped alignment.
Boolean do_not_reallocate
Is reallocation of the hsp_array allowed?
Int4 hspcnt
Number of HSPs saved.
BlastHSP ** hsp_array
Array of pointers to individual HSPs.
Int4 allocated
The allocated size of the hsp_array.
Structure holding all information about an HSP.
double evalue
This HSP's e-value.
Int4 num_ident
Number of identical base pairs in this HSP.
BlastSeg query
Query sequence info.
Int4 context
Context number of query.
BlastSeg subject
Subject sequence info.
GapEditScript * gap_info
ALL gapped alignment is here.
Int4 score
This HSP's raw score.
The structure to contain all BLAST results for one query sequence.
Int4 hsplist_max
Maximal allowed size of the HSP lists array.
BlastHSPList ** hsplist_array
Array of HSP lists for individual database hits.
Int4 hsplist_count
Filled size of the HSP lists array.
Int4 low_score
The lowest of the best scores among the HSP lists.
Int4 hsplist_current
Number of allocated HSP list arrays.
Options used when evaluating and saving hits These include: a.
Int4 max_hsps_per_subject
Queries are paired reads, for mapping.
double expect_value
The expect value cut-off threshold for an HSP, or a combined hit if sum statistics is used.
Int4 hitlist_size
Maximal number of database sequences to return results for.
Int4 min_hit_length
optional minimum alignment length; alignments not at least this long are discarded
double query_cov_hsp_perc
Min query coverage hsp percentage.
double percent_identity
The percent identity cut-off threshold.
Parameter block that contains a pointer to BlastHitSavingOptions and the values derived from it.
BlastGappedCutoffs * cutoffs
per-context gapped cutoff information
Int4 cutoff_score_min
smallest cutoff score across all contexts
BlastHitSavingOptions * options
The original (unparsed) options.
Options needed for initial word finding and processing.
Parameter block that contains a pointer to BlastInitialWordOptions and the values derived from it.
Int4 cutoff_score_min
smallest cutoff score across all contexts
The query related information.
BlastContextInfo * contexts
Information per context.
Int4 last_context
Index of the last element of the context array.
Structure used for scoring calculations.
Blast_KarlinBlk ** kbp_gap
K-A parameters for gapped alignments.
Boolean round_down
Score must be rounded down to nearest even score if odd.
Scoring options block Used to produce the BlastScoreBlk structure This structure may be needed for lo...
Int2 penalty
Penalty for a mismatch.
Int4 gap_open
Extra penalty for starting a gap.
Int4 gap_extend
Penalty for each gap residue.
Int2 reward
Reward for a match.
Boolean gapped_calculation
gap-free search if FALSE
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...
BlastScoringOptions * options
User-provided values for these params.
Int4 gapped_start
Where the gapped extension started.
Int2 frame
Translation frame.
Int4 offset
Start of hsp.
Used to hold a set of positions, mostly used for filtering.
Structure to hold the a message from the core of the BLAST engine.
Edit script: linked list of correspondencies between two sequences.
Int4 * num
Array of number of operations.
EGapAlignOpType * op_type
Array of type of operation.
Options needed to construct a lookup table Also needed: query sequence and query length.
Wrapper structure for different types of BLAST lookup tables.
Options required for setting up the query sequence.
Keeps prelim_hitlist_size and HitSavingOptions together, mostly for use by hspstream.
Int4 prelim_hitlist_size
number of hits saved during preliminary part of search.
Structure to store sequence data and its length for use in the CORE of BLAST (it's a malloc'ed array ...
Information about target translations.
Utility stuff for more convenient using of Boost.Test library.
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