NCBI C++ ToolKit
blast_search_params.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef PKG_ALIGNMENT___BLAST_SEARCH_PARAMS__HPP
2 #define PKG_ALIGNMENT___BLAST_SEARCH_PARAMS__HPP
3 
4 /* $Id: blast_search_params.hpp 36454 2016-09-26 17:49:22Z katargir $
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: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistl.hpp>
36 #include <corelib/ncbiobj.hpp>
37 
38 #include <gui/utils/mru_list.hpp>
39 
40 #include <gui/objutils/objects.hpp>
41 
45 
46 
48 
49 /** @addtogroup GUI_PKG_ALIGNMENT
50  *
51  * @{
52  */
53 
55  class CUser_object;
57 
58 ///////////////////////////////////////////////////////////////////////////////
59 /// CBLASTParams - save user-specified parameters and preferences
61 {
62 public:
65 
67  {
70  eLocalDB
71  };
72 
73  /// describes static attributes of a BLAST program
74  struct SProgInfo {
76  string m_Label;
77  bool m_NucInput;
78  bool m_NucDB;
83  };
84 
85  /// describes parameters for a BLAST program
86  struct SProgParams
87  {
90  double m_eValue;
94  bool m_MaskLowercase; ///< mask Lowercase features
95  bool m_MaskRepeats; ///< mask Repeat features
96  string m_RepeatLib;
97  int m_WM_TaxId; ///< winmask tax id
98 
99  SProgParams();
100  SProgParams(int thresh, int word, double ev, bool low_c, int query_gen_code, int db_gen_code);
101  };
102 
103 public:
104  CBLASTParams();
105 
106  bool& IsNucInput();
107  bool IsNucInput() const;
108 
109  TConstScopedObjects& GetSeqLocs();
110  const TConstScopedObjects& GetSeqLocs() const;
111 
112  /// returns the current program for the currently selected input type
113  blast::EProgram& GetCurrProgram();
114  const blast::EProgram GetCurrProgram() const;
115 
116  /// returns the selected programs for the given input type
117  blast::EProgram& GetProgram(bool nuc);
118  const blast::EProgram GetProgram(bool nuc) const;
119 
120  /// returns the current database for the current program
121  string& GetCurrDatabase();
122  const string& GetCurrDatabase() const;
123 
124  /// returns the database of the specified type
125  string& GetDatabase(bool nuc_db);
126  const string& GetDatabase(bool nuc_db) const;
127 
128  /// returns MRU databases for the current program
129  TMRUDatabases& GetCurrMRUDatabases();
130 
131  TMRUDatabases& GetMRUDatabases(bool nuc_db);
132 
133  string& GetEntrezQuery();
134  string GetEntrezQuery() const;
135 
136  bool IsSubjNucInput() const;
137 
138  TConstScopedObjects& GetSubjSeqLocs();
139  const TConstScopedObjects& GetSubjSeqLocs() const;
140 
141  /// returns params for the current program
142  SProgParams& GetCurrParams();
143  const SProgParams& GetCurrParams() const;
144 
145  void ResetCurrParams();
146 
147 
148  string& GetAdvancedParams();
149  string GetAdvancedParams() const;
150 
152  static TRepeatLibs GetAllRepeatLibs();
153  static string GetRepeatLib(const string& repeat_db);
154  static string GetRepeatDb(const string& repeat_lib);
155 
156  string& GetJobTitle();
157  string GetJobTitle() const;
158 
159  bool IsStandaloneRequested() const { return mf_Standalone; }
160  void StandaloneRequested( bool req ) { mf_Standalone = req; }
161 
162  bool IsCompartmentsRequested() const { return mf_FindComparts; }
163  void FindCompartments( bool req ) { mf_FindComparts = req; }
164 
165  void SetWM_Dir(const string& wm_dir_path) { m_WM_Dir = wm_dir_path; }
166  const string& GetWmDir() const { return m_WM_Dir; }
167 
168  vector<string>& ToArgVec( vector<string>& arg_vec ) const;
169  CArgs* ToArgs( vector<string>& argv ) const;
170  CRef<blast::CBlastOptionsHandle> ToBlastOptions( bool local = false ) const;
171  CRef<blast::CBlastOptionsHandle> ToArgVecBlastOptions( vector<string>& arg_vec, bool local = true ) const;
172 
173  objects::CUser_object* ToUserObject() const;
174  void FromUserObject(const objects::CUser_object& user_obj);
175 
176  static void GetProgramLabels(bool nuc_input, vector<string>& labels);
177  static string GetProgramLabel(blast::EProgram program);
178  static blast::EProgram GetProgramByLabel(const string& str);
179 
180  static bool IsNucInput(blast::EProgram program);
181  static bool IsNucDatabase(blast::EProgram program);
182 
183  static bool UseDustFilter(blast::EProgram program);
184 
185  static bool NeedsThreshold(blast::EProgram program);
186 
187  static bool NeedsDbGeneticCode(blast::EProgram program);
188  static bool NeedsQueryGeneticCode(blast::EProgram program);
189 
190  static int GetGeneticCodeByLabel(const string& label);
191  static string GetGeneticCodeLabel(int code_id);
192  static void GetGeneticCodeLabels(vector<string>& labels);
193 
194 
195  /// LOG_POST params for forensic purposes
196  void PrintParams(const string& log_title) const;
197 
198  string GetLocalNucDB() const { return m_LocalNucDB; }
199  void SetLocalNucDB(const string& value) { m_LocalNucDB = value; }
200 
201  string GetLocalProtDB() const { return m_LocalProtDB; }
202  void SetLocalProtDB(const string& value) { m_LocalProtDB = value; }
203 
204  ESubjectType GetSubjectType() const { return m_SubjectType; }
205  void SetSubjectType(ESubjectType subjectType) { m_SubjectType = subjectType; }
206 
207  bool GetLocalDBLoader() const { return m_LocalDBLoader; }
208  void SetLocalDBLoader(bool value) { m_LocalDBLoader = value; }
209 
210 protected:
211  void x_AddProgramParams(blast::EProgram program, int thresh, int word, int ev);
212 
213  void x_ArgsToBlastOptions(const string& cmd_line, blast::CBlastOptions& opts) const;
214 
215  static objects::CUser_object* x_ToUserObject(blast::EProgram prg,
216  const SProgParams& params);
217  static void x_FromUserObject(const objects::CUser_object& user_obj,
218  blast::EProgram prg,
219  SProgParams& params);
220 
221 protected:
224 
226 
229 
232 
237 
238  /// Params applying only to BLAST Search
241 
242  /// Params applying only to BLAST Sequences
244 
245  /// Common parameters
247 
249  string m_JobTitle;
252  string m_WM_Dir; ///< path to WM statistics databases
253 
254  string m_LocalNucDB;
256 
259 };
260 
261 
262 /* @} */
263 
265 
266 
267 #endif // PKG_ALIGNMENT___BLAST_SEARCH_PARAMS__HPP
268 
Declares class to encapsulate all BLAST options.
Declares the CBlastOptionsHandle and CBlastOptionsFactory classes.
Definitions of special type used in BLAST.
EProgram
This enumeration is to evolve into a task/program specific list that specifies sets of default parame...
Definition: blast_types.hpp:56
CArgs –.
Definition: ncbiargs.hpp:379
CBLASTParams - save user-specified parameters and preferences.
Definition: map.hpp:338
char value[7]
Definition: config.c:431
bool GetLocalDBLoader() const
string m_WM_Dir
path to WM statistics databases
void StandaloneRequested(bool req)
map< blast::EProgram, const SProgInfo * > TProgramAttrMap
TMRUDatabases m_NucMRUDatabases
TConstScopedObjects m_SubjSeqLocs
Params applying only to BLAST Sequences.
set< string, PNocase > TRepeatLibs
void SetLocalNucDB(const string &value)
const string & GetWmDir() const
void FindCompartments(bool req)
TMRUDatabases m_ProtMRUDatabases
void x_AddProgramParams(blast::EProgram program, int thresh, int word, int ev)
TProgramParamsMap m_ProgToParams
Common parameters.
string GetLocalNucDB() const
TConstScopedObjects m_SeqLocs
void SetLocalProtDB(const string &value)
void SetSubjectType(ESubjectType subjectType)
static TProgramAttrMap sm_ProgramToAttr
blast::EProgram m_NucProgram
bool IsCompartmentsRequested() const
bool m_MaskLowercase
mask Lowercase features
void SetLocalDBLoader(bool value)
CMRUList< string > TMRUQueries
blast::EProgram m_ProtProgram
string GetLocalProtDB() const
ESubjectType m_SubjectType
bool m_MaskRepeats
mask Repeat features
CMRUList< string > TMRUDatabases
string m_EntrezQuery
Params applying only to BLAST Search.
ESubjectType GetSubjectType() const
void SetWM_Dir(const string &wm_dir_path)
map< blast::EProgram, SProgParams > TProgramParamsMap
TMRUQueries m_MRUQueries
bool IsStandaloneRequested() const
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static const char label[]
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
The NCBI C++/STL use hints.
static const char * str(char *buf, int n)
Definition: stats.c:84
describes static attributes of a BLAST program
describes parameters for a BLAST program
#define local
Definition: zutil.h:33
Modified on Thu Feb 29 12:21:20 2024 by modify_doxy.py rev. 669887