00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <ncbi_pch.hpp>
00034 #include <corelib/test_boost.hpp>
00035
00036 #include <algo/blast/api/blast_options_handle.hpp>
00037 #include <algo/blast/api/blast_prot_options.hpp>
00038 #include <algo/blast/api/psiblast_options.hpp>
00039 #include <algo/blast/api/blast_advprot_options.hpp>
00040 #include <algo/blast/api/blast_nucl_options.hpp>
00041 #include <algo/blast/api/disc_nucl_options.hpp>
00042 #include <algo/blast/api/blastx_options.hpp>
00043 #include <algo/blast/api/tblastn_options.hpp>
00044 #include <algo/blast/api/tblastx_options.hpp>
00045 #include <algo/blast/core/blast_def.h>
00046
00047 #include "test_objmgr.hpp"
00048
00049 #ifdef NCBI_OS_IRIX
00050 #include <stdlib.h>
00051 #else
00052 #include <cstdlib>
00053 #endif
00054
00055
00056
00057
00058 template <class BC, class T>
00059 void VerifyMutatorAccessor(BC& obj,
00060 void (BC::*mutator)(T),
00061 T (BC::*accessor)(void) const,
00062 T& expected_value)
00063 {
00064 # define CALL_MEMBER_FUNCTION(obj, membFnPtr) ((obj).*(membFnPtr))
00065
00066 CALL_MEMBER_FUNCTION(obj, mutator)(expected_value);
00067 T actual_value = CALL_MEMBER_FUNCTION(obj, accessor)();
00068 BOOST_REQUIRE_EQUAL(expected_value, actual_value);
00069 }
00070
00071 using namespace std;
00072 using namespace ncbi;
00073 using namespace ncbi::blast;
00074
00075 struct UniversalOptiosHandleFixture {
00076 UniversalOptiosHandleFixture() {
00077
00078
00079
00080 EProgram p = (EProgram) (1 + rand() % ((int)eBlastProgramMax - 1));
00081 m_OptsHandle = CBlastOptionsFactory::Create(p);
00082 }
00083 ~UniversalOptiosHandleFixture() { delete m_OptsHandle;}
00084
00085 CBlastOptionsHandle* m_OptsHandle;
00086 };
00087
00088
00089
00090
00091 BOOST_FIXTURE_TEST_CASE(Set_Get_MaskAtHash_Universal, UniversalOptiosHandleFixture) {
00092 bool value = true;
00093
00094 VerifyMutatorAccessor<CBlastOptionsHandle, bool>
00095 (*m_OptsHandle,
00096 &CBlastOptionsHandle::SetMaskAtHash,
00097 &CBlastOptionsHandle::GetMaskAtHash,
00098 value);
00099 }
00100
00101 BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoff_Universal, UniversalOptiosHandleFixture) {
00102 double value = 10.5;
00103
00104 VerifyMutatorAccessor<CBlastOptionsHandle, double>
00105 (*m_OptsHandle,
00106 &CBlastOptionsHandle::SetGapXDropoff,
00107 &CBlastOptionsHandle::GetGapXDropoff,
00108 value);
00109 }
00110
00111 BOOST_FIXTURE_TEST_CASE(Set_Get_GapTrigger_Universal, UniversalOptiosHandleFixture) {
00112 double value = 10.5;
00113
00114 VerifyMutatorAccessor<CBlastOptionsHandle, double>
00115 (*m_OptsHandle,
00116 &CBlastOptionsHandle::SetGapTrigger,
00117 &CBlastOptionsHandle::GetGapTrigger,
00118 value);
00119 }
00120
00121 BOOST_FIXTURE_TEST_CASE(Set_Get_HitlistSize_Universal, UniversalOptiosHandleFixture) {
00122 int value = 100;
00123
00124 VerifyMutatorAccessor<CBlastOptionsHandle, int>
00125 (*m_OptsHandle,
00126 &CBlastOptionsHandle::SetHitlistSize,
00127 &CBlastOptionsHandle::GetHitlistSize,
00128 value);
00129 }
00130
00131 BOOST_FIXTURE_TEST_CASE(Set_Get_MaxNumHspPerSequence_Universal, UniversalOptiosHandleFixture) {
00132 int value = 100;
00133
00134 VerifyMutatorAccessor<CBlastOptionsHandle, int>
00135 (*m_OptsHandle,
00136 &CBlastOptionsHandle::SetMaxNumHspPerSequence,
00137 &CBlastOptionsHandle::GetMaxNumHspPerSequence,
00138 value);
00139 }
00140
00141 BOOST_FIXTURE_TEST_CASE(Set_Get_EvalueThreshold_Universal, UniversalOptiosHandleFixture) {
00142 double value = -10.5;
00143
00144 VerifyMutatorAccessor<CBlastOptionsHandle, double>
00145 (*m_OptsHandle,
00146 &CBlastOptionsHandle::SetEvalueThreshold,
00147 &CBlastOptionsHandle::GetEvalueThreshold,
00148 value);
00149 }
00150
00151 BOOST_FIXTURE_TEST_CASE(Set_Get_CutoffScore_Universal, UniversalOptiosHandleFixture) {
00152 int value = -10;
00153
00154 VerifyMutatorAccessor<CBlastOptionsHandle, int>
00155 (*m_OptsHandle,
00156 &CBlastOptionsHandle::SetCutoffScore,
00157 &CBlastOptionsHandle::GetCutoffScore,
00158 value);
00159 }
00160
00161 BOOST_FIXTURE_TEST_CASE(Set_Get_PercentIdentity_Universal, UniversalOptiosHandleFixture) {
00162 double value = 1.5;
00163
00164 VerifyMutatorAccessor<CBlastOptionsHandle, double>
00165 (*m_OptsHandle,
00166 &CBlastOptionsHandle::SetPercentIdentity,
00167 &CBlastOptionsHandle::GetPercentIdentity,
00168 value);
00169 }
00170
00171 BOOST_FIXTURE_TEST_CASE(Set_Get_GappedMode_Universal, UniversalOptiosHandleFixture) {
00172 bool value = false;
00173
00174 VerifyMutatorAccessor<CBlastOptionsHandle, bool>
00175 (*m_OptsHandle,
00176 &CBlastOptionsHandle::SetGappedMode,
00177 &CBlastOptionsHandle::GetGappedMode,
00178 value);
00179 }
00180
00181 BOOST_FIXTURE_TEST_CASE(Set_Get_Culling_Universal, UniversalOptiosHandleFixture) {
00182 int value = 20;
00183
00184 VerifyMutatorAccessor<CBlastOptionsHandle, int>
00185 (*m_OptsHandle,
00186 &CBlastOptionsHandle::SetCullingLimit,
00187 &CBlastOptionsHandle::GetCullingLimit,
00188 value);
00189 }
00190
00191
00192
00193
00194 BOOST_AUTO_TEST_CASE(BlastnTest) {
00195 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastn");
00196 CBlastNucleotideOptionsHandle* opts =
00197 dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
00198 BOOST_REQUIRE(opts != NULL);
00199 BOOST_REQUIRE_EQUAL(2, opts->GetMatchReward());
00200 delete handle;
00201 }
00202
00203 BOOST_AUTO_TEST_CASE(BlastnShortTest) {
00204 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastn-short");
00205 CBlastNucleotideOptionsHandle* opts =
00206 dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
00207 BOOST_REQUIRE(opts != NULL);
00208 BOOST_REQUIRE_EQUAL(1, opts->GetMatchReward());
00209 BOOST_REQUIRE_EQUAL(7, opts->GetWordSize());
00210 delete handle;
00211 }
00212
00213 BOOST_AUTO_TEST_CASE(MegablastTest) {
00214 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("megablast");
00215 CBlastNucleotideOptionsHandle* opts =
00216 dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
00217 BOOST_REQUIRE(opts != NULL);
00218 BOOST_REQUIRE_EQUAL(1, opts->GetMatchReward());
00219 delete handle;
00220 }
00221
00222 BOOST_AUTO_TEST_CASE(DCMegablastTest) {
00223 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("dc-megablast");
00224 CDiscNucleotideOptionsHandle* opts =
00225 dynamic_cast<CDiscNucleotideOptionsHandle*> (handle);
00226 BOOST_REQUIRE(opts != NULL);
00227 BOOST_REQUIRE_EQUAL(2, opts->GetMatchReward());
00228 BOOST_REQUIRE_EQUAL(18, (int) opts->GetTemplateLength());
00229 delete handle;
00230 }
00231
00232 BOOST_AUTO_TEST_CASE(CaseSensitiveTest) {
00233 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("MeGaBlaSt");
00234 CBlastNucleotideOptionsHandle* opts =
00235 dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
00236 BOOST_REQUIRE(opts != NULL);
00237 delete handle;
00238 }
00239
00240 BOOST_AUTO_TEST_CASE(BadNameTest) {
00241 CBlastOptionsHandle* handle = NULL;
00242 BOOST_CHECK_THROW(handle = CBlastOptionsFactory::CreateTask("mega"),
00243 CBlastException);
00244 CBlastNucleotideOptionsHandle* opts =
00245 dynamic_cast<CBlastNucleotideOptionsHandle*> (handle);
00246 BOOST_REQUIRE(opts == NULL);
00247 delete handle;
00248 }
00249
00250 BOOST_AUTO_TEST_CASE(BlastpTest) {
00251 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastp");
00252 CBlastAdvancedProteinOptionsHandle* opts =
00253 dynamic_cast<CBlastAdvancedProteinOptionsHandle*> (handle);
00254 BOOST_REQUIRE(opts != NULL);
00255 BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
00256 BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
00257 delete handle;
00258 }
00259
00260 BOOST_AUTO_TEST_CASE(BlastpShortTest) {
00261 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastp-short");
00262 CBlastAdvancedProteinOptionsHandle* opts =
00263 dynamic_cast<CBlastAdvancedProteinOptionsHandle*> (handle);
00264 BOOST_REQUIRE(opts != NULL);
00265 BOOST_REQUIRE(!strcmp("PAM30", opts->GetMatrixName()));
00266 BOOST_REQUIRE_EQUAL(2, opts->GetWordSize());
00267 delete handle;
00268 }
00269
00270 BOOST_AUTO_TEST_CASE(BlastxTest) {
00271 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("blastx");
00272 CBlastxOptionsHandle* opts =
00273 dynamic_cast<CBlastxOptionsHandle*> (handle);
00274 BOOST_REQUIRE(opts != NULL);
00275 BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
00276 BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
00277 delete handle;
00278 }
00279
00280 BOOST_AUTO_TEST_CASE(TblastnTest) {
00281 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("tblastn");
00282 CTBlastnOptionsHandle* opts =
00283 dynamic_cast<CTBlastnOptionsHandle*> (handle);
00284 BOOST_REQUIRE(opts != NULL);
00285 BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
00286 BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
00287 delete handle;
00288 }
00289
00290 BOOST_AUTO_TEST_CASE(TblastxTest) {
00291 CBlastOptionsHandle* handle = CBlastOptionsFactory::CreateTask("tblastx");
00292 CTBlastxOptionsHandle* opts =
00293 dynamic_cast<CTBlastxOptionsHandle*> (handle);
00294 BOOST_REQUIRE(opts != NULL);
00295 BOOST_REQUIRE(!strcmp("BLOSUM62", opts->GetMatrixName()));
00296 BOOST_REQUIRE_EQUAL(3, opts->GetWordSize());
00297 delete handle;
00298 }
00299
00300
00301 struct ProteinOptiosHandleFixture {
00302 ProteinOptiosHandleFixture() {
00303 m_OptsHandle = new CBlastProteinOptionsHandle();
00304 }
00305 ~ProteinOptiosHandleFixture() { delete m_OptsHandle;}
00306
00307 CBlastProteinOptionsHandle* m_OptsHandle;
00308 };
00309
00310
00311
00312
00313
00314 BOOST_FIXTURE_TEST_CASE(Set_Get_WordThreshold_Protein, ProteinOptiosHandleFixture) {
00315 double value = 15;
00316
00317 VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
00318 (*m_OptsHandle,
00319 &CBlastProteinOptionsHandle::SetWordThreshold,
00320 &CBlastProteinOptionsHandle::GetWordThreshold,
00321 value);
00322 }
00323
00324 BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_Protein, ProteinOptiosHandleFixture) {
00325 int value = 5;
00326
00327 VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
00328 (*m_OptsHandle,
00329 &CBlastProteinOptionsHandle::SetWordSize,
00330 &CBlastProteinOptionsHandle::GetWordSize,
00331 value);
00332 }
00333
00334 BOOST_FIXTURE_TEST_CASE(Set_Get_WindowSize_Protein, ProteinOptiosHandleFixture) {
00335 int value = 50;
00336
00337 VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
00338 (*m_OptsHandle,
00339 &CBlastProteinOptionsHandle::SetWindowSize,
00340 &CBlastProteinOptionsHandle::GetWindowSize,
00341 value);
00342 }
00343
00344 BOOST_FIXTURE_TEST_CASE(Set_Get_XDropoff_Protein, ProteinOptiosHandleFixture) {
00345 double value = 26.2;
00346
00347 VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
00348 (*m_OptsHandle,
00349 &CBlastProteinOptionsHandle::SetXDropoff,
00350 &CBlastProteinOptionsHandle::GetXDropoff,
00351 value);
00352 }
00353
00354 BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoffFinal_Protein, ProteinOptiosHandleFixture) {
00355 double value = 26.2;
00356
00357 VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
00358 (*m_OptsHandle,
00359 &CBlastProteinOptionsHandle::SetGapXDropoffFinal,
00360 &CBlastProteinOptionsHandle::GetGapXDropoffFinal,
00361 value);
00362 }
00363
00364 BOOST_FIXTURE_TEST_CASE(Set_Get_DbLength_Protein, ProteinOptiosHandleFixture) {
00365 Int8 value = 1000000;
00366
00367 VerifyMutatorAccessor<CBlastProteinOptionsHandle, Int8>
00368 (*m_OptsHandle,
00369 &CBlastProteinOptionsHandle::SetDbLength,
00370 &CBlastProteinOptionsHandle::GetDbLength,
00371 value);
00372 }
00373
00374 BOOST_FIXTURE_TEST_CASE(Set_Get_DbSeqNum_Protein, ProteinOptiosHandleFixture) {
00375 unsigned int value = 0x1<<16;
00376
00377 VerifyMutatorAccessor<CBlastProteinOptionsHandle, unsigned int>
00378 (*m_OptsHandle,
00379 &CBlastProteinOptionsHandle::SetDbSeqNum,
00380 &CBlastProteinOptionsHandle::GetDbSeqNum,
00381 value);
00382 }
00383
00384 BOOST_FIXTURE_TEST_CASE(Set_Get_EffectiveSearchSpace_Protein, ProteinOptiosHandleFixture) {
00385 Int8 value = 1000000;
00386
00387 VerifyMutatorAccessor<CBlastProteinOptionsHandle, Int8>
00388 (*m_OptsHandle,
00389 &CBlastProteinOptionsHandle::SetEffectiveSearchSpace,
00390 &CBlastProteinOptionsHandle::GetEffectiveSearchSpace,
00391 value);
00392 }
00393
00394 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFiltering_Protein, ProteinOptiosHandleFixture) {
00395 bool value = true;
00396
00397 VerifyMutatorAccessor<CBlastProteinOptionsHandle, bool>
00398 (*m_OptsHandle,
00399 &CBlastProteinOptionsHandle::SetSegFiltering,
00400 &CBlastProteinOptionsHandle::GetSegFiltering,
00401 value);
00402 }
00403
00404 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringWindow_Protein, ProteinOptiosHandleFixture) {
00405 int value = 26;
00406
00407 VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
00408 (*m_OptsHandle,
00409 &CBlastProteinOptionsHandle::SetSegFilteringWindow,
00410 &CBlastProteinOptionsHandle::GetSegFilteringWindow,
00411 value);
00412 }
00413
00414 BOOST_FIXTURE_TEST_CASE(Get_SegWindowWithSegOptionsUnallocated_Protein, ProteinOptiosHandleFixture) {
00415
00416 m_OptsHandle->SetSegFiltering(false);
00417
00418 int value = m_OptsHandle->GetSegFilteringWindow();
00419 BOOST_REQUIRE(value < 0);
00420 }
00421
00422 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringLocut_Protein, ProteinOptiosHandleFixture) {
00423 double value = 1.7;
00424
00425 VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
00426 (*m_OptsHandle,
00427 &CBlastProteinOptionsHandle::SetSegFilteringLocut,
00428 &CBlastProteinOptionsHandle::GetSegFilteringLocut,
00429 value);
00430 }
00431
00432 BOOST_FIXTURE_TEST_CASE(Get_SegLocutWithSegOptionsUnallocated_Protein, ProteinOptiosHandleFixture) {
00433
00434 m_OptsHandle->SetSegFiltering(false);
00435
00436 double value = m_OptsHandle->GetSegFilteringLocut();
00437 BOOST_REQUIRE(value < 0);
00438 }
00439
00440 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringHicut_Protein, ProteinOptiosHandleFixture) {
00441 double value = 3.7;
00442
00443 VerifyMutatorAccessor<CBlastProteinOptionsHandle, double>
00444 (*m_OptsHandle,
00445 &CBlastProteinOptionsHandle::SetSegFilteringHicut,
00446 &CBlastProteinOptionsHandle::GetSegFilteringHicut,
00447 value);
00448 }
00449
00450 BOOST_FIXTURE_TEST_CASE(Get_SegHicutWithSegOptionsUnallocated_Protein, ProteinOptiosHandleFixture) {
00451
00452 m_OptsHandle->SetSegFiltering(false);
00453
00454 double value = m_OptsHandle->GetSegFilteringHicut();
00455 BOOST_REQUIRE(value < 0);
00456 }
00457
00458 BOOST_FIXTURE_TEST_CASE(Set_Get_MatrixName_Protein, ProteinOptiosHandleFixture) {
00459 const char* value = "dummy matrix";
00460
00461 VerifyMutatorAccessor<CBlastProteinOptionsHandle, const char*>
00462 (*m_OptsHandle,
00463 &CBlastProteinOptionsHandle::SetMatrixName,
00464 &CBlastProteinOptionsHandle::GetMatrixName,
00465 value);
00466 }
00467
00468 BOOST_FIXTURE_TEST_CASE(Set_Get_GapOpeningCost_Protein, ProteinOptiosHandleFixture) {
00469 int value = 150;
00470
00471 VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
00472 (*m_OptsHandle,
00473 &CBlastProteinOptionsHandle::SetGapOpeningCost,
00474 &CBlastProteinOptionsHandle::GetGapOpeningCost,
00475 value);
00476 }
00477
00478 BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtensionCost_Protein, ProteinOptiosHandleFixture) {
00479 int value = 150;
00480
00481 VerifyMutatorAccessor<CBlastProteinOptionsHandle, int>
00482 (*m_OptsHandle,
00483 &CBlastProteinOptionsHandle::SetGapExtensionCost,
00484 &CBlastProteinOptionsHandle::GetGapExtensionCost,
00485 value);
00486 }
00487
00488 struct PSIBlastOptiosHandleFixture {
00489 PSIBlastOptiosHandleFixture() {
00490 m_OptsHandle = new CPSIBlastOptionsHandle();
00491 }
00492 ~PSIBlastOptiosHandleFixture() { delete m_OptsHandle;}
00493
00494 CPSIBlastOptionsHandle* m_OptsHandle;
00495 };
00496
00497
00498
00499
00500
00501 BOOST_FIXTURE_TEST_CASE(Set_Get_WordThreshold_PSIBlast, PSIBlastOptiosHandleFixture) {
00502 double value = 15;
00503
00504 VerifyMutatorAccessor<CPSIBlastOptionsHandle, double>
00505 (*m_OptsHandle,
00506 &CPSIBlastOptionsHandle::SetWordThreshold,
00507 &CPSIBlastOptionsHandle::GetWordThreshold,
00508 value);
00509 }
00510
00511 BOOST_FIXTURE_TEST_CASE(Set_Get_InclusionThreshold_PSIBlast, PSIBlastOptiosHandleFixture) {
00512 double value = 0.05;
00513
00514 VerifyMutatorAccessor<CPSIBlastOptionsHandle, double>
00515 (*m_OptsHandle,
00516 &CPSIBlastOptionsHandle::SetInclusionThreshold,
00517 &CPSIBlastOptionsHandle::GetInclusionThreshold,
00518 value);
00519 }
00520
00521 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFiltering_PSIBlast, PSIBlastOptiosHandleFixture) {
00522 bool value = true;
00523
00524 VerifyMutatorAccessor<CPSIBlastOptionsHandle, bool>
00525 (*m_OptsHandle,
00526 &CPSIBlastOptionsHandle::SetSegFiltering,
00527 &CPSIBlastOptionsHandle::GetSegFiltering,
00528 value);
00529 }
00530
00531 BOOST_FIXTURE_TEST_CASE(Set_Get_SegFilteringWindow_PSIBlast, PSIBlastOptiosHandleFixture) {
00532 int value = 26;
00533
00534 VerifyMutatorAccessor<CPSIBlastOptionsHandle, int>
00535 (*m_OptsHandle,
00536 &CPSIBlastOptionsHandle::SetSegFilteringWindow,
00537 &CPSIBlastOptionsHandle::GetSegFilteringWindow,
00538 value);
00539 }
00540
00541 struct AdvancedProteinOptionsHandleFixture {
00542 AdvancedProteinOptionsHandleFixture() {
00543 m_OptsHandle = new CBlastAdvancedProteinOptionsHandle();
00544 }
00545 ~AdvancedProteinOptionsHandleFixture() { delete m_OptsHandle;}
00546
00547 CBlastAdvancedProteinOptionsHandle* m_OptsHandle;
00548 };
00549
00550
00551
00552 BOOST_FIXTURE_TEST_CASE(Set_Get_CompositionBasedStats_AdvancedProtein, AdvancedProteinOptionsHandleFixture) {
00553 ECompoAdjustModes value = eNoCompositionBasedStats;
00554
00555 VerifyMutatorAccessor<CBlastAdvancedProteinOptionsHandle,
00556 ECompoAdjustModes>
00557 (*m_OptsHandle,
00558 &CBlastAdvancedProteinOptionsHandle::SetCompositionBasedStats,
00559 &CBlastAdvancedProteinOptionsHandle::GetCompositionBasedStats,
00560 value);
00561 }
00562
00563 BOOST_FIXTURE_TEST_CASE(Set_Get_SmithWatermanMode_AdvancedProtein, AdvancedProteinOptionsHandleFixture) {
00564 bool value = true;
00565
00566 VerifyMutatorAccessor<CBlastAdvancedProteinOptionsHandle, bool>
00567 (*m_OptsHandle,
00568 &CBlastAdvancedProteinOptionsHandle::SetSmithWatermanMode,
00569 &CBlastAdvancedProteinOptionsHandle::GetSmithWatermanMode,
00570 value);
00571 }
00572
00573 struct BlastNuclOptionsHandleFixture {
00574 BlastNuclOptionsHandleFixture() {
00575 m_OptsHandle = new CBlastNucleotideOptionsHandle();
00576 }
00577 ~BlastNuclOptionsHandleFixture() { delete m_OptsHandle;}
00578
00579 CBlastNucleotideOptionsHandle* m_OptsHandle;
00580 };
00581
00582
00583
00584
00585 BOOST_FIXTURE_TEST_CASE(Set_Get_LookupTableType_BlastNucl, BlastNuclOptionsHandleFixture) {
00586 ELookupTableType value = eNaLookupTable;
00587
00588 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, ELookupTableType>
00589 (*m_OptsHandle,
00590 &CBlastNucleotideOptionsHandle::SetLookupTableType,
00591 &CBlastNucleotideOptionsHandle::GetLookupTableType,
00592 value);
00593 }
00594
00595 BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_BlastNucl, BlastNuclOptionsHandleFixture) {
00596 int value = 23;
00597
00598 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00599 (*m_OptsHandle,
00600 &CBlastNucleotideOptionsHandle::SetWordSize,
00601 &CBlastNucleotideOptionsHandle::GetWordSize,
00602 value);
00603 }
00604
00605 BOOST_FIXTURE_TEST_CASE(Set_Get_StrandOption_BlastNucl, BlastNuclOptionsHandleFixture) {
00606 objects::ENa_strand value = objects::eNa_strand_minus;
00607
00608 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, objects::ENa_strand>
00609 (*m_OptsHandle,
00610 &CBlastNucleotideOptionsHandle::SetStrandOption,
00611 &CBlastNucleotideOptionsHandle::GetStrandOption,
00612 value);
00613 }
00614
00615 BOOST_FIXTURE_TEST_CASE(Set_Get_WindowSize_BlastNucl, BlastNuclOptionsHandleFixture) {
00616 int value = 50;
00617
00618 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00619 (*m_OptsHandle,
00620 &CBlastNucleotideOptionsHandle::SetWindowSize,
00621 &CBlastNucleotideOptionsHandle::GetWindowSize,
00622 value);
00623 }
00624
00625 BOOST_FIXTURE_TEST_CASE(Set_Get_XDropoff_BlastNucl, BlastNuclOptionsHandleFixture) {
00626 double value = 40;
00627
00628 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, double>
00629 (*m_OptsHandle,
00630 &CBlastNucleotideOptionsHandle::SetXDropoff,
00631 &CBlastNucleotideOptionsHandle::GetXDropoff,
00632 value);
00633 }
00634
00635 BOOST_FIXTURE_TEST_CASE(Set_Get_GapXDropoffFinal_BlastNucl, BlastNuclOptionsHandleFixture) {
00636 double value = 100;
00637
00638 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, double>
00639 (*m_OptsHandle,
00640 &CBlastNucleotideOptionsHandle::SetGapXDropoffFinal,
00641 &CBlastNucleotideOptionsHandle::GetGapXDropoffFinal,
00642 value);
00643 }
00644
00645 BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtnAlgorithm_BlastNucl, BlastNuclOptionsHandleFixture) {
00646 EBlastPrelimGapExt value = eDynProgScoreOnly;
00647 const int kGapOpen = 7;
00648 const int kGapExtend = 3;
00649
00650 m_OptsHandle->SetGapOpeningCost(kGapOpen);
00651 m_OptsHandle->SetGapExtensionCost(kGapExtend);
00652
00653 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, EBlastPrelimGapExt>
00654 (*m_OptsHandle,
00655 &CBlastNucleotideOptionsHandle::SetGapExtnAlgorithm,
00656 &CBlastNucleotideOptionsHandle::GetGapExtnAlgorithm,
00657 value);
00658
00659 BOOST_REQUIRE_EQUAL(kGapOpen, m_OptsHandle->GetGapOpeningCost());
00660 BOOST_REQUIRE_EQUAL(kGapExtend, m_OptsHandle->GetGapExtensionCost());
00661
00662 value = eGreedyScoreOnly;
00663 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, EBlastPrelimGapExt>
00664 (*m_OptsHandle,
00665 &CBlastNucleotideOptionsHandle::SetGapExtnAlgorithm,
00666 &CBlastNucleotideOptionsHandle::GetGapExtnAlgorithm,
00667 value);
00668
00669 BOOST_REQUIRE_EQUAL(kGapOpen, m_OptsHandle->GetGapOpeningCost());
00670 BOOST_REQUIRE_EQUAL(kGapExtend, m_OptsHandle->GetGapExtensionCost());
00671
00672 }
00673
00674 BOOST_FIXTURE_TEST_CASE(Set_Get_GapTracebackAlgorithm_BlastNucl, BlastNuclOptionsHandleFixture) {
00675 EBlastTbackExt value = eDynProgTbck;
00676 const int kGapOpen = 7;
00677 const int kGapExtend = 3;
00678
00679 m_OptsHandle->SetGapOpeningCost(kGapOpen);
00680 m_OptsHandle->SetGapExtensionCost(kGapExtend);
00681
00682 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, EBlastTbackExt>
00683 (*m_OptsHandle,
00684 &CBlastNucleotideOptionsHandle::SetGapTracebackAlgorithm,
00685 &CBlastNucleotideOptionsHandle::GetGapTracebackAlgorithm,
00686 value);
00687
00688 BOOST_REQUIRE_EQUAL(kGapOpen, m_OptsHandle->GetGapOpeningCost());
00689 BOOST_REQUIRE_EQUAL(kGapExtend, m_OptsHandle->GetGapExtensionCost());
00690
00691 }
00692
00693 BOOST_FIXTURE_TEST_CASE(Set_Get_MatchReward_BlastNucl, BlastNuclOptionsHandleFixture) {
00694 int value = 2;
00695
00696 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00697 (*m_OptsHandle,
00698 &CBlastNucleotideOptionsHandle::SetMatchReward,
00699 &CBlastNucleotideOptionsHandle::GetMatchReward,
00700 value);
00701 }
00702
00703 BOOST_FIXTURE_TEST_CASE(Set_Get_MismatchPenalty_BlastNucl, BlastNuclOptionsHandleFixture) {
00704 int value = -3;
00705
00706 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00707 (*m_OptsHandle,
00708 &CBlastNucleotideOptionsHandle::SetMismatchPenalty,
00709 &CBlastNucleotideOptionsHandle::GetMismatchPenalty,
00710 value);
00711 }
00712
00713 BOOST_FIXTURE_TEST_CASE(Set_Get_MatrixName_BlastNucl, BlastNuclOptionsHandleFixture) {
00714 const char* value = "MYNAMATRIX";
00715
00716 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, const char*>
00717 (*m_OptsHandle,
00718 &CBlastNucleotideOptionsHandle::SetMatrixName,
00719 &CBlastNucleotideOptionsHandle::GetMatrixName,
00720 value);
00721 }
00722
00723 BOOST_FIXTURE_TEST_CASE(Set_Get_GapOpeningCost_BlastNucl, BlastNuclOptionsHandleFixture) {
00724 int value = 4;
00725
00726 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00727 (*m_OptsHandle,
00728 &CBlastNucleotideOptionsHandle::SetGapOpeningCost,
00729 &CBlastNucleotideOptionsHandle::GetGapOpeningCost,
00730 value);
00731 }
00732
00733 BOOST_FIXTURE_TEST_CASE(Set_Get_GapExtensionCost_BlastNucl, BlastNuclOptionsHandleFixture) {
00734 int value = 1;
00735
00736 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00737 (*m_OptsHandle,
00738 &CBlastNucleotideOptionsHandle::SetGapExtensionCost,
00739 &CBlastNucleotideOptionsHandle::GetGapExtensionCost,
00740 value);
00741 }
00742
00743 BOOST_FIXTURE_TEST_CASE(Set_Get_EffectiveSearchSpace_BlastNucl, BlastNuclOptionsHandleFixture) {
00744 Int8 value = 20000000;
00745
00746 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, Int8>
00747 (*m_OptsHandle,
00748 &CBlastNucleotideOptionsHandle::SetEffectiveSearchSpace,
00749 &CBlastNucleotideOptionsHandle::GetEffectiveSearchSpace,
00750 value);
00751 }
00752
00753 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFiltering_BlastNucl, BlastNuclOptionsHandleFixture) {
00754 bool value = true;
00755
00756 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, bool>
00757 (*m_OptsHandle,
00758 &CBlastNucleotideOptionsHandle::SetDustFiltering,
00759 &CBlastNucleotideOptionsHandle::GetDustFiltering,
00760 value);
00761 }
00762
00763 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringLevel_BlastNucl, BlastNuclOptionsHandleFixture) {
00764 int value = 20;
00765
00766 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00767 (*m_OptsHandle,
00768 &CBlastNucleotideOptionsHandle::SetDustFilteringLevel,
00769 &CBlastNucleotideOptionsHandle::GetDustFilteringLevel,
00770 value);
00771 }
00772
00773 BOOST_FIXTURE_TEST_CASE(Get_DustLevelWithDustOptionsUnallocated_BlastNucl, BlastNuclOptionsHandleFixture) {
00774
00775 m_OptsHandle->SetDustFiltering(false);
00776
00777 int value = m_OptsHandle->GetDustFilteringLevel();
00778 BOOST_REQUIRE(value < 0);
00779 }
00780
00781 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringWindow_BlastNucl, BlastNuclOptionsHandleFixture) {
00782 int value = 21;
00783
00784 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00785 (*m_OptsHandle,
00786 &CBlastNucleotideOptionsHandle::SetDustFilteringWindow,
00787 &CBlastNucleotideOptionsHandle::GetDustFilteringWindow,
00788 value);
00789 }
00790
00791 BOOST_FIXTURE_TEST_CASE(Get_DustWindowWithDustOptionsUnallocated_BlastNucl, BlastNuclOptionsHandleFixture) {
00792
00793 m_OptsHandle->SetDustFiltering(false);
00794
00795 int value = m_OptsHandle->GetDustFilteringWindow();
00796 BOOST_REQUIRE(value < 0);
00797 }
00798
00799 BOOST_FIXTURE_TEST_CASE(Set_Get_DustFilteringLinker_BlastNucl, BlastNuclOptionsHandleFixture) {
00800 int value = 22;
00801
00802 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, int>
00803 (*m_OptsHandle,
00804 &CBlastNucleotideOptionsHandle::SetDustFilteringLinker,
00805 &CBlastNucleotideOptionsHandle::GetDustFilteringLinker,
00806 value);
00807 }
00808
00809 BOOST_FIXTURE_TEST_CASE(Get_DustLinkerWithDustOptionsUnallocated_BlastNucl, BlastNuclOptionsHandleFixture) {
00810
00811 m_OptsHandle->SetDustFiltering(false);
00812
00813 int value = m_OptsHandle->GetDustFilteringLinker();
00814 BOOST_REQUIRE(value < 0);
00815 }
00816
00817 BOOST_FIXTURE_TEST_CASE(Set_Get_RepeatFiltering_BlastNucl, BlastNuclOptionsHandleFixture) {
00818 bool value = true;
00819
00820 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, bool>
00821 (*m_OptsHandle,
00822 &CBlastNucleotideOptionsHandle::SetRepeatFiltering,
00823 &CBlastNucleotideOptionsHandle::GetRepeatFiltering,
00824 value);
00825 }
00826
00827 BOOST_FIXTURE_TEST_CASE(Set_Get_RepeatFilteringDB_BlastNucl, BlastNuclOptionsHandleFixture) {
00828 const char* db = "my_repeat_db";
00829
00830 VerifyMutatorAccessor<CBlastNucleotideOptionsHandle, const char*>
00831 (*m_OptsHandle,
00832 &CBlastNucleotideOptionsHandle::SetRepeatFilteringDB,
00833 &CBlastNucleotideOptionsHandle::GetRepeatFilteringDB,
00834 db);
00835 }
00836
00837 struct DiscNucleotideOptionsHandleFixture {
00838 DiscNucleotideOptionsHandleFixture() {
00839 m_OptsHandle = new CDiscNucleotideOptionsHandle();
00840 }
00841 ~DiscNucleotideOptionsHandleFixture() { delete m_OptsHandle;}
00842
00843 CDiscNucleotideOptionsHandle* m_OptsHandle;
00844 };
00845
00846
00847
00848
00849 BOOST_FIXTURE_TEST_CASE(Set_Get_TemplateLength_DiscNucleotide, DiscNucleotideOptionsHandleFixture) {
00850 unsigned char value = 18;
00851
00852 VerifyMutatorAccessor<CDiscNucleotideOptionsHandle, unsigned char>
00853 (*m_OptsHandle,
00854 &CDiscNucleotideOptionsHandle::SetTemplateLength,
00855 &CDiscNucleotideOptionsHandle::GetTemplateLength,
00856 value);
00857 }
00858
00859 BOOST_FIXTURE_TEST_CASE(Set_Get_TemplateType_DiscNucleotide, DiscNucleotideOptionsHandleFixture) {
00860 unsigned char value = 1;
00861
00862 VerifyMutatorAccessor<CDiscNucleotideOptionsHandle, unsigned char>
00863 (*m_OptsHandle,
00864 &CDiscNucleotideOptionsHandle::SetTemplateType,
00865 &CDiscNucleotideOptionsHandle::GetTemplateType,
00866 value);
00867 }
00868
00869 BOOST_FIXTURE_TEST_CASE(Set_Get_WordSize_DiscNucleotide, DiscNucleotideOptionsHandleFixture) {
00870 int value = 12;
00871
00872 VerifyMutatorAccessor<CDiscNucleotideOptionsHandle, int>
00873 (*m_OptsHandle,
00874 &CDiscNucleotideOptionsHandle::SetWordSize,
00875 &CDiscNucleotideOptionsHandle::GetWordSize,
00876 value);
00877 value = 16;
00878 try {
00879 m_OptsHandle->SetWordSize(value);
00880 } catch (const CBlastException& exptn) {
00881 BOOST_REQUIRE(!strcmp("Word size must be 11 or 12 only", exptn.GetMsg().c_str()));
00882 }
00883 }
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993