NCBI C++ ToolKit
ngalign_params.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: ngalign_params.cpp 39666 2017-10-25 16:01:13Z katargir $
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: Roman Katargin
27 *
28 * File Description:
29 *
30 */
31 
32 #include <ncbi_pch.hpp>
33 
35 
38 
40 
43 
45 {
46  Init();
47 }
48 
50 {
51  Init();
52  Copy(data);
53 }
54 
56 {
57 }
58 
60 {
61  Copy(data);
62 }
63 
65 {
66  ////@begin CNGAlignParams equality operator
67  if (!(m_FilterMode == data.m_FilterMode)) return false;
68  if (!(m_WordSize == data.m_WordSize)) return false;
69  if (!(m_eValue == data.m_eValue)) return false;
70  if (!(m_BestHit == data.m_BestHit)) return false;
71  if (!(m_JobTitle == data.m_JobTitle)) return false;
72  if (!(m_AdvParams == data.m_AdvParams)) return false;
73  if (!(m_WM_TaxId == data.m_WM_TaxId)) return false;
74  if (!(m_WM_Dir == data.m_WM_Dir)) return false;
75  ////@end CNGAlignParams equality operator
76  return true;
77 }
78 
80 {
81  ////@begin CNGAlignParams copy function
82  m_FilterMode = data.m_FilterMode;
83  m_WordSize = data.m_WordSize;
84  m_eValue = data.m_eValue;
85  m_BestHit = data.m_BestHit;
86  m_JobTitle = data.m_JobTitle;
87  m_AdvParams = data.m_AdvParams;
88  m_WM_TaxId = data.m_WM_TaxId;
89  m_WM_Dir = data.m_WM_Dir;
90  ////@end CNGAlignParams copy function
91  m_Subject = data.m_Subject;
92  m_Queries = data.m_Queries;
93 }
94 
96 {
97  ////@begin CNGAlignParams member initialisation
98  m_FilterMode = 0;
99  m_WordSize = 100;
100  m_eValue = 0.0001;
101  m_BestHit = true;
102  m_WM_TaxId = 0;
103  ////@end CNGAlignParams member initialisation
104 }
105 
106 static const char
107 *kFilterMode = "FilterMode",
108 *kWordSize = "WordSize",
109 *keValue = "eValue",
110 *kJobTitle = "JobTitle",
111 *kAdvParams = "AdvParams",
112 *kBestHit = "BestHit",
113 *kWM_TaxId = "WM_TaxId";
114 
116 {
117  if (!m_RegPath.empty()) {
119  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
120 
122  view.Set(kWordSize, (int)m_WordSize);
123  view.Set(keValue, m_eValue);
126  view.Set(kBestHit, m_BestHit);
127  view.Set(kWM_TaxId, m_WM_TaxId);
128  }
129 }
130 
132 {
133  if (!m_RegPath.empty()) {
135  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
136 
138  m_WordSize = view.GetInt(kWordSize, (int)m_WordSize);
139  m_eValue = view.GetReal(keValue, m_eValue);
144  }
145 }
146 
148 {
149  LOG_POST(Info << "CNGAlignParams");
150 
151  string subject_seq, query_seqs;
152  const CSeq_id* seq_id = dynamic_cast<const CSeq_id*>(m_Subject.object.GetPointer());
153  if (seq_id != NULL) {
154  seq_id->GetLabel(&subject_seq, CSeq_id::eContent);
155  }
156 
157  LOG_POST(Info << " Subject: " << subject_seq);
158 
160  seq_id = dynamic_cast<const CSeq_id*>(iter->object.GetPointer());
161  if (seq_id != NULL) {
162  string seq;
163  seq_id->GetLabel(&seq, CSeq_id::eContent);
164  if (!query_seqs.empty())
165  query_seqs += ", ";
166  query_seqs += seq;
167  }
168  }
169  LOG_POST(Info << " Query: " << query_seqs);
170  LOG_POST(Info << " Word size: " << m_WordSize);
171  LOG_POST(Info << " e-value: " << m_eValue);
172  LOG_POST(Info << " Use BLAST best hit algorithm: " << (m_BestHit ? "true" : "false"));
173 
174  string tune_for;
175  switch (m_FilterMode) {
176  case 0:
177  tune_for = "Phase 1 HTG Sequences";
178  break;
179  case 1:
180  tune_for = "Finished clones";
181  break;
182  case 2:
183  tune_for = "Curated genomic sequences(NGs)";
184  break;
185  default:
186  tune_for = "Invalid value";
187  break;
188  }
189 
190  LOG_POST(Info << " Tune search for: " << tune_for);
191  if (m_WM_TaxId != 0)
192  LOG_POST(Info << " Windowmasket TaxId: " << m_WM_TaxId);
193  if (!m_AdvParams.empty())
194  LOG_POST(Info << " Advanced BLAST params: " << m_AdvParams);
195 }
196 
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
Definition: reg_view.cpp:230
double GetReal(const string &key, double default_val=0) const
Definition: reg_view.cpp:235
bool GetBool(const string &key, bool default_val=false) const
Definition: reg_view.cpp:241
string GetString(const string &key, const string &default_val=kEmptyStr) const
Definition: reg_view.cpp:246
void Set(const string &key, int val)
access a named key at this level, with no recursion
Definition: reg_view.cpp:533
char data[12]
Definition: iconv.c:80
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
virtual void LoadSettings()
SConstScopedObject m_Subject
void Copy(const CNGAlignParams &data)
void operator=(const CNGAlignParams &data)
bool operator==(const CNGAlignParams &data) const
TConstScopedObjects m_Queries
virtual void SaveSettings() const
CConstRef< CObject > object
Definition: objects.hpp:52
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2040
@ eContent
Untagged human-readable accession or the like.
Definition: Seq_id.hpp:605
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static const char * kAdvParams
USING_SCOPE(objects)
static const char * kWM_TaxId
static const char * keValue
static const char * kFilterMode
static const char * kWordSize
static const char * kJobTitle
static const char * kBestHit
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Fri Sep 20 14:58:33 2024 by modify_doxy.py rev. 669887