wxWindowID
id,
constwxString& caption,
constwxPoint& pos,
constwxSize&
size,
longstyle )
125 Create(parent,
id, caption, pos,
size, style);
136SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
137wxDialog::Create( parent,
id, caption, pos,
size, style );
142GetSizer()->SetSizeHints(
this);
147SetSize(wxSize(280, 750));
185wxBoxSizer* itemBoxSizer2 =
newwxBoxSizer(wxVERTICAL);
186itemDialog1->SetSizer(itemBoxSizer2);
188wxBoxSizer* itemBoxSizer3 =
newwxBoxSizer(wxHORIZONTAL);
189itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
192itemBoxSizer3->Add(
m_ListCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
194 m_ListCtrl->InsertColumn(0,
" Sequence",wxLIST_FORMAT_LEFT,220);
200 for(
unsigned int i=0;
i<
m_SetSeq.size(); ++
i)
209wxStaticBox* itemStaticBoxSizer4Static =
newwxStaticBox(itemDialog1,
wxID_ANY,
_(
"Move selected sequences"));
210wxStaticBoxSizer* itemStaticBoxSizer4 =
newwxStaticBoxSizer(itemStaticBoxSizer4Static, wxHORIZONTAL);
211itemBoxSizer2->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
213wxButton* itemButton1 =
newwxButton( itemDialog1,
ID_BUTTON_UP,
_(
"Up"), wxDefaultPosition, wxDefaultSize, 0 );
214itemStaticBoxSizer4->Add(itemButton1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 15);
216wxButton* itemButton2 =
newwxButton( itemDialog1,
ID_BUTTON_DOWN,
_(
"Down"), wxDefaultPosition, wxDefaultSize, 0 );
217itemStaticBoxSizer4->Add(itemButton2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 15);
219wxBoxSizer* itemBoxSizer5 =
newwxBoxSizer(wxHORIZONTAL);
220itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
227itemBoxSizer5->Add(
m_SortButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
230wxBoxSizer* itemBoxSizer12 =
newwxBoxSizer(wxHORIZONTAL);
231itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
233wxButton* itemButton13 =
newwxButton( itemDialog1, wxID_OK,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
234itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
236wxButton* itemButton14 =
newwxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
237itemBoxSizer12->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
260setseq.push_back(pair<CBioseq_set_Handle,CSeq_entry_Handle>(bssh,bsh.
GetSeq_entry_Handle()));
301vector < pair<CBioseq_set_Handle,CSeq_entry_Handle> > setseq;
304 for(
unsigned int i=0;
i<setseq.size(); ++
i)
316vector<int> list_index;
320 cmd->AddCommand(*set_cmd);
333item =
m_ListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_DONTCARE);
334 if( item == -1 )
break;
335 int i=
static_cast<int>(
m_ListCtrl->GetItemData(item));
336list_index.push_back(
i);
347 for(
size_tj = 0; j < list_index.size(); j++)
349 int i= list_index[j];
350 if(set_seq[
i].
first== bssh)
353 if(set_seq[
i].second.HasParentEntry() && set_seq[
i].second.GetParentEntry().IsSet() &&
356se->
Assign(*set_seq[
i].second.GetParentEntry().GetCompleteSeq_entry());
358se->
Assign(*set_seq[
i].second.GetCompleteSeq_entry());
361CBioseq_set::TSeq_set::iterator it = old_seq_set.begin();
362 while(it != old_seq_set.end())
365 if((*it)->IsSeq() && (*it)->GetSeq().CanGetId())
366 for(CBioseq::TId::const_iterator
b= (*it)->GetSeq().GetId().begin();
b!= (*it)->GetSeq().GetId().end(); ++
b)
367 if((*b)->Match(*set_seq[
i].second.GetSeq().GetSeqId()))
match=
true;
370(*it)->GetSet().GetNucFromNucProtSet().CanGetId())
371 for(CBioseq::TId::const_iterator
b= (*it)->GetSet().GetNucFromNucProtSet().GetId().begin();
b!= (*it)->GetSet().GetNucFromNucProtSet().GetId().end(); ++
b)
372 if((*b)->Match(*set_seq[
i].second.GetSeq().GetSeqId()))
match=
true;
375it = old_seq_set.erase(it);
382 for(CBioseq_set::TSeq_set::iterator it = old_seq_set.begin(); it != old_seq_set.end(); ++it)
394item =
m_ListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
395 if( item == -1 )
break;
396 if( item == 0 )
break;
397 int i=
static_cast<int>(
m_ListCtrl->GetItemData(item));
398wxString name_i =
m_ListCtrl->GetItemText(item);
399 intstate_i =
m_ListCtrl->GetItemState(item,wxLIST_STATE_SELECTED);
400 intj =
static_cast<int>(
m_ListCtrl->GetItemData(item-1));
401wxString name_j =
m_ListCtrl->GetItemText(item-1);
402 intstate_j =
m_ListCtrl->GetItemState(item-1,wxLIST_STATE_SELECTED);
405 m_ListCtrl->SetItemState(item-1,state_i,wxLIST_STATE_SELECTED);
408 m_ListCtrl->SetItemState(item,state_j,wxLIST_STATE_SELECTED);
420item =
m_ListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
421 if( item == -1 )
break;
422index.push_back(item);
424 if( !index.empty() && index.back() !=
m_ListCtrl->GetItemCount()-1 )
425 for(vector<long>::reverse_iterator rit = index.rbegin(); rit != index.rend(); ++rit)
428 int i=
static_cast<int>(
m_ListCtrl->GetItemData(item));
429wxString name_i =
m_ListCtrl->GetItemText(item);
430 intstate_i =
m_ListCtrl->GetItemState(item,wxLIST_STATE_SELECTED);
431 intj =
static_cast<int>(
m_ListCtrl->GetItemData(item+1));
432wxString name_j =
m_ListCtrl->GetItemText(item+1);
433 intstate_j =
m_ListCtrl->GetItemState(item+1,wxLIST_STATE_SELECTED);
436 m_ListCtrl->SetItemState(item+1,state_i,wxLIST_STATE_SELECTED);
439 m_ListCtrl->SetItemState(item,state_j,wxLIST_STATE_SELECTED);
447 typedefvector < pair<CBioseq_set_Handle,CSeq_entry_Handle> > vptr;
448vptr * setseq = (vptr *)(
data);
456 return(
a.compare(
b));
459 if(
i<j)
return-1;
487 static bool cmp_labels(
constpair<
unsigned int, pair<bool, string> >&
a,
constpair<
unsigned int, pair<bool,string> > &
b)
489 boolnumeric1 =
a.second.first;
490 boolnumeric2 =
b.second.first;
491 stringstr1 =
a.second.second;
492 stringstr2 =
b.second.second;
493 if(numeric1 && numeric2)
497 if(
i!= 0 && j != 0)
500 return(str1 < str2);
505 stringgenebank, general_str, general_int,
local;
507 for(CBioseq_Handle::TId::const_iterator it = bsh.
GetId().begin(); it != bsh.
GetId().end(); ++it)
509 const CSeq_id&
id= *(it->GetSeqId());
510 if(
id.IsGenbank() &&
id.GetGenbank().IsSetAccession())
511genebank =
id.GetGenbank().GetAccession();
512 if(
id.IsGeneral() &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsStr())
513general_str =
id.GetGeneral().GetTag().GetStr();
514 if(
id.IsGeneral() &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsId())
516 if(
id.IsLocal() &&
id.GetLocal().IsStr())
517 local=
id.GetLocal().GetStr();
519 if(!genebank.empty())
524 if(!general_int.empty())
529 if(!general_str.empty())
541vector < pair<CBioseq_set_Handle,CSeq_entry_Handle> > set_seq;
542vector<pair<unsigned int, pair<bool, string> > > list_seq;
543 ReadBioseq(*(seh.GetCompleteSeq_entry()),set_seq, seh);
544 for(
unsigned int i=0;
i<set_seq.size(); ++
i)
548list_seq.push_back(pair<
unsigned int, pair<bool, string> >(
i, pair<bool, string>(numeric,
label)));
551 for(
unsigned int i=0;
i<set_seq.size(); ++
i)
558vector<int> list_index;
559 for(
size_tj = 0; j < list_seq.size(); j++)
561list_index.push_back(list_seq[j].
first);
573 cmd->AddCommand(*set_cmd);
const CSeq_id * GetFirstId() const
objects::CSeq_entry_Handle m_TopSeqEntry
void PrepareList(vector< int > &list_index)
static bool ShowToolTips()
Should we show tooltips?
static string GetIdLabel(CBioseq_Handle bsh, bool &numeric)
static void ReadBioseq(const CSeq_entry &se, vector< pair< CBioseq_set_Handle, CSeq_entry_Handle > > &setseq, CSeq_entry_Handle seh)
~CReorderSequencesDlg()
Destructor.
vector< pair< CBioseq_set_Handle, CSeq_entry_Handle > > m_SetSeq
void OnButtonDown(wxCommandEvent &event)
void OnButtonSort(wxCommandEvent &event)
void CreateControls()
Creates the controls and sizers.
static CRef< CCmdComposite > ReorderById(objects::CSeq_entry_Handle seh)
void OnButtonUp(wxCommandEvent &event)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
static void PopulateSet(CBioseq_set_Handle bssh, CBioseq_set &new_set, const vector< int > &list_index, const vector< pair< CBioseq_set_Handle, CSeq_entry_Handle > > &set_seq)
void Init()
Initialises member variables.
bool Create(wxWindow *parent, wxWindowID id=11100, const wxString &caption=_("Reorder Sequences Dialog"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
CRef< CCmdComposite > GetCommand()
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CReorderSequencesDlg()
Constructors.
iterator_bool insert(const value_type &val)
const_iterator begin() const
parent_type::iterator iterator
const_iterator end() const
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
@ eContent
Untagged human-readable accession or the like.
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
bool CanGetClass(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CConstRef< CBioseq_set > GetCompleteBioseq_set(void) const
Return the complete bioseq-set object.
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id) const
Get Bioseq handle from the TSE of this Seq-entry.
CSeq_entry_Handle GetParentEntry(void) const
Return a handle for the parent seq-entry of the bioseq.
const TId & GetId(void) const
CConstRef< CBioseq_set > GetBioseq_setCore(void) const
Return core data for the bioseq-set.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ fAllowLeadingSymbols
Ignore leading non-numeric characters.
@ fAllowTrailingSymbols
Ignore trailing non-numerics characters.
static const char label[]
const TSeq & GetSeq(void) const
Get the variant data.
bool CanGetSeq_set(void) const
Check if it is safe to call GetSeq_set method.
TClass GetClass(void) const
Get the Class member data.
const TSet & GetSet(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
void ResetSeq_set(void)
Reset Seq_set data member.
bool CanGetClass(void) const
Check if it is safe to call GetClass method.
bool IsSet(void) const
Check if variant Set is selected.
const TSeq_set & GetSeq_set(void) const
Get the Seq_set member data.
list< CRef< CSeq_entry > > TSeq_set
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
@ eClass_nuc_prot
nuc acid and coded proteins
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::SIZE size
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
static const char * down_xpm[]
int wxCALLBACK ReverseCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr data)
int wxCALLBACK DirectCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr data)
static const char * up_xpm[]
static bool cmp_labels(const pair< unsigned int, pair< bool, string > > &a, const pair< unsigned int, pair< bool, string > > &b)
#define ID_LISTCTRL_REORDER
#define FOR_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
FOR_EACH_SEQENTRY_ON_SEQSET EDIT_EACH_SEQENTRY_ON_SEQSET.
wxString ToWxString(const string &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