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

Go to the SVN repository for this file.

1 #ifndef PKG_ALIGNMENT___BLAST_JOBS__HPP
2 #define PKG_ALIGNMENT___BLAST_JOBS__HPP
3 
4 /* $Id: blast_jobs.hpp 40209 2018-01-08 20:35:14Z joukovv $
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: Andrey Yazhuk, Anatoliy Kuznetsov
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistl.hpp>
36 #include <corelib/ncbiobj.hpp>
37 
38 #include <gui/gui_export.h>
39 
42 #include <gui/objutils/objects.hpp>
43 
44 #include <gui/utils/scheduler_engine.hpp> //TODO
45 
46 
48 
49 /** @addtogroup GUI_PKG_ALIGNMENT
50  *
51  * @{
52  */
53 
55  class CSeq_align;
56  class CSeq_align_set;
58 
59 
60 class CProjectService;
61 class CBLASTParams;
63 
64 ///////////////////////////////////////////////////////////////////////////////
65 /// CNetBlastSubmittingJob
67 {
68 public:
69  typedef vector< CRef<CNetBlastJobDescriptor> > TDescriptors;
70 
71  CNetBlastSubmittingJob(string tool_name,
72  const CBLASTParams& params,
74 
75  /// @name IAppJob implementation
76  /// @{
77  virtual EJobState Run();
79  virtual CRef<CObject> GetResult();
81  virtual string GetDescr() const;
82  /// @}
83 
84  void GetDescriptors(TDescriptors& descriptors);
85  void GetErrors(vector<string>& errors) const;
86 
87 protected:
88  void x_Run();
89  void x_SetStatusText(const string& text);
90  void x_ResetState();
91  void x_AddError(const string& error);
92 
93 protected:
94  CFastMutex m_Mutex; /// mutex to sync our internals
95 
96  string m_Descr;
97  string m_Status;
98 
99  TConstScopedObjects m_SeqLocs; // query sequences
100 
101  vector< CRef<CNetBlastJobDescriptor> > m_Descriptors;
102  vector<string> m_Errors;
103 
105 };
106 
107 
108 ///////////////////////////////////////////////////////////////////////////////
109 /// CNetBlastMonitoringJob
110 
111 class IServiceLocator;
112 
114 {
115 public:
116  typedef vector< CRef<CNetBlastJobDescriptor> > TDescriptors;
117 
119  IServiceLocator* srv_locator,
120  const string& tool_name,
121  TDescriptors& descriptors);
122 
123  virtual void SetLoadingOptions(CSelectProjectOptions& options);
124 
125  /// @name IAppJob implementation
126  /// @{
127  virtual EJobState Run();
129  virtual CRef<CObject> GetResult();
131  virtual string GetDescr() const;
132  /// @}
133 
134  /// @name IWaitPeriod implementation
135  /// @{
136  virtual CTimeSpan GetWaitPeriod();
137  /// @}
138 
139 protected:
140  EJobState x_Run();
141  void x_SetStatusText(const string& text);
142  void x_ResetState();
143 
144  void x_StartRetrivingTask(const vector<string>& RIDs);
145 
146 protected:
147  CFastMutex m_Mutex; /// mutex to sync our internals
148 
149  string m_ToolName;
152 
153  string m_Descr;
154  string m_Status;
155 
157 
159 
161  vector<string> m_Errors;
162 
164 };
165 
166 
167 ///////////////////////////////////////////////////////////////////////////////
168 /// CNetBlastLoadingJob - an application job for loading RIDs from
169 /// NCBI Net BLAST server.
171 {
172 public:
173  typedef vector< CRef<CNetBlastJobDescriptor> > TDescriptors;
174 
176  const vector<string>* RIDs = NULL,
177  CScope *scope = NULL);
178 
179  void SetRIDs(CNetBLASTUIDataSource& ds, const vector<string>& RIDs);
180  bool HasErrors() const;
181  void GetErrors(vector<string>& errors) const;
182 
183 protected:
184  virtual void x_CreateProjectItems();
185 
186  void x_CreateProjectItemsFromBlastResult(objects::CSeq_align_set& results,
187  CRef<blast::CRemoteBlast> RemoteBlast);
188 protected:
190 
191  vector<string> m_Errors;
193 };
194 
195 
196 
197 /* @} */
198 
200 
201 
202 #endif // PKG_ALIGNMENT___BLAST_JOBS__HPP
203 
CBLASTParams - save user-specified parameters and preferences.
CDataLoadingAppJob - a base class for Jobs loading data into projects.
CFastMutex –.
Definition: ncbimtx.hpp:667
Base class to build jobs with cancel functionality.
CNetBlastLoadingJob - an application job for loading RIDs from NCBI Net BLAST server.
Definition: blast_jobs.hpp:171
CNetBlastSubmittingJob.
Definition: blast_jobs.hpp:67
CProjectService - a service providing API for operations with Workspaces and Projects.
CScope –.
Definition: scope.hpp:92
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
CTimeSpan.
Definition: ncbitime.hpp:1313
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
#define NULL
Definition: ncbistd.hpp:225
void GetErrors(vector< string > &errors) const
Definition: blast_jobs.cpp:517
EJobState x_Run()
this functions performs real work every call to this function does pools each job once,...
Definition: blast_jobs.cpp:335
virtual CRef< CObject > GetResult()
Returns the Job Result.
Definition: blast_jobs.cpp:451
CRef< CNetBLASTUIDataSource > m_NetBlastDS
Definition: blast_jobs.hpp:151
virtual CTimeSpan GetWaitPeriod()
returns a period of time after which the task shall be executed again
Definition: blast_jobs.cpp:469
vector< CRef< CNetBlastJobDescriptor > > TDescriptors
Definition: blast_jobs.hpp:116
void x_StartRetrivingTask(const vector< string > &RIDs)
Definition: blast_jobs.cpp:403
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
Definition: blast_jobs.cpp:235
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
Definition: blast_jobs.cpp:285
void x_SetStatusText(const string &text)
Definition: blast_jobs.cpp:196
vector< CRef< CNetBlastJobDescriptor > > TDescriptors
Definition: blast_jobs.hpp:69
vector< string > m_Errors
Definition: blast_jobs.hpp:161
TConstScopedObjects m_SeqLocs
Definition: blast_jobs.hpp:99
virtual CRef< CObject > GetResult()
Returns the Job Result.
Definition: blast_jobs.cpp:223
CNetBlastLoadingJob(CNetBLASTUIDataSource &ds, const vector< string > *RIDs=NULL, CScope *scope=NULL)
CNetBlastLoadingJob.
Definition: blast_jobs.cpp:482
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
Definition: blast_jobs.cpp:229
virtual void x_CreateProjectItems()
iterates on the given RIDs and creates Project Items or accumulates error
Definition: blast_jobs.cpp:524
CNetBlastMonitoringJob(CNetBLASTUIDataSource &ds, IServiceLocator *srv_locator, const string &tool_name, TDescriptors &descriptors)
CNetBlastSubmittingJob.
Definition: blast_jobs.cpp:263
CNetBlastSubmittingJob(string tool_name, const CBLASTParams &params, CNetBLASTUIDataSource &ds)
CNetBlastSubmittingJob.
Definition: blast_jobs.cpp:68
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
Definition: blast_jobs.cpp:457
bool HasErrors() const
Definition: blast_jobs.cpp:511
virtual void SetLoadingOptions(CSelectProjectOptions &options)
Definition: blast_jobs.cpp:279
void x_Run()
this fucntions performs real work
Definition: blast_jobs.cpp:130
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
Definition: blast_jobs.cpp:215
string m_Descr
mutex to sync our internals
Definition: blast_jobs.hpp:96
vector< CRef< CNetBlastJobDescriptor > > m_Descriptors
Definition: blast_jobs.hpp:101
vector< CRef< CNetBlastJobDescriptor > > TDescriptors
Definition: blast_jobs.hpp:173
CSelectProjectOptions m_LoadingOptions
Definition: blast_jobs.hpp:156
void GetDescriptors(TDescriptors &descriptors)
Definition: blast_jobs.cpp:241
vector< string > m_Errors
Definition: blast_jobs.hpp:102
string m_ToolName
mutex to sync our internals
Definition: blast_jobs.hpp:149
void x_CreateProjectItemsFromBlastResult(objects::CSeq_align_set &results, CRef< blast::CRemoteBlast > RemoteBlast)
Definition: blast_jobs.cpp:573
TDescriptors m_Descriptors
Definition: blast_jobs.hpp:189
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
Definition: blast_jobs.cpp:463
void SetRIDs(CNetBLASTUIDataSource &ds, const vector< string > &RIDs)
Definition: blast_jobs.cpp:496
CRef< CAppJobError > m_Error
Definition: blast_jobs.hpp:104
TDescriptors m_Descriptors
Definition: blast_jobs.hpp:160
void GetErrors(vector< string > &errors) const
Definition: blast_jobs.cpp:247
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
Definition: blast_jobs.cpp:443
vector< string > m_Errors
Definition: blast_jobs.hpp:191
CRef< CAppJobError > m_Error
Definition: blast_jobs.hpp:163
IServiceLocator * m_SrvLocator
Definition: blast_jobs.hpp:150
void x_SetStatusText(const string &text)
Definition: blast_jobs.cpp:426
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
Definition: blast_jobs.cpp:86
void x_AddError(const string &error)
Definition: blast_jobs.cpp:188
EJobState
Job states (describe FSM)
Definition: app_job.hpp:86
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#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
Defines to provide correct exporting from DLLs in Windows.
static void text(MDB_val *v)
Definition: mdb_dump.c:62
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
The NCBI C++/STL use hints.
static int * results[]
Modified on Wed Sep 04 15:07:12 2024 by modify_doxy.py rev. 669887