54 #include <wx/stattext.h>
55 #include <wx/choice.h>
56 #include <wx/srchctrl.h>
59 #define ID_COMBOBOX 10003
75 static string name(
"Component Search");
103 return sl_ctx !=
NULL;
121 return "search_tool::component_search_tool";
126 return "Datamining Tool - Component search";
187 wxFlexGridSizer * sz =
new wxFlexGridSizer(1, 4, 0, 0);
188 sz->AddGrowableCol(3);
191 m_Sizer->Add(
new wxStaticText( parent, wxID_STATIC,
wxT(
"Search Context:"), wxDefaultPosition, wxDefaultSize, 0 ),
192 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
195 wxDefaultPosition, wxDefaultSize,
196 0, (
const wxString*)
NULL);
200 m_Sizer->Add(
new wxStaticText( parent, wxID_STATIC,
wxT(
"Search Expression:"), wxDefaultPosition, wxDefaultSize, 0 ),
201 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
204 m_Sizer->Add(
m_Text,1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
256 sc_locs.push_back(sl);
271 static string sep(
", ");
274 it->m_Scope.GetPointer());
276 if ( !s_locs.empty() ) {
335 list<CSeq_id_Handle> idhs;
338 ITERATE (list<string>, iter, toks) {
339 const string& s = *iter;
357 <<
"not a gi: " << e.
GetMsg());
382 for (
size_t level = 0;
383 level < 5 && !
IsCanceled() && idhs.size(); ++level) {
389 for ( ; idhs.size() && map_it && !
IsCanceled(); ++map_it) {
396 list<CSeq_id_Handle>::iterator id_it = idhs.begin();
397 for ( ; id_it != idhs.end(); ) {
417 if (count % 20 == 0) {
422 " components searched, " +
436 LOG_POST(
Info <<
"CComponentSearchJob::x_DoSearch(): done: "
437 <<
sw.
Elapsed() <<
" seconds. Found = " << found);
444 const string& loc_name,
445 const string& ctx_name)
447 static const int kUpdateIncrement = 20;
454 if(count >= kUpdateIncrement) {
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CObjectList * GetObjectList()
CObjectList Data structure representing a list of CObjects with associated Scopes and other optional ...
int AddRow(CObject *obj, objects::CScope *scope)
void SetString(int col, int row, const string &val)
void Append(const CObjectList &list)
adds rows from the given list, the lists must have identical sets of columns
int AddColumn(EColumnType type, const string &name, int col=-1)
CRef< CDMSearchResult > m_TempResult
holds temporary results, guarded by Mutex
string m_Descr
human-readable description of the Job
CMutex m_Mutex
synchronizes access to the Job members
CRef< CAppJobError > m_Error
CObjectList m_AccList
accumulates found objects before they are transferred to m_ResultList
TScopedLocs & GetScopedLocs()
vector< SScopedLoc > TScopedLocs
IDMSearchQuery - abstract data mining query.
IDataMiningContext IDataMiningContext represents an abstract context for a Search.
virtual string GetDMContextName()=0
returns Name of the context to be used in UI
virtual CRef< objects::CScope > GetSearchScope()=0
virtual CRef< objects::CSeq_loc > GetSearchLoc()=0
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
void Info(CExceptionArgs_Base &args)
static bool Match(const objects::CSeq_id &id1, const objects::CSeq_id &id2, objects::CScope *scope=NULL)
check to see if two seq-ids are identical.
virtual CIRef< IDMSearchQuery > ConstructQuery()
CComponentSearchTool()
IDMSearchTool.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CRef< CComponentSearchTool > m_Tool
void x_AddToResults(CObject &obj, objects::CScope &scope, const string &loc_name, const string &ctx_name)
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual wxSizer * GetWidget(wxWindow *parent)
return a widget associated with the form; the form controls the lifetime of the widget (do not delete...
virtual bool x_ValidateParams()
returns true if Job params are correct, implement in derived classes
virtual CRef< CSearchJobBase > x_CreateJob(IDMSearchQuery &query)
implementing CSearchToolBase pure virtual function
virtual IUITool * Clone() const
virtual void x_CreateWidgets()
virtual EJobState x_DoSearch()
performs searching, assuming that params are correct; Implement in derived classes
virtual bool IsCompatible(IDataMiningContext *context)
retuns true if the tool is compatible with the provided Search Context
CComponentSearchQuery(TScopedLocs &locs, const string &ids)
CComponentSearchQuery.
CRef< CComponentSearchQuery > m_Query
CComponentSearchQuery::TScopedLocs TScopedLocs
CComponentSearchJob(CComponentSearchQuery &query)
CComponentSearchJob.
virtual void x_SetupColumns(CObjectList &obj_list)
add custom columns if needed
virtual void UpdateContexts()
updates m_ContextCombo
virtual CIRef< IDMSearchForm > CreateSearchForm()
factory method for creating a form representing the tool
CComponentSearchForm(CComponentSearchTool &tool)
CComponentSearchForm.
virtual string GetName() const
returns unique name of the method that is used in UI to identify it
virtual IDMSearchTool * x_GetTool()
CComponentSearchQuery::TScopedLocs TScopedLocs
virtual string GetDescription() const
returns a detailed description of the method that is used in UI
vector< ISeqLocSearchContext * > m_SeqLocContexts
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
const CTextseq_id * GetTextseq_Id(void) const
Return embedded CTextseq_id, if any.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
TRange GetTotalRange(void) const
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
@ eGetId_ForceGi
return only a gi-based seq-id
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TSeqPos GetBioseqLength(void) const
const CSeqMap & GetSeqMap(void) const
Get sequence map.
TSeqPos GetEndPosition(void) const
return end position of current segment in sequence (exclusive)
CSeqMap::ESegmentType GetType(void) const
CSeq_id_Handle GetRefSeqid(void) const
The following function makes sense only when the segment is a reference to another seq.
TSeqPos GetPosition(void) const
return position of current segment in sequence
CSeqMap_CI ResolvedRangeIterator(CScope *scope, TSeqPos from, TSeqPos length, ENa_strand strand=eNa_strand_plus, size_t maxResolve=size_t(-1), TFlags flags=fDefaultFlags) const
Iterate segments in the range with specified strand coordinates.
@ eSeqRef
reference to Bioseq
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ fWithCommas
Use commas as thousands separator.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
bool IsWhole(void) const
Check if variant Whole is selected.
bool IsSetVersion(void) const
Check if a value has been assigned to Version data member.
range(_Ty, _Ty) -> range< _Ty >
Defines: CTimeFormat - storage class for time format.
CRef< objects::CScope > m_Scope
CRef< objects::CSeq_loc > m_Loc
string ToStdString(const wxString &s)