50 #include <wx/button.h>
68 if (
label == name) found =
true;
75 static bool GetIds(
const T& d,
set<string> &labels,
const string name =
"",
bool detect =
false,
bool found =
false)
78 for (
typename T::TIds::const_iterator id_iter = d.GetIds().begin(); id_iter != d.GetIds().end(); ++id_iter)
79 found =
GetIdLabel(**id_iter, labels, name, detect, found);
84 static bool GetSeqId(
const T& d,
set<string> &labels,
const string name =
"",
bool detect =
false,
bool found =
false)
87 found =
GetIdLabel(d.GetId(), labels, name, detect, found);
108 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
112 Create(parent,
id, caption, pos,
size, style);
117 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
118 wxDialog::Create( parent,
id, caption, pos,
size, style );
123 GetSizer()->SetSizeHints(
this);
127 SetSize(wxSize(280, 600));
159 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
160 itemDialog1->SetSizer(itemBoxSizer2);
162 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
163 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
166 itemBoxSizer3->Add(
m_ListCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 m_ListCtrl->InsertColumn(0,
" Sequence ID",wxLIST_FORMAT_LEFT,237);
176 wxBoxSizer* itemBoxSizer12 =
new wxBoxSizer(wxHORIZONTAL);
177 itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
179 wxButton* itemButton13 =
new wxButton( itemDialog1, wxID_OK,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
180 itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
182 wxButton* itemButton14 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
183 itemBoxSizer12->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
227 for (CSeq_annot::C_Data::TAlign::iterator
a=aligns.begin();
a!=aligns.end();
a++)
244 for (CStd_seg::TLoc::const_iterator
l = locs.begin();
l != locs.end(); ++
l)
257 if (loc.GetPacked_int().CanGet())
258 for (CPacked_seqint::Tdata::const_iterator d = loc.GetPacked_int().Get().begin(); d != loc.GetPacked_int().Get().end(); ++d)
259 found =
GetSeqId(**d, labels, name, detect, found);
264 if (loc.GetMix().CanGet())
265 for (CSeq_loc_mix::Tdata::const_iterator d = loc.GetMix().Get().begin(); d != loc.GetMix().Get().end(); ++d)
269 if (loc.GetEquiv().CanGet())
270 for (CSeq_loc_equiv::Tdata::const_iterator d = loc.GetEquiv().Get().begin(); d != loc.GetEquiv().Get().end(); ++d)
274 if (loc.GetBond().CanGetA())
275 found =
GetSeqId(loc.GetBond().GetA(), labels, name, detect, found);
300 if (!(*d)->IsSetIds() && (*d)->IsSetLoc())
347 rem = rem ||
GetIds(**d, labels, name,
true);
362 if (!(*d)->IsSetIds() && (*d)->IsSetLoc())
365 if ((*d)->IsSetIds())
366 dim =
static_cast<int>((*d)->GetIds().size());
367 else if ( (*d)->IsSetDim() )
368 dim = (*d)->GetDim();
369 rem = rem || (
find_id && dim == 2);
391 unsigned int num = 0;
395 if ((*d)->IsSetFirst_id()) found =
GetIdLabel((*d)->GetFirst_id(), labels, name,
true);
396 if ((*d)->IsSetSecond_id()) found = found ||
GetIdLabel((*d)->GetSecond_id(), labels, name,
true);
400 else if (num > 0 ) modified =
true;
414 vector<string>
names;
418 item =
m_ListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
419 if ( item == -1 )
break;
421 names.push_back(name);
435 unsigned int index = 0;
440 if (
GetIdLabel(**id_iter, labels, name,
true)) found =
true;
441 else ids.push_back(*id_iter);
451 CDense_seg::TStarts::const_iterator start_iter;
453 CDense_seg::TStrands::const_iterator strand_iter;
458 for (
unsigned int seg = 0; seg<numseg; seg++)
459 for (
unsigned int i=0;
i<dim;
i++)
464 starts.push_back(*start_iter);
469 strands.push_back(*strand_iter);
489 align->
SetSegs().SetDenseg().SetIds().swap(ids);
490 align->
SetSegs().SetDenseg().RemovePureGapSegs();
495 CSeq_align::C_Segs::TSparse::TRows rows;
496 CSeq_align::C_Segs::TSparse::TRow_scores row_scores;
497 CSeq_align::C_Segs::TSparse::TExt ext;
502 if ((*d)->IsSetFirst_id()) found =
GetIdLabel((*d)->GetFirst_id(), labels, name,
true);
503 if ((*d)->IsSetSecond_id()) found = found ||
GetIdLabel((*d)->GetSecond_id(), labels, name,
true);
512 align->
SetSegs().SetSparse().SetRows().swap(rows);
525 for (
CAlign_CI align_ci(*it); align_ci; ++align_ci, ++total)
527 bool modified =
false;
528 bool to_delete =
false;
529 for (
auto name :
names)
530 to_delete |=
RemoveIdLabel(align_ci.GetOriginalSeq_align(), name, modified);
532 if (!to_delete && modified)
535 edited_align->
Assign(align_ci.GetOriginalSeq_align());
536 for (
auto name :
names)
554 if (deleted == total && it->IsAlign())
void AddCommand(IEditCommand &command)
static void ApplyToCSeq_entry(objects::CSeq_entry_Handle tse, CCmdComposite *composite, const vector< string > &names)
void SearchSeq_entry(objects::CSeq_entry_Handle tse, const CSeq_entry &se)
CRemoveSeqFromAlignDlg()
Constructors.
static void ModifyAlign(CRef< CSeq_align > align, const string name)
static bool GetIdsFromLocs(const CStd_seg::TLoc &locs, set< string > &labels, const string name="", bool detect=false, bool found=false)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
static bool RemoveIdLabel(const CSeq_align &align, string name, bool &modified)
CRef< CCmdComposite > GetCommand()
~CRemoveSeqFromAlignDlg()
Destructor.
void CreateControls()
Creates the controls and sizers.
static bool ShowToolTips()
Should we show tooltips?
bool Create(wxWindow *parent, wxWindowID id=12000, const wxString &caption=_("Remove Sequences From Alignments"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void Init()
Initialises member variables.
objects::CSeq_entry_Handle m_TopSeqEntry
static bool GetIdsFromLoc(const CSeq_loc &loc, set< string > &labels, const string name="", bool detect=false, bool found=false)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void GetAlignLabel(const CSeq_align &align)
TDim CheckNumRows(void) const
Validatiors.
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator end() const
TIDRefCont::const_iterator find_id(const TIDRefCont &cont, const IHitSeqId &id)
static const struct name_t names[]
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CSeq_entry_Handle GetSeq_entryHandle(CDataLoader *loader, const TBlobId &blob_id, EMissing action=eMissing_Default)
Get Seq-entry handle by its blob-id, with possible loading.
CScope & GetScope(void) const
Get scope this handle belongs to.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
const TDenseg & GetDenseg(void) const
Get the variant data.
const TExt & GetExt(void) const
Get the Ext member data.
vector< CRef< CSeq_loc > > TLoc
const TGenomic_id & GetGenomic_id(void) const
Get the Genomic_id member data.
bool IsSetNumseg(void) const
number of segments here Check if a value has been assigned to Numseg data member.
E_Choice Which(void) const
Which variant is currently selected.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
const TStarts & GetStarts(void) const
Get the Starts member data.
const TProduct_id & GetProduct_id(void) const
Get the Product_id member data.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
vector< ENa_strand > TStrands
bool IsSetSegs(void) const
Check if a value has been assigned to Segs data member.
void SetDim(TDim value)
Assign a value to Dim data member.
vector< TSignedSeqPos > TStarts
vector< CRef< CSeq_id > > TIds
bool IsSetProduct_id(void) const
product is either protein or transcript (cDNA) Check if a value has been assigned to Product_id data ...
const TSpliced & GetSpliced(void) const
Get the variant data.
const TPacked & GetPacked(void) const
Get the variant data.
const TStd & GetStd(void) const
Get the variant data.
const TIds & GetIds(void) const
Get the Ids member data.
const TDendiag & GetDendiag(void) const
Get the variant data.
bool IsSetStarts(void) const
start OFFSETS in ids order within segs Check if a value has been assigned to Starts data member.
const TRow_scores & GetRow_scores(void) const
Get the Row_scores member data.
const TIds & GetIds(void) const
Get the Ids member data.
bool IsSetExt(void) const
index of extra items Check if a value has been assigned to Ext data member.
TNumseg GetNumseg(void) const
Get the Numseg member data.
const TSparse & GetSparse(void) const
Get the variant data.
const TRows & GetRows(void) const
Get the Rows member data.
const TDisc & GetDisc(void) const
Get the variant data.
const TStrands & GetStrands(void) const
Get the Strands member data.
const Tdata & Get(void) const
Get the member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
bool IsSetRow_scores(void) const
per-row scores Check if a value has been assigned to Row_scores data member.
bool IsSetRows(void) const
pairwise alignments constituting this multiple alignment Check if a value has been assigned to Rows d...
bool IsSetGenomic_id(void) const
Check if a value has been assigned to Genomic_id data member.
@ e_Equiv
equivalent sets of locations
@ e_Empty
to NULL one Seq-id in a collection
@ e_Feat
indirect, through a Seq-feat
const TSet & GetSet(void) const
Get the variant data.
bool IsSet(void) const
Check if variant Set is selected.
bool IsAlign(void) const
Check if variant Align is selected.
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
list< CRef< CSeq_align > > TAlign
const TAlign & GetAlign(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
const struct ncbi::grid::netcache::search::fields::SIZE size
static bool GetIds(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
static bool GetIdLabel(const CSeq_id &id, set< string > &labels, const string name="", bool detect=false, bool found=false)
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
#define ID_LISTCTRL_SEQ_ALIGN
#define FOR_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
FOR_EACH_SEQENTRY_ON_SEQSET EDIT_EACH_SEQENTRY_ON_SEQSET.
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)