38 #include <wx/imaglist.h>
40 #include <wx/stattext.h>
41 #include <wx/listctrl.h>
42 #include <wx/checklst.h>
43 #include <wx/button.h>
44 #include <wx/wupdlock.h>
83 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style)
84 : m_Seh(seh), m_FtblIDs(ftblids)
98 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
99 wxDialog::Create( parent,
id, caption, pos,
size, style );
104 GetSizer()->SetSizeHints(
this);
148 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
149 itemDialog1->SetSizer(itemBoxSizer2);
151 wxStaticText* itemStaticText3 =
new wxStaticText( itemDialog1, wxID_STATIC,
_(
"Feature Table IDs not found in record"), wxDefaultPosition, wxDefaultSize, 0 );
152 itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
154 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
155 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 1);
157 wxBoxSizer* itemBoxSizer5 =
new wxBoxSizer(wxVERTICAL);
158 itemBoxSizer4->Add(itemBoxSizer5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3);
166 wxBoxSizer* itemBoxSizer8 =
new wxBoxSizer(wxVERTICAL);
167 itemBoxSizer4->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3);
175 m_Map =
new wxButton( itemDialog1,
ID_FEATTBLID_BTN,
_(
"Map Selected"), wxDefaultPosition, wxDefaultSize, 0 );
176 itemBoxSizer2->Add(
m_Map, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 3);
178 wxBoxSizer* itemBoxSizer12 =
new wxBoxSizer(wxHORIZONTAL);
179 itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
181 wxButton* itemButton13 =
new wxButton( itemDialog1,
ID_AUTOMATCH_TABLE_ID,
_(
"AutoMatch where table ID"), wxDefaultPosition, wxDefaultSize, 0 );
182 itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
184 wxArrayString m_AutoMatchTypeStrings;
185 m_AutoMatchTypeStrings.Add(
_(
"Matches"));
186 m_AutoMatchTypeStrings.Add(
_(
"Is contained in"));
187 m_AutoMatchTypeStrings.Add(
_(
"Is start of"));
188 m_AutoMatchTypeStrings.Add(
_(
"Is end of"));
190 itemBoxSizer12->Add(
m_AutoMatchType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
192 wxStaticText* itemStaticText15 =
new wxStaticText( itemDialog1, wxID_STATIC,
_(
"record ID"), wxDefaultPosition, wxDefaultSize, 0 );
193 itemBoxSizer12->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
195 wxStaticText* itemStaticText16 =
new wxStaticText( itemDialog1, wxID_STATIC,
_(
"Selected matches"), wxDefaultPosition, wxDefaultSize, 0 );
196 itemBoxSizer2->Add(itemStaticText16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 3);
198 wxArrayString m_MappedIDsStrings;
200 itemBoxSizer2->Add(
m_MappedIDs, 1, wxEXPAND| wxALL, 5);
202 wxBoxSizer* itemBoxSizer18 =
new wxBoxSizer(wxHORIZONTAL);
203 itemBoxSizer2->Add(itemBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
205 wxButton* itemButton19 =
new wxButton( itemDialog1, wxID_OK,
_(
"OK"), wxDefaultPosition, wxDefaultSize, 0 );
206 itemBoxSizer18->Add(itemButton19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
208 wxButton* itemButton20 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
209 itemBoxSizer18->Add(itemButton20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
220 if ((*id_it)->IsGeneral() && (*id_it)->GetGeneral().IsSetDb() &&
221 ((*id_it)->GetGeneral().GetDb() ==
"TMSMART" || (*id_it)->GetGeneral().GetDb() ==
"BankIt" || (*id_it)->GetGeneral().GetDb() ==
"NCBIFILE"))
223 string id_label = (*id_it)->AsFastaString();
224 if (!
label.empty()) {
239 id->GetLabel(&
label);
254 return wxDialog::TransferDataToWindow();
261 ftbl_seqid_map.
clear();
262 wxArrayInt checked_items;
266 for (
unsigned int n = 0;
n < checked_items.size(); ++
n) {
269 string ftbl_label =
text.substr(0, pos);
335 if (item_ftbl == -1 || item_seqid == -1) {
351 switch (match_type) {
359 if (ver != string::npos &&
NStr::Equal(ft_id, rec_id.substr(0, ver))) {
401 wxArrayString matched_ids;
414 for (
size_t i = 0;
i < matched_ids.size(); ++
i) {
424 item_ftbl =
m_FeatTableIDList->GetNextItem(item_ftbl, wxLIST_NEXT_ALL, wxLIST_STATE_DONTCARE);
425 if (item_ftbl == -1)
break;
428 ftcheck = ftcheck.substr(4);
430 long item_seqid = -1;
431 bool found_match =
false;
432 while (!found_match) {
433 item_seqid =
m_SequenceIDList->GetNextItem(item_seqid, wxLIST_NEXT_ALL, wxLIST_STATE_DONTCARE);
434 if (item_seqid == -1)
break;
436 vector<CTempString> tokens;
438 ITERATE(vector<CTempString>,
t, tokens) {
456 item_ftbl =
m_FeatTableIDList->GetNextItem(item_ftbl, wxLIST_NEXT_ALL, wxLIST_STATE_DONTCARE);
457 if (item_ftbl == -1)
break;
460 ftcheck = ftcheck.substr(4);
464 label_to_item[ftcheck] = item_ftbl;
469 string gnl = ftcheck.substr(pos + 1,
NPOS);
471 label_to_item[gnl] = item_ftbl;
476 long item_seqid = -1;
479 item_seqid =
m_SequenceIDList->GetNextItem(item_seqid, wxLIST_NEXT_ALL, wxLIST_STATE_DONTCARE);
480 if (item_seqid == -1)
break;
482 vector<CTempString> tokens;
484 ITERATE(vector<CTempString>,
t, tokens) {
485 auto p = label_to_item.
find(*
t);
486 if (p == label_to_item.
end()) {
488 if (ver != string::npos) {
489 p = label_to_item.
find(
t->substr(0, ver));
492 if (p != label_to_item.
end()) {
494 to_delete.
insert(p->second);
499 for (
auto p = to_delete.rbegin(); p != to_delete.rend(); ++p) {
wxCheckListBox * m_MappedIDs
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void x_AddMatch(long item_ftbl, long item_seqid)
void OnMapSelectedBtnClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FEATTBLID_BTN
objects::CSeq_entry_Handle m_Seh
void QuadraticAutomatch(wxArrayString &matched_ids)
wxChoice * m_AutoMatchType
void LinearAutomatch(wxArrayString &matched_ids)
void CreateControls()
Creates the controls and sizers.
bool Create(wxWindow *parent, wxWindowID id=ID_CMATCHFEATURETABLEDLG, const wxString &caption=_("Match Feature Table IDs"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
wxListView * m_SequenceIDList
const set< objects::CSeq_id_Handle > m_FtblIDs
CMatchFeatureTableDlg()
Constructors.
void GetFtableIDToSeqIDMap(TFeatSeqIDMap &ftbl_seqid_map)
void OnAutomatchTableIdClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_AUTOMATCH_TABLE_ID
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
~CMatchFeatureTableDlg()
Destructor.
bool TransferDataToWindow()
bool x_TokenMatch(const string &ft, const string &rec)
static bool ShowToolTips()
Should we show tooltips?
wxListView * m_FeatTableIDList
void Init()
Initialises member variables.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
container_type::const_iterator const_iterator
const_iterator end() const
iterator_bool insert(const value_type &val)
container_type::value_type value_type
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
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,...
@ eGetId_Seq_id_BestRank
use CSeq_id::BestRank() as the scoring function
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
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 SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
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.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eNocase
Case insensitive compare.
static const char label[]
const TId & GetId(void) const
Get the Id member data.
list< CRef< CSeq_id > > TId
@ eMol_na
just a nucleic acid
static const char * sToSign
string s_GetDisplayLabel(CBioseq_Handle bh)
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)