1 /* $Id: blast_options_local_priv.hpp 566836 2018-07-09 13:56:34Z fongah2 $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Christiam Camacho
27 *
28 */
29
30 /** @file blast_options_local_priv.hpp
31 * Private header for local representation of BLAST options.
32 */
33
34 #ifndef ALGO_BLAST_API___BLAST_OPTIONS_LOCAL_PRIV__HPP
35 #define ALGO_BLAST_API___BLAST_OPTIONS_LOCAL_PRIV__HPP
36
37 #include <objects/seqloc/Na_strand.hpp>
38 #include <algo/blast/api/blast_types.hpp>
39 #include <algo/blast/api/blast_aux.hpp>
40 #include <algo/blast/composition_adjustment/composition_constants.h>
41 #include <algo/blast/core/hspfilter_besthit.h>
42
43 /** @addtogroup AlgoBlast
44 *
45 * @{
46 */
47
48 BEGIN_NCBI_SCOPE
49 BEGIN_SCOPE(blast)
50
51 #ifndef SKIP_DOXYGEN_PROCESSING
52
53 static const int kInvalidFilterValue = -1;
54
55 // Forward declarations
56 class CBlastOptionsMemento;
57
58 /// Encapsulates all blast input parameters
59 class NCBI_XBLAST_EXPORT CBlastOptionsLocal : public CObject
60 {
61 public:
62 CBlastOptionsLocal();
63 ~CBlastOptionsLocal();
64
65 /// Copy constructor
66 CBlastOptionsLocal(const CBlastOptionsLocal& optsLocal);
67
68 /// Assignment operator
69 CBlastOptionsLocal& operator=(const CBlastOptionsLocal& optsLocal);
70
71 /// Validate the options
72 bool Validate() const;
73
74 /// Accessors/Mutators for individual options
75
76 EProgram GetProgram() const;
77 EBlastProgramType GetProgramType() const;
78 void SetProgram(EProgram p);
79
80 /******************* Lookup table options ***********************/
81 double GetWordThreshold() const;
82 void SetWordThreshold(double w);
83
84 ELookupTableType GetLookupTableType() const;
85 void SetLookupTableType(ELookupTableType type);
86
87 int GetWordSize() const;
88 void SetWordSize(int ws);
89
90 /// Skip words after each collected one while creating a lookup table
91 /// (currently only for megablast)
92 Uint4 GetLookupTableStride() const;
93 void SetLookupTableStride(Uint4 val);
94
95 /// Megablast only lookup table options
96 unsigned char GetMBTemplateLength() const;
97 void SetMBTemplateLength(unsigned char len);
98
99 unsigned char GetMBTemplateType() const;
100 void SetMBTemplateType(unsigned char type);
101
102 bool GetLookupDbFilter(void) const;
103 void SetLookupDbFilter(bool val);
104
105 Uint1 GetMaxDbWordCount(void) const;
106 void SetMaxDbWordCount(Uint1 val);
107
108 /******************* Query setup options ************************/
109 char* GetFilterString() const;
110 void SetFilterString(const char* f);
111
112 bool GetMaskAtHash() const;
113 void SetMaskAtHash(bool val = true);
114
115 bool GetDustFiltering() const;
116 void SetDustFiltering(bool val = true);
117
118 int GetDustFilteringLevel() const;
119 void SetDustFilteringLevel(int m);
120
121 int GetDustFilteringWindow() const;
122 void SetDustFilteringWindow(int m);
123
124 int GetDustFilteringLinker() const;
125 void SetDustFilteringLinker(int m);
126
127 bool GetSegFiltering() const;
128 void SetSegFiltering(bool val = true);
129
130 int GetSegFilteringWindow() const;
131 void SetSegFilteringWindow(int m);
132
133 double GetSegFilteringLocut() const;
134 void SetSegFilteringLocut(double m);
135
136 double GetSegFilteringHicut() const;
137 void SetSegFilteringHicut(double m);
138
139 bool GetRepeatFiltering() const;
140 void SetRepeatFiltering(bool val = true);
141
142 const char* GetRepeatFilteringDB() const;
143 void SetRepeatFilteringDB(const char* db);
144
145 int GetWindowMaskerTaxId() const;
146 void SetWindowMaskerTaxId(int taxid);
147
148 const char* GetWindowMaskerDatabase() const;
149 void SetWindowMaskerDatabase(const char* db);
150
151 objects::ENa_strand GetStrandOption() const;
152 void SetStrandOption(objects::ENa_strand s);
153
154 int GetQueryGeneticCode() const;
155 void SetQueryGeneticCode(int gc);
156
157 bool GetReadQualityFiltering(void) const;
158 void SetReadQualityFiltering(bool val = true);
159
160 double GetReadMaxFractionAmbiguous(void) const;
161 void SetReadMaxFractionAmbiguous(double val);
162
163 int GetReadMinDimerEntropy(void) const;
164 void SetReadMinDimerEntropy(int val);
165
166 /******************* Initial word options ***********************/
167 int GetWindowSize() const;
168 void SetWindowSize(int w);
169
170 int GetOffDiagonalRange() const;
171 void SetOffDiagonalRange(int r);
172
173 double GetXDropoff() const;
174 void SetXDropoff(double x);
175
176 /******************* Gapped extension options *******************/
177 double GetGapXDropoff() const;
178 void SetGapXDropoff(double x);
179
180 double GetGapXDropoffFinal() const;
181 void SetGapXDropoffFinal(double x);
182
183 EBlastPrelimGapExt GetGapExtnAlgorithm() const;
184 void SetGapExtnAlgorithm(EBlastPrelimGapExt a);
185
186 EBlastTbackExt GetGapTracebackAlgorithm() const;
187 void SetGapTracebackAlgorithm(EBlastTbackExt a);
188
189 ECompoAdjustModes GetCompositionBasedStats() const;
190 void SetCompositionBasedStats(ECompoAdjustModes mode);
191
192 bool GetSmithWatermanMode() const;
193 void SetSmithWatermanMode(bool m = true);
194
195 int GetUnifiedP() const;
196 void SetUnifiedP(int u = 0);
197
198 int GetMaxMismatches() const;
199 void SetMaxMismatches(int m);
200
201 int GetMismatchWindow() const;
202 void SetMismatchWindow(int w);
203
204 /******************* Hit saving options *************************/
205 int GetHitlistSize() const;
206 void SetHitlistSize(int s);
207
208 int GetMaxNumHspPerSequence() const;
209 void SetMaxNumHspPerSequence(int m);
210
211 int GetMaxHspsPerSubject() const;
212 void SetMaxHspsPerSubject(int m);
213
214 int GetCullingLimit() const;
215 void SetCullingLimit(int s);
216
217 bool GetSubjectBestHit() const;
218 void SetSubjectBestHit();
219
220 double GetBestHitOverhang() const;
221 void SetBestHitOverhang(double s);
222 void SetBestHitScoreEdge(double score_edge);
223 double GetBestHitScoreEdge() const;
224
225 // Expect value cut-off threshold for an HSP, or a combined hit if sum
226 // statistics is used
227 double GetEvalueThreshold() const;
228 void SetEvalueThreshold(double eval);
229
230 // Raw score cutoff threshold
231 int GetCutoffScore() const;
232 void SetCutoffScore(int s);
233
234 vector<double> GetCutoffScoreCoeffs() const;
235 void SetCutoffScoreCoeffs(const vector<double>& c);
236
237 double GetPercentIdentity() const;
238 void SetPercentIdentity(double p);
239
240 int GetMaxEditDistance() const;
241 void SetMaxEditDistance(int e);
242
243 double GetQueryCovHspPerc() const;
244 void SetQueryCovHspPerc(double p);
245
246 int GetMinDiagSeparation() const;
247 void SetMinDiagSeparation(int d);
248
249 /// Sum statistics options
250 bool GetSumStatisticsMode() const;
251 void SetSumStatisticsMode(bool m = true);
252
253 int GetLongestIntronLength() const; // for linking HSPs with uneven gaps
254 void SetLongestIntronLength(int l); // for linking HSPs with uneven gaps
255
256 /// Returns true if gapped BLAST is set, false otherwise
257 bool GetGappedMode() const;
258 void SetGappedMode(bool m = true);
259
260 /// Masklevel filtering option -RMH-
261 int GetMaskLevel() const;
262 void SetMaskLevel(int s);
263
264 /// Sets low score percentages.
265 double GetLowScorePerc() const;
266 void SetLowScorePerc(double p = 0.0);
267
268 // Paired reads only if set to true
269 bool GetPaired() const;
270 void SetPaired(bool p);
271
272 /// Splice HSPs for each query
273 bool GetSplice() const;
274 void SetSplice(bool p);
275
276 /// Returns true if cross_match-like complexity adjusted
277 // scoring is required, false otherwise. -RMH-
278 bool GetComplexityAdjMode() const;
279 void SetComplexityAdjMode(bool m = true);
280
281 double GetGapTrigger() const;
282 void SetGapTrigger(double g);
283
284 /************************ Scoring options ************************/
285 const char* GetMatrixName() const;
286 void SetMatrixName(const char* matrix);
287
288 int GetMatchReward() const;
289 void SetMatchReward(int r); // r should be a positive integer
290
291 int GetMismatchPenalty() const;
292 void SetMismatchPenalty(int p); // p should be a negative integer
293
294 int GetGapOpeningCost() const;
295 void SetGapOpeningCost(int g); // g should be a positive integer
296
297 int GetGapExtensionCost() const;
298 void SetGapExtensionCost(int e); // e should be a positive integer
299
300 int GetFrameShiftPenalty() const;
301 void SetFrameShiftPenalty(int p);
302
303 bool GetOutOfFrameMode() const;
304 void SetOutOfFrameMode(bool m = true);
305
306 /******************** Effective Length options *******************/
307 Int8 GetDbLength() const;
308 void SetDbLength(Int8 l);
309
310 unsigned int GetDbSeqNum() const;
311 void SetDbSeqNum(unsigned int n);
312
313 Int8 GetEffectiveSearchSpace() const;
314 void SetEffectiveSearchSpace(Int8 eff);
315 void SetEffectiveSearchSpace(const vector<Int8>& eff);
316
317 int GetDbGeneticCode() const;
318
319 // Set genetic code id
320 void SetDbGeneticCode(int gc);
321
322 /// @todo PSI-Blast options could go on their own subclass?
323 const char* GetPHIPattern() const;
324 void SetPHIPattern(const char* pattern, bool is_dna);
325
326 /// Allows to dump a snapshot of the object
327 void DebugDump(CDebugDumpContext ddc, unsigned int depth) const;
328
329 /******************** PSIBlast options *******************/
330 double GetInclusionThreshold() const;
331 void SetInclusionThreshold(double incthr);
332
333 int GetPseudoCount() const;
334 void SetPseudoCount(int ps);
335
336 bool GetIgnoreMsaMaster() const;
337 void SetIgnoreMsaMaster(bool val);
338
339 /******************** DELTA-Blast options *******************/
340 double GetDomainInclusionThreshold() const;
341 void SetDomainInclusionThreshold(double incthr);
342
343 /******************** Megablast Database Index *******************/
344 bool GetUseIndex() const;
345 bool GetForceIndex() const;
346 bool GetIsOldStyleMBIndex() const;
347 const string GetIndexName() const;
348 void SetUseIndex(
349 bool use_index = true, const string & index_name = "",
350 bool force_index = false, bool old_style_index = false );
351 bool GetMBIndexLoaded() const;
352 void SetMBIndexLoaded( bool index_loaded = true );
353
354 bool operator==(const CBlastOptionsLocal& rhs) const;
355 bool operator!=(const CBlastOptionsLocal& rhs) const;
356
357 private:
358
359 /// Query sequence settings
360 CQuerySetUpOptions m_QueryOpts;
361
362 /// Lookup table settings
363 CLookupTableOptions m_LutOpts;
364
365 /// Word settings
366 CBlastInitialWordOptions m_InitWordOpts;
367
368 /// Hit extension settings
369 CBlastExtensionOptions m_ExtnOpts;
370
371 /// Hit saving settings
372 CBlastHitSavingOptions m_HitSaveOpts;
373
374 /// PSI-Blast settings
375 CPSIBlastOptions m_PSIBlastOpts;
376
377 /// Delta-Blast settings
378 CPSIBlastOptions m_DeltaBlastOpts;
379
380 /// Blast database settings
381 CBlastDatabaseOptions m_DbOpts;
382
383 /// Scoring options
384 CBlastScoringOptions m_ScoringOpts;
385
386 /// Effective lengths options
387 CBlastEffectiveLengthsOptions m_EffLenOpts;
388
389 /// Blast program
390 EProgram m_Program;
391
392 /// Use megablast database index.
393 bool m_UseMBIndex;
394 bool m_ForceMBIndex;
395 bool m_OldStyleMBIndex;
396
397 /// Database index has been loaded.
398 bool m_MBIndexLoaded;
399
400 /// Megablast database index name.
401 string m_MBIndexName;
402
403 friend class CBlastOptions;
404
405 /// Friend class which allows extraction of this class' data members for
406 /// internal use in the C++ API APIs
407 friend class CBlastOptionsMemento;
408 friend class CEffectiveSearchSpacesMemento;
409
410 /// @internal
GetQueryOpts() const411 QuerySetUpOptions * GetQueryOpts() const
412 {
413 return m_QueryOpts;
414 }
415
416 /// @internal
GetLutOpts() const417 LookupTableOptions * GetLutOpts() const
418 {
419 return m_LutOpts;
420 }
421
422 /// @internal
GetInitWordOpts() const423 BlastInitialWordOptions * GetInitWordOpts() const
424 {
425 return m_InitWordOpts;
426 }
427
428 /// @internal
GetExtnOpts() const429 BlastExtensionOptions * GetExtnOpts() const
430 {
431 return m_ExtnOpts;
432 }
433
434 /// @internal
GetHitSaveOpts() const435 BlastHitSavingOptions * GetHitSaveOpts() const
436 {
437 return m_HitSaveOpts;
438 }
439
440 /// @internal
GetPSIBlastOpts() const441 PSIBlastOptions * GetPSIBlastOpts() const
442 {
443 return m_PSIBlastOpts;
444 }
445
446 /// @internal
GetDbOpts() const447 BlastDatabaseOptions * GetDbOpts() const
448 {
449 return m_DbOpts;
450 }
451
452 /// @internal
GetScoringOpts() const453 BlastScoringOptions * GetScoringOpts() const
454 {
455 return m_ScoringOpts;
456 }
457
458 /// @internal
GetEffLenOpts() const459 BlastEffectiveLengthsOptions * GetEffLenOpts() const
460 {
461 return m_EffLenOpts;
462 }
463
464 /// Perform a "deep copy" of local Blast options
465 /// @param optsLocal local Blast options object to copy from.
466 void x_DoDeepCopy(const CBlastOptionsLocal& optsLocal);
467
468 /// Get a copy of CQuerySetUpOptions
469 /// @param queryOptsDst options structure to copy to.
470 /// @param queryOptsSrc options structure to copy from.
471 static void x_Copy_CQuerySetUpOptions(
472 CQuerySetUpOptions& queryOptsDst,
473 const CQuerySetUpOptions& queryOptsSrc);
474
475 /// Get a copy of CLookupTableOptions
476 /// @param lutOptsDst options structure to copy to.
477 /// @param lutOptsSrc options structure to copy from.
478 static void x_Copy_CLookupTableOptions(
479 CLookupTableOptions& lutOptsDst,
480 const CLookupTableOptions& lutOptsSrc);
481
482 /// Get a copy of CBlastInitialWordOptions
483 /// @param initWordOptsDst options structure to copy to.
484 /// @param initWordOptsSrc options structure to copy from.
485 static void x_Copy_CBlastInitialWordOptions(
486 CBlastInitialWordOptions& initWordOptsDst,
487 const CBlastInitialWordOptions& initWordOptsSrc);
488
489 /// Get a copy of CBlastExtensionOptions
490 /// @param extnOptsDst options structure to copy to.
491 /// @param extnOptsSrc options structure to copy from.
492 static void x_Copy_CBlastExtensionOptions(
493 CBlastExtensionOptions& extnOptsDst,
494 const CBlastExtensionOptions& extnOptsSrc);
495
496 /// Get a copy of CBlastHitSavingOptions
497 /// @param hitSaveOptsDst options structure to copy to.
498 /// @param hitSaveOptsSrc options structure to copy from.
499 static void x_Copy_CBlastHitSavingOptions(
500 CBlastHitSavingOptions& hitSaveOptsDst,
501 const CBlastHitSavingOptions& hitSaveOptsSrc);
502
503 /// Get a copy of CPSIBlastOptions
504 /// @param psiBlastOptsDst options structure to copy to.
505 /// @param psiBlastOptsSrc options structure to copy from.
506 static void x_Copy_CPSIBlastOptions(
507 CPSIBlastOptions& psiBlastOptsDst,
508 const CPSIBlastOptions& psiBlastOptsSrc);
509
510 /// Get a copy of CBlastDatabaseOptions
511 /// @param dbOptsDst options structure to copy to.
512 /// @param dbOptsSrc options structure to copy from.
513 static void x_Copy_CBlastDatabaseOptions(
514 CBlastDatabaseOptions& dbOptsDst,
515 const CBlastDatabaseOptions& dbOptsSrc);
516
517 /// Get a copy of CBlastScoringOptions
518 /// @param scoringOptsDst options structure to copy to.
519 /// @param scoringOptsSrc options structure to copy from.
520 static void x_Copy_CBlastScoringOptions(
521 CBlastScoringOptions& scoringOptsDst,
522 const CBlastScoringOptions& scoringOptsSrc);
523
524 /// Get a copy of CBlastEffectiveLengthsOptions
525 /// @param effLenOptsDst options structure to copy to.
526 /// @param effLenOptsSrc options structure to copy from.
527 static void x_Copy_CBlastEffectiveLengthsOptions(
528 CBlastEffectiveLengthsOptions& effLenOptsDst,
529 const CBlastEffectiveLengthsOptions& effLenOptsSrc);
530 };
531
532 inline EProgram
GetProgram() const533 CBlastOptionsLocal::GetProgram() const
534 {
535 return m_Program;
536 }
537
538 inline void
SetProgram(EProgram p)539 CBlastOptionsLocal::SetProgram(EProgram p)
540 {
541 _ASSERT(p >= eBlastn && p < eBlastProgramMax);
542 m_Program = p;
543 const EBlastProgramType prog_type = EProgramToEBlastProgramType(p);
544 if (prog_type == eBlastTypeUndefined) {
545 return;
546 }
547
548 GetScoringOpts()->program_number = prog_type;
549 GetLutOpts()->program_number = prog_type;
550 GetInitWordOpts()->program_number = prog_type;
551 GetExtnOpts()->program_number = prog_type;
552 GetHitSaveOpts()->program_number = prog_type;
553 if ( !Blast_SubjectIsTranslated(prog_type) ) {
554 // not needed for non-translated databases/subjects
555 GetDbOpts()->genetic_code = 0;
556 }
557 }
558
559 inline const char*
GetMatrixName() const560 CBlastOptionsLocal::GetMatrixName() const
561 {
562 return m_ScoringOpts->matrix;
563 }
564
565 inline void
SetMatrixName(const char * matrix)566 CBlastOptionsLocal::SetMatrixName(const char* matrix)
567 {
568 if (!matrix)
569 return;
570
571 sfree(m_ScoringOpts->matrix);
572 m_ScoringOpts->matrix = strdup(matrix);
573 }
574
575 inline double
GetWordThreshold() const576 CBlastOptionsLocal::GetWordThreshold() const
577 {
578 return m_LutOpts->threshold;
579 }
580
581 inline void
SetWordThreshold(double w)582 CBlastOptionsLocal::SetWordThreshold(double w)
583 {
584 m_LutOpts->threshold = w;
585 }
586
587 inline ELookupTableType
GetLookupTableType() const588 CBlastOptionsLocal::GetLookupTableType() const
589 {
590 return m_LutOpts->lut_type;
591 }
592
593 inline void
SetLookupTableType(ELookupTableType type)594 CBlastOptionsLocal::SetLookupTableType(ELookupTableType type)
595 {
596 m_LutOpts->lut_type = type;
597 if (type == eMBLookupTable) {
598 m_LutOpts->word_size = BLAST_WORDSIZE_MEGABLAST;
599 }
600 }
601
602 inline int
GetWordSize() const603 CBlastOptionsLocal::GetWordSize() const
604 {
605 return m_LutOpts->word_size;
606 }
607
608 inline void
SetWordSize(int ws)609 CBlastOptionsLocal::SetWordSize(int ws)
610 {
611 m_LutOpts->word_size = ws;
612 if (m_LutOpts->lut_type == eCompressedAaLookupTable && ws <= 5)
613 m_LutOpts->lut_type = eAaLookupTable;
614 else if (m_LutOpts->lut_type == eAaLookupTable && ws > 5)
615 m_LutOpts->lut_type = eCompressedAaLookupTable;
616 }
617
618 inline Uint4
GetLookupTableStride() const619 CBlastOptionsLocal::GetLookupTableStride() const
620 {
621 return m_LutOpts->stride;
622 }
623
624 inline void
SetLookupTableStride(Uint4 val)625 CBlastOptionsLocal::SetLookupTableStride(Uint4 val)
626 {
627 m_LutOpts->stride = val;
628 }
629
630 inline unsigned char
GetMBTemplateLength() const631 CBlastOptionsLocal::GetMBTemplateLength() const
632 {
633 return m_LutOpts->mb_template_length;
634 }
635
636 inline void
SetMBTemplateLength(unsigned char len)637 CBlastOptionsLocal::SetMBTemplateLength(unsigned char len)
638 {
639 m_LutOpts->mb_template_length = len;
640 }
641
642 inline unsigned char
GetMBTemplateType() const643 CBlastOptionsLocal::GetMBTemplateType() const
644 {
645 return m_LutOpts->mb_template_type;
646 }
647
648 inline void
SetMBTemplateType(unsigned char type)649 CBlastOptionsLocal::SetMBTemplateType(unsigned char type)
650 {
651 m_LutOpts->mb_template_type = type;
652 }
653
654 inline bool
GetLookupDbFilter(void) const655 CBlastOptionsLocal::GetLookupDbFilter(void) const
656 {
657 return m_LutOpts->db_filter;
658 }
659
660 inline void
SetLookupDbFilter(bool val)661 CBlastOptionsLocal::SetLookupDbFilter(bool val)
662 {
663 m_LutOpts->db_filter = val;
664 }
665
666 inline Uint1
GetMaxDbWordCount(void) const667 CBlastOptionsLocal::GetMaxDbWordCount(void) const
668 {
669 return m_LutOpts->max_db_word_count;
670 }
671
672 inline void
SetMaxDbWordCount(Uint1 val)673 CBlastOptionsLocal::SetMaxDbWordCount(Uint1 val)
674 {
675 m_LutOpts->max_db_word_count = val;
676 }
677
678
679 /******************* Query setup options ************************/
680
681 inline char*
GetFilterString() const682 CBlastOptionsLocal::GetFilterString() const
683 {
684 if (m_QueryOpts->filter_string == NULL) {
685 // Don't cache this in case the filtering options are changed
686 return BlastFilteringOptionsToString(m_QueryOpts->filtering_options);
687 }
688 _ASSERT(m_QueryOpts->filter_string != NULL);
689 return strdup(m_QueryOpts->filter_string);
690 }
691 inline void
SetFilterString(const char * f)692 CBlastOptionsLocal::SetFilterString(const char* f)
693 {
694 if (!f)
695 return;
696
697 sfree(m_QueryOpts->filter_string);
698 m_QueryOpts->filter_string = strdup(f);
699
700 SBlastFilterOptions* new_opts = NULL;
701 BlastFilteringOptionsFromString(GetProgramType(), f, &(new_opts), NULL);
702
703 if (m_QueryOpts->filtering_options)
704 {
705 SBlastFilterOptions* old_opts = m_QueryOpts->filtering_options;
706 m_QueryOpts->filtering_options = NULL;
707 SBlastFilterOptionsMerge(&(m_QueryOpts->filtering_options), old_opts, new_opts);
708 old_opts = SBlastFilterOptionsFree(old_opts);
709 new_opts = SBlastFilterOptionsFree(new_opts);
710 }
711 else
712 {
713 if (m_QueryOpts->filtering_options)
714 m_QueryOpts->filtering_options =
715 SBlastFilterOptionsFree(m_QueryOpts->filtering_options);
716 m_QueryOpts->filtering_options = new_opts;
717 new_opts = NULL;
718 }
719
720 // Repeat filtering is only allowed for blastn.
721 if (GetProgramType() != eBlastTypeBlastn &&
722 GetProgramType() != eBlastTypeMapping &&
723 m_QueryOpts->filtering_options->repeatFilterOptions)
724 m_QueryOpts->filtering_options->repeatFilterOptions =
725 SRepeatFilterOptionsFree(m_QueryOpts->filtering_options->repeatFilterOptions);
726
727 return;
728 }
729
730 inline bool
GetMaskAtHash() const731 CBlastOptionsLocal::GetMaskAtHash() const
732 {
733 if (m_QueryOpts->filtering_options->mask_at_hash)
734 return true;
735 else
736 return false;
737 }
738 inline void
SetMaskAtHash(bool val)739 CBlastOptionsLocal::SetMaskAtHash(bool val)
740 {
741
742 m_QueryOpts->filtering_options->mask_at_hash = val;
743
744 return;
745 }
746
747 inline bool
GetDustFiltering() const748 CBlastOptionsLocal::GetDustFiltering() const
749 {
750 if (m_QueryOpts->filtering_options->dustOptions)
751 return true;
752 else
753 return false;
754 }
755 inline void
SetDustFiltering(bool val)756 CBlastOptionsLocal::SetDustFiltering(bool val)
757 {
758
759 if (m_QueryOpts->filtering_options->dustOptions) // free previous structure so we provide defaults.
760 m_QueryOpts->filtering_options->dustOptions =
761 SDustOptionsFree(m_QueryOpts->filtering_options->dustOptions);
762
763 if (val == false) // filtering should be turned off
764 return;
765
766 SDustOptionsNew(&(m_QueryOpts->filtering_options->dustOptions));
767
768 return;
769 }
770
771 inline int
GetDustFilteringLevel() const772 CBlastOptionsLocal::GetDustFilteringLevel() const
773 {
774 if (m_QueryOpts->filtering_options->dustOptions == NULL)
775 return kInvalidFilterValue;
776
777 return m_QueryOpts->filtering_options->dustOptions->level;
778 }
779 inline void
SetDustFilteringLevel(int level)780 CBlastOptionsLocal::SetDustFilteringLevel(int level)
781 {
782 if (m_QueryOpts->filtering_options->dustOptions == NULL)
783 SDustOptionsNew(&(m_QueryOpts->filtering_options->dustOptions));
784
785 m_QueryOpts->filtering_options->dustOptions->level = level;
786
787 return;
788 }
789 inline int
GetDustFilteringWindow() const790 CBlastOptionsLocal::GetDustFilteringWindow() const
791 {
792 if (m_QueryOpts->filtering_options->dustOptions == NULL)
793 return kInvalidFilterValue;
794
795 return m_QueryOpts->filtering_options->dustOptions->window;
796 }
797
798 inline void
SetDustFilteringWindow(int window)799 CBlastOptionsLocal::SetDustFilteringWindow(int window)
800 {
801 if (m_QueryOpts->filtering_options->dustOptions == NULL)
802 SDustOptionsNew(&(m_QueryOpts->filtering_options->dustOptions));
803
804 m_QueryOpts->filtering_options->dustOptions->window = window;
805
806 return;
807 }
808 inline int
GetDustFilteringLinker() const809 CBlastOptionsLocal::GetDustFilteringLinker() const
810 {
811 if (m_QueryOpts->filtering_options->dustOptions == NULL)
812 return kInvalidFilterValue;
813
814 return m_QueryOpts->filtering_options->dustOptions->linker;
815 }
816
817 inline void
SetDustFilteringLinker(int linker)818 CBlastOptionsLocal::SetDustFilteringLinker(int linker)
819 {
820 if (m_QueryOpts->filtering_options->dustOptions == NULL)
821 SDustOptionsNew(&(m_QueryOpts->filtering_options->dustOptions));
822
823 m_QueryOpts->filtering_options->dustOptions->linker = linker;
824
825 return;
826 }
827
828 inline bool
GetSegFiltering() const829 CBlastOptionsLocal::GetSegFiltering() const
830 {
831 if (m_QueryOpts->filtering_options->segOptions)
832 return true;
833 else
834 return false;
835 }
836
837 inline void
SetSegFiltering(bool val)838 CBlastOptionsLocal::SetSegFiltering(bool val)
839 {
840
841 if (m_QueryOpts->filtering_options->segOptions) // free previous structure so we provide defaults.
842 m_QueryOpts->filtering_options->segOptions =
843 SSegOptionsFree(m_QueryOpts->filtering_options->segOptions);
844
845 if (val == false) // filtering should be turned off
846 return;
847
848 SSegOptionsNew(&(m_QueryOpts->filtering_options->segOptions));
849
850 return;
851 }
852
853 inline int
GetSegFilteringWindow() const854 CBlastOptionsLocal::GetSegFilteringWindow() const
855 {
856 if (m_QueryOpts->filtering_options->segOptions == NULL)
857 return kInvalidFilterValue;
858
859 return m_QueryOpts->filtering_options->segOptions->window;
860 }
861
862 inline void
SetSegFilteringWindow(int window)863 CBlastOptionsLocal::SetSegFilteringWindow(int window)
864 {
865 if (m_QueryOpts->filtering_options->segOptions == NULL)
866 SSegOptionsNew(&(m_QueryOpts->filtering_options->segOptions));
867
868 m_QueryOpts->filtering_options->segOptions->window = window;
869
870 return;
871 }
872
873 inline double
GetSegFilteringLocut() const874 CBlastOptionsLocal::GetSegFilteringLocut() const
875 {
876 if (m_QueryOpts->filtering_options->segOptions == NULL)
877 return kInvalidFilterValue;
878
879 return m_QueryOpts->filtering_options->segOptions->locut;
880 }
881
882 inline void
SetSegFilteringLocut(double locut)883 CBlastOptionsLocal::SetSegFilteringLocut(double locut)
884 {
885 if (m_QueryOpts->filtering_options->segOptions == NULL)
886 SSegOptionsNew(&(m_QueryOpts->filtering_options->segOptions));
887
888 m_QueryOpts->filtering_options->segOptions->locut = locut;
889
890 return;
891 }
892
893 inline double
GetSegFilteringHicut() const894 CBlastOptionsLocal::GetSegFilteringHicut() const
895 {
896 if (m_QueryOpts->filtering_options->segOptions == NULL)
897 return kInvalidFilterValue;
898
899 return m_QueryOpts->filtering_options->segOptions->hicut;
900 }
901
902 inline void
SetSegFilteringHicut(double hicut)903 CBlastOptionsLocal::SetSegFilteringHicut(double hicut)
904 {
905 if (m_QueryOpts->filtering_options->segOptions == NULL)
906 SSegOptionsNew(&(m_QueryOpts->filtering_options->segOptions));
907
908 m_QueryOpts->filtering_options->segOptions->hicut = hicut;
909
910 return;
911 }
912
913 inline bool
GetRepeatFiltering() const914 CBlastOptionsLocal::GetRepeatFiltering() const
915 {
916 if (m_QueryOpts->filtering_options->repeatFilterOptions)
917 return true;
918 else
919 return false;
920 }
921
922 inline void
SetRepeatFiltering(bool val)923 CBlastOptionsLocal::SetRepeatFiltering(bool val)
924 {
925
926 if (m_QueryOpts->filtering_options->repeatFilterOptions) // free previous structure so we provide defaults.
927 m_QueryOpts->filtering_options->repeatFilterOptions =
928 SRepeatFilterOptionsFree(m_QueryOpts->filtering_options->repeatFilterOptions);
929
930 if (val == false) // filtering should be turned off
931 return;
932
933 SRepeatFilterOptionsNew(&(m_QueryOpts->filtering_options->repeatFilterOptions));
934
935 return;
936 }
937
938 inline const char*
GetRepeatFilteringDB() const939 CBlastOptionsLocal::GetRepeatFilteringDB() const
940 {
941 if (m_QueryOpts->filtering_options->repeatFilterOptions == NULL)
942 return NULL;
943
944 return m_QueryOpts->filtering_options->repeatFilterOptions->database;
945 }
946
947 inline void
SetRepeatFilteringDB(const char * db)948 CBlastOptionsLocal::SetRepeatFilteringDB(const char* db)
949 {
950 if (!db)
951 return;
952
953 SRepeatFilterOptionsResetDB(&(m_QueryOpts->filtering_options->repeatFilterOptions), db);
954
955 return;
956 }
957
958 inline int
GetWindowMaskerTaxId() const959 CBlastOptionsLocal::GetWindowMaskerTaxId() const
960 {
961 if (m_QueryOpts->filtering_options->windowMaskerOptions == NULL)
962 return 0;
963
964 return m_QueryOpts->filtering_options->windowMaskerOptions->taxid;
965 }
966
967 inline void
SetWindowMaskerTaxId(int taxid)968 CBlastOptionsLocal::SetWindowMaskerTaxId(int taxid)
969 {
970 if (m_QueryOpts->filtering_options->windowMaskerOptions == NULL)
971 SWindowMaskerOptionsNew
972 (&(m_QueryOpts->filtering_options->windowMaskerOptions));
973
974 m_QueryOpts->filtering_options->windowMaskerOptions->taxid = taxid;
975 }
976
977 inline const char*
GetWindowMaskerDatabase() const978 CBlastOptionsLocal::GetWindowMaskerDatabase() const
979 {
980 if (! m_QueryOpts->filtering_options->windowMaskerOptions)
981 return NULL;
982
983 return m_QueryOpts->filtering_options->windowMaskerOptions->database;
984 }
985
986 inline void
SetWindowMaskerDatabase(const char * db)987 CBlastOptionsLocal::SetWindowMaskerDatabase(const char* db)
988 {
989 if (m_QueryOpts->filtering_options->windowMaskerOptions == NULL)
990 SWindowMaskerOptionsNew
991 (&(m_QueryOpts->filtering_options->windowMaskerOptions));
992
993 SWindowMaskerOptionsResetDB
994 (&(m_QueryOpts->filtering_options->windowMaskerOptions), db);
995 }
996
997 inline objects::ENa_strand
GetStrandOption() const998 CBlastOptionsLocal::GetStrandOption() const
999 {
1000 return (objects::ENa_strand) m_QueryOpts->strand_option;
1001 }
1002
1003 inline void
SetStrandOption(objects::ENa_strand s)1004 CBlastOptionsLocal::SetStrandOption(objects::ENa_strand s)
1005 {
1006 m_QueryOpts->strand_option = (unsigned char) s;
1007 }
1008
1009 inline int
GetQueryGeneticCode() const1010 CBlastOptionsLocal::GetQueryGeneticCode() const
1011 {
1012 return m_QueryOpts->genetic_code;
1013 }
1014
1015 inline void
SetQueryGeneticCode(int gc)1016 CBlastOptionsLocal::SetQueryGeneticCode(int gc)
1017 {
1018 m_QueryOpts->genetic_code = gc;
1019 }
1020
1021 inline bool
GetReadQualityFiltering(void) const1022 CBlastOptionsLocal::GetReadQualityFiltering(void) const
1023 {
1024 if (m_QueryOpts->filtering_options->readQualityOptions) {
1025 return true;
1026 }
1027 else {
1028 return false;
1029 }
1030 }
1031
1032 inline void
SetReadQualityFiltering(bool val)1033 CBlastOptionsLocal::SetReadQualityFiltering(bool val /* = true */)
1034 {
1035 m_QueryOpts->filtering_options->readQualityOptions =
1036 SReadQualityOptionsFree(
1037 m_QueryOpts->filtering_options->readQualityOptions);
1038
1039 if (val) {
1040 SReadQualityOptionsNew(
1041 &m_QueryOpts->filtering_options->readQualityOptions);
1042 }
1043 }
1044
1045 inline double
GetReadMaxFractionAmbiguous(void) const1046 CBlastOptionsLocal::GetReadMaxFractionAmbiguous(void) const
1047 {
1048 if (m_QueryOpts->filtering_options->readQualityOptions == NULL) {
1049 return -1.0;
1050 }
1051
1052 return m_QueryOpts->filtering_options->readQualityOptions->frac_ambig;
1053 }
1054
1055 inline void
SetReadMaxFractionAmbiguous(double val)1056 CBlastOptionsLocal::SetReadMaxFractionAmbiguous(double val)
1057 {
1058 if (m_QueryOpts->filtering_options->readQualityOptions == NULL) {
1059 SReadQualityOptionsNew(
1060 &m_QueryOpts->filtering_options->readQualityOptions);
1061 }
1062
1063 m_QueryOpts->filtering_options->readQualityOptions->frac_ambig = val;
1064 }
1065
1066 inline int
GetReadMinDimerEntropy(void) const1067 CBlastOptionsLocal::GetReadMinDimerEntropy(void) const
1068 {
1069 if (m_QueryOpts->filtering_options->readQualityOptions == NULL) {
1070 return -1;
1071 }
1072
1073 return m_QueryOpts->filtering_options->readQualityOptions->entropy;
1074 }
1075
1076 inline void
SetReadMinDimerEntropy(int val)1077 CBlastOptionsLocal::SetReadMinDimerEntropy(int val)
1078 {
1079 if (m_QueryOpts->filtering_options->readQualityOptions == NULL) {
1080 SReadQualityOptionsNew(
1081 &m_QueryOpts->filtering_options->readQualityOptions);
1082 }
1083
1084 m_QueryOpts->filtering_options->readQualityOptions->entropy = val;
1085 }
1086
1087
1088 /******************* Initial word options ***********************/
1089 inline int
GetWindowSize() const1090 CBlastOptionsLocal::GetWindowSize() const
1091 {
1092 return m_InitWordOpts->window_size;
1093 }
1094
1095 inline void
SetWindowSize(int s)1096 CBlastOptionsLocal::SetWindowSize(int s)
1097 {
1098 m_InitWordOpts->window_size = s;
1099 }
1100
1101 inline int
GetOffDiagonalRange() const1102 CBlastOptionsLocal::GetOffDiagonalRange() const
1103 {
1104 return m_InitWordOpts->scan_range;
1105 }
1106
1107 inline void
SetOffDiagonalRange(int r)1108 CBlastOptionsLocal::SetOffDiagonalRange(int r)
1109 {
1110 m_InitWordOpts->scan_range = r;
1111 }
1112
1113 inline double
GetXDropoff() const1114 CBlastOptionsLocal::GetXDropoff() const
1115 {
1116 return m_InitWordOpts->x_dropoff;
1117 }
1118
1119 inline void
SetXDropoff(double x)1120 CBlastOptionsLocal::SetXDropoff(double x)
1121 {
1122 m_InitWordOpts->x_dropoff = x;
1123 }
1124
1125 inline double
GetGapTrigger() const1126 CBlastOptionsLocal::GetGapTrigger() const
1127 {
1128 return m_InitWordOpts->gap_trigger;
1129 }
1130
1131 inline void
SetGapTrigger(double g)1132 CBlastOptionsLocal::SetGapTrigger(double g)
1133 {
1134 m_InitWordOpts->gap_trigger = g;
1135 }
1136
1137 /******************* Gapped extension options *******************/
1138 inline double
GetGapXDropoff() const1139 CBlastOptionsLocal::GetGapXDropoff() const
1140 {
1141 return m_ExtnOpts->gap_x_dropoff;
1142 }
1143
1144 inline void
SetGapXDropoff(double x)1145 CBlastOptionsLocal::SetGapXDropoff(double x)
1146 {
1147 m_ExtnOpts->gap_x_dropoff = x;
1148 }
1149
1150 inline double
GetGapXDropoffFinal() const1151 CBlastOptionsLocal::GetGapXDropoffFinal() const
1152 {
1153 return m_ExtnOpts->gap_x_dropoff_final;
1154 }
1155
1156 inline void
SetGapXDropoffFinal(double x)1157 CBlastOptionsLocal::SetGapXDropoffFinal(double x)
1158 {
1159 m_ExtnOpts->gap_x_dropoff_final = x;
1160 }
1161
1162 inline EBlastPrelimGapExt
GetGapExtnAlgorithm() const1163 CBlastOptionsLocal::GetGapExtnAlgorithm() const
1164 {
1165 return m_ExtnOpts->ePrelimGapExt;
1166 }
1167
1168 inline void
SetGapExtnAlgorithm(EBlastPrelimGapExt a)1169 CBlastOptionsLocal::SetGapExtnAlgorithm(EBlastPrelimGapExt a)
1170 {
1171 m_ExtnOpts->ePrelimGapExt = a;
1172 }
1173
1174 inline EBlastTbackExt
GetGapTracebackAlgorithm() const1175 CBlastOptionsLocal::GetGapTracebackAlgorithm() const
1176 {
1177 return m_ExtnOpts->eTbackExt;
1178 }
1179
1180 inline void
SetGapTracebackAlgorithm(EBlastTbackExt a)1181 CBlastOptionsLocal::SetGapTracebackAlgorithm(EBlastTbackExt a)
1182 {
1183 m_ExtnOpts->eTbackExt = a;
1184 }
1185
1186 inline ECompoAdjustModes
GetCompositionBasedStats() const1187 CBlastOptionsLocal::GetCompositionBasedStats() const
1188 {
1189 return static_cast<ECompoAdjustModes>(m_ExtnOpts->compositionBasedStats);
1190 }
1191
1192 inline void
SetCompositionBasedStats(ECompoAdjustModes mode)1193 CBlastOptionsLocal::SetCompositionBasedStats(ECompoAdjustModes mode)
1194 {
1195 m_ExtnOpts->compositionBasedStats = static_cast<Int4>(mode);
1196 }
1197
1198 inline bool
GetSmithWatermanMode() const1199 CBlastOptionsLocal::GetSmithWatermanMode() const
1200 {
1201 if (m_ExtnOpts->eTbackExt == eSmithWatermanTbck)
1202 return true;
1203 else
1204 return false;
1205 }
1206
1207 inline void
SetSmithWatermanMode(bool m)1208 CBlastOptionsLocal::SetSmithWatermanMode(bool m)
1209 {
1210 if (m == true)
1211 m_ExtnOpts->eTbackExt = eSmithWatermanTbck;
1212 else
1213 m_ExtnOpts->eTbackExt = eDynProgTbck;
1214 }
1215
1216 inline int
GetUnifiedP() const1217 CBlastOptionsLocal::GetUnifiedP() const
1218 {
1219 return m_ExtnOpts->unifiedP;
1220 }
1221
1222 inline void
SetUnifiedP(int u)1223 CBlastOptionsLocal::SetUnifiedP(int u)
1224 {
1225 m_ExtnOpts->unifiedP = u;
1226 }
1227
1228 inline int
GetMaxMismatches() const1229 CBlastOptionsLocal::GetMaxMismatches() const
1230 {
1231 return m_ExtnOpts->max_mismatches;
1232 }
1233
1234 inline void
SetMaxMismatches(int m)1235 CBlastOptionsLocal::SetMaxMismatches(int m)
1236 {
1237 m_ExtnOpts->max_mismatches = m;
1238 }
1239
1240 inline int
GetMismatchWindow() const1241 CBlastOptionsLocal::GetMismatchWindow() const
1242 {
1243 return m_ExtnOpts->mismatch_window;
1244 }
1245
1246 inline void
SetMismatchWindow(int w)1247 CBlastOptionsLocal::SetMismatchWindow(int w)
1248 {
1249 m_ExtnOpts->mismatch_window = w;
1250 }
1251
1252 /******************* Hit saving options *************************/
1253 inline int
GetHitlistSize() const1254 CBlastOptionsLocal::GetHitlistSize() const
1255 {
1256 return m_HitSaveOpts->hitlist_size;
1257 }
1258
1259 inline void
SetHitlistSize(int s)1260 CBlastOptionsLocal::SetHitlistSize(int s)
1261 {
1262 m_HitSaveOpts->hitlist_size = s;
1263 }
1264
1265 inline int
GetMaxNumHspPerSequence() const1266 CBlastOptionsLocal::GetMaxNumHspPerSequence() const
1267 {
1268 return m_HitSaveOpts->hsp_num_max;
1269 }
1270
1271 inline void
SetMaxHspsPerSubject(int m)1272 CBlastOptionsLocal::SetMaxHspsPerSubject(int m)
1273 {
1274 m_HitSaveOpts->max_hsps_per_subject = m;
1275 }
1276
1277 inline int
GetMaxHspsPerSubject() const1278 CBlastOptionsLocal::GetMaxHspsPerSubject() const
1279 {
1280 return m_HitSaveOpts->max_hsps_per_subject;
1281 }
1282
1283 inline void
SetMaxNumHspPerSequence(int m)1284 CBlastOptionsLocal::SetMaxNumHspPerSequence(int m)
1285 {
1286 m_HitSaveOpts->hsp_num_max = m;
1287 }
1288
1289
1290 inline int
GetCullingLimit() const1291 CBlastOptionsLocal::GetCullingLimit() const
1292 {
1293 _ASSERT( (m_HitSaveOpts->culling_limit &&
1294 m_HitSaveOpts->hsp_filt_opt->culling_opts->max_hits ==
1295 m_HitSaveOpts->culling_limit) ||
1296
1297 (m_HitSaveOpts->culling_limit == 0 &&
1298 ( (m_HitSaveOpts->hsp_filt_opt == NULL) ||
1299 (m_HitSaveOpts->hsp_filt_opt->culling_opts == NULL) ) )
1300 );
1301 return m_HitSaveOpts->culling_limit;
1302 }
1303
1304 inline void
SetCullingLimit(int s)1305 CBlastOptionsLocal::SetCullingLimit(int s)
1306 {
1307 if (s <= 0) {
1308 return;
1309 }
1310
1311 if ( !m_HitSaveOpts->hsp_filt_opt ) {
1312 m_HitSaveOpts->hsp_filt_opt = BlastHSPFilteringOptionsNew();
1313 }
1314 // N.B.: ePrelimSearch is the default culling implemetation
1315 if (m_HitSaveOpts->hsp_filt_opt->culling_opts == NULL) {
1316 BlastHSPCullingOptions* culling = BlastHSPCullingOptionsNew(s);
1317 BlastHSPFilteringOptions_AddCulling(m_HitSaveOpts->hsp_filt_opt,
1318 &culling,
1319 eBoth);
1320 _ASSERT(culling == NULL);
1321 } else {
1322 m_HitSaveOpts->hsp_filt_opt->culling_opts->max_hits = s;
1323 }
1324 // for backwards compatibility reasons
1325 m_HitSaveOpts->culling_limit = s;
1326 }
1327
1328 inline double
GetBestHitScoreEdge() const1329 CBlastOptionsLocal::GetBestHitScoreEdge() const
1330 {
1331 if (m_HitSaveOpts->hsp_filt_opt &&
1332 m_HitSaveOpts->hsp_filt_opt->best_hit) {
1333 return m_HitSaveOpts->hsp_filt_opt->best_hit->score_edge;
1334 } else {
1335 return kBestHit_ScoreEdgeMin;
1336 }
1337 }
1338
1339 inline void
SetBestHitScoreEdge(double score_edge)1340 CBlastOptionsLocal::SetBestHitScoreEdge(double score_edge)
1341 {
1342 if ( !m_HitSaveOpts->hsp_filt_opt ) {
1343 m_HitSaveOpts->hsp_filt_opt = BlastHSPFilteringOptionsNew();
1344 }
1345 // per this object's assumption, just set the value
1346 if (m_HitSaveOpts->hsp_filt_opt->best_hit) {
1347 m_HitSaveOpts->hsp_filt_opt->best_hit->score_edge = score_edge;
1348 } else {
1349 BlastHSPBestHitOptions* best_hit_opts =
1350 BlastHSPBestHitOptionsNew(kBestHit_OverhangDflt, score_edge);
1351 BlastHSPFilteringOptions_AddBestHit(m_HitSaveOpts->hsp_filt_opt,
1352 &best_hit_opts,
1353 eBoth);
1354 _ASSERT(best_hit_opts == NULL);
1355 }
1356 }
1357
1358 inline double
GetBestHitOverhang() const1359 CBlastOptionsLocal::GetBestHitOverhang() const
1360 {
1361 if (m_HitSaveOpts->hsp_filt_opt &&
1362 m_HitSaveOpts->hsp_filt_opt->best_hit) {
1363 return m_HitSaveOpts->hsp_filt_opt->best_hit->overhang;
1364 } else {
1365 return kBestHit_OverhangMin;
1366 }
1367 }
1368
1369 inline void
SetBestHitOverhang(double overhang)1370 CBlastOptionsLocal::SetBestHitOverhang(double overhang)
1371 {
1372 if ( !m_HitSaveOpts->hsp_filt_opt ) {
1373 m_HitSaveOpts->hsp_filt_opt = BlastHSPFilteringOptionsNew();
1374 }
1375 // per this object's assumption, just set the value
1376 if (m_HitSaveOpts->hsp_filt_opt->best_hit) {
1377 m_HitSaveOpts->hsp_filt_opt->best_hit->overhang = overhang;
1378 } else {
1379 BlastHSPBestHitOptions* best_hit_opts =
1380 BlastHSPBestHitOptionsNew(overhang, kBestHit_ScoreEdgeDflt);
1381 BlastHSPFilteringOptions_AddBestHit(m_HitSaveOpts->hsp_filt_opt,
1382 &best_hit_opts,
1383 eBoth);
1384 _ASSERT(best_hit_opts == NULL);
1385 }
1386 }
1387
1388 inline void
SetSubjectBestHit()1389 CBlastOptionsLocal::SetSubjectBestHit()
1390 {
1391
1392 if ( !m_HitSaveOpts->hsp_filt_opt ) {
1393 m_HitSaveOpts->hsp_filt_opt = BlastHSPFilteringOptionsNew();
1394 }
1395 if (m_HitSaveOpts->hsp_filt_opt->subject_besthit_opts == NULL) {
1396 bool isProtein = !Blast_ProgramIsNucleotide(EProgramToEBlastProgramType(m_Program));
1397 BlastHSPSubjectBestHitOptions* besthit = BlastHSPSubjectBestHitOptionsNew(isProtein);
1398 BlastHSPFilteringOptions_AddSubjectBestHit(m_HitSaveOpts->hsp_filt_opt,
1399 &besthit);
1400 _ASSERT(besthit == NULL);
1401 }
1402 }
1403
1404 inline bool
GetSubjectBestHit() const1405 CBlastOptionsLocal::GetSubjectBestHit() const
1406 {
1407
1408 if ((m_HitSaveOpts->hsp_filt_opt ) &&
1409 (m_HitSaveOpts->hsp_filt_opt->subject_besthit_opts != NULL)) {
1410 return true;
1411 }
1412 return false;
1413 }
1414
1415
1416 inline double
GetEvalueThreshold() const1417 CBlastOptionsLocal::GetEvalueThreshold() const
1418 {
1419 return m_HitSaveOpts->expect_value;
1420 }
1421
1422 inline void
SetEvalueThreshold(double eval)1423 CBlastOptionsLocal::SetEvalueThreshold(double eval)
1424 {
1425 m_HitSaveOpts->expect_value = eval;
1426 }
1427
1428 inline int
GetCutoffScore() const1429 CBlastOptionsLocal::GetCutoffScore() const
1430 {
1431 return m_HitSaveOpts->cutoff_score;
1432 }
1433
1434 inline void
SetCutoffScore(int s)1435 CBlastOptionsLocal::SetCutoffScore(int s)
1436 {
1437 m_HitSaveOpts->cutoff_score = s;
1438 }
1439
1440 inline vector<double>
GetCutoffScoreCoeffs() const1441 CBlastOptionsLocal::GetCutoffScoreCoeffs() const
1442 {
1443 vector<double> retval(2);
1444 retval[0] = (double)m_HitSaveOpts->cutoff_score_fun[0] / 100.0;
1445 retval[1] = (double)m_HitSaveOpts->cutoff_score_fun[1] / 100.0;
1446 return retval;
1447 }
1448
1449 inline void
SetCutoffScoreCoeffs(const vector<double> & c)1450 CBlastOptionsLocal::SetCutoffScoreCoeffs(const vector<double>& c)
1451 {
1452 m_HitSaveOpts->cutoff_score_fun[0] = (int)(c[0] * 100.0);
1453 m_HitSaveOpts->cutoff_score_fun[1] = (int)(c[1] * 100.0);
1454 }
1455
1456 inline double
GetPercentIdentity() const1457 CBlastOptionsLocal::GetPercentIdentity() const
1458 {
1459 return m_HitSaveOpts->percent_identity;
1460 }
1461
1462 inline void
SetPercentIdentity(double p)1463 CBlastOptionsLocal::SetPercentIdentity(double p)
1464 {
1465 m_HitSaveOpts->percent_identity = p;
1466 }
1467
1468 inline int
GetMaxEditDistance() const1469 CBlastOptionsLocal::GetMaxEditDistance() const
1470 {
1471 return m_HitSaveOpts->max_edit_distance;
1472 }
1473
1474 inline void
SetMaxEditDistance(int e)1475 CBlastOptionsLocal::SetMaxEditDistance(int e)
1476 {
1477 m_HitSaveOpts->max_edit_distance = e;
1478 }
1479
1480 inline double
GetQueryCovHspPerc() const1481 CBlastOptionsLocal::GetQueryCovHspPerc() const
1482 {
1483 return m_HitSaveOpts->query_cov_hsp_perc;
1484 }
1485
1486 inline void
SetQueryCovHspPerc(double p)1487 CBlastOptionsLocal::SetQueryCovHspPerc(double p)
1488 {
1489 m_HitSaveOpts->query_cov_hsp_perc = p;
1490 }
1491
1492 inline int
GetMinDiagSeparation() const1493 CBlastOptionsLocal::GetMinDiagSeparation() const
1494 {
1495 return m_HitSaveOpts->min_diag_separation;
1496 }
1497
1498 inline void
SetMinDiagSeparation(int d)1499 CBlastOptionsLocal::SetMinDiagSeparation(int d)
1500 {
1501 m_HitSaveOpts->min_diag_separation = d;
1502 }
1503
1504 inline bool
GetSumStatisticsMode() const1505 CBlastOptionsLocal::GetSumStatisticsMode() const
1506 {
1507 return m_HitSaveOpts->do_sum_stats ? true : false;
1508 }
1509
1510 inline void
SetSumStatisticsMode(bool m)1511 CBlastOptionsLocal::SetSumStatisticsMode(bool m)
1512 {
1513 m_HitSaveOpts->do_sum_stats = m;
1514 }
1515
1516 inline int
GetLongestIntronLength() const1517 CBlastOptionsLocal::GetLongestIntronLength() const
1518 {
1519 return m_HitSaveOpts->longest_intron;
1520 }
1521
1522 inline void
SetLongestIntronLength(int l)1523 CBlastOptionsLocal::SetLongestIntronLength(int l)
1524 {
1525 m_HitSaveOpts->longest_intron = l;
1526 }
1527
1528 inline bool
GetGappedMode() const1529 CBlastOptionsLocal::GetGappedMode() const
1530 {
1531 return m_ScoringOpts->gapped_calculation ? true : false;
1532 }
1533
1534 inline void
SetGappedMode(bool m)1535 CBlastOptionsLocal::SetGappedMode(bool m)
1536 {
1537 m_ScoringOpts->gapped_calculation = m;
1538 }
1539
1540 /* Masklevel parameter -RMH- */
1541 inline int
GetMaskLevel() const1542 CBlastOptionsLocal::GetMaskLevel() const
1543 {
1544 return m_HitSaveOpts->mask_level;
1545 }
1546
1547 // -RMH-
1548 inline void
SetMaskLevel(int s)1549 CBlastOptionsLocal::SetMaskLevel(int s)
1550 {
1551 m_HitSaveOpts->mask_level = s;
1552 }
1553
1554 inline double
GetLowScorePerc() const1555 CBlastOptionsLocal::GetLowScorePerc() const
1556 {
1557 return m_HitSaveOpts->low_score_perc;
1558 }
1559
1560 inline void
SetLowScorePerc(double p)1561 CBlastOptionsLocal::SetLowScorePerc(double p)
1562 {
1563 m_HitSaveOpts->low_score_perc = p;
1564 }
1565
1566 inline bool
GetPaired() const1567 CBlastOptionsLocal::GetPaired() const
1568 {
1569 return m_HitSaveOpts->paired;
1570 }
1571
1572 inline void
SetPaired(bool p)1573 CBlastOptionsLocal::SetPaired(bool p)
1574 {
1575 m_HitSaveOpts->paired = p;
1576 }
1577
1578 inline bool
GetSplice() const1579 CBlastOptionsLocal::GetSplice() const
1580 {
1581 return m_HitSaveOpts->splice;
1582 }
1583
1584 inline void
SetSplice(bool s)1585 CBlastOptionsLocal::SetSplice(bool s)
1586 {
1587 m_HitSaveOpts->splice = s;
1588 }
1589
1590 /* Flag to indicate if cross_match-like complexity adjusted
1591 scoring is in use. Currently only used by RMBlastN. -RMH- */
1592 inline bool
GetComplexityAdjMode() const1593 CBlastOptionsLocal::GetComplexityAdjMode() const
1594 {
1595 return m_ScoringOpts->complexity_adjusted_scoring ? true : false;
1596 }
1597
1598 // -RMH-
1599 inline void
SetComplexityAdjMode(bool m)1600 CBlastOptionsLocal::SetComplexityAdjMode(bool m)
1601 {
1602 m_ScoringOpts->complexity_adjusted_scoring = m;
1603 }
1604
1605 /************************ Scoring options ************************/
1606 inline int
GetMatchReward() const1607 CBlastOptionsLocal::GetMatchReward() const
1608 {
1609 return m_ScoringOpts->reward;
1610 }
1611
1612 inline void
SetMatchReward(int r)1613 CBlastOptionsLocal::SetMatchReward(int r)
1614 {
1615 m_ScoringOpts->reward = r;
1616 }
1617
1618 inline int
GetMismatchPenalty() const1619 CBlastOptionsLocal::GetMismatchPenalty() const
1620 {
1621 return m_ScoringOpts->penalty;
1622 }
1623
1624 inline void
SetMismatchPenalty(int p)1625 CBlastOptionsLocal::SetMismatchPenalty(int p)
1626 {
1627 m_ScoringOpts->penalty = p;
1628 }
1629
1630 inline int
GetGapOpeningCost() const1631 CBlastOptionsLocal::GetGapOpeningCost() const
1632 {
1633 return m_ScoringOpts->gap_open;
1634 }
1635
1636 inline void
SetGapOpeningCost(int g)1637 CBlastOptionsLocal::SetGapOpeningCost(int g)
1638 {
1639 m_ScoringOpts->gap_open = g;
1640 }
1641
1642 inline int
GetGapExtensionCost() const1643 CBlastOptionsLocal::GetGapExtensionCost() const
1644 {
1645 return m_ScoringOpts->gap_extend;
1646 }
1647
1648 inline void
SetGapExtensionCost(int e)1649 CBlastOptionsLocal::SetGapExtensionCost(int e)
1650 {
1651 m_ScoringOpts->gap_extend = e;
1652 }
1653
1654 inline int
GetFrameShiftPenalty() const1655 CBlastOptionsLocal::GetFrameShiftPenalty() const
1656 {
1657 return m_ScoringOpts->shift_pen;
1658 }
1659
1660 inline void
SetFrameShiftPenalty(int p)1661 CBlastOptionsLocal::SetFrameShiftPenalty(int p)
1662 {
1663 m_ScoringOpts->shift_pen = p;
1664 }
1665
1666 inline bool
GetOutOfFrameMode() const1667 CBlastOptionsLocal::GetOutOfFrameMode() const
1668 {
1669 return m_ScoringOpts->is_ooframe ? true : false;
1670 }
1671
1672 inline void
SetOutOfFrameMode(bool m)1673 CBlastOptionsLocal::SetOutOfFrameMode(bool m)
1674 {
1675 m_ScoringOpts->is_ooframe = m;
1676 }
1677
1678 /******************** Effective Length options *******************/
1679 inline Int8
GetDbLength() const1680 CBlastOptionsLocal::GetDbLength() const
1681 {
1682 return m_EffLenOpts->db_length;
1683 }
1684
1685 inline void
SetDbLength(Int8 l)1686 CBlastOptionsLocal::SetDbLength(Int8 l)
1687 {
1688 m_EffLenOpts->db_length = l;
1689 }
1690
1691 inline unsigned int
GetDbSeqNum() const1692 CBlastOptionsLocal::GetDbSeqNum() const
1693 {
1694 return (unsigned int) m_EffLenOpts->dbseq_num;
1695 }
1696
1697 inline void
SetDbSeqNum(unsigned int n)1698 CBlastOptionsLocal::SetDbSeqNum(unsigned int n)
1699 {
1700 m_EffLenOpts->dbseq_num = (Int4) n;
1701 }
1702
1703 inline Int8
GetEffectiveSearchSpace() const1704 CBlastOptionsLocal::GetEffectiveSearchSpace() const
1705 {
1706 if (m_EffLenOpts->num_searchspaces == 0)
1707 return 0;
1708
1709 return m_EffLenOpts->searchsp_eff[0];
1710 }
1711
1712 inline void
SetEffectiveSearchSpace(Int8 eff)1713 CBlastOptionsLocal::SetEffectiveSearchSpace(Int8 eff)
1714 {
1715 if (m_EffLenOpts->num_searchspaces < 1) {
1716 m_EffLenOpts->num_searchspaces = 1;
1717 if (m_EffLenOpts->searchsp_eff) sfree(m_EffLenOpts->searchsp_eff);
1718 m_EffLenOpts->searchsp_eff = (Int8 *)malloc(sizeof(Int8));
1719 }
1720
1721 fill(m_EffLenOpts->searchsp_eff,
1722 m_EffLenOpts->searchsp_eff+m_EffLenOpts->num_searchspaces,
1723 eff);
1724 }
1725
1726 inline void
SetEffectiveSearchSpace(const vector<Int8> & eff)1727 CBlastOptionsLocal::SetEffectiveSearchSpace(const vector<Int8>& eff)
1728 {
1729 if (m_EffLenOpts->num_searchspaces < static_cast<Int4>(eff.size())) {
1730 m_EffLenOpts->num_searchspaces = static_cast<Int4>(eff.size());
1731 if (m_EffLenOpts->searchsp_eff) sfree(m_EffLenOpts->searchsp_eff);
1732 m_EffLenOpts->searchsp_eff = (Int8 *)malloc(eff.size() * sizeof(Int8));
1733 }
1734
1735 copy(eff.begin(), eff.end(), m_EffLenOpts->searchsp_eff);
1736 }
1737
1738 inline int
GetDbGeneticCode() const1739 CBlastOptionsLocal::GetDbGeneticCode() const
1740 {
1741 return m_DbOpts->genetic_code;
1742 }
1743
1744 inline const char*
GetPHIPattern() const1745 CBlastOptionsLocal::GetPHIPattern() const
1746 {
1747 return m_LutOpts->phi_pattern;
1748 }
1749
1750 inline double
GetInclusionThreshold() const1751 CBlastOptionsLocal::GetInclusionThreshold() const
1752 {
1753 return m_PSIBlastOpts->inclusion_ethresh;
1754 }
1755
1756 inline void
SetInclusionThreshold(double incthr)1757 CBlastOptionsLocal::SetInclusionThreshold(double incthr)
1758 {
1759 m_PSIBlastOpts->inclusion_ethresh = incthr;
1760 }
1761
1762 inline int
GetPseudoCount() const1763 CBlastOptionsLocal::GetPseudoCount() const
1764 {
1765 return m_PSIBlastOpts->pseudo_count;
1766 }
1767
1768 inline void
SetPseudoCount(int pc)1769 CBlastOptionsLocal::SetPseudoCount(int pc)
1770 {
1771 m_PSIBlastOpts->pseudo_count = pc;
1772 }
1773
1774 inline bool
GetIgnoreMsaMaster() const1775 CBlastOptionsLocal::GetIgnoreMsaMaster() const
1776 {
1777 return m_PSIBlastOpts->nsg_compatibility_mode ? true : false;
1778 }
1779
1780 inline void
SetIgnoreMsaMaster(bool val)1781 CBlastOptionsLocal::SetIgnoreMsaMaster(bool val)
1782 {
1783 m_PSIBlastOpts->nsg_compatibility_mode = val;
1784 }
1785
1786 inline void
SetPHIPattern(const char * pattern,bool is_dna)1787 CBlastOptionsLocal::SetPHIPattern(const char* pattern, bool is_dna)
1788 {
1789 if (is_dna)
1790 m_LutOpts->lut_type = ePhiNaLookupTable;
1791 else
1792 m_LutOpts->lut_type = ePhiLookupTable;
1793
1794 if (pattern)
1795 m_LutOpts->phi_pattern = strdup(pattern);
1796 else if (m_LutOpts->phi_pattern)
1797 sfree(m_LutOpts->phi_pattern);
1798 }
1799
1800 /******************** DELTA BLAST Options ************************/
1801 inline double
GetDomainInclusionThreshold(void) const1802 CBlastOptionsLocal::GetDomainInclusionThreshold(void) const
1803 {
1804 return m_DeltaBlastOpts->inclusion_ethresh;
1805 }
1806
1807 inline void
SetDomainInclusionThreshold(double incthr)1808 CBlastOptionsLocal::SetDomainInclusionThreshold(double incthr)
1809 {
1810 m_DeltaBlastOpts->inclusion_ethresh = incthr;
1811 }
1812
1813 /******************** Megablast Database Index *******************/
GetUseIndex() const1814 inline bool CBlastOptionsLocal::GetUseIndex() const
1815 {
1816 return m_UseMBIndex;
1817 }
1818
GetForceIndex() const1819 inline bool CBlastOptionsLocal::GetForceIndex() const
1820 {
1821 return m_ForceMBIndex;
1822 }
1823
GetMBIndexLoaded() const1824 inline bool CBlastOptionsLocal::GetMBIndexLoaded() const
1825 {
1826 return m_MBIndexLoaded;
1827 }
1828
GetIndexName() const1829 inline const string CBlastOptionsLocal::GetIndexName() const
1830 {
1831 return m_MBIndexName;
1832 }
1833
SetMBIndexLoaded(bool index_loaded)1834 inline void CBlastOptionsLocal::SetMBIndexLoaded( bool index_loaded )
1835 {
1836 m_MBIndexLoaded = index_loaded;
1837 }
1838
GetIsOldStyleMBIndex() const1839 inline bool CBlastOptionsLocal::GetIsOldStyleMBIndex() const
1840 {
1841 return m_OldStyleMBIndex;
1842 }
1843
SetUseIndex(bool use_index,const string & index_name,bool force_index,bool old_style_index)1844 inline void CBlastOptionsLocal::SetUseIndex(
1845 bool use_index, const string & index_name,
1846 bool force_index, bool old_style_index )
1847 {
1848 m_UseMBIndex = use_index;
1849
1850 if( m_UseMBIndex ) {
1851 m_ForceMBIndex = force_index;
1852 m_MBIndexName = index_name;
1853 m_OldStyleMBIndex = old_style_index;
1854 }
1855 }
1856
1857 #endif /* SKIP_DOXYGEN_PROCESSING */
1858
1859 END_SCOPE(blast)
1860 END_NCBI_SCOPE
1861
1862 /* @} */
1863
1864 #endif /* ALGO_BLAST_API___BLAST_OPTIONS_LOCAL_PRIV__HPP */
1865