47 #include <wx/stattext.h>
48 #include <wx/choice.h>
49 #include <wx/srchctrl.h>
56 #define ID_COMBOBOX 11003
98 static string s_name(
"Search NCBI Public Databases");
134 return "search_tool::entrez_search_tool";
139 return "Datamining Tool - Entrez Search search";
157 m_CurrDbName(
"Entrez Gene"),
198 wxFlexGridSizer * sz =
new wxFlexGridSizer(1, 3, 0, 0);
199 sz->AddGrowableCol(2);
202 m_Sizer->Add(
new wxStaticText( parent, wxID_STATIC,
203 wxT(
"Select NCBI Database:"),
204 wxDefaultPosition, wxDefaultSize, 0 ),
205 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
208 wxDefaultPosition, wxDefaultSize,
209 0, (
const wxString*)
NULL);
214 wxDefaultPosition, wxDefaultSize,
215 wxTE_PROCESS_ENTER );
216 m_Sizer->Add(
m_Text,1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
235 if (sel == wxNOT_FOUND) {
271 +
", database = " + vis_db_name;
292 bool assemblyDB(db_name ==
"assembly");
293 size_t total_uids = 0;
333 if (itAccession == ds.
end())
336 xml::node releaseType(
"ReleaseType",
"RefSeq");
340 xml::node releaseType(
"ReleaseType",
"GenBank");
369 TStringPair(
"Organism/ScientificName",
"Organism"),
382 TStringPair(
"Assembly_Accession",
"Assembly Accession")
386 : m_DbName( aDbName )
409 for(
int i = 0; ptr &&
i < num;
i++ ){
440 const string& field =
m_Fields[col].first;
442 if ((field_node == doc_sum->
GetNode().
end())) {
444 if ((string::npos == field.find(
'/')))
448 vector<string> nodes;
451 size_t count = nodes.
size();
453 for (
i = 0; parent && (
i<count); ++
i) {
454 field_node = parent->
find(nodes[
i].c_str());
455 if ((field_node == parent->
end()))
457 parent = &(*field_node);
460 if (!parent || (
i != count))
474 if(
m_DbName ==
"gene" )
return wxT(
"symbol::feature");
475 if(
m_DbName ==
"protein" )
return wxT(
"symbol::sequence_protein");
476 if(
m_DbName ==
"nucleotide" )
return wxT(
"symbol::sequence_dna");
477 if(
m_DbName ==
"assembly" )
return wxT(
"symbol::sequence");
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CObjectList * GetObjectList()
virtual wxString GetExtraColumnName(int col) const
virtual int GetNumExtraColumns() const
virtual wxVariant GetExtraValueAt(int row, int col) const
CDocsumTableModel(const string &aDbName)
vector< TStringPair > m_Fields
maps doc summary field names to columns
virtual wxString GetImageAlias(int row) const
static void GetDbNames(vector< string > &names)
static string GetVisibleName(const string &db_name)
static void Query(const string &db_name, const string &terms, size_t &total_uids, xml::document &docsums, size_t max_return=0)
CRef< CObjectList > m_ObjectList
CObjectList Data structure representing a list of CObjects with associated Scopes and other optional ...
int AddRow(CObject *obj, objects::CScope *scope)
CObject * GetObject(int row)
access to values (row, column)
class CRegistryReadView provides a nested hierarchical view at a particular key.
string GetString(const string &key, const string &default_val=kEmptyStr) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
int m_MaxResultsCount
Max possible results count.
CRef< CDMSearchResult > m_TempResult
holds temporary results, guarded by Mutex
string m_Descr
human-readable description of the Job
int m_ResultsCount
total number of results
CMutex m_Mutex
synchronizes access to the Job members
CRef< CAppJobError > m_Error
const xml::node & GetNode() const
IDMSearchQuery - abstract data mining query.
IDataMiningContext IDataMiningContext represents an abstract context for a Search.
The xml::document class is used to hold the XML tree and various bits of information about it.
const node & get_root_node(void) const
Get a reference to the root node of this document.
The xml::node::const_iterator provides a way to access children nodes similar to a standard C++ conta...
The xml::node_set class is used to store xpath query result set.
The xml::node class is used to hold information about one XML node.
iterator end(void)
Get an iterator that points one past the last child for this node.
iterator find(const char *name, const ns *nspace=NULL)
Find the first child node that has the given name and namespace.
node_set run_xpath_query(const xpath_expression &expr)
Run the given XPath query.
const char * get_content(void) const
Get the content for this text node.
iterator insert(const node &n)
Insert a new child node.
size_type size(void) const
Returns the number of childer this nodes has.
#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 NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual CObjectListTableModel * x_GetNewOLTModel() const
factory method creating new column handler for CObjectListWidget
CEntrezSearchQuery(const string &terms, const string &db_name)
CEntrezSearchTool.
virtual string GetDescription() const
returns a detailed description of the method that is used in UI
vector< TStrPair > TNamePairs
virtual void x_LoadSettings(const CRegistryReadView &view)
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
string m_CurrDbName
Entrez db names.
virtual CIRef< IDMSearchForm > CreateSearchForm()
factory method for creating a form representing the tool
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CEntrezSearchTool()
IDMSearchTool.
CRef< CEntrezSearchQuery > m_Query
virtual wxSizer * GetWidget(wxWindow *parent)
return a widget associated with the form; the form controls the lifetime of the widget (do not delete...
wxChoice * m_DbCombo
techical name
virtual CIRef< IDMSearchQuery > ConstructQuery()
CEntrezSearchJob(CEntrezSearchQuery &query)
CEntrezSearchJob.
virtual void UpdateContexts()
updates m_ContextCombo
void SetReleaseType(xml::node &ds)
Adds an additional child node, indicating the release type (RefSeq or GenBank)
virtual IUITool * Clone() const
virtual bool IsCompatible(IDataMiningContext *context)
retuns true if the tool is compatible with the provided Search Context
virtual CRef< CSearchJobBase > x_CreateJob(IDMSearchQuery &query)
implementing CSearchToolBase pure virtual function
virtual string GetName() const
returns unique name of the method that is used in UI to identify it
virtual EJobState x_DoSearch()
performs searching, assuming that params are correct; Implement in derived classes
virtual void x_SaveSettings(CRegistryWriteView view) const
virtual bool x_ValidateParams()
returns true if Job params are correct, implement in derived classes
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#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 SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
char * dbname(DBPROCESS *dbproc)
Get name of current database.
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
CRef< objects::CObjectManager > om
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)