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

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___MACRO_FN_ENTRY__HPP
2 #define GUI_OBJUTILS___MACRO_FN_ENTRY__HPP
3 /* $Id: macro_fn_entry.hpp 47543 2023-08-17 17:06:56Z asztalos $
4  * ===========================================================================
5  *
6  * PUBLIC DOMAIN NOTICE
7  * National Center for Biotechnology Information
8  *
9  * This software/database is a "United States Government Work" under the
10  * terms of the United States Copyright Act. It was written as part of
11  * the author's official duties as a United States Government employee and
12  * thus cannot be copyrighted. This software/database is freely available
13  * to the public for use. The National Library of Medicine and the U.S.
14  * Government have not placed any restriction on its use or reproduction.
15  *
16  * Although all reasonable efforts have been taken to ensure the accuracy
17  * and reliability of the software and data, the NLM and the U.S.
18  * Government do not and cannot warrant the performance or results that
19  * may be obtained by using this software or data. The NLM and the U.S.
20  * Government disclaim all warranties, express or implied, including
21  * warranties of performance, merchantability or fitness for any particular
22  * purpose.
23  *
24  * Please cite the author in any work or product based on this material.
25  *
26  * ===========================================================================
27  *
28  * Authors: Andrea Asztalos
29  *
30  * File Description:
31  * Macro editing functions used in the DO/DONE section that in general
32  * modify the whole top seq-entry
33  *
34  */
35 
36 /// @file macro_fn_entry.hpp
37 /// Functions used in the DO/DONE section affecting the top seq-entry
38 
39 #include <corelib/ncbistd.hpp>
42 
43 /** @addtogroup GUI_MACRO_SCRIPTS_UTIL
44  *
45  * @{
46  */
47 
49 
51  class CSeq_entry_Handle;
52  class CBioseq_set_Handle;
53  class CAutoDef;
54  class CAutoDefOptions;
58 
59 BEGIN_SCOPE(macro)
60 
61 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_TaxLookup)
62 
63 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_DiscrepancyAutofix)
64 
65 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_ConvertRawToDeltabyNs)
66 
67 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_AddGapFeaturesByNs)
68 
70 {
71 public:
73  : IEditMacroFunction(func_scope) {}
74 
75  virtual void TheFunction();
76  static void s_SpellingFixes(CSerialObject& object, CNcbiOstrstream& oss);
78 protected:
79  virtual bool x_ValidArguments() const;
80 };
81 
83 {
84 public:
86  : IEditMacroFunction(func_scope) {}
87 
88  virtual void TheFunction();
89  static short s_RemoveSingleItemSet(objects::CSeq_entry_Handle& seh);
90  static bool s_IsSingletonSet(const objects::CBioseq_set_Handle& bioseq_set);
92 protected:
93  virtual bool x_ValidArguments() const;
94 };
95 
97 {
98 public:
100  : IEditMacroFunction(func_scope), m_Descr(kEmptyStr) {}
101 
102  virtual void TheFunction();
103 
104  static CRef<CCmdComposite> s_AutodefSeqEntryNoTitle(const objects::CSeq_entry_Handle& seh, const objects::CAutoDefOptions& options);
105  static CRef<CCmdComposite> s_AutodefSequenceNoTitle(const objects::CSeq_entry_Handle& seh, const objects::CBioseq_Handle& target, const objects::CAutoDefOptions& options);
106 
107  static void s_AutodefBioseqsNoTitle(const objects::CSeq_entry_Handle& seh, objects::CAutoDefWithTaxonomy& autodef,
108  objects::CAutoDefModifierCombo* mod_combo, CRef<CCmdComposite> composite_cmd);
109 
110  static void s_AutodefSetsNoTitle(const objects::CSeq_entry_Handle& seh, objects::CAutoDefWithTaxonomy& autodef, CRef<CCmdComposite> composite_cmd);
111 
112  static void s_AddAutodefOptions(const objects::CAutoDef& autodef, const objects::CBioseq_Handle& bsh, CRef<CCmdComposite> composite_cmd);
113 
115 protected:
116  virtual bool x_ValidArguments() const;
117  virtual void x_ResetState() { m_Descr = kEmptyStr; }
118 
119  void x_AddModifiersToOptions(objects::CAutoDefOptions& opts);
120  bool x_IsRequested(const objects::CAutoDefAvailableModifier& modifier);
121  string x_GetDescription();
122  string m_Descr;
123 };
124 
126 {
127 public:
129  : IEditMacroFunction(func_scope) {}
130 
131  virtual void TheFunction();
132 
133  using TModifiers = objects::CAutoDefSourceDescription::TAvailableModifierVector;
134  static void s_ConfigureAutodefOptionsForID(TModifiers& modifiers, objects::CSeq_entry_Handle seh);
135 
136  /*static void s_ConfigureAutodefOptionsForID(TModifiers& modifiers, objects::CSeq_entry_Handle seh,
137  const objects::CAutoDef::TSources& sources);
138  */
139 
141 protected:
142  bool x_ValidArguments() const;
143 
144  static void s_SelectModifiersforAutodefID(objects::CAutoDef& autodef, TModifiers& modifiers, objects::CSeq_entry_Handle seh);
145 };
146 
148 {
149 public:
151  : IEditMacroFunction(func_scope) {}
152 
153  virtual void TheFunction();
155  static CRef<CCmdComposite> s_RefreshDeflineCommand(const objects::CSeq_entry_Handle& seh);
156 protected:
157  bool x_ValidArguments() const;
158 };
159 
161 {
162 public:
164  : IEditMacroFunction(func_scope) {}
165 
166  virtual void TheFunction();
168 protected:
169  bool x_ValidArguments() const;
170  void x_AddModifiersToOptions(objects::CAutoDefOptions& opts);
171  bool x_IsRequested(const objects::CAutoDefAvailableModifier& modifier);
172  bool x_IsComplete(const objects::CBioseq_Handle bsh);
173  string m_Descr;
174 };
175 
177 {
178 public:
180  : IEditMacroFunction(func_scope) {}
181 
182  virtual void TheFunction();
183 
184  void s_RenormalizeNucProtSets(objects::CSeq_entry_Handle seh, Int4& count);
186 protected:
187  bool x_ValidArguments() const;
188 };
189 
191 {
192 public:
194  : IEditMacroFunction(func_scope) {}
195 
196  virtual void TheFunction();
198 protected:
199  bool x_ValidArguments() const;
201 };
202 
204 {
205 public:
207  : IEditMacroFunction(func_scope) {}
208 
209  virtual void TheFunction();
211  static CRef<CCmdComposite> s_ConvertDeltaToRaw(objects::CSeq_entry_Handle seh, Int4& count);
212 protected:
213  bool x_ValidArguments() const;
215 };
216 
218 {
219 public:
221  : IEditMacroFunction(func_scope) {}
222 
223  virtual void TheFunction();
225 
226  enum EMatch
227  {
229  eMatchId, ///< match protein by protein_id
230  eMatchName ///< match protein by protein name
231  };
232 
233 protected:
234  bool x_ValidArguments() const;
235  void x_ReadUpdateSeqs(CNcbiIstream& istr);
236  EMatch x_GetMatchType();
237 
238  vector<CRef<objects::CSeq_entry>> m_Proteins;
239 };
240 
241 END_SCOPE(macro)
243 
244 /* @} */
245 
246 #endif
247  // GUI_OBJUTILS___MACRO_FN_ENTRY__HPP
CBioseq_set_Handle –.
CSeq_entry_Handle –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
Base class for any user function that performs editing operations on ASN.1 data.
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
virtual void TheFunction()=0
Function implementation.
DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_SetPubAuthorMI)
static CTempString GetFuncName()
CMacroFunction_AutodefComplete(EScopeEnum func_scope)
static CTempString GetFuncName()
static CTempString GetFuncName()
map< objects::CBioseq_Handle, set< objects::CSeq_feat_Handle > > m_ProductToCds
CMacroFunction_DeltaSeqToRaw(EScopeEnum func_scope)
static CTempString GetFuncName()
CMacroFunction_RemoveSingleItemSet(EScopeEnum func_scope)
CMacroFunction_RenormalizeNucProtSet(EScopeEnum func_scope)
virtual void x_ResetState()
Reset the state of member variables that are set directly/indirectly from function arguments.
static CTempString GetFuncName()
map< objects::CBioseq_Handle, set< objects::CSeq_feat_Handle > > m_ProductToCds
vector< CRef< objects::CSeq_entry > > m_Proteins
CMacroFunction_UpdateProteinSeqs(EScopeEnum func_scope)
CMacroFunction_Autodef(EScopeEnum func_scope)
CMacroFunction_FixSpelling(EScopeEnum func_scope)
CMacroFunction_AutodefId(EScopeEnum func_scope)
static CTempString GetFuncName()
static CTempString GetFuncName()
static CTempString GetFuncName()
CMacroFunction_CreateProteinFeats(EScopeEnum func_scope)
CMacroFunction_RefreshDefline(EScopeEnum func_scope)
virtual bool x_ValidArguments() const =0
Tests the number and the type of function arguments.
objects::CAutoDefSourceDescription::TAvailableModifierVector TModifiers
static CTempString GetFuncName()
@ eMatchId
match protein by protein_id
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#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
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
#define kEmptyStr
Definition: ncbistr.hpp:123
#define NCBI_GUIOBJUTILS_EXPORT
Definition: gui_export.h:512
#define count
static bool s_IsSingletonSet(const CBioseq_set_Handle &bioseq_set)
Modified on Fri Sep 20 14:57:45 2024 by modify_doxy.py rev. 669887