59 #include <wx/button.h>
60 #include <wx/statbox.h>
61 #include <wx/msgdlg.h>
84 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
94 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
100 GetSizer()->SetSizeHints(
this);
104 SetSize(wxSize(280, 750));
126 ITERATE(vector<const CFeatListItem *>, ft_it, feat_list) {
129 int feat_type = item.
GetType();
131 m_Types[pair<int,int>(feat_type,feat_subtype)] = desc;
132 if (existing.
find(desc) == existing.
end())
155 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
156 itemDialog1->SetSizer(itemBoxSizer2);
158 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
159 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
162 itemBoxSizer3->Add(
m_ListCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
164 m_ListCtrl->InsertColumn(0,
" Feature",wxLIST_FORMAT_LEFT,237);
169 wxBoxSizer* itemBoxSizer5 =
new wxBoxSizer(wxHORIZONTAL);
170 itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
172 wxBoxSizer* itemBoxSizer6 =
new wxBoxSizer(wxVERTICAL);
173 itemBoxSizer5->Add(itemBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
175 wxStaticBox* itemStaticBoxSizer7Static =
new wxStaticBox(itemDialog1,
wxID_ANY,
_(
"Optional String Constraint"));
176 wxStaticBoxSizer* itemStaticBoxSizer7 =
new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
177 itemBoxSizer6->Add(itemStaticBoxSizer7, 0, wxALIGN_LEFT|wxALL, 5);
181 itemStaticBoxSizer7->Add(
m_RadioButton, 0, wxALIGN_LEFT|wxALL, 5);
184 itemRadioButton9->SetValue(
false);
185 itemStaticBoxSizer7->Add(itemRadioButton9, 0, wxALIGN_LEFT|wxALL, 5);
188 itemStaticBoxSizer7->Add(
m_TextCtrl, 0, wxALIGN_LEFT|wxALL, 5);
192 itemStaticBoxSizer7->Add(
m_CheckBox, 0, wxALIGN_LEFT|wxALL, 5);
194 wxStaticBox* itemStaticBoxSizer15Static =
new wxStaticBox(itemDialog1,
wxID_ANY,
_(
"Optional Seq-id Constraint"));
195 wxStaticBoxSizer* itemStaticBoxSizer15 =
new wxStaticBoxSizer(itemStaticBoxSizer15Static, wxVERTICAL);
196 itemBoxSizer6->Add(itemStaticBoxSizer15, 0, wxALIGN_LEFT|wxALL, 5);
203 itemRadioButton16->SetValue(
false);
204 itemStaticBoxSizer15->Add(itemRadioButton16, 0, wxALIGN_LEFT|wxALL, 5);
207 itemStaticBoxSizer15->Add(
m_TextCtrl_id, 0, wxALIGN_LEFT|wxALL, 5);
211 itemStaticBoxSizer15->Add(
m_CheckBox_id, 0, wxALIGN_LEFT|wxALL, 5);
213 wxStaticBox* itemStaticBoxSizer17Static =
new wxStaticBox(itemDialog1,
wxID_ANY,
_(
"Optional Location Constraint"));
214 wxStaticBoxSizer* itemStaticBoxSizer17 =
new wxStaticBoxSizer(itemStaticBoxSizer17Static, wxVERTICAL);
215 itemBoxSizer6->Add(itemStaticBoxSizer17, 0, wxALIGN_LEFT|wxALL, 5);
217 wxArrayString strands,
types;
218 strands.Add(
wxT(
"Any Strand"));
219 strands.Add(
wxT(
"Plus Strand"));
220 strands.Add(
wxT(
"Minus Strand"));
221 types.Add(
wxT(
"Nucleotide and protein sequences"));
222 types.Add(
wxT(
"Nucleotide sequences only"));
223 types.Add(
wxT(
"Protein sequences only"));
227 itemStaticBoxSizer17->Add(
m_ChoiceStrand, 0, wxALIGN_LEFT|wxALL, 5);
230 itemStaticBoxSizer17->Add(
m_ChoiceType, 0, wxALIGN_LEFT|wxALL, 5);
233 itemBoxSizer2->Add(OkCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
272 bool modified =
false;
281 bool remove_orphans =
true;
286 item =
m_ListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
287 if ( item == -1 )
break;
296 cmd->AddCommand(*cmd_remove_orphans);
319 list<string> non_refseq;
323 refseq.push_back(*it);
325 non_refseq.push_back(*it);
334 if (non_refseq.size()) {
335 if ( !accs.empty() ) {
341 if ( !accs.empty() ) {
349 if ( !lines.empty() ) {
350 ITERATE (list<string>, iter, lines) {
351 if (iter != lines.begin()) {
352 ostream <<
" " << *iter << endl;
354 ostream << *iter << endl;
367 list< CConstRef<CUser_object> > objs;
374 objs.push_back(sub_o);
400 ostream <<
"Model Generation Method: ";
403 method =
f->GetData().GetStr();
406 ostream <<
"<unknown>";
413 if (method ==
"Chainer" || method ==
"Gnomon") {
423 if ( !core.empty() ) {
429 if ( !core.empty() ) {
430 s =
"Model Based On: ";
432 ostream << s << endl;
454 stringstream& ostream,
const objects::CSeq_feat& feat, objects::CScope& scope)
460 ostream <<
text << endl;
464 ostream <<
"Total Range: ";
481 ostream <<
"Total Length: "
485 ostream <<
"Processed Length: "
490 if (feat.IsSetProduct()) {
495 ostream <<
"Product Length: "
515 CFeat_CI feat_it(scope, feat.GetLocation(), sel);
516 for (; feat_it ; ++feat_it) {
522 string::size_type pos = s.find_first_not_of(
" \n\r\t");
523 if( pos != string::npos ){
527 string::size_type lpos = string::npos;
530 lpos = s.find_first_of(
"\n\r", pos );
532 if( lpos == string::npos ){
533 text = s.substr( pos );
535 text = s.substr( pos, lpos - pos );
537 ostream <<
text << endl;
539 }
while( lpos != string::npos );
562 else if (subtypeAnyFlag)
566 string desc =
m_Types[pair<int,int>(
type,subtype)];
574 string desc =
m_Types[pair<int,int>(
type,subtype)];
587 CScope &scope = tse.GetScope();
589 string pattern =
m_TextCtrl->GetLineText(0).ToStdString();
601 string pattern =
m_TextCtrl_id->GetLineText(0).ToStdString();
608 for (CBioseq_Handle::TId::const_iterator idh = bsh.
GetId().begin(); idh != bsh.
GetId().end(); ++idh)
667 set_of_proteins.
insert(
id);
690 if (this_seq && top_parent && fh.IsSetProduct())
708 CBioseq_CI bi(seh, objects::CSeq_inst::eMol_na);
717 set_of_proteins.
insert(
id);
722 return static_cast<int>(set_of_proteins.
size());
733 if (
fi->IsSetProduct())
738 proteins.
insert(prot_bsh);
742 objects::CBioseq_CI b_iter(seh, objects::CSeq_inst::eMol_aa);
743 for ( ; b_iter ; ++b_iter )
746 if (proteins.
find(bsh) == proteins.
end())
757 remove_proteins =
false;
758 remove_orphans =
false;
759 if (num_proteins + num_orphans == 0)
762 if (num_orphans == 0)
764 remove_proteins =
true;
767 if (num_proteins == 0)
769 remove_orphans =
true;
772 remove_proteins =
true;
773 remove_orphans =
true;
781 bool remove_proteins =
true;
782 bool remove_orphans =
true;
788 cmd->AddCommand(*cmd_remove_orphans);
793 wxMessageBox(
_(
"No features found!"),
wxT(
"Error"),
794 wxOK | wxICON_ERROR,
NULL);
803 bool remove_proteins =
true;
804 bool remove_orphans =
true;
809 bool modified =
false;
811 for (
CFeat_CI feat1(tse); feat1; ++feat1)
813 for (
CFeat_CI feat2(tse.GetScope(),feat1->GetLocation()); feat2; ++feat2)
815 if (feat1->GetSeq_feat_Handle() < feat2->GetSeq_feat_Handle() &&
816 deleted_feats.
find(feat1->GetSeq_feat_Handle()) == deleted_feats.
end() &&
817 deleted_feats.
find(feat2->GetSeq_feat_Handle()) == deleted_feats.
end()) {
821 deleted_feats.
insert(feat2->GetSeq_feat_Handle());
830 cmd->AddCommand(*cmd_remove_orphans);
847 if (
fi->IsSetProduct())
852 proteins.
insert(prot_bsh);
856 objects::CBioseq_CI b_iter(seh, objects::CSeq_inst::eMol_aa);
857 for ( ; b_iter ; ++b_iter )
860 if (proteins.
find(bsh) == proteins.
end())
900 Create(parent,
id, caption, pos,
size, style);
911 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
912 wxDialog::Create( parent,
id, caption, pos,
size, style );
917 GetSizer()->SetSizeHints(
this);
960 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
961 itemDialog1->SetSizer(itemBoxSizer2);
965 itemBoxSizer2->Add(
m_Proteins, 0, wxALIGN_LEFT|wxALL, 5);
969 itemBoxSizer2->Add(
m_Orphans, 0, wxALIGN_LEFT|wxALL, 5);
971 wxBoxSizer* itemBoxSizer5 =
new wxBoxSizer(wxHORIZONTAL);
972 itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
974 wxButton* itemButton6 =
new wxButton( itemDialog1, wxID_OK,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
975 itemBoxSizer5->Add(itemButton6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
977 wxButton* itemButton7 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
978 itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1002 return wxNullBitmap;
~CAskToRemoveOrphansAndProteins()
Destructor.
CAskToRemoveOrphansAndProteins()
Constructors.
void Init()
Initialises member variables.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void CreateControls()
Creates the controls and sizers.
static bool ShowToolTips()
Should we show tooltips?
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Warning"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
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)
bool GetTopLevelSeqEntryAndProcessor()
void AddCommand(IEditCommand &command)
CFeatListItem - basic configuration data for one "feature" type.
string GetDescription() const
CFlatFileConfig & SetNeverTranslateCDS(bool val=true)
static string GetSeqFeatText(const CMappedFeat &feat, CScope &scope, const CFlatFileConfig &cfg, CRef< feature::CFeatTree > ftree=null)
static void RemoveDuplicateFeatures(objects::CSeq_entry_Handle tse, ICommandProccessor *processor)
static int CountProteinsBeforeRemoval(objects::CSeq_entry_Handle seh)
static void RemoveAllFeatures(CSeq_entry_Handle seh, ICommandProccessor *processor)
virtual CRef< CCmdComposite > GetCommand()
map< pair< int, int >, string > m_Types
wxTextCtrl * m_TextCtrl_id
CRemoveFeaturesDlg()
Constructors.
bool m_CollectInfoAboutProteins
static bool ShowToolTips()
Should we show tooltips?
vector< bool > m_SubtypeAnyFlag
void Init()
Initialises member variables.
void CreateControls()
Creates the controls and sizers.
static CSeq_id_Handle GetProductId(objects::CSeq_feat_Handle fh)
wxRadioButton * m_RadioButton_id
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxCheckBox * m_CheckBox_id
static CRef< CCmdComposite > RemoveOrphansRenormalizeNucProtSets(objects::CSeq_entry_Handle seh)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
bool Create(wxWindow *parent, wxWindowID id=11000, const wxString &caption=_("Remove Features"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void ApplyToCSeq_entry(objects::CSeq_entry_Handle tse, CCmdComposite *composite, string name, bool subtypeAnyFlag, bool &modified, map< objects::CBioseq_Handle, set< objects::CSeq_feat_Handle > > &product_to_cds)
wxRadioButton * m_RadioButton
wxChoice * m_ChoiceStrand
~CRemoveFeaturesDlg()
Destructor.
static int CountOrphanedProteins(objects::CSeq_entry_Handle seh)
vector< string > m_Descriptions
static void AskUser(int num_proteins, int num_orphans, bool &remove_proteins, bool &remove_orphans)
ESubtype GetSubtype(void) const
namespace ncbi::objects::
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
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
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
vector< const objects::CFeatListItem * > GetSortedFeatList(objects::CSeq_entry_Handle seh, size_t max=numeric_limits< size_t >::max())
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
EAccessionInfo
For IdentifyAccession (below)
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
ENa_strand GetStrand(void) const
Get the location's strand.
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TSeqPos GetBioseqLength(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
bool IsProtein(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
const TId & GetId(void) const
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
const CSeq_loc & GetLocation(void) const
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
const CSeq_feat_Handle & GetSeq_feat_Handle(void) const
Get original feature handle.
CConstRef< CSeq_feat > GetSeq_feat(void) const
Get current seq-feat.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
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 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.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static void Wrap(const string &str, SIZE_TYPE width, IWrapDest &dest, TWrapFlags flags, const string *prefix, const string *prefix1)
@ fWithCommas
Use commas as thousands separator.
const TStr & GetStr(void) const
Get the variant data.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
const TData & GetData(void) const
Get the Data member data.
vector< CRef< CUser_field > > TFields
const TStr & GetStr(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
const TObject & GetObject(void) const
Get the variant data.
const TLabel & GetLabel(void) const
Get the Label member data.
const TType & GetType(void) const
Get the Type member data.
vector< CStringUTF8 > TStrs
vector< CRef< CUser_field > > TData
E_Choice Which(void) const
Which variant is currently selected.
const TExts & GetExts(void) const
Get the Exts member data.
bool IsSetExt(void) const
user defined structure extension Check if a value has been assigned to Ext data member.
const TLocation & GetLocation(void) const
Get the Location member data.
const TData & GetData(void) const
Get the Data member data.
bool CanGetData(void) const
Check if it is safe to call GetData method.
bool IsSetExts(void) const
set of extensions; will replace 'ext' field Check if a value has been assigned to Exts data member.
const TExt & GetExt(void) const
Get the Ext member data.
bool IsSetLocation(void) const
feature made from Check if a value has been assigned to Location data member.
@ e_Other
for historical reasons, 'other' = 'refseq'
static void text(MDB_val *v)
range(_Ty, _Ty) -> range< _Ty >
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
double f(double x_, const double &y_)
static int match(register const pcre_uchar *eptr, register const pcre_uchar *ecode, const pcre_uchar *mstart, int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
static void s_Render_SeqFeat(stringstream &ostream, const objects::CSeq_feat &feat, objects::CScope &scope)
static void s_RenderAccList(stringstream &ostream, const CUser_field::TData::TStrs &item_data, const string &title)
static void s_Render_Feat_Evidence(stringstream &ostream, const CSeq_feat &feat, CScope &)
#define ID_RMVPROTEINS_CHECKBOX
#define ID_REMOVE_FEATURES_RADIOBUTTON
#define ID_REMOVE_FEATURES_CHECKBOX1
#define ID_REMOVE_FEATURES_CHECKBOX
#define ID_REMOVE_FEATURES_TEXTCTRL1
#define ID_REMOVE_FEATURES_RADIOBUTTON2
#define ID_REMOVE_FEATURES_OKCANCEL
#define ID_REMOVE_FEATURES_RADIOBUTTON1
#define ID_REMOVE_FEATURES_CHOICE2
#define ID_REMOVE_FEATURES_CHOICE1
#define ID_REMOVE_FEATURES_TEXTCTRL
#define ID_REMOVE_FEATURES_RADIOBUTTON3
#define ID_RMVPROTEINS_CHECKBOX1
static const char * str(char *buf, int n)
static const struct type types[]
void GetProductToCDSMap(objects::CScope &scope, map< objects::CBioseq_Handle, set< objects::CSeq_feat_Handle > > &product_to_cds)
CRef< CCmdComposite > GetDeleteAllFeaturesCommand(objects::CSeq_entry_Handle seh, size_t &count, bool remove_proteins=true)
CRef< CCmdComposite > GetDeleteFeatureCommand(const objects::CSeq_feat_Handle &fh, bool remove_proteins=true)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)