1 #ifndef ALGO_BLAST_API___BLAST_NUCL_OPTIONS__HPP
2 #define ALGO_BLAST_API___BLAST_NUCL_OPTIONS__HPP
3 
4 /*  $Id: blast_nucl_options.hpp 404677 2013-06-26 13:46:36Z fongah2 $
5  * ===========================================================================
6  *
7  *                            PUBLIC DOMAIN NOTICE
8  *               National Center for Biotechnology Information
9  *
10  *  This software/database is a "United States Government Work" under the
11  *  terms of the United States Copyright Act.  It was written as part of
12  *  the author's official duties as a United States Government employee and
13  *  thus cannot be copyrighted.  This software/database is freely available
14  *  to the public for use. The National Library of Medicine and the U.S.
15  *  Government have not placed any restriction on its use or reproduction.
16  *
17  *  Although all reasonable efforts have been taken to ensure the accuracy
18  *  and reliability of the software and data, the NLM and the U.S.
19  *  Government do not and cannot warrant the performance or results that
20  *  may be obtained by using this software or data. The NLM and the U.S.
21  *  Government disclaim all warranties, express or implied, including
22  *  warranties of performance, merchantability or fitness for any particular
23  *  purpose.
24  *
25  *  Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors:  Christiam Camacho
30  *
31  */
32 
33 /// @file blast_nucl_options.hpp
34 /// Declares the CBlastNucleotideOptionsHandle class.
35 
36 #include <algo/blast/api/blast_options_handle.hpp>
37 
38 /** @addtogroup AlgoBlast
39  *
40  * @{
41  */
42 
43 BEGIN_NCBI_SCOPE
44 BEGIN_SCOPE(blast)
45 
46 /// Handle to the nucleotide-nucleotide options to the BLAST algorithm.
47 ///
48 /// Adapter class for nucleotide-nucleotide BLAST comparisons.
49 /// Exposes an interface to allow manipulation the options that are relevant to
50 /// this type of search.
51 ///
52 /// NB: By default, traditional megablast defaults are used. If blastn defaults
53 /// are desired, please call the appropriate member function:
54 ///
55 ///    void SetTraditionalBlastnDefaults();
56 ///    void SetTraditionalMegablastDefaults();
57 
58 class NCBI_XBLAST_EXPORT CBlastNucleotideOptionsHandle :
59                                             public CBlastOptionsHandle
60 {
61 public:
62 
63     /// Creates object with default options set
64     CBlastNucleotideOptionsHandle(EAPILocality locality = CBlastOptions::eLocal);
65 
66     /// Create Options Handle from Existing CBlastOptions Object
67     CBlastNucleotideOptionsHandle(CRef<CBlastOptions> opt);
68 
69     /// Sets Defaults
70     virtual void SetDefaults();
71 
72     /******************* Lookup table options ***********************/
73     /// Returns LookupTableType
GetLookupTableType() const74     ELookupTableType GetLookupTableType() const { return m_Opts->GetLookupTableType(); }
75     /// Sets LookupTableType
76     /// @param type LookupTableType [in]
SetLookupTableType(ELookupTableType type)77     void SetLookupTableType(ELookupTableType type)
78     {
79         m_Opts->SetLookupTableType(type);
80     }
81 
82     /// Returns WordSize
GetWordSize() const83     int GetWordSize() const { return m_Opts->GetWordSize(); }
84     /// Sets WordSize
85     /// @param ws WordSize [in]
SetWordSize(int ws)86     void SetWordSize(int ws)
87     {
88         m_Opts->SetWordSize(ws);
89     }
90 
91     /******************* Query setup options ************************/
92     /// Returns StrandOption
GetStrandOption() const93     objects::ENa_strand GetStrandOption() const {
94         return m_Opts->GetStrandOption();
95     }
96     /// Sets StrandOption
97     /// @param strand StrandOption [in]
SetStrandOption(objects::ENa_strand strand)98     void SetStrandOption(objects::ENa_strand strand) {
99         m_Opts->SetStrandOption(strand);
100     }
101 
102     /// Is dust filtering enabled?
GetDustFiltering() const103     bool GetDustFiltering() const { return m_Opts->GetDustFiltering(); }
104     /// Enable dust filtering.
105     /// @param val enable dust filtering [in]
SetDustFiltering(bool val)106     void SetDustFiltering(bool val) { m_Opts->SetDustFiltering(val); }
107 
108     /// Get level parameter for dust
GetDustFilteringLevel() const109     int GetDustFilteringLevel() const { return m_Opts->GetDustFilteringLevel(); }
110     /// Set level parameter for dust.  Acceptable values: 2 < level < 64
111     /// @param level dust filtering parameter level [in]
SetDustFilteringLevel(int level)112     void SetDustFilteringLevel(int level) { m_Opts->SetDustFilteringLevel(level); }
113 
114     /// Get window parameter for dust
GetDustFilteringWindow() const115     int GetDustFilteringWindow() const { return m_Opts->GetDustFilteringWindow(); }
116     /// Set window parameter for dust.  Acceptable values: 8 < windowsize < 64
117     /// @param window dust filtering parameter window [in]
SetDustFilteringWindow(int window)118     void SetDustFilteringWindow(int window) { m_Opts->SetDustFilteringWindow(window); }
119 
120     /// Get linker parameter for dust
GetDustFilteringLinker() const121     int GetDustFilteringLinker() const { return m_Opts->GetDustFilteringLinker(); }
122     /// Set linker parameter for dust.  Acceptable values: 1 < linker < 32
123     /// @param linker dust filtering parameter linker [in]
SetDustFilteringLinker(int linker)124     void SetDustFilteringLinker(int linker) { m_Opts->SetDustFilteringLinker(linker); }
125 
126     /// Is repeat filtering enabled?
GetRepeatFiltering() const127     bool GetRepeatFiltering() const { return m_Opts->GetRepeatFiltering(); }
128     /// Enable repeat filtering.
129     /// @param val enable repeat filtering [in]
SetRepeatFiltering(bool val)130     void SetRepeatFiltering(bool val) { m_Opts->SetRepeatFiltering(val); }
131 
132     /// Get the repeat filtering database
GetRepeatFilteringDB() const133     const char* GetRepeatFilteringDB() const { return m_Opts->GetRepeatFilteringDB(); }
134     /// Enable repeat filtering.
135     /// @param db repeat filtering database [in]
SetRepeatFilteringDB(const char * db)136     void SetRepeatFilteringDB(const char* db) { m_Opts->SetRepeatFilteringDB(db); }
137 
138     /// Get the window masker taxid (or 0 if not set).
GetWindowMaskerTaxId() const139     int GetWindowMaskerTaxId() const { return m_Opts->GetWindowMaskerTaxId(); }
140 
141     /// Enable window masker and select a taxid (or 0 to disable).
142     /// @param taxid Select Window Masker filtering database for this taxid [in]
SetWindowMaskerTaxId(int taxid)143     void SetWindowMaskerTaxId(int taxid) { m_Opts->SetWindowMaskerTaxId(taxid); }
144 
145     /// Get the window masker database name (or NULL if not set).
GetWindowMaskerDatabase() const146     const char* GetWindowMaskerDatabase() const
147     {
148         return m_Opts->GetWindowMaskerDatabase();
149     }
150 
151     /// Enable window masker and select a database (or NULL to disable).
152     /// @param taxid Select Window Masker filtering database by filename [in]
SetWindowMaskerDatabase(const char * db)153     void SetWindowMaskerDatabase(const char* db)
154     {
155         m_Opts->SetWindowMaskerDatabase(db);
156     }
157 
158     /******************* Initial word options ***********************/
159 
160     /// Returns XDropoff
GetXDropoff() const161     double GetXDropoff() const { return m_Opts->GetXDropoff(); }
162     /// Sets XDropoff
163     /// @param x XDropoff [in]
SetXDropoff(double x)164     void SetXDropoff(double x) { m_Opts->SetXDropoff(x); }
165 
166     /******************* Gapped extension options *******************/
167     /// Returns GapExtnAlgorithm
GetGapExtnAlgorithm() const168     EBlastPrelimGapExt GetGapExtnAlgorithm() const { return m_Opts->GetGapExtnAlgorithm(); }
169 
170     /// Sets GapExtnAlgorithm
171     /// @param algo GapExtnAlgorithm [in]
SetGapExtnAlgorithm(EBlastPrelimGapExt algo)172     void SetGapExtnAlgorithm(EBlastPrelimGapExt algo) {m_Opts->SetGapExtnAlgorithm(algo);}
173 
174     /// Returns GapTracebackAlgorithm
GetGapTracebackAlgorithm() const175     EBlastTbackExt GetGapTracebackAlgorithm() const { return m_Opts->GetGapTracebackAlgorithm(); }
176 
177     /// Sets GapTracebackAlgorithm
178     /// @param algo GapTracebackAlgorithm [in]
SetGapTracebackAlgorithm(EBlastTbackExt algo)179     void SetGapTracebackAlgorithm(EBlastTbackExt algo) {m_Opts->SetGapTracebackAlgorithm(algo); }
180 
181     /************************ Scoring options ************************/
182     /// Returns MatchReward
GetMatchReward() const183     int GetMatchReward() const { return m_Opts->GetMatchReward(); }
184     /// Sets MatchReward
185     /// @param r MatchReward [in]
SetMatchReward(int r)186     void SetMatchReward(int r) { m_Opts->SetMatchReward(r); }
187 
188     /// Returns MismatchPenalty
GetMismatchPenalty() const189     int GetMismatchPenalty() const { return m_Opts->GetMismatchPenalty(); }
190     /// Sets MismatchPenalty
191     /// @param p MismatchPenalty [in]
SetMismatchPenalty(int p)192     void SetMismatchPenalty(int p) { m_Opts->SetMismatchPenalty(p); }
193 
194     /// Returns MatrixName
GetMatrixName() const195     const char* GetMatrixName() const { return m_Opts->GetMatrixName(); }
196     /// Sets MatrixName
197     /// @param matrix MatrixName [in]
SetMatrixName(const char * matrix)198     void SetMatrixName(const char* matrix) { m_Opts->SetMatrixName(matrix); }
199 
200     /// Returns GapOpeningCost
GetGapOpeningCost() const201     int GetGapOpeningCost() const { return m_Opts->GetGapOpeningCost(); }
202     /// Sets GapOpeningCost
203     /// @param g GapOpeningCost [in]
SetGapOpeningCost(int g)204     void SetGapOpeningCost(int g) { m_Opts->SetGapOpeningCost(g); }
205 
206     /// Returns GapExtensionCost
GetGapExtensionCost() const207     int GetGapExtensionCost() const { return m_Opts->GetGapExtensionCost(); }
208     /// Sets GapExtensionCost
209     /// @param e GapExtensionCost [in]
SetGapExtensionCost(int e)210     void SetGapExtensionCost(int e) { m_Opts->SetGapExtensionCost(e); }
211 
212     /// Sets TraditionalBlastnDefaults
213     void SetTraditionalBlastnDefaults();
214     /// Sets TraditionalMegablastDefaults
215     void SetTraditionalMegablastDefaults();
216     /// Sets default options for VecScreen
217     void SetVecScreenDefaults();
218 
219 protected:
220     /// Set the program and service name for remote blast.
SetRemoteProgramAndService_Blast3()221     virtual void SetRemoteProgramAndService_Blast3()
222     {
223         m_Opts->SetRemoteProgramAndService_Blast3("blastn", "megablast");
224     }
225 
226     /// Overrides LookupTableDefaults for nucleotide options
227     virtual void SetLookupTableDefaults();
228     /// Overrides MBLookupTableDefaults for nucleotide options
229     virtual void SetMBLookupTableDefaults();
230     /// Overrides QueryOptionDefaults for nucleotide options
231     virtual void SetQueryOptionDefaults();
232     /// Overrides InitialWordOptionsDefaults for nucleotide options
233     virtual void SetInitialWordOptionsDefaults();
234     /// Overrides MBInitialWordOptionsDefaults for nucleotide options
235     virtual void SetMBInitialWordOptionsDefaults();
236     /// Overrides GappedExtensionDefaults for nucleotide options
237     virtual void SetGappedExtensionDefaults();
238     /// Overrides MBGappedExtensionDefaults for nucleotide options
239     virtual void SetMBGappedExtensionDefaults();
240     /// Overrides ScoringOptionsDefaults for nucleotide options
241     virtual void SetScoringOptionsDefaults();
242     /// Overrides MBScoringOptionsDefaults for nucleotide options
243     virtual void SetMBScoringOptionsDefaults();
244     /// Overrides HitSavingOptionsDefaults for nucleotide options
245     virtual void SetHitSavingOptionsDefaults();
246     /// Overrides MBHitSavingOptionsDefaults for nucleotide options
247     virtual void SetMBHitSavingOptionsDefaults();
248     /// Overrides EffectiveLengthsOptionsDefaults for nucleotide options
249     virtual void SetEffectiveLengthsOptionsDefaults();
250     /// Overrides SubjectSequenceOptionsDefaults for nucleotide options
251     virtual void SetSubjectSequenceOptionsDefaults();
252 
253 private:
254     /// Disallow copy constructor
255     CBlastNucleotideOptionsHandle(const CBlastNucleotideOptionsHandle& rhs);
256     /// Disallow assignment operator
257     CBlastNucleotideOptionsHandle& operator=(const CBlastNucleotideOptionsHandle& rhs);
258 };
259 
260 END_SCOPE(blast)
261 END_NCBI_SCOPE
262 
263 
264 /* @} */
265 
266 
267 #endif  /* ALGO_BLAST_API___BLAST_NUCL_OPTIONS__HPP */
268