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

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___MACRO_FN_FEATURE__HPP
2 #define GUI_OBJUTILS___MACRO_FN_FEATURE__HPP
3 /* $Id: macro_fn_feature.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 applied to features used in the DO - DONE section
32  *
33  */
34 
35 /// @file macro_fn_feature.hpp
36 #include <corelib/ncbistd.hpp>
42 
44 
45 /** @addtogroup GUI_MACRO_SCRIPTS_UTIL
46  *
47  * @{
48  */
49 
51 
53 
54 BEGIN_SCOPE(macro)
55 
56 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_TrimStopFromCompleteCDS)
57 
58 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_SynchronizeCDSPartials)
59 
60 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_AdjustConsensusSpliceSites)
61 
62 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_RemoveInvalidECNumbers)
63 
64 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_UpdatemRNAProduct)
65 
66 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_CopyNameToCDSNote)
67 
68 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_RemoveFeature)
69 
70 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_RemoveDuplFeatures)
71 
72 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_AddGeneXref)
73 
74 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_JoinShorttRNAs)
75 
76 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_UpdateReplacedECNumbers)
77 
78 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_RetranslateCDS)
79 
80 DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_RestoreRNAEditing)
81 
83 {
84 public:
86  : IEditMacroFunction(func_scope) {}
87 
89  virtual void TheFunction();
90  static string s_FixProteinNameFormat(const string& protein, const vector<string>& taxnames);
92 protected:
93  virtual bool x_ValidArguments() const;
94  void x_FixProteinNames(objects::CProt_ref& prot, const vector<string>& taxnames);
95  vector<string> m_OrigNames, m_NewNames;
96 };
97 
99 {
100 public:
102  virtual void TheFunction() {}
103 protected:
104  virtual bool x_ValidArguments() const { return false; }
105 
106  bool x_CheckInitFeature();
108  void x_RetranslateCDSAdjustGene(const string& descr);
109 
112 
119 };
120 
122 {
123 public:
125  : CMacroFunction_EditFeatLocation(func_scope) {}
126 
127  virtual void TheFunction();
128  static bool s_SetBothEndsPartial(objects::CSeq_feat& feat, objects::CScope& scope, const string& descr, bool extend = false);
130 protected:
131  virtual bool x_ValidArguments() const;
132 };
133 
135 {
136 public:
138  : CMacroFunction_EditFeatLocation(func_scope) {}
139 
140  virtual void TheFunction();
141  static bool s_RemoveBothPartials(objects::CSeq_feat& feat, objects::CScope& scope, const string& descr);
143 protected:
144  virtual bool x_ValidArguments() const;
145 };
146 
148 {
149 public:
151  : CMacroFunction_EditFeatLocation(func_scope) {}
152 
153  virtual void TheFunction();
154  static bool s_Set5EndPartial(objects::CSeq_feat& feat, objects::CScope& scope, const string& descr, bool extend5 = false);
156 protected:
157  virtual bool x_ValidArguments() const;
158 };
159 
161 {
162 public:
164  : CMacroFunction_EditFeatLocation(func_scope) {}
165 
166  virtual void TheFunction();
167  static bool s_Set3EndPartial(objects::CSeq_feat& feat, objects::CScope& scope, const string& descr, bool extend3 = false);
169 protected:
170  virtual bool x_ValidArguments() const;
171 };
172 
174 {
175 public:
177  : CMacroFunction_EditFeatLocation(func_scope) {}
178 
179  virtual void TheFunction();
180  static bool s_Clear5EndPartial(objects::CSeq_feat& feat, objects::CScope& scope, const string& descr);
182 protected:
183  virtual bool x_ValidArguments() const;
184 };
185 
187 {
188 public:
190  : CMacroFunction_EditFeatLocation(func_scope) {}
191 
192  virtual void TheFunction();
193  static bool s_Clear3EndPartial(objects::CSeq_feat& feat, objects::CScope& scope, const string& descr);
195 protected:
196  virtual bool x_ValidArguments() const;
197 };
198 
200 {
201 public:
203  : CMacroFunction_EditFeatLocation(func_scope) {}
204 
205  virtual void TheFunction();
206  static objects::ENa_strand s_GetStrandFromString(const string& str);
207  static bool s_ConvertLocationStrand(objects::CSeq_feat& feat, objects::CScope& scope, const string& str_from, const string& str_to);
209 protected:
210  virtual bool x_ValidArguments() const;
211 };
212 
214 {
215 public:
217  : CMacroFunction_EditFeatLocation(func_scope) {}
218 
219  virtual void TheFunction();
220  static bool s_ConvertLocationType(objects::CSeq_feat& feat, objects::CScope& scope, const string& descr);
222 protected:
223  virtual bool x_ValidArguments() const;
224 };
225 
227 {
228 public:
230  : CMacroFunction_EditFeatLocation(func_scope) {}
231 
232  virtual void TheFunction();
234 protected:
235  virtual bool x_ValidArguments() const;
236 };
237 
239 {
240 public:
242  : CMacroFunction_EditFeatLocation(func_scope) {}
243 
244  virtual void TheFunction();
246 protected:
247  virtual bool x_ValidArguments() const;
248 };
249 
251 {
252 public:
254  : IEditMacroFunction(func_scope) {}
255 
256  virtual void TheFunction();
258 protected:
259  virtual bool x_ValidArguments() const;
261 };
262 
263 
265 {
266 public:
267  enum ECdsFrame {
269  eBest, // choose the frame that produces the longest sequence of aas before a stop codon is produced
270  eMatch // choose the frame that matches the protein sequence if it can find one
271  };
273  : IEditMacroFunction(func_scope) {}
274 
276  virtual void TheFunction();
277 
278  static bool s_SetCDSFrame(objects::CSeq_feat& cds, ECdsFrame frame_type, objects::CScope& scope);
279  static objects::CCdregion::TFrame s_FindMatchingFrame(const objects::CSeq_feat& cds, objects::CScope& scope);
280  static ECdsFrame s_GetFrameFromName(const string& name);
282 protected:
283  virtual bool x_ValidArguments() const;
284 };
285 
287 {
288 public:
289  typedef objects::CSeqFeatData::ESubtype TFeatSubtype;
290 
292  : IEditMacroFunction(func_scope) {}
293 
295 
296  virtual void TheFunction();
298 protected:
299  virtual bool x_ValidArguments() const;
300  void x_SetConvertOptions(CRef<CConvertFeatureBase> converter);
301  TFeatSubtype m_FromType{ objects::CSeqFeatData::eSubtype_any };
302  TFeatSubtype m_ToType{ objects::CSeqFeatData::eSubtype_any };
303 };
304 
306 {
307 public:
309  : CMacroFunction_ConvertFeature(func_scope) {}
312 protected:
313  virtual bool x_ValidArguments() const;
314 };
315 
316 
318 {
319 public:
321  : IEditMacroFunction(func_scope) {}
322 
324  virtual void TheFunction();
325 
326  static bool s_GeneXrefMatchesSuppression(const objects::CGene_ref& gene, objects::EGene_xref_suppression_type suppr_type);
327  static bool s_GeneXrefMatchesNecessary(const objects::CGene_ref& gene,
328  const objects::CSeq_feat& feat, objects::CScope& scope, objects::EGene_xref_necessary_type necessary_type);
330 protected:
331  virtual bool x_ValidArguments() const;
332 };
333 
335 {
336 public:
338  : IEditMacroFunction(func_scope) {}
339 
341  virtual void TheFunction();
343 protected:
344  virtual bool x_ValidArguments() const;
345  CRef<objects::CSeq_loc> x_GetProteinLoc(const objects::CSeq_id& prot_id, TSeqPos pos) const;
346 };
347 
348 
350 {
351 public:
353  virtual void TheFunction() {}
354 protected:
355  virtual bool x_ValidArguments() const { return false; }
356  bool x_SetCurrentBioseq();
357  void x_HandleNegativeCoordinates(size_t index);
358  objects::ENa_strand x_GetStrand(const string& str);
359 
361  : IEditMacroFunction(func_scope) {}
362 
363  objects::CBioseq_Handle m_Bsh;
364 };
365 
367 {
368 public:
370  : CMacroFunction_MakeLocation(func_scope) {}
371 
372  virtual void TheFunction();
374 protected:
375  virtual bool x_ValidArguments() const;
376 };
377 
379 {
380 public:
382  : CMacroFunction_MakeLocation(func_scope) {}
383 
384  virtual void TheFunction();
386 protected:
387  virtual bool x_ValidArguments() const;
388 };
389 
391 {
392 public:
394  : CMacroFunction_MakeLocation(func_scope) {}
395 
396  virtual void TheFunction();
398 protected:
399  virtual bool x_ValidArguments() const;
400 };
401 
402 
404 {
405 public:
406  virtual void TheFunction() {}
407  //static CMacroFunction_ApplyFeature* s_MakeApplyFeatureType(EScopeEnum func_scope, objects::CSeqFeatData::E_Choice type);
408 protected:
409  virtual bool x_ValidArguments() const { return false; }
410  bool x_SetLocation(size_t index);
411  bool x_ShouldAddRedundant(size_t index);
412  void x_SetAdditionalFields(size_t index);
413 
415  : IEditMacroFunction(func_scope) {}
416 
417  objects::CBioseq_Handle m_Bsh;
420 };
421 
423 {
424 public:
426  : CMacroFunction_ApplyFeature(func_scope) {}
427 
428  virtual void TheFunction();
430 protected:
431  virtual bool x_ValidArguments() const;
432 };
433 
435 {
436 public:
438  : CMacroFunction_ApplyFeature(func_scope) {}
439 
440  virtual void TheFunction();
442 protected:
443  virtual bool x_ValidArguments() const;
444 };
445 
447 {
448 public:
450  : CMacroFunction_ApplyFeature(func_scope) {}
451 
452  virtual void TheFunction();
454 protected:
455  virtual bool x_ValidArguments() const;
456 };
457 
459 {
460 public:
462  : CMacroFunction_ApplyFeature(func_scope) {}
463 
464  virtual void TheFunction();
466 protected:
467  virtual bool x_ValidArguments() const;
468 };
469 
470 
471 END_SCOPE(macro)
473 
474 /* @} */
475 
476 #endif // GUI_OBJUTILS___MACRO_FN_FEATURE__HPP
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define false
Definition: bool.h:36
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.
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
DECLARE_FUNC_CLASS_WITH_FNCNAME(CMacroFunction_SetPubAuthorMI)
CMacroFunction_ApplyCDS(EScopeEnum func_scope)
CMacroFunction_EditFeatLocation(EScopeEnum func_scope)
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
CRef< objects::CScope > m_Scope
CMacroFunction_MakeLocation(EScopeEnum func_scope)
CMacroFunction_Clear5Partial(EScopeEnum func_scope)
objects::CSeqFeatData::ESubtype TFeatSubtype
CMacroFunction_MakeWholeSeqInterval(EScopeEnum func_scope)
static CTempString GetFuncName()
CConstRef< objects::CSeq_feat > m_Origfeat
static CTempString GetFuncName()
CMacroFunction_MakeInterval(EScopeEnum func_scope)
static CTempString GetFuncName()
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
void x_RetranslateCDS(CNcbiOstrstream &log)
CMacroFunction_ApplyFeature(EScopeEnum func_scope)
static CTempString GetFuncName()
virtual void TheFunction()
Function implementation.
static CTempString GetFuncName()
static CTempString GetFuncName()
static CTempString GetFuncName()
bool x_SetCurrentBioseq()
class CMacroFunction_MakeLocation Generates different type of seq-loc objects
virtual void TheFunction()
Function implementation.
static CTempString GetFuncName()
CMacroFunction_RemoveGeneXref(EScopeEnum func_scope)
CMacroFunction_RemoveAllFeatures(EScopeEnum func_scope)
CRef< objects::CSeq_feat > m_Seqfeat
CMacroFunction_ApplyOtherFeature(EScopeEnum func_scope)
CMacroFunction_ConvertLocType(EScopeEnum func_scope)
static CTempString GetFuncName()
CMacroFunction_ReplaceStopWithSelenocysteine(EScopeEnum func_scope)
CMacroFunction_Extend5Feature(EScopeEnum func_scope)
CMacroFunction_ConvertFeature(EScopeEnum func_scope)
CMacroFunction_MakePoint(EScopeEnum func_scope)
bool x_ShouldAddRedundant(size_t index)
class CMacroFunction_ApplyFeature Generates different types of apply feature commands
objects::CBioseq_Handle m_Bsh
static CTempString GetFuncName()
CMacroFunction_FixProteinFormat(EScopeEnum func_scope)
void x_RetranslateCDSAdjustGene(const string &descr)
CMacroFunction_SetBothPartials(EScopeEnum func_scope)
static CTempString GetFuncName()
CMacroFunction_Set3Partial(EScopeEnum func_scope)
static CTempString GetFuncName()
CMacroFunction_ConvertLocStrand(EScopeEnum func_scope)
CMacroFunction_ApplyCDSFrame(EScopeEnum func_scope)
static CTempString GetFuncName()
CMacroFunction_ApplyRNA(EScopeEnum func_scope)
static CTempString GetFuncName()
static CTempString GetFuncName()
static CTempString GetFuncName()
CMacroFunction_RemoveBothPartials(EScopeEnum func_scope)
virtual void TheFunction()
Function implementation.
objects::ENa_strand x_GetStrand(const string &str)
CRef< objects::CSeq_loc > m_Location
map< objects::CBioseq_Handle, set< objects::CSeq_feat_Handle > > m_ProductToCds
CMacroFunction_ConvertCDS(EScopeEnum func_scope)
static CTempString GetFuncName()
CMacroFunction_Clear3Partial(EScopeEnum func_scope)
CRef< objects::CSeq_feat > m_NewFeat
static CTempString GetFuncName()
static CTempString GetFuncName()
void x_SetAdditionalFields(size_t index)
CMacroFunction_Set5Partial(EScopeEnum func_scope)
CMacroFunction_ApplyGene(EScopeEnum func_scope)
CMacroFunction_Extend3Feature(EScopeEnum func_scope)
static CTempString GetFuncName()
static CTempString GetFuncName()
static CTempString GetFuncName()
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
void x_HandleNegativeCoordinates(size_t index)
objects::CBioseq_Handle m_Bsh
static CTempString GetFuncName()
#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
#define NCBI_GUIOBJUTILS_EXPORT
Definition: gui_export.h:512
EGene_xref_suppression_type
Access to EGene_xref_suppression_type's attributes (values, names) as defined in spec.
EGene_xref_necessary_type
Access to EGene_xref_necessary_type's attributes (values, names) as defined in spec.
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
@ eMatch
Definition: ncbistr.cpp:283
static const char * str(char *buf, int n)
Definition: stats.c:84
Modified on Fri Mar 01 10:08:33 2024 by modify_doxy.py rev. 669887