77 (*query_info)->contexts[0].query_offset = 0;
78 (*query_info)->contexts[0].query_length = query_length;
79 (*query_info)->contexts[1].query_offset = query_length + 1;
80 (*query_info)->contexts[1].query_length = query_length;
81 (*query_info)->max_length = query_length;
101 const int kNumHsps = 10;
102 const int kScores[kNumHsps] =
103 { 1023, 282, 246, 202, 142, 117, 98, 92, 63, 53 };
104 const int kQueryOffsets[kNumHsps] =
105 { 11, 346, 399, 244, 287, 224, 311, 218, 0, 404};
106 const int kQueryLengths[kNumHsps] =
107 { 244, 56, 49, 49, 104, 29, 36, 37, 12, 25 };
108 const int kSubjectFrames[kNumHsps] =
109 { 2, 2, 3, 2, 1, 1, 2, 3, 3, 2 };
110 const int kSubjectOffsets[kNumHsps] =
111 { 1372, 2677, 2756, 2062, 2209, 1832, 2351, 1732, 1140, 2683 };
112 const int kSubjectLengths[kNumHsps] =
113 {300, 56, 49, 50, 75, 29, 32, 36, 12, 26 };
119 for (index = 0; index < kNumHsps; ++index) {
122 hsp->
score = kScores[index];
125 hsp->
query.
end = kQueryOffsets[index] + kQueryLengths[index];
128 kSubjectOffsets[index] + kSubjectLengths[index];
133 kSubjectOffsets[index] + kSubjectLengths[index];
135 hsp->
subject.
end = kQueryOffsets[index] + kQueryLengths[index];
140 m_HspList->
hspcnt = kNumHsps;
158 BOOST_REQUIRE(!
strcmp(
"BLOSUM62", score_options->
matrix));
163 BOOST_REQUIRE(status == 0);
167 seqbuf, m_QueryInfo, &message);
169 BOOST_REQUIRE(message ==
NULL);
171 BOOST_REQUIRE(status == 0);
175 m_ProgramType, m_QueryInfo,
NULL);
176 BOOST_REQUIRE(status == 0);
182 if (score_options_ptr)
183 *score_options_ptr = score_options;
214 db_num_seq, &eff_len_params);
216 m_ScoreBlk, m_QueryInfo,
NULL);
224 const string kProtGi =
"9930103";
225 const string kNuclGi =
"9930102";
226 const Uint4 kProtLength = 448;
227 const Uint4 kNuclLength = 8872;
235 unique_ptr<SSeqLoc> qsl(
238 query_v.push_back(*qsl);
240 unique_ptr<SSeqLoc> qsl(
242 query_v.push_back(*qsl);
258 m_ProgramType, strand_opt, blast_msg);
260 BOOST_REQUIRE(m->empty());
264 setupScoreBlk(query_blk->
sequence,
true, &score_options);
267 kNuclLength / 3 : kProtLength);
269 fillEffectiveLengths(score_options, (
Int8)m_SubjectLength, 1);
288 const int kNumHsps = 8;
289 const int kLongestIntron = 4000;
291 const int kNumsLinked[kNumHsps] = { 1, 5, 5, 5, 2, 5, 5, 2 };
292 const int kScores[kNumHsps] = { 1023, 282, 246, 202, 142, 117, 98, 92 };
294 setupLinkHspInputTblastn();
295 setupHSPListTransl();
296 setupHitParams(kLongestIntron,
kEvalue);
298 BLAST_LinkHsps(m_ProgramType, m_HspList, m_QueryInfo, m_SubjectLength,
303 BOOST_REQUIRE_EQUAL(kNumHsps, m_HspList->
hspcnt);
305 for (
int index = 0; index < kNumHsps; ++index) {
306 BOOST_REQUIRE_EQUAL(kNumsLinked[index], m_HspList->
hsp_array[index]->
num);
307 BOOST_REQUIRE_EQUAL(kScores[index], m_HspList->
hsp_array[index]->
score);
313 const int kNumHsps = 5;
314 const int kScores[kNumHsps] =
315 { 80, 60, 55, 54, 52 };
316 const int kQueryOffsets[kNumHsps] =
317 { 100, 130, 239, 239, 191 };
318 const int kLengths[kNumHsps] =
319 { 100, 50, 100, 9, 57 };
320 const int kSubjectOffsets[kNumHsps] =
321 { 1100, 1130, 3240, 3240, 2195 };
327 for (index = 0; index < kNumHsps; ++index) {
330 hsp->
score = kScores[index];
338 m_HspList->
hspcnt = kNumHsps;
344 const int kNumHsps = 8;
345 const int kScores[kNumHsps] = { 35, 31, 22, 21, 20, 20, 20, 20 };
346 const int kQueryFrames[kNumHsps] = { 1, 1, 1, -1, 1, -1, -1, -1 };
347 const int kQueryStarts[kNumHsps] =
348 { 790, 790, 791, 4606, 870, 4572, 4526, 4589 };
349 const int kQueryEnds[kNumHsps] =
350 { 865, 865, 833, 4635, 894, 4604, 4550, 4629 };
351 const int kSubjectStarts[kNumHsps] =
352 { 453, 3469, 5837, 12508, 5951, 11005, 9899, 7397 };
353 const int kSubjectEnds[kNumHsps] =
354 { 528, 3544, 5879, 12537, 5975, 11037, 9923, 7437 };
360 for (index = 0; index < kNumHsps; ++index) {
363 hsp->
score = kScores[index];
367 hsp->
context = (kQueryFrames[index] > 0 ? 0 : 1);
372 m_HspList->
hspcnt = kNumHsps;
378 const Uint4 kQueryLength = 5419;
379 const Int8 kEffDbLength = 122632232;
386 m_SubjectLength = 12991;
389 pair<TSeqPos, TSeqPos>
range(26993,32411);
397 setupScoreBlk(sequence.
data.
get(),
false, &score_options);
399 fillEffectiveLengths(score_options, kEffDbLength, 1);
407 Uint4 subj_length,
int longest_intron=0)
421 if (longest_intron > 0)
456 m_ProgramType, strand_opt, blast_msg);
458 BOOST_REQUIRE(m->empty());
462 setupScoreBlk(query_blk->
sequence, gapped, &score_options);
465 m_QueryInfo, &ext_params);
466 fillEffectiveLengths(score_options, (
Int8)db_length, db_num_seq);
468 BOOST_REQUIRE(score_options ==
NULL);
471 m_ScoreBlk, m_QueryInfo, subj_length, 0, &m_HitParams);
482 BOOST_REQUIRE(query_options ==
NULL);
484 Uint4 avg_subj_length = (
Uint4)(db_length/db_num_seq);
486 m_ScoreBlk, m_QueryInfo, avg_subj_length, &word_params);
489 BOOST_REQUIRE(blast_seq_loc ==
NULL);
491 BOOST_REQUIRE(lookup_wrap ==
NULL);
493 BOOST_REQUIRE(lookup_options ==
NULL);
538 testUnevenGapLinkHsps();
545 testUnevenGapLinkHsps();
551 const int kNumHsps = 5;
552 const int kLongestIntron = 3000;
554 const int kLinkNums[kNumHsps] = { 3, 1, 3, 1, 3 };
558 setupLinkHspInputTblastn();
559 setupHSPListForMiddleInsertTest();
560 setupHitParams(kLongestIntron,
kEvalue);
562 BLAST_LinkHsps(m_ProgramType, m_HspList, m_QueryInfo, m_SubjectLength,
563 m_ScoreBlk, m_HitParams->link_hsp_params,
TRUE);
564 for (
int index = 0; index < m_HspList->hspcnt; ++index) {
565 BOOST_REQUIRE_EQUAL(kLinkNums[index],
566 m_HspList->hsp_array[index]->num);
572 const int kNumHsps = 5;
574 const int kNumsLinked[kNumHsps] = { 1, 2, 2, 1, 1 };
575 const int kScores[kNumHsps] = { 1023, 282, 246, 202, 142 };
579 setupLinkHspInputTblastn();
580 setupHSPListTransl();
584 BLAST_LinkHsps(m_ProgramType, m_HspList, m_QueryInfo, m_SubjectLength,
585 m_ScoreBlk, m_HitParams->link_hsp_params,
TRUE);
589 BOOST_REQUIRE_EQUAL(kNumHsps, m_HspList->hspcnt);
592 for (index = 0; index < kNumHsps; ++index) {
593 BOOST_REQUIRE_EQUAL(kNumsLinked[index], m_HspList->hsp_array[index]->num);
594 BOOST_REQUIRE_EQUAL(kScores[index],
595 m_HspList->hsp_array[index]->score);
601 const int kNumHsps = 8;
603 const int kNumsLinked[kNumHsps] =
604 { 2, 1, 1, 3, 2, 1, 3, 3 };
605 const double kEvalues[kNumHsps] =
606 { 3e-12, 3e-7, 0.07, 1e-7, 3e-12, 1.1, 1e-7, 1e-7 };
608 setupLinkHspInputBlastn();
611 BLAST_LinkHsps(m_ProgramType, m_HspList, m_QueryInfo, m_SubjectLength,
612 m_ScoreBlk, m_HitParams->link_hsp_params,
FALSE);
615 BOOST_REQUIRE_EQUAL(kNumHsps, m_HspList->hspcnt);
617 for (
Int4 index = 0; index < kNumHsps; ++index) {
618 BOOST_REQUIRE_EQUAL(kNumsLinked[index],
619 m_HspList->hsp_array[index]->num);
620 BOOST_REQUIRE(
fabs(kEvalues[index] - m_HspList->hsp_array[index]->evalue)/kEvalues[index] < 0.5);
648 const int kNumDbs = 4;
649 const Int8 kDbLengths[kNumDbs] =
650 { 10000000000LL, 10000000000LL, 3000000000LL, 10000LL };
651 const Uint4 kDbNumSeqs[kNumDbs] = { 2000000, 20000000, 500, 100 };
652 const Uint4 kSubjectLengths[kNumDbs] = { 2000, 400, 3000000, 100 };
654 { 11, 0, 0, 0, 14, 20,
true, 14, 0 },
655 { 11, 0, 0, 0, 12, 20,
true, 12, 0 },
656 { 11, 0, 0, 0, 19, 19,
true, 19, 0 },
657 { 11, 0, 0, 0, 10, 10,
true, 10, 0 } };
663 for (index = 0; index < kNumDbs; ++index) {
664 cutoffs = setupCutoffScores(
false, kDbLengths[index],
665 kDbNumSeqs[index], kSubjectLengths[index]);
669 if (index < kNumDbs-1)
676 const Int8 kDbLength = 500000000;
677 const Uint4 kDbNumSeqs = 1000000;
678 const int kNumSubjects = 3;
679 const Uint4 kSubjectLengths[kNumSubjects] = {400, 60, 3000 };
681 { 16, 0, 0, 0, 41, 66,
true, 41, 38 },
682 { 16, 0, 0, 0, 41, 66,
true, 0, 29 },
683 { 16, 0, 0, 0, 41, 66,
true, 41, 44 } };
688 for (index = 0; index < kNumSubjects; ++index) {
689 cutoffs = setupCutoffScores(
false, kDbLength,
690 kDbNumSeqs, kSubjectLengths[index]);
694 if (index < kNumSubjects-1)
701 const Int8 kDbLength = 227102922;
702 const Uint4 kDbNumSeqs = 761886;
703 const int kNumSubjects = 3;
704 const Uint4 kSubjectLengths[kNumSubjects] = { 400, 100, 3000 };
706 { 16, 0, 0, 0, 31, 63,
true, 31, 37 },
707 { 16, 0, 0, 0, 31, 63,
true, 0, 31 },
708 { 16, 0, 0, 0, 31, 63,
true, 31, 43 } };
713 for (index = 0; index < kNumSubjects; ++index) {
714 cutoffs = setupCutoffScores(
false, kDbLength, kDbNumSeqs,
715 kSubjectLengths[index]);
719 if (index < kNumSubjects-1)
726 const int kNumDbs = 3;
727 const Int8 kDbLengths[kNumDbs] =
728 { 10000000000LL, 10000000000LL, 3000000000LL };
729 const Uint4 kDbNumSeqs[kNumDbs] = { 2000000, 20000000, 500 };
730 const Uint4 kSubjectLengths[kNumDbs] = { 2000, 400, 3000000 };
732 { 16, 0, 0, 0, 40, 72,
true, 40, 40 },
733 { 16, 0, 0, 0, 33, 71,
true, 33, 35 },
734 { 16, 0, 0, 0, 41, 69,
true, 41, 60 } };
740 for (index = 0; index < kNumDbs; ++index) {
741 cutoffs = setupCutoffScores(
false, kDbLengths[index],
742 kDbNumSeqs[index], kSubjectLengths[index]);
746 if (index < kNumDbs-1)
753 const int kNumDbs = 4;
754 const Int8 kDbLengths[kNumDbs] =
755 { 10000000000LL, 10000000000LL, 10000000000LL, 3000000000LL };
756 const Uint4 kDbNumSeqs[kNumDbs] = { 2000000, 2000000, 20000000, 500 };
757 const Uint4 kSubjectLengths[kNumDbs] = { 2000, 100, 400, 3000000 };
759 { 16, 0, 0, 0, 41, 72,
true, 41, 40 },
760 { 16, 0, 0, 0, 41, 72,
true, 0, 27 },
761 { 16, 0, 0, 0, 41, 70,
true, 41, 34 },
762 { 16, 0, 0, 0, 41, 68,
true, 41, 60 } };
768 for (index = 0; index < kNumDbs; ++index) {
769 cutoffs = setupCutoffScores(
false, kDbLengths[index],
770 kDbNumSeqs[index], kSubjectLengths[index]);
774 if (index < kNumDbs-1)
781 const int kNumDbs = 4;
782 const Int8 kDbLengths[kNumDbs] =
783 { 10000000000LL, 10000000000LL, 3000000000LL, 10000LL };
784 const Uint4 kDbNumSeqs[kNumDbs] = { 2000000, 20000000, 500, 200 };
785 const Uint4 kSubjectLengths[kNumDbs] = { 2000, 400, 3000000, 60 };
787 { 11, 15, 50, 0, 13, 20,
false, 0, 0 },
788 { 11, 15, 50, 0, 13, 20,
false, 0, 0 },
789 { 11, 15, 50, 0, 13, 19,
false, 0, 0 },
790 { 11, 15, 50, 0, 10, 10,
false, 0, 0 } };
796 for (index = 0; index < kNumDbs; ++index) {
797 cutoffs = setupCutoffScores(
true, kDbLengths[index],
798 kDbNumSeqs[index], kSubjectLengths[index]);
802 if (index < kNumDbs-1)
809 const Int8 kDbLength = 600000000;
810 const Uint4 kDbNumSeqs = 1800000;
811 const Uint4 kSubjectLength = 200;
815 { 16, 38, 64, 41, 19, 19,
false, 0, 0 };
817 setupCutoffScores(
true, kDbLength, kDbNumSeqs, kSubjectLength);
825 const int kNumDbs = 2;
826 const Int8 kDbLengths[kNumDbs] =
827 {600000000, 6000000000LL};
828 const Uint4 kDbNumSeqs = 1800000;
829 const Uint4 kSubjectLength[kNumDbs] = {500, 2000};
831 { 16, 38, 64, 0, 22, 22,
true, 22, 0 },
832 { 16, 38, 64, 0, 27, 27,
true, 27, 0 } };
835 for (
int index = 0; index < kNumDbs; ++index) {
837 kDbLengths[index], kDbNumSeqs, kSubjectLength[index]);
841 if (index < kNumDbs-1)
848 const int kNumDbs = 3;
849 const Int8 kDbLengths[kNumDbs] =
850 { 10000000000LL, 10000000000LL, 3000000000LL };
851 const Uint4 kDbNumSeqs[kNumDbs] = { 2000000, 20000000, 500 };
852 const Uint4 kSubjectLengths[kNumDbs] = { 2000, 400, 3000000 };
854 { 16, 38, 64, 41, 27, 27,
true, 27, 0 },
855 { 16, 38, 64, 41, 21, 21,
true, 21, 0 },
856 { 16, 38, 64, 41, 41, 54,
true, 41, 0 } };
862 for (index = 0; index < kNumDbs; ++index) {
863 cutoffs = setupCutoffScores(
true, kDbLengths[index],
864 kDbNumSeqs[index], kSubjectLengths[index]);
868 if (index < kNumDbs-1)
875 const int kNumDbs = 3;
876 const Int8 kDbLengths[kNumDbs] =
877 { 10000000000LL, 10000000000LL, 3000000000LL };
878 const Uint4 kDbNumSeqs[kNumDbs] = { 2000000, 20000000, 500 };
879 const Uint4 kSubjectLengths[kNumDbs] = { 2000, 400, 3000000 };
885 for (index = 0; index < kNumDbs; ++index) {
886 cutoffs = setupCutoffScores(
true, kDbLengths[index],
887 kDbNumSeqs[index], kSubjectLengths[index], 1);
889 BOOST_REQUIRE_EQUAL((
int)
false, (
int) cutoffs->
do_sum_stats);
892 if (index < kNumDbs-1)
#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.
BlastHSPList * Blast_HSPListNew(Int4 hsp_max)
Creates HSP list structure with a default size HSP array.
BlastHSPList * Blast_HSPListFree(BlastHSPList *hsp_list)
Deallocate memory for an HSP list structure as well as all it's components.
Int2 Blast_HSPListReapByEvalue(BlastHSPList *hsp_list, const BlastHitSavingOptions *hit_options)
Discard the HSPs above the e-value threshold from the HSP list.
Blast_Message * Blast_MessageFree(Blast_Message *blast_msg)
Deallocates message memory.
Definitions which are dependant on the NCBI C++ Object Manager.
The structures and functions in blast_options.
#define BLAST_GAP_X_DROPOFF_NUCL
default dropoff for non-greedy nucleotide gapped extensions
BlastHitSavingOptions * BlastHitSavingOptionsFree(BlastHitSavingOptions *options)
Deallocate memory for BlastHitSavingOptions.
#define BLAST_UNGAPPED_X_DROPOFF_NUCL
ungapped dropoff score for blastn (and megablast)
Int2 BlastQuerySetUpOptionsNew(QuerySetUpOptions **options)
Allocate memory for QuerySetUpOptions and fill with default values.
Int2 BlastEffectiveLengthsOptionsNew(BlastEffectiveLengthsOptions **options)
Allocate memory for BlastEffectiveLengthsOptions* and fill with default values.
BlastInitialWordOptions * BlastInitialWordOptionsFree(BlastInitialWordOptions *options)
Deallocate memory for BlastInitialWordOptions.
Int2 BlastScoringOptionsNew(EBlastProgramType program, BlastScoringOptions **options)
Allocate memory for BlastScoringOptions and fill with default values.
BlastEffectiveLengthsOptions * BlastEffectiveLengthsOptionsFree(BlastEffectiveLengthsOptions *options)
Deallocate memory for BlastEffectiveLengthsOptions*.
Int2 LookupTableOptionsNew(EBlastProgramType program, LookupTableOptions **options)
Allocate memory for lookup table options and fill with default values.
#define BLAST_GAP_X_DROPOFF_FINAL_NUCL
default dropoff for nucleotide gapped extensions)
BlastExtensionOptions * BlastExtensionOptionsFree(BlastExtensionOptions *options)
Deallocate memory for BlastExtensionOptions.
Int2 BlastHitSavingOptionsNew(EBlastProgramType program, BlastHitSavingOptions **options, Boolean gapped_calculation)
Allocate memory for BlastHitSavingOptions.
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.
Declares class to encapsulate all BLAST options.
BlastHitSavingParameters * BlastHitSavingParametersFree(BlastHitSavingParameters *parameters)
Deallocate memory for BlastHitSavingOptions*.
Int2 BlastLinkHSPParametersNew(EBlastProgramType program_number, Boolean gapped_calculation, BlastLinkHSPParameters **link_hsp_params)
Initialize the linking HSPs parameters with default values.
BlastEffectiveLengthsParameters * BlastEffectiveLengthsParametersFree(BlastEffectiveLengthsParameters *parameters)
Deallocate memory for BlastEffectiveLengthsParameters*.
Int2 BlastExtensionParametersNew(EBlastProgramType blast_program, const BlastExtensionOptions *options, BlastScoreBlk *sbp, BlastQueryInfo *query_info, BlastExtensionParameters **parameters)
Calculate the raw values for the X-dropoff parameters.
BlastInitialWordParameters * BlastInitialWordParametersFree(BlastInitialWordParameters *parameters)
Deallocate memory for BlastInitialWordParameters.
BlastExtensionParameters * BlastExtensionParametersFree(BlastExtensionParameters *parameters)
Deallocate memory for BlastExtensionParameters.
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.
Int2 BlastLinkHSPParametersUpdate(const BlastInitialWordParameters *word_params, const BlastHitSavingParameters *hit_params, Boolean gapped_calculation)
Update BlastLinkHSPParameters, using calculated values of other parameters.
void CalculateLinkHSPCutoffs(EBlastProgramType program, BlastQueryInfo *query_info, const BlastScoreBlk *sbp, BlastLinkHSPParameters *link_hsp_params, const BlastInitialWordParameters *word_params, Int8 db_length, Int4 subject_length)
Calculates cutoff scores and returns them.
Int2 BlastEffectiveLengthsParametersNew(const BlastEffectiveLengthsOptions *options, Int8 db_length, Int4 num_seqs, BlastEffectiveLengthsParameters **parameters)
Allocate memory for BlastEffectiveLengthsParameters.
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 Blast_ScoreBlkKbpGappedCalc(BlastScoreBlk *sbp, const BlastScoringOptions *scoring_options, EBlastProgramType program, const BlastQueryInfo *query_info, Blast_Message **error_return)
Blast_ScoreBlkKbpGappedCalc, fills the ScoreBlkPtr for a gapped search.
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.
Int2 BLAST_CalcEffLengths(EBlastProgramType program_number, const BlastScoringOptions *scoring_options, const BlastEffectiveLengthsParameters *eff_len_params, const BlastScoreBlk *sbp, BlastQueryInfo *query_info, Blast_Message **blast_message)
Function to calculate effective query length and db length as well as effective search space.
BlastScoreBlk * BlastScoreBlkFree(BlastScoreBlk *sbp)
Deallocates BlastScoreBlk as well as all associated structures.
Int2 Blast_ScoreBlkKbpUngappedCalc(EBlastProgramType program, BlastScoreBlk *sbp, Uint1 *query, const BlastQueryInfo *query_info, Blast_Message **blast_message)
Calculate and fill the ungapped Karlin-Altschul parameters in the BlastScoreBlk structure (fields kbp...
BlastScoreBlk * BlastScoreBlkNew(Uint1 alphabet, Int4 number_of_contexts)
Allocates and initializes BlastScoreBlk.
EProgram
This enumeration is to evolve into a task/program specific list that specifies sets of default parame...
@ eTblastx
Translated nucl-Translated nucl.
@ eBlastn
Nucl-Nucl (traditional blastn)
@ eBlastp
Protein-Protein.
@ eTblastn
Protein-Translated nucl.
@ eBlastx
Translated nucl-Protein.
Wrapper class for BLAST_SequenceBlk .
Encapsulates ALL the BLAST algorithm's options.
Wrapper class for BlastQueryInfo .
static CTestObjMgr & Instance()
typedef for the messages for an entire BLAST search, which could be comprised of multiple query seque...
void SetStrandOption(objects::ENa_strand s)
void SetQueryGeneticCode(int gc)
void SetupQueries(TSeqLocVector &queries, BlastQueryInfo *qinfo, BLAST_SequenceBlk **seqblk, EBlastProgramType prog, objects::ENa_strand strand_opt, TSearchMessages &messages)
Populates BLAST_SequenceBlk with sequence data for use in CORE BLAST.
objects::ENa_strand GetStrandOption() const
#define BLASTNA_SEQ_CODE
Identifies the blastna alphabet, for use in blast only.
void SetProgram(EProgram p)
Sets the task this object is best suited for.
#define BLASTAA_SEQ_CODE
== Seq_code_ncbistdaa
TAutoUint1Ptr data
Sequence data.
char * BlastFindMatrixPath(const char *matrix_name, Boolean is_prot)
Returns the path to a specified matrix.
void SetupQueryInfo(TSeqLocVector &queries, EBlastProgramType prog, objects::ENa_strand strand_opt, BlastQueryInfo **qinfo)
Allocates the query information structure and fills the context offsets, in case of multiple queries,...
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.
@ eBlastEncodingNucleotide
Special encoding for preliminary stage of BLAST: permutation of NCBI4na.
@ eSentinels
Use sentinel bytes.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
element_type * get(void) const
Get pointer.
void Reset(void)
Reset reference object.
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
ENa_strand
strand of nucleic acid
@ eNa_strand_both
in forward orientation
Functions to link HSPs using sum statistics.
Int2 BLAST_LinkHsps(EBlastProgramType program_number, BlastHSPList *hsp_list, const BlastQueryInfo *query_info, Int4 subject_length, const BlastScoreBlk *sbp, const BlastLinkHSPParameters *link_hsp_params, Boolean gapped_calculation)
Link HSPs using sum statistics.
BOOST_AUTO_TEST_CASE(testUnevenGapLinkHspsTblastn)
Test linking with uneven gap sum statistics.
static void s_SetupNuclQueryInfo(Uint4 query_length, BlastQueryInfo **query_info)
Sets up the query information structure without a real sequence.
static void testAllCutoffs(const AllCutoffScores &good_cutoffs, AllCutoffScores &cutoffs)
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.
range(_Ty, _Ty) -> range< _Ty >
Magic spell ;-) needed for some weird compilers... very empiric.
int strcmp(const char *str1, const char *str2)
Uint1 Boolean
bool replacment for C
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
Defines: CTimeFormat - storage class for time format.
Implementation of the BlastSeqSrc interface using the C++ BLAST databases API.
static const string kEvalue
vector< SSeqLoc > TSeqLocVector
Vector of sequence locations.
Int4 cutoff_score_ungapped
Uint1 * sequence
Sequence used for search (could be translation).
Int4 query_length
Length of this query, strand or frame.
Options for setting up effective lengths and search spaces.
Parameters for setting up effective lengths and search spaces.
Options used for gapped extension These include: a.
double gap_x_dropoff_final
X-dropoff value for the final gapped extension (in bits)
double gap_x_dropoff
X-dropoff value for gapped extension (in bits)
Computed values used as parameters for gapped alignments.
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)
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.
Int4 num
How many HSP's are linked together for sum statistics evaluation? If unset (0), this HSP is not part ...
BlastSeg subject
Subject sequence info.
Int4 score
This HSP's raw score.
Options used when evaluating and saving hits These include: a.
Int4 longest_intron
The longest distance between HSPs allowed for combining via sum statistics with uneven gaps.
double expect_value
The expect value cut-off threshold for an HSP, or a combined hit if sum statistics is used.
Parameter block that contains a pointer to BlastHitSavingOptions and the values derived from it.
Int4 cutoff_score_min
smallest cutoff score across all contexts
Boolean do_sum_stats
TRUE if sum stats will be used.
BlastLinkHSPParameters * link_hsp_params
Parameters for linking HSPs with sum statistics; linking is not done if NULL.
BlastHitSavingOptions * options
The original (unparsed) options.
Options needed for initial word finding and processing.
double x_dropoff
X-dropoff value (in bits) for the ungapped extension.
Parameter block that contains a pointer to BlastInitialWordOptions and the values derived from it.
Int4 cutoff_score_min
smallest cutoff score across all contexts
Int4 x_dropoff_max
largest X-drop cutoff across all contexts
Int4 cutoff_big_gap
Cutoff sum score for linked HSPs with big gaps.
Int4 cutoff_small_gap
Cutoff sum score for linked HSPs with small gaps.
Int4 longest_intron
Length of a longest intron for uneven gap linking of HSPs.
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
Karlin-Altschul parameters.
Blast_KarlinBlk ** kbp_gap
K-A parameters for gapped alignments.
Blast_KarlinBlk ** kbp_gap_std
K-A parameters for std (not position-based) alignments.
Blast_KarlinBlk ** kbp_std
K-A parameters for ungapped alignments.
Scoring options block Used to produce the BlastScoreBlk structure This structure may be needed for lo...
Boolean gapped_calculation
gap-free search if FALSE
char * matrix
Name of the matrix containing all scores: needed for finding neighboring words.
Int2 frame
Translation frame.
Used to hold a set of positions, mostly used for filtering.
Structure to hold the a message from the core of the BLAST engine.
void freeStructures()
Frees all the C structures used in the test.
BlastScoreBlk * m_ScoreBlk
void fillEffectiveLengths(const BlastScoringOptions *score_options, Int8 db_length, Int4 db_num_seq)
Fills the effective lengths data into the query information structure.
void setupLinkHspInputBlastn()
Complete set-up before calling the HSP linking algorithm.
void setupScoreBlk(Uint1 *seqbuf, bool gapped, BlastScoringOptions **score_options_ptr)
Sets up the scoring block with the Karlin-Altschul parameters.
void setupLinkHspInputTblastn()
Complete set-up before calling the HSP linking algorithm.
BlastHitSavingParameters * m_HitParams
void setupHitParams(int longest_intron, double evalue)
Sets up the hit saving parameters structures.
void setupHSPListNucl()
HSP list setup for blastn.
void setupHSPListForMiddleInsertTest()
void setupHSPListTransl()
Sets up the input list of HSPs. These must be sorted by score.
AllCutoffScores * setupCutoffScores(bool gapped, Int8 db_length, Uint4 db_num_seq, Uint4 subj_length, int longest_intron=0)
CBlastQueryInfo m_QueryInfo
void testUnevenGapLinkHsps()
Test linking with uneven gap sum statistics.
EBlastProgramType m_ProgramType
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.
Structure to store sequence data and its length for use in the CORE of BLAST (it's a malloc'ed array ...
Utility stuff for more convenient using of Boost.Test library.
voidp calloc(uInt items, uInt size)