1 /*  $Id: blast_rps_options.cpp 456407 2015-01-12 15:47:18Z 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  * Authors:  Tom Madden
27  *
28  */
29 
30 /// @file blast_rps_options.cpp
31 /// Implements the CBlastRPSOptionsHandle class.
32 
33 #include <ncbi_pch.hpp>
34 #include <algo/blast/api/blast_rps_options.hpp>
35 #include <objects/seqloc/Na_strand.hpp>
36 #include "blast_setup.hpp"
37 
38 
39 /** @addtogroup AlgoBlast
40  *
41  * @{
42  */
43 
44 
45 BEGIN_NCBI_SCOPE
BEGIN_SCOPE(blast)46 BEGIN_SCOPE(blast)
47 
48 CBlastRPSOptionsHandle::CBlastRPSOptionsHandle(EAPILocality locality)
49     : CBlastOptionsHandle(locality)
50 {
51     SetDefaults();
52     m_Opts->SetProgram(eRPSBlast);
53 }
54 
CBlastRPSOptionsHandle(CRef<CBlastOptions> opt)55 CBlastRPSOptionsHandle::CBlastRPSOptionsHandle(CRef<CBlastOptions> opt)
56     : CBlastOptionsHandle(opt)
57 {
58 }
59 
60 void
SetLookupTableDefaults()61 CBlastRPSOptionsHandle::SetLookupTableDefaults()
62 {
63     m_Opts->SetLookupTableType(eRPSLookupTable);
64     // N.B.: the word threshold is not set because for RPS-BLAST it CANNOT be
65     // done, i.e.: the RPS-BLAST databases already have this value encoded in
66     // them and therefore this value cannot be changed on an RPS-BLAST run
67 }
68 
69 void
SetQueryOptionDefaults()70 CBlastRPSOptionsHandle::SetQueryOptionDefaults()
71 {
72     SetSegFiltering(false);
73     m_Opts->SetStrandOption(objects::eNa_strand_unknown);
74 }
75 
76 void
SetInitialWordOptionsDefaults()77 CBlastRPSOptionsHandle::SetInitialWordOptionsDefaults()
78 {
79     SetXDropoff(BLAST_UNGAPPED_X_DROPOFF_PROT);
80     SetWindowSize(BLAST_WINDOW_SIZE_PROT);
81     // FIXME: extend_word_method is missing
82 }
83 
84 void
SetGappedExtensionDefaults()85 CBlastRPSOptionsHandle::SetGappedExtensionDefaults()
86 {
87     SetGapXDropoff(BLAST_GAP_X_DROPOFF_PROT);
88     SetGapXDropoffFinal(BLAST_GAP_X_DROPOFF_FINAL_PROT);
89     SetGapTrigger(BLAST_GAP_TRIGGER_PROT);
90     m_Opts->SetGapExtnAlgorithm(eDynProgScoreOnly);
91     m_Opts->SetGapTracebackAlgorithm(eDynProgTbck);
92     SetCompositionBasedStats(true);
93 }
94 
95 
96 void
SetScoringOptionsDefaults()97 CBlastRPSOptionsHandle::SetScoringOptionsDefaults()
98 {
99     SetGappedMode();
100     // set invalid values for options that are not applicable
101     m_Opts->SetOutOfFrameMode(false);
102     m_Opts->SetFrameShiftPenalty(INT2_MAX);
103 }
104 
105 void
SetHitSavingOptionsDefaults()106 CBlastRPSOptionsHandle::SetHitSavingOptionsDefaults()
107 {
108     SetHitlistSize(500);
109     SetEvalueThreshold(BLAST_EXPECT_VALUE);
110     SetMinDiagSeparation(0);
111     SetPercentIdentity(0);
112     m_Opts->SetSumStatisticsMode(false);
113     // set some default here, allow INT4MAX to mean infinity
114     SetMaxNumHspPerSequence(0);
115     SetMaxHspsPerSubject(0);
116 
117     SetCutoffScore(0); // will be calculated based on evalue threshold,
118     // effective lengths and Karlin-Altschul params in BLAST_Cutoffs_simple
119     // and passed to the engine in the params structure
120 
121     SetQueryCovHspPerc(0);
122 }
123 
124 void
SetEffectiveLengthsOptionsDefaults()125 CBlastRPSOptionsHandle::SetEffectiveLengthsOptionsDefaults()
126 {
127     SetDbLength(0);
128     SetDbSeqNum(0);
129     SetEffectiveSearchSpace(0);
130 }
131 
132 void
SetSubjectSequenceOptionsDefaults()133 CBlastRPSOptionsHandle::SetSubjectSequenceOptionsDefaults()
134 {}
135 
136 END_SCOPE(blast)
137 END_NCBI_SCOPE
138 
139 
140 /* @} */
141