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

Go to the SVN repository for this file.

1 #ifndef PKG_ALIGNMENT___CREATE_GENE_MODEL_TOOL_MANAGER__HPP
2 #define PKG_ALIGNMENT___CREATE_GENE_MODEL_TOOL_MANAGER__HPP
3 
4 /* $Id: create_gene_model_tool_manager.hpp 46706 2021-09-09 19:54:51Z asztalos $
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: Mike DiCuccio
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 #include <gui/gui_export.h>
37 
39 
41 
43 
45 
47 
48 /** @addtogroup GUI_PKG_ALIGNMENT
49  *
50  * @{
51  */
52 
53 class CCmdComposite;
54 ///////////////////////////////////////////////////////////////////////////////
55 /// CCreateGeneModelToolManager
58 {
59 public:
61 
62  /// @name overriding IUIToolManager functions implemented in CAlgoToolManagerBase
63  /// @{
64  virtual void InitUI();
65  virtual void CleanUI();
66  virtual IAppTask* GetTask();
67  /// @}
68 
69  /// @name IExtension interface implementation
70  /// @{
71  virtual string GetExtensionIdentifier() const;
72  virtual string GetExtensionLabel() const;
73  /// @}
74 
75 protected:
76  /// @name overriding CAlgoToolManagerBase virtual functions
77  /// @{
80  virtual bool x_CreateParamsPanelIfNeeded();
81  virtual bool x_ValidateParams();
83 
84  /// @}
85 
87  void x_RemoveDuplicates();
88 
89 protected:
91 
94 };
95 
96 // mrna only
97 // cds only
98 // mrna + cds
100 {
101 public:
104 
105  CConstRef<objects::CSeq_id> GetID(objects::CScope* scope) const;
106  // placing feature id Xrefs between:
107  // mRNA <=> CDS, mRNA => gene, CDS => gene ( create a link to the parent gene feature) (CR0011)
108  // additionaly: add a dbxref for the GeneID to RNA and CDS features (CR0006)
109  void CrossLinkTriple();
110  static void s_CreateXRefLink(objects::CSeq_feat& from_feat, objects::CSeq_feat& to_feat);
111  static void s_CreateDBXref(const objects::CSeq_feat& from_feat, objects::CSeq_feat& to_feat, const string& dbname);
112 
116 };
117 
118 
119 ///////////////////////////////////////////////////////////////////////////////
120 /// CCreateGeneModelTask
122 {
123 public:
126  /// a loader might be tied with a specific project item.
127  /// if so, we need to know such that they will go together and
128  /// get added to the same project.
129 
130  typedef list<SGeneCdsmRnaFeats> TGeneCDSmRNAList;
132 
133  CCreateGeneModelTask(const string& descr,
134  CProjectService* service,
135  CSelectProjectOptions& options,
136  const SCreateGeneModelParams& params)
137  : CAppTask(descr), m_Service(service), m_Options(options), m_Params(params) {}
138  virtual ~CCreateGeneModelTask();
139 
140  static objects::CObject_id::TId s_GetGeneID(const objects::CSeq_feat& feat);
141  static objects::CObject_id::TId s_FindHighestFeatId(const objects::CSeq_entry_Handle seh);
142  // return true if there is at least one local feat id
143  static bool s_FeaturesHaveIDs(const objects::CSeq_annot& annot);
144  // return true if there is at least one feature Xref to a local id
145  static bool s_FeaturesHaveXrefs(const objects::CSeq_annot& annot);
146  // local identifiers are assigned to each new feature (CR0010)
147  static void s_AssignFeatureIds(objects::CSeq_annot& annot, objects::CObject_id::TId& max_id);
148 
149  static const string sGeneDbName;
150 
151 protected:
152  virtual ETaskState x_Run();
153 
154 private:
156 
157  void x_StoreGeneratedFeats(const objects::CSeq_annot& annot, TGeneCDSmRNAList& gene_cds_rna) const;
158 
159  void x_Group_By_GeneID(objects::CSeq_annot& annot, const objects::CSeq_id_Handle& idh);
160 
161  void x_GroupGenes(const objects::CSeq_id_Handle& idh, CRef<objects::CSeq_feat> gene);
162 
163  void x_AssignIDsAndCrossLinkFeats(objects::CSeq_annot& annot, const objects::CSeq_id_Handle& idh, objects::CObject_id::TId max_id);
164 
165  CRef<CCmdComposite> x_AssignIDsAndUpdateGenes(objects::CSeq_annot& annot, const objects::CSeq_id_Handle& idh, objects::CSeq_entry_Handle seh);
166 
167  void x_GetUpdatedGeneCommand(objects::CSeq_entry_Handle seh, const objects::CSeq_id_Handle& idh, CCmdComposite* cmd);
168 
170 
175 
178 };
179 
180 /* @} */
181 
183 
184 #endif // PKG_ALIGNMENT___CREATE_GENE_MODEL_TOOL_MANAGER__HPP
CAlgoToolManagerBase This is base class for simple algorithmic tool managers.
CAlgoToolManagerParamsPanel.
CAppTask - default implementation of IAppTask, use it as a base class for custom tasks.
CDataLoadingAppJob - a base class for Jobs loading data into projects.
CProjectService - a service providing API for operations with Workspaces and Projects.
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
IAppTask.
Definition: app_task.hpp:83
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
Include a standard set of the NCBI C++ Toolkit most basic headers.
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
ETaskState
List of task states defining the task management FSM.
Definition: app_task.hpp:87
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CRef< CCmdComposite > x_AssignIDsAndUpdateGenes(objects::CSeq_annot &annot, const objects::CSeq_id_Handle &idh, objects::CSeq_entry_Handle seh)
void x_StoreGeneratedFeats(const objects::CSeq_annot &annot, TGeneCDSmRNAList &gene_cds_rna) const
map< objects::CSeq_id_Handle, TGeneCDSmRNAList > TGeneModelMap
void x_GroupGenes(const objects::CSeq_id_Handle &idh, CRef< objects::CSeq_feat > gene)
void x_AssignIDsAndCrossLinkFeats(objects::CSeq_annot &annot, const objects::CSeq_id_Handle &idh, objects::CObject_id::TId max_id)
virtual bool x_ValidateParams()
validates user input in Parameters panel, report errors if any
static bool s_FeaturesHaveXrefs(const objects::CSeq_annot &annot)
void x_Group_By_GeneID(objects::CSeq_annot &annot, const objects::CSeq_id_Handle &idh)
static const string sGeneDbName
CCreateGeneModelTask.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
CRef< CCmdComposite > x_GetCommand()
static objects::CObject_id::TId s_FindHighestFeatId(const objects::CSeq_entry_Handle seh)
list< SGeneCdsmRnaFeats > TGeneCDSmRNAList
a loader might be tied with a specific project item.
CCreateGeneModelTask(const string &descr, CProjectService *service, CSelectProjectOptions &options, const SCreateGeneModelParams &params)
virtual IRegSettings * x_GetParamsAsRegSetting()
return a pointer to Parameters object as IRegSettings interface
virtual CAlgoToolManagerParamsPanel * x_GetParamsPanel()
returns a pointer to the parameters panel, override in derived classes
void x_GetUpdatedGeneCommand(objects::CSeq_entry_Handle seh, const objects::CSeq_id_Handle &idh, CCmdComposite *cmd)
static void s_CreateXRefLink(objects::CSeq_feat &from_feat, objects::CSeq_feat &to_feat)
CConstRef< objects::CSeq_id > GetID(objects::CScope *scope) const
SGeneCdsmRnaFeats.
virtual void CleanUI()
override this function in a derived class and clean extra members
CRef< objects::CProjectItem > TItemRef
virtual ETaskState x_Run()
override this function in derived classes
static bool s_FeaturesHaveIDs(const objects::CSeq_annot &annot)
virtual CDataLoadingAppJob * x_CreateLoadingJob()
factory method for creating the job that executes the tool algorithm override in derived classes
static void s_AssignFeatureIds(objects::CSeq_annot &annot, objects::CObject_id::TId &max_id)
CRef< objects::CSeq_feat > cds
virtual bool x_CreateParamsPanelIfNeeded()
returns / creates Parameters panel, override in derived classes see cpp file for example
CRef< objects::CSeq_feat > gene
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
static objects::CObject_id::TId s_GetGeneID(const objects::CSeq_feat &feat)
virtual void InitUI()
override this function in a derived class and initialize extra members
CCreateGeneModelParamsPanel * m_ParamsPanel
CSelectProjectOptions::TItems m_Items
CIRef< CProjectService > m_Service
CRef< objects::CLoaderDescriptor > TLoaderRef
static void s_CreateDBXref(const objects::CSeq_feat &from_feat, objects::CSeq_feat &to_feat, const string &dbname)
bool x_UpdateGeneOnSequence(TGeneCDSmRNAList &gene_cds_rna, CRef< objects::CSeq_feat > gene)
CRef< objects::CSeq_feat > mRNA
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:6929
Defines to provide correct exporting from DLLs in Windows.
Modified on Sat Jul 20 11:14:32 2024 by modify_doxy.py rev. 669887