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 47378 2023-02-27 20:09:44Z 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_AutodefSeqEntry(const objects::CSeq_entry_Handle& seh, const objects::CAutoDefOptions& options);
105  static CRef<CCmdComposite> s_AutodefSequence(const objects::CSeq_entry_Handle& seh, const objects::CBioseq_Handle& target, const objects::CAutoDefOptions& options);
106 
107  static void s_AutodefBioseqs(const objects::CSeq_entry_Handle& seh, objects::CAutoDefWithTaxonomy& autodef,
108  objects::CAutoDefModifierCombo* mod_combo, CRef<CCmdComposite> composite_cmd);
109  static void s_AutodefSets(const objects::CSeq_entry_Handle& seh, objects::CAutoDefWithTaxonomy& autodef, CRef<CCmdComposite> composite_cmd);
110  static void s_AddAutodefOptions(const objects::CAutoDef& autodef, const objects::CBioseq_Handle& bsh, CRef<CCmdComposite> composite_cmd);
111 
113 
114  static void s_AutodefBioseqsNoTitle(const objects::CSeq_entry_Handle& seh, objects::CAutoDefWithTaxonomy& autodef,
115  objects::CAutoDefModifierCombo* mod_combo, CRef<CCmdComposite> composite_cmd);
116 
117  static void s_AutodefSetsNoTitle(const objects::CSeq_entry_Handle& seh, objects::CAutoDefWithTaxonomy& autodef, CRef<CCmdComposite> composite_cmd);
118 protected:
119  virtual bool x_ValidArguments() const;
120  virtual void x_ResetState() { m_Descr = kEmptyStr; }
121 
122  void x_AddModifiersToOptions(objects::CAutoDefOptions& opts);
123  bool x_IsRequested(const objects::CAutoDefAvailableModifier& modifier);
124  string x_GetDescription();
125  string m_Descr;
126 };
127 
129 {
130 public:
132  : IEditMacroFunction(func_scope) {}
133 
134  virtual void TheFunction();
135 
136  using TModifiers = objects::CAutoDefSourceDescription::TAvailableModifierVector;
137  static void s_ConfigureAutodefOptionsForID(TModifiers& modifiers, objects::CSeq_entry_Handle seh);
138 
139  /*static void s_ConfigureAutodefOptionsForID(TModifiers& modifiers, objects::CSeq_entry_Handle seh,
140  const objects::CAutoDef::TSources& sources);
141  */
142 
144 protected:
145  bool x_ValidArguments() const;
146 
147  static void s_SelectModifiersforAutodefID(objects::CAutoDef& autodef, TModifiers& modifiers, objects::CSeq_entry_Handle seh);
148 };
149 
151 {
152 public:
154  : IEditMacroFunction(func_scope) {}
155 
156  virtual void TheFunction();
158  static CRef<CCmdComposite> s_RefreshDeflineCommand(const objects::CSeq_entry_Handle& seh);
159 protected:
160  bool x_ValidArguments() const;
161 };
162 
164 {
165 public:
167  : IEditMacroFunction(func_scope) {}
168 
169  virtual void TheFunction();
171 protected:
172  bool x_ValidArguments() const;
173  void x_AddModifiersToOptions(objects::CAutoDefOptions& opts);
174  bool x_IsRequested(const objects::CAutoDefAvailableModifier& modifier);
175  bool x_IsComplete(const objects::CBioseq_Handle bsh);
176  string m_Descr;
177 };
178 
180 {
181 public:
183  : IEditMacroFunction(func_scope) {}
184 
185  virtual void TheFunction();
186 
187  void s_RenormalizeNucProtSets(objects::CSeq_entry_Handle seh, Int4& count);
189 protected:
190  bool x_ValidArguments() const;
191 };
192 
194 {
195 public:
197  : IEditMacroFunction(func_scope) {}
198 
199  virtual void TheFunction();
201 protected:
202  bool x_ValidArguments() const;
204 };
205 
207 {
208 public:
210  : IEditMacroFunction(func_scope) {}
211 
212  virtual void TheFunction();
214  static CRef<CCmdComposite> s_ConvertDeltaToRaw(objects::CSeq_entry_Handle seh, Int4& count);
215 protected:
216  bool x_ValidArguments() const;
218 };
219 
221 {
222 public:
224  : IEditMacroFunction(func_scope) {}
225 
226  virtual void TheFunction();
228 
229  enum EMatch
230  {
232  eMatchId, ///< match protein by protein_id
233  eMatchName ///< match protein by protein name
234  };
235 
236 protected:
237  bool x_ValidArguments() const;
238  void x_ReadUpdateSeqs(CNcbiIstream& istr);
239  EMatch x_GetMatchType();
240 
241  vector<CRef<objects::CSeq_entry>> m_Proteins;
242 };
243 
244 END_SCOPE(macro)
246 
247 /* @} */
248 
249 #endif
250  // 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
static bool s_IsSingletonSet(const CBioseq_set_Handle &bioseq_set)
Modified on Wed Jun 19 17:06:09 2024 by modify_doxy.py rev. 669887