52 #include <wx/msgdlg.h>
92 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
93 : m_TopSeqEntry(seh), m_Workbench(workbench)
107 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
113 GetSizer()->SetSizeHints(
this);
161 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
162 itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
164 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
165 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
167 wxBoxSizer* LeftOptions =
new wxBoxSizer(wxVERTICAL);
168 itemBoxSizer3->Add(LeftOptions, 0, wxALIGN_TOP|wxALL, 5);
170 wxStaticText* itemStaticText5 =
new wxStaticText( itemCBulkCmdDlg1, wxID_STATIC,
_(
"Left Feature"), wxDefaultPosition, wxDefaultSize, 0 );
171 LeftOptions->Add(itemStaticText5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
173 m_NoFeatPartialLeft =
new wxRadioButton( itemCBulkCmdDlg1,
wxID_ANY,
_(
"if selected feature is missing, extend to partial end"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
200 wxStaticLine *
line1 =
new wxStaticLine (itemCBulkCmdDlg1,
wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
201 itemBoxSizer3->Add(
line1, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxSHAPED, 5);
203 wxBoxSizer* FeatureOptions =
new wxBoxSizer(wxVERTICAL);
204 itemBoxSizer3->Add(FeatureOptions, 0, wxALIGN_TOP|wxALL, 5);
206 wxStaticText* itemStaticText6 =
new wxStaticText( itemCBulkCmdDlg1, wxID_STATIC,
_(
"Feature To Add"), wxDefaultPosition, wxDefaultSize, 0 );
207 FeatureOptions->Add(itemStaticText6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
209 m_Notebook =
new wxNotebook(itemCBulkCmdDlg1,
wxID_ANY,wxDefaultPosition,wxDefaultSize);
211 FeatureOptions->Add(
m_Notebook, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
223 wxStaticLine *
line2 =
new wxStaticLine (itemCBulkCmdDlg1,
wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
224 itemBoxSizer3->Add(
line2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxSHAPED, 5);
226 wxBoxSizer* RightOptions =
new wxBoxSizer(wxVERTICAL);
227 itemBoxSizer3->Add(RightOptions, 0, wxALIGN_TOP|wxALL, 5);
229 wxStaticText* itemStaticText7 =
new wxStaticText( itemCBulkCmdDlg1, wxID_STATIC,
_(
"Right Feature"), wxDefaultPosition, wxDefaultSize, 0 );
230 RightOptions->Add(itemStaticText7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
232 m_NoFeatPartialRight =
new wxRadioButton( itemCBulkCmdDlg1,
wxID_ANY,
_(
"if selected feature is missing, extend to partial end"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
259 wxBoxSizer* itemBoxSizer5 =
new wxBoxSizer(wxHORIZONTAL);
260 itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
262 wxButton* itemButton6 =
new wxButton( itemCBulkCmdDlg1,
ID_APPLY_BUTTON,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
263 itemBoxSizer5->Add(itemButton6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
265 wxButton* itemButton7 =
new wxButton( itemCBulkCmdDlg1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
266 itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
269 itemBoxSizer5->Add(
m_LeaveUp, 0, wxALIGN_LEFT|wxALL, 5);
285 ITERATE(vector<const CFeatListItem *>, feat_it, featlist) {
288 int feat_type = item.
GetType();
291 if (existing.
find(desc) == existing.
end()) {
306 objects::CSeqFeatData::ESubtype subtype1 = objects::CSeqFeatData::eSubtype_bad;
308 && s1 != wxNOT_FOUND)
312 objects::CSeqFeatData::ESubtype subtype2 = objects::CSeqFeatData::eSubtype_bad;
314 && s2 != wxNOT_FOUND)
325 string leftconstr_ncRNA_class;
329 subtype1, ncRNA_class1,
332 leftconstr_subtype, leftconstr_ncRNA_class,
342 string rightconstr_ncRNA_class;
346 subtype2, ncRNA_class2,
349 rightconstr_subtype, rightconstr_ncRNA_class,
356 bool partial_left =
true;
357 bool partial_right =
true;
364 if (subtype1 != objects::CSeqFeatData::eSubtype_bad)
366 for (objects::CFeat_CI feat1(*bsi, objects::SAnnotSelector(subtype1)); feat1; ++feat1)
368 if (constraint_left && !constraint_left->
Match(*feat1))
370 const CSeq_loc &loc1 = feat1->GetLocation();
371 TSignedSeqPos start1 = feat1->GetLocationTotalRange().GetFrom();
372 TSignedSeqPos stop1 = feat1->GetLocationTotalRange().GetTo();
373 partial_left =
false;
377 if (subtype2 != objects::CSeqFeatData::eSubtype_bad)
378 for (objects::CFeat_CI feat2(*bsi, objects::SAnnotSelector(subtype2)); feat2 && feat_right == length-1; ++feat2)
380 if (constraint_right && !constraint_right->
Match(*feat2))
382 const CSeq_loc &loc2 = feat2->GetLocation();
383 TSignedSeqPos start2 = feat2->GetLocationTotalRange().GetFrom();
384 TSignedSeqPos stop2 = feat2->GetLocationTotalRange().GetTo();
385 if (start2 >= feat_left)
387 partial_right =
false;
388 feat_right = start2-1;
392 if ( feat_right >= feat_left && (feat_right < length - 1 || !m_NoFeatNoFeatRight->GetValue()))
395 partial_right =
false;
404 if (subtype2 != objects::CSeqFeatData::eSubtype_bad)
405 for (objects::CFeat_CI feat2(*bsi, objects::SAnnotSelector(subtype2)); feat2 && feat_right == length-1; ++feat2)
407 if (constraint_right && !constraint_right->
Match(*feat2))
409 const CSeq_loc &loc2 = feat2->GetLocation();
410 TSignedSeqPos start2 = feat2->GetLocationTotalRange().GetFrom();
411 TSignedSeqPos stop2 = feat2->GetLocationTotalRange().GetTo();
412 if (start2 > feat_left)
414 partial_right =
false;
415 feat_right = start2 - 1;
424 partial_right =
false;
426 if (feat_right >= feat_left)
432 else if (subtype2 != objects::CSeqFeatData::eSubtype_bad)
436 partial_left =
false;
437 for (objects::CFeat_CI feat2(*bsi, objects::SAnnotSelector(subtype2)); feat2 && !found; ++feat2)
439 if (constraint_right && !constraint_right->
Match(*feat2))
441 partial_right =
false;
442 const CSeq_loc &loc2 = feat2->GetLocation();
443 TSignedSeqPos start2 = feat2->GetLocationTotalRange().GetFrom();
444 TSignedSeqPos stop2 = feat2->GetLocationTotalRange().GetTo();
446 if (feat_right >= feat_left)
459 partial_left =
false;
461 partial_right =
false;
462 if (feat_right >= feat_left)
470 if (feat_left < 0 || feat_right < 0)
473 loc->SetInt().SetId().Assign(*
id);
474 loc->SetInt().SetFrom(feat_left);
475 loc->SetInt().SetTo(feat_right);
476 loc->SetStrand(strand);
520 vector<CRef<objects::CSeq_loc> > locs;
522 for (
unsigned int i=0;
i<locs.size();
i++)
524 if (locs[
i] && locs[
i]->IsInt() && locs[
i]->GetInt().IsSetId())
530 if (sel != wxNOT_FOUND)
552 if (sel != wxNOT_FOUND)
575 sel_srv->GetActiveObjects(
objects);
594 const objects::CSeq_loc* loc =
dynamic_cast<const objects::CSeq_loc*
>(ptr);
640 bool allow_other =
true;
651 bool allow_other =
true;
@ eExtreme_Positional
numerical value
static bool ShowToolTips()
Should we show tooltips?
wxRadioButton * m_NoFeatNoFeatLeft
virtual string GetErrorMessage()
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnApplyButton(wxCommandEvent &event)
CFeatureFieldNamePanel * m_FeatRightConstraint
wxListBox * m_FeatureTypeLeft
virtual CRef< CCmdComposite > GetCommand()
bool Create(wxWindow *parent, wxWindowID id=10029, const wxString &caption=_("Add Features"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void OnFeatRightChanged(wxCommandEvent &event)
wxRadioButton * m_NoFeatPartialRight
~CAddFeatureBetweenDlg()
Destructor.
wxRadioButton * m_ExtendPartialRight
void OnFeatLeftChanged(wxCommandEvent &event)
vector< objects::CSeqFeatData::ESubtype > m_Subtype
void Init()
Initialises member variables.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void CreateControls()
Creates the controls and sizers.
wxRadioButton * m_ExtendCompleteLeft
CStringConstraintPanel * m_StringConstraintPanelRight
wxRadioButton * m_ExtendCompleteRight
wxListBox * m_FeatureTypeRight
wxRadioButton * m_ExtendPartialLeft
wxRadioButton * m_NoFeatPartialLeft
void GetFeatureLocations(vector< CRef< objects::CSeq_loc > > &locs)
CAddFeatureBetweenDlg()
Constructors.
void AddOneFeatureBetween(vector< CRef< objects::CSeq_loc > > &locs, TSignedSeqPos feat_left, TSignedSeqPos feat_right, bool partial_left, bool partial_right, objects::ENa_strand strand, const CSeq_id *id)
wxRadioButton * m_NoFeatNoFeatRight
wxArrayString m_FeatureTypeStrings
CStringConstraintPanel * m_StringConstraintPanelLeft
CFeatureFieldNamePanel * m_FeatLeftConstraint
objects::CSeq_entry_Handle m_TopSeqEntry
bool Create(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
virtual void AddOneCommand(const objects::CBioseq_Handle &bsh, CRef< CCmdComposite > cmd)
void SetLoc(CRef< objects::CSeq_loc > loc)
virtual string GetErrorMessage()=0
virtual bool Match(const string &value)
CFeatListItem - basic configuration data for one "feature" type.
string GetDescription() const
virtual bool SetFieldName(const string &field)
virtual vector< string > GetChoices(bool &allow_other)
virtual string GetFieldName(const bool subfield=false)
Returns the name of the field as selected in the panel.
void ListPresentFeaturesFirst(objects::CSeq_entry_Handle seh, vector< const objects::CFeatListItem * > *featlist=nullptr)
static bool s_IsRarelyUsedOrDiscouragedFeatureType(int subtype)
CUndoManager & GetUndoManager()
CProjectService - a service providing API for operations with Workspaces and Projects.
static bool IsRegulatory(ESubtype subtype)
CRef< edit::CStringConstraint > GetStringConstraint()
void SetChoices(const vector< string > &choices, const vector< string > &values)
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
IWorkbench is the central interface in the application framework.
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
CRef< CEditingActionConstraint > CreateEditingActionConstraint(const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, string &const_ncRNA_class, CRef< CConstraintMatcher >constraint)
int CorrectForncRNASubtypes(CSeqFeatData::ESubtype subtype, string &ncRNA_class)
int GetSubtype(CFieldNamePanel *field_name_panel, string &ncRNA_class)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
objects::CSeq_entry_Handle GetTopSeqEntryFromScopedObject(SConstScopedObject &obj)
vector< const objects::CFeatListItem * > GetSortedFeatList(objects::CSeq_entry_Handle seh, size_t max=numeric_limits< size_t >::max())
vector< SConstScopedObject > TConstScopedObjects
ENa_strand GetStrand(void) const
Get the location's strand.
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,...
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
ENa_strand
strand of nucleic acid
@ eMol_na
just a nucleic acid
void GetViewObjects(IWorkbench *workbench, TConstScopedObjects &objects)
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * str(char *buf, int n)
static char line1[1024 *16]
static char line2[1024 *16]
wxString ToWxString(const string &s)