49 #include <wx/listctrl.h>
50 #include <wx/hyperlink.h>
69 objects::CBioseq_CI b_iter(seh, objects::CSeq_inst::eMol_na);
70 for ( ; b_iter ; ++b_iter ) {
71 m_Seqs.push_back(*b_iter);
75 Create(parent,
id, caption, pos,
size, style);
82 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
83 itemPanel1->SetSizer(itemBoxSizer2);
85 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
86 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
88 m_ListCtrl1 =
new wxListCtrl( itemPanel1,
wxID_ANY, wxDefaultPosition, wxSize(400, 320), wxLC_REPORT|wxLC_NO_HEADER );
89 itemBoxSizer3->Add(
m_ListCtrl1, 1, wxGROW|wxALL, 5);
92 m_ListCtrl2 =
new wxListCtrl( itemPanel1,
wxID_ANY, wxDefaultPosition, wxSize(400, 320), wxLC_REPORT|wxLC_NO_HEADER );
93 itemBoxSizer3->Add(
m_ListCtrl2, 1, wxGROW|wxALL, 5);
95 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
96 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
98 wxButton* itemButton1 =
new wxButton( itemPanel1,
ID_REMOVE_SEQ_LEFT,
_(
"<<<"), wxDefaultPosition, wxDefaultSize, 0 );
99 itemBoxSizer4->Add(itemButton1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 15);
101 wxButton* itemButton2 =
new wxButton( itemPanel1,
ID_REMOVE_SEQ_RIGHT,
_(
">>>"), wxDefaultPosition, wxDefaultSize, 0 );
102 itemBoxSizer4->Add(itemButton2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 15);
104 wxBoxSizer* itemBoxSizer17 =
new wxBoxSizer(wxHORIZONTAL);
105 itemBoxSizer2->Add(itemBoxSizer17, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
107 wxStaticText* itemStaticText4 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Seq-id"), wxDefaultPosition, wxDefaultSize, 0 );
108 itemBoxSizer17->Add(itemStaticText4, 0, wxALIGN_TOP|wxALL, 5);
114 wxFlexGridSizer* itemFlexGridSizer5 =
new wxFlexGridSizer(0, 2, 0, 0);
115 itemBoxSizer2->Add(itemFlexGridSizer5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0);
117 wxStaticText* itemStaticText5 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Select sequences longer than"), wxDefaultPosition, wxDefaultSize, 0 );
118 itemFlexGridSizer5->Add(itemStaticText5, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
120 m_Min =
new wxTextCtrl(itemPanel1,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, -1), 0);
121 itemFlexGridSizer5->Add(
m_Min, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP|wxBOTTOM, 5);
123 wxStaticText* itemStaticText6 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Select sequences less than"), wxDefaultPosition, wxDefaultSize, 0 );
124 itemFlexGridSizer5->Add(itemStaticText6, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL |wxALL, 5);
126 m_Max =
new wxTextCtrl( itemPanel1,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, -1), 0 );
127 itemFlexGridSizer5->Add(
m_Max, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 5);
129 wxBoxSizer* itemBoxSizer12 =
new wxBoxSizer(wxHORIZONTAL);
130 itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 3);
132 wxButton* itemButton13 =
new wxButton(itemPanel1,
ID_REMOVE_SEQ_SELECT,
_(
"Select"), wxDefaultPosition, wxDefaultSize, 0);
133 itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
135 wxButton* itemButton14 =
new wxButton(itemPanel1,
ID_REMOVE_SEQ_SELECT_ALL,
_(
"Select All"), wxDefaultPosition, wxDefaultSize, 0);
136 itemBoxSizer12->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
138 wxButton* itemButton15 =
new wxButton(itemPanel1,
ID_REMOVE_SEQ_UNSELECT_ALL,
_(
"Unselect All"), wxDefaultPosition, wxDefaultSize, 0);
139 itemBoxSizer12->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
141 wxBoxSizer* itemBoxSizer16 =
new wxBoxSizer(wxHORIZONTAL);
142 itemBoxSizer2->Add(itemBoxSizer16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
144 wxButton* itemButton16 =
new wxButton( itemPanel1, wxID_OK,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
145 itemBoxSizer16->Add(itemButton16, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
147 wxButton* itemButton17 =
new wxButton( itemPanel1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
148 itemBoxSizer16->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
150 wxHyperlinkCtrl* itemHyperlinkCtrl =
new wxHyperlinkCtrl( itemPanel1, wxID_HELP,
_(
"Help"),
wxT(
"https://www.ncbi.nlm.nih.gov/tools/gbench/manual9/#remove-sequences"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
151 itemHyperlinkCtrl->SetForegroundColour(wxColour(192, 192, 192));
152 itemBoxSizer16->Add(itemHyperlinkCtrl, 0, wxALIGN_CENTER_VERTICAL, 5);
159 if (
id.IsGenbank() &&
id.GetGenbank().IsSetAccession())
160 labels[0] =
id.GetGenbank().GetAccession();
161 if (
id.IsGeneral() &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsStr())
162 labels[1] =
id.GetGeneral().GetTag().GetStr();
163 if (
id.IsGeneral() &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsId())
165 if (
id.IsLocal() &&
id.GetLocal().IsStr())
166 labels[3] =
id.GetLocal().GetStr();
170 labels.push_back(
label);
175 vector<string> labels(5);
179 for (CBioseq_Handle::TId::const_iterator it = seh.
GetSeq().
GetId().begin(); it != seh.
GetSeq().
GetId().end(); ++it)
190 for (
int i=0;
i<labels.size();
i++)
192 strs.push_back(labels[
i]);
207 if (
id.IsGenbank() &&
id.GetGenbank().IsSetAccession())
209 if (
id.IsGeneral() &&
id.GetGeneral().IsSetDb() &&
id.GetGeneral().GetDb() ==
"BankIt" &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsStr())
211 labels.
insert(
id.GetGeneral().GetTag().GetStr());
212 labels.
insert(
"BankIt" +
id.GetGeneral().GetTag().GetStr());
213 string first, second;
218 if (
id.IsGeneral() &&
id.GetGeneral().IsSetDb() &&
id.GetGeneral().GetDb() ==
"NCBIFILE" &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsStr())
220 labels.
insert(
id.GetGeneral().GetTag().GetStr());
221 labels.
insert(
"NCBIFILE" +
id.GetGeneral().GetTag().GetStr());
223 if (
id.IsGeneral() &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsStr())
224 labels.
insert(
id.GetGeneral().GetTag().GetStr());
225 if (
id.IsGeneral() &&
id.GetGeneral().IsSetTag() &&
id.GetGeneral().GetTag().IsId())
227 if (
id.IsLocal() &&
id.GetLocal().IsStr())
228 labels.
insert(
id.GetLocal().GetStr());
239 for (CBioseq_Handle::TId::const_iterator it = seh.
GetSeq().
GetId().begin(); it != seh.
GetSeq().
GetId().end(); ++it)
255 vector<string> vec(strs.
begin(), strs.
end());
256 return constraint->DoesListMatch(vec);
275 for (
unsigned int i=0;
i<set_size; ++
i)
294 item =
m_ListCtrl1->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
295 if ( item == -1 )
break;
296 int i =
static_cast<int>(
m_ListCtrl1->GetItemData(item));
307 item =
m_ListCtrl2->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
308 if ( item == -1 )
break;
309 int i =
static_cast<int>(
m_ListCtrl2->GetItemData(item));
320 for (
unsigned int i=0;
i<set_size; ++
i)
335 long min_length = -1;
336 long max_length = LONG_MAX;
337 bool min_num =
m_Min->GetValue().ToLong(&min_length);
338 bool max_num =
m_Max->GetValue().ToLong(&max_length);
341 if ( !min_num && !max_num && !constraint)
365 else if (min_num || max_num)
367 if (length > min_length && length < max_length)
384 wxDialog::Create( parent,
id, caption, pos,
size, style );
388 GetSizer()->SetSizeHints(
this);
417 report->SetTitle(
wxT(
"Bioseqs Removed"));
418 report->
SetText(wxString(msg));
428 for (
int i = 0;
i <
m_Seqs.size();
i++) {
445 objects::CBioseq_CI b_iter(seh, objects::CSeq_inst::eMol_aa);
446 for ( ; b_iter ; ++b_iter ) {
459 objects::CBioseq_CI b_iter(seh, objects::CSeq_inst::eMol_aa);
460 for ( ; b_iter ; ++b_iter )
477 if (!
fi->IsSetProduct())
482 proteins.
insert(prot_bsh);
485 objects::CBioseq_CI b_iter(seh, objects::CSeq_inst::eMol_aa);
486 for ( ; b_iter ; ++b_iter )
489 if (proteins.
find(bsh) == proteins.
end())
const CBioseq & GetNucFromNucProtSet(void) const
TSeqPos GetLength(void) const
bool IsSetLength(void) const
void SetText(const wxString &text)
static CRef< CCmdComposite > JustRemoveProteins(objects::CSeq_entry_Handle seh)
static CRef< CCmdComposite > OrphanedProteins(objects::CSeq_entry_Handle seh)
static CRef< CCmdComposite > AndRenormalizeNucProtSets(objects::CSeq_entry_Handle seh)
vector< CBioseq_Handle > m_Seqs
CRef< CCmdComposite > GetCommand()
void OnSelectAll(wxCommandEvent &event)
CSeq_entry_Handle GetSeqEntry(unsigned int i)
void ChooseSequence(CBioseq_Handle bsh)
void OnButtonMoveRight(wxCommandEvent &event)
bool MatchConstraint(CRef< objects::edit::CStringConstraint > constraint, CSeq_entry_Handle seh)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Remove Sequences"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
void CollectLabelsAll(CSeq_entry_Handle seh, set< string > &strs)
void OnUnselectAll(wxCommandEvent &event)
void OnSelect(wxCommandEvent &event)
void CombineLabels(const CSeq_id &id, vector< string > &labels)
string GetLabel(CSeq_entry_Handle seh)
void OnButtonMoveLeft(wxCommandEvent &event)
vector< int > m_Available
void CollectLabels(CSeq_entry_Handle seh, list< string > &strs)
CStringConstraintPanel * m_StringConstraintPanel
void CombineLabelsAll(const CSeq_id &id, set< string > &labels)
void SetStringSelection(const wxString &str)
CRef< edit::CStringConstraint > GetStringConstraint()
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
unsigned int TSeqPos
Type for sequence locations and lengths.
int TSignedSeqPos
Type for signed sequence position.
const string & GetMsg(void) const
Get message string.
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
CConstRef< CSeq_id > GetSeqId(void) const
@ eContent
Untagged human-readable accession or the like.
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_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
TClass GetClass(void) const
TSeqPos GetBioseqLength(void) const
CConstRef< CBioseq_set > GetCompleteBioseq_set(void) const
Return the complete bioseq-set object.
bool IsProtein(void) const
bool IsSetClass(void) const
const TId & GetId(void) const
#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 string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static const char label[]
@ eClass_nuc_prot
nuc acid and coded proteins
const TId & GetId(void) const
Get the Id member data.
bool IsSetId(void) const
equivalent identifiers Check if a value has been assigned to Id data member.
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
const CConstRef< CSeq_id > GetAccession(const CSeq_id_Handle &id_handle)
#define ID_REMOVE_SEQ_SELECT_ALL
#define ID_REMOVE_SEQ_RIGHT
#define ID_REMOVE_SEQ_UNSELECT_ALL
#define ID_REMOVE_SEQ_LEFT
#define ID_REMOVE_SEQ_SELECT
CRef< CCmdComposite > GetDeleteSequenceCommand(objects::CBioseq_Handle bsh)
wxString ToWxString(const string &s)