.
filters.push_back(pair<string,string>(
"Show only positive strand results",
114 m_Filters.
filters.push_back(pair<string,string>(
"Show only negative strand results",
121 static stringname(
"Sequence Search");
149 returnsl_ctx !=
NULL;
166 return "search_tool::sequence_search_tool";
171 return "Datamining Tool - Sequence Search search";
183 const string& pattern,
185 const string&
file)
188m_PatternType(pt_type),
189m_PatternFile(
file)
255wxBoxSizer * vSz =
newwxBoxSizer(wxVERTICAL);
258wxFlexGridSizer * sz =
newwxFlexGridSizer(1, 4, 0, 0);
259sz->AddGrowableCol(3);
261 m_Sizer->Add(sz, 0, wxGROW|wxALL, 0);
264sz->Add(
newwxStaticText( parent, wxID_STATIC,
265 wxT(
"Search Context:"),
266wxDefaultPosition, wxDefaultSize, 0 ),
2670, wxALIGN_CENTER_VERTICAL|wxALL, 5);
270wxDefaultPosition, wxDefaultSize,
2710, (
constwxString*)
NULL);
273sz->Add(
m_DbCombo,1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
276sz->Add(
newwxStaticText( parent, wxID_STATIC,
wxT(
"Search Type:"),
277wxDefaultPosition, wxDefaultSize, 0 ),
2780, wxALIGN_CENTER_VERTICAL|wxALL, 5);
282wxDefaultPosition, wxDefaultSize,
2830, (
constwxString*)
NULL);
297sz->Add(
m_TypeCombo,1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
303 wxT(
"Search Expression:"),
304wxDefaultPosition, wxDefaultSize, 0 ),
3050, wxALIGN_CENTER_VERTICAL|wxALL, 5);
312 m_pPatternSizer->Add(
newwxStaticText( parent, wxID_STATIC,
wxT(
"Select Named Pattern:"), wxDefaultPosition, wxDefaultSize, 0 ),
3130, wxALIGN_CENTER_VERTICAL|wxALL, 5);
315wxDefaultPosition, wxDefaultSize,
3160, (
constwxString*)
NULL);
337 boolbPattern = (
m_TypeCombo->GetSelection()==3);
368 if(search_loc.
IsNull()) {
372vector<CRef<CSeq_loc> > locs;
378locs.back()->SetInt(*ref);
382locs.push_back(search_loc);
386 id->Assign(*(search_loc->
GetId()));
388locs.back()->SetWhole(*
id);
396sc_locs.push_back(sl);
409searchString =
"#undefined#";
454 if( (dir =
registry.
Get(
"Patterns",
"PatternPath")).empty() ) {
455 registry.
Set(
"Patterns",
"PatternPath",
"<std>, <home>",
458dir =
registry.
Get(
"Patterns",
"PatternPath");
463 ITERATE(list<string>, iter, paths) {
465 if(*iter ==
"<std>"|| *iter ==
"<home>") {
470 if( dir_name.empty() ) {
474wxFileName fname(dir_name, wxEmptyString);
475 if( !fname.DirExists(dir_name) ) {
482 boolcont = dir.GetFirst(&filename,
wxT(
"*.ini"), wxDIR_FILES);
484fname.SetFullName(filename);
485wxString full_path = fname.GetFullPath();
491list<string> pat_ids;
492 patterns.EnumerateSections(&pat_ids);
495 ITERATE(list<string>, pat_id, pat_ids) {
496 if(*pat_id ==
"-") {
497fName =
patterns.Get(
"-",
"name");
498 if(!fName.empty()) {
503 stringpattern =
patterns.Get(*pat_id,
"pattern");
504 stringdesc =
patterns.Get(*pat_id,
"description");
505 if(!fName.empty()) {
510cont = dir.GetNext(&filename);
521m_PatternType(
query.GetPatternType())
524 static stringsep(
", ");
527it->m_Scope.GetPointer());
531 if( ! s_locs.empty()) {
532s_locs.resize(s_locs.size() - sep.size());
535 m_Descr=
"Search Sequence for \""+ s_pat +
"\" on "+ s_locs;
630 boolsearchForward =
true, searchReverse =
true;
634 if(expr.find(
"Strand=") == 0 && expr.size() > 7) {
635 string value= expr.substr(7);
636 if(
value==
"'+'")
637searchReverse =
false;
638 else if(
value==
"'-'")
639searchForward =
false;
643 if(!searchForward && !searchReverse)
644searchForward = searchReverse =
true;
677 if(seq_loc.
IsInt())
707range.
GetFrom() + seq_offset,
708range.
GetTo() + seq_offset));
742range.
GetFrom() + seq_offset,
743range.
GetTo() + seq_offset));
774 while((
int) coll.
size() < max_coll_size) {
779coll.
insert(make_pair(from, to));
790 intstart_pos = 0, num = 0;
795 for(
int i= 0; i < num && max_coll_size > 0 && !
IsCanceled(); ++
i) {
799p0 = (
int)(
data.size() - p[1]);
800p1 = (
int)(
data.size() - p[0]);
810coll.
insert(make_pair(from, to));
813 if((
int) coll.
size() >= max_coll_size) {
831 static const TSeqPoskMaxLen = 40;
837*s = s1 +
"..."+ s2;
846 const string& sequence,
847 const string& loc_name,
848 const string& strand,
849 const string& ctx_name)
851 static const intkUpdateIncrement = 250;
874 if(
count>= kUpdateIncrement) {
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CObjectList * GetObjectList()
static CNcbiApplication * Instance(void)
Singleton method.
CObjectList Data structure representing a list of CObjects with associated Scopes and other optional ...
int AddRow(CObject *obj, objects::CScope *scope)
void AddObjectLabel(const string &name, CLabel::ELabelType type)
void SetString(int col, int row, const string &val)
void SetInteger(int col, int row, int 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)
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
virtual void UpdateContexts()
updates m_ContextCombo
void UpdateContextCombo(wxChoice *combo)
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
IDMSearchTool::TFilters m_Filters
holds the final results
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
static SIZE_TYPE ReverseComplement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
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
iterator_bool insert(const value_type &val)
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
unsigned int TSeqPos
Type for sequence locations and lengths.
#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.
virtual IAppJob::EJobState x_DoSearch()
performs searching, assuming that params are correct; Implement in derived classes
CRef< CSequenceSearchTool > m_Tool
void x_GetSequence(objects::CSeqVector &vec, const CRange< TSeqPos > &range, string *s)
virtual CObjectListTableModel * x_GetNewOLTModel() const
factory method creating new column handler for CObjectListWidget
virtual IDMSearchTool * x_GetTool()
virtual CIRef< IDMSearchForm > CreateSearchForm()
factory method for creating a form representing the tool
virtual IDMSearchTool::TUIToolFlags GetFlags(void)
special flags
wxChoice * m_PatternCombo
void x_UpdateFileList(void)
CSequenceSearchQuery::TScopedLocs TScopedLocs
CSequenceSearchQuery(TScopedLocs &locs, const string &pattern, TPatternType pt_type, const string &file)
CSequenceSearchQuery.
wxFlexGridSizer * m_pSearchSizer
CRegexp * m_Pattern
search patteern for "Exact Match" and "Wildcard" modes
virtual void x_LoadSettings(const CRegistryReadView &view)
virtual string GetName() const
returns unique name of the method that is used in UI to identify it
CSequenceSearchJob(CSequenceSearchQuery &query)
CSequenceSearchJob.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual string ToString() const
Prepare a string representation of a query (for logging and debugging)
virtual bool IsCompatible(IDataMiningContext *context)
retuns true if the tool is compatible with the provided Search Context
CRef< CSequenceSearchQuery > m_Query
virtual void UpdateContexts()
updates m_ContextCombo
void x_AddToResults(CObject &obj, objects::CScope &scope, const string &sequence, const string &loc_name, const string &strand, const string &ctx_name)
virtual wxSizer * GetWidget(wxWindow *parent)
return a widget associated with the form; the form controls the lifetime of the widget (do not delete...
vector< ISeqLocSearchContext * > m_SeqLocContexts
virtual CIRef< IDMSearchQuery > ConstructQuery()
virtual IUITool * Clone() const
void x_GetMatches(const string &data, int start, TRangeCollection &coll, bool reverse)
"offset" argument defines the sequence position corresponding to the fisrt character in "data"
TPatternType m_PatternType
CSequenceSearchForm(CSequenceSearchTool &tool)
list< TDescPattern > TDescPatList
wxFlexGridSizer * m_pPatternSizer
virtual void x_SaveSettings(CRegistryWriteView view) const
pair< string, string > TDescPattern
TPatternType m_PatternType
IAppJob::EJobState x_SearchSequence(TScopedLocs &scoped_locs)
virtual void x_SetupColumns(CObjectList &obj_list)
add custom columns if needed
virtual bool x_ValidateParams()
returns true if Job params are correct, implement in derived classes
string m_PatternFile
regular expression to apply
TPatternType GetPatternType()
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual CRef< CSearchJobBase > x_CreateJob(IDMSearchQuery &query)
implementing CSearchToolBase pure virtual function
CSequenceSearchQuery::TScopedLocs TScopedLocs
TPatternType m_PatternType
CSequenceSearchTool()
CSequenceSearchTool.
virtual string GetDescription() const
returns a detailed description of the method that is used in UI
static TFileList m_FileList
CSequenceSearchForm.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
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.
TRange GetTotalRange(void) const
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
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,...
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
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().
position_type GetLength(void) const
const TOffset * GetResults(size_t idx) const
Get location of pattern/subpattern for the last GetMatch().
CTempString GetMatch(CTempString str, size_t offset=0, size_t idx=0, TMatch flags=fMatch_default, bool noreturn=false)
Get matching pattern and subpatterns.
int NumFound() const
Get number of patterns + subpatterns.
static string WildcardToRegexp(CTempString mask)
Convert wildcard mask to regular expression.
virtual const string & Get(const string §ion, const string &name, TFlags flags=0) const
Get the parameter value.
bool Set(const string §ion, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
Set the configuration parameter value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
NCBI_NS_STD::string::size_type SIZE_TYPE
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.
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.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eForwardSearch
Search in a forward direction.
@ fWithCommas
Use commas as thousands separator.
@ eNocase
Case insensitive compare.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
list< CRef< CSeq_interval > > Tdata
const Tdata & Get(void) const
Get the member data.
TFrom GetFrom(void) const
Get the From member data.
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
unsigned int
A callback function used to compare two keys in a database.
const GenericPointer< typename T::ValueType > T2 value
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Process information in the NCBI Registry, including working with configuration files.
#define row(bind, expected)
CRef< objects::CScope > m_Scope
CRef< objects::CSeq_loc > m_Loc
static CS_CONTEXT * context
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4