: m_UpdMultiSeqInput(0), m_Updated(0), m_Skipped(0)
101wxWindowID
id,
constwxString& caption,
constwxPoint& pos,
constwxSize&
size,
longstyle)
102: m_UpdMultiSeqInput(&updmultiseq_in), m_UpdateCmd(
cmd), m_Updated(0), m_Skipped(0)
105 Create(parent,
id, caption, pos,
size, style);
111 size_tidentNum =
input.GetIdenticalUpdates().size();
116 size_tnonIdentNum =
input.GetNonIdenticalUpdates().size();
119oss <<
"One sequence out of "<< identNum + nonIdentNum <<
" is identical to its update sequence.";
121 else if(identNum > 1) {
122oss << identNum <<
" sequences out of ";
123oss << identNum + nonIdentNum <<
" are identical to their update sequences.";
127 for(
auto&& it :
input.GetIdenticalUpdates()) {
140 constwxPoint& pos,
constwxSize&
size,
longstyle )
143SetExtraStyle(wxWS_EX_BLOCK_EVENTS | wxWS_EX_VALIDATE_RECURSIVELY);
144CDialog::Create( parent,
id, caption, pos,
size, style );
149GetSizer()->SetSizeHints(
this);
197wxBoxSizer* itemBoxSizer2 =
newwxBoxSizer(wxVERTICAL);
198itemDialog1->SetSizer(itemBoxSizer2);
200wxBoxSizer* itemBoxSizer3 =
newwxBoxSizer(wxHORIZONTAL);
201itemBoxSizer2->Add(itemBoxSizer3, 1, wxEXPAND | wxALL, 5);
203 m_Notebook=
newwxNotebook( itemDialog1,
ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_TOP );
205wxPanel* itemPanel5 =
newwxPanel(
m_Notebook,
ID_PANEL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
206wxBoxSizer* itemBoxSizer6 =
newwxBoxSizer(wxVERTICAL);
207itemPanel5->SetSizer(itemBoxSizer6);
210wxStaticText* itemStaticText7 =
newwxStaticText( itemPanel5, wxID_STATIC,
_(
"Nonidentical updates"), wxDefaultPosition, wxDefaultSize, 0 );
211itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
213wxArrayString m_NonIdenticalListStrings;
221wxStaticText* itemStaticText9 =
newwxStaticText( itemPanel5, wxID_STATIC,
_(
"Identical updates"), wxDefaultPosition, wxDefaultSize, 0 );
222itemBoxSizer6->Add(itemStaticText9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
224wxArrayString m_IdenticalListStrings;
237wxPanel* itemPanel12 =
newwxPanel(
m_Notebook,
ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
238wxBoxSizer* itemBoxSizer13 =
newwxBoxSizer(wxVERTICAL);
239itemPanel12->SetSizer(itemBoxSizer13);
241wxStaticText* itemStaticText14 =
newwxStaticText( itemPanel12, wxID_STATIC,
_(
"No updates"), wxDefaultPosition, wxDefaultSize, 0 );
242itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
244wxArrayString m_NoUpdateListStrings;
249wxStaticText* itemStaticText16 =
newwxStaticText( itemPanel12, wxID_STATIC,
_(
"Unmatched sequences"), wxDefaultPosition, wxDefaultSize, 0 );
250itemBoxSizer13->Add(itemStaticText16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
252wxArrayString m_UnmatchedListStrings;
257wxBoxSizer* itemBoxSizer18 =
newwxBoxSizer(wxHORIZONTAL);
258itemBoxSizer13->Add(itemBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
260itemBoxSizer18->Add(
m_LoadMap, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
263itemBoxSizer18->Add(
m_MapSelection, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
267itemBoxSizer3->Add(
m_Notebook, 0, wxGROW|wxALL, 2);
287wxBoxSizer* itemBoxSizer22 =
newwxBoxSizer(wxHORIZONTAL);
288itemBoxSizer2->Add(itemBoxSizer22, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
290wxButton* itemButton23 =
newwxButton( itemDialog1,
ID_UPDMULTSEQ_OKTHIS,
_(
"Update This Sequence"), wxDefaultPosition, wxDefaultSize, 0 );
291itemBoxSizer22->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
293wxButton* itemButton24 =
newwxButton( itemDialog1,
ID_UPDMULTSEQ_SKIP,
_(
"Skip This Sequence"), wxDefaultPosition, wxDefaultSize, 0 );
294itemBoxSizer22->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
296wxButton* itemButton25 =
newwxButton( itemDialog1,
ID_UPDMULTSEQ_OKALL,
_(
"Update All Sequences"), wxDefaultPosition, wxDefaultSize, 0 );
297itemBoxSizer22->Add(itemButton25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
299wxButton* itemButton26 =
newwxButton( itemDialog1,
ID_UPDMULTSEQ_STOP,
_(
"Stop Updating"), wxDefaultPosition, wxDefaultSize, 0 );
300itemBoxSizer22->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
302wxButton* itemButton27 =
newwxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
303itemBoxSizer22->Add(itemButton27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
309itemButton23->Disable();
310itemButton24->Disable();
311itemButton25->Disable();
327 for(
auto&& it : updates) {
341 for(
auto&& it : identicals) {
353 for(
auto&& it : noUpdates) {
364 for(
auto&& it : noUpdates) {
393 statictuple<objects::CSeq_id_Handle, CConstRef<objects::CSeq_align> >
s_CreateAlign(
405 boolaccept_atleast_one = (
subject.GetBioseqLength() <
query.GetBioseqLength());
409 if(align_vector.size() > 1)
410 LOG_POST(
Info<<
"More than one alignment was found");
412 if(align_vector.empty())
413 LOG_POST(
Info<<
"Could not form alignment between old and update sequence");
416 size_tbest_align = 0;
417 for(
size_t i= 0;
i< align_vector.size(); ++
i) {
418 for(
size_tj =
i+ 1; j < align_vector.size(); ++j) {
422 _ASSERT(best_align < align_vector.size());
423std::get<1>(
result) = align_vector[best_align];
426}
NCBI_CATCH(
"CUpdateMultiSeq_Dlg::s_CreateAlign()");
441 if(it->IsComplete()) {
444 auto& res = (*it)();
449upd_input->
SetAlignment(std::get<1>(res).GetPointerOrNull());
453 if(!seq_name.empty()) {
455 if(idh_it !=
m_SeqList.
end() && idh_it->second == idH)
487 for(
auto&& it : ident_updates) {
489 if(annot && annot->
IsAlign()) {
498 for(
const auto& it : updates) {
500[idH = it.first,
subject= it.second->GetOldBioseq(),
query= it.second->GetUpdateBioseq()](
ICanceled& canceled)
502return s_CreateAlign(idH, subject, query, canceled);
503},
"Update Sequence Align"));
510 for(
auto&& it : update_pairs) {
520 if(annot && annot->
IsAlign()) {
528return s_CreateAlign(idH, subject, query, canceled);
529},
"Update Sequence Align"));
584 intselected = wxNOT_FOUND;
588 if(selected != wxNOT_FOUND) {
593 if(seq_name.empty()) {
596 if(selected != wxNOT_FOUND) {
606 if(seq_name.empty())
611wxMessageBox(
wxT(
"This sequence could not be updated!"),
wxT(
"Info"), wxOK | wxICON_INFORMATION);
616 if(upd_input.
IsNull()) {
617wxMessageBox(
wxT(
"This sequence could not be updated!"),
wxT(
"Info"), wxOK | wxICON_INFORMATION);
632 event.Enable(
false);
638 event.Enable(
false);
641 event.Enable(
true);
647 if(selected != wxNOT_FOUND) {
660 if(selected != wxNOT_FOUND) {
676 for(
auto&& it : identicals) {
684wxString ext =
wxT(
"Text Documents (*.txt)|*.txt|All Files (*.*)|*.*");
685wxFileDialog open_dlg(
this,
wxT(
"Select a file"), wxEmptyString, wxEmptyString, ext, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
686 if(open_dlg.ShowModal() == wxID_CANCEL) {
690wxString filename = open_dlg.GetPath();
693 if(line_reader.
Empty()) {
700 autopos = s.first.
find(
'.');
701 if(string::npos != pos)
702unmatchedOldSeqs.emplace(s.first.substr(0, pos), s.second);
705vector<string> ignored_lines;
708 while(!line_reader->
AtEOF()) {
714 for(
auto&& it : ids) {
718 if(ids.size() != 2) {
719ignored_lines.push_back(line);
724 autooldidh_it = unmatchedOldSeqs.find(ids[0]);
726 if(oldidh_it == unmatchedOldSeqs.end()) {
728oldidh_it = unmatchedOldSeqs.find(ids[1]);
734ignored_lines.push_back(line);
738 if(oldidh_it == unmatchedOldSeqs.end()) {
739 NcbiMessageBox(
"Old sequence id "+ ids[1] +
" was not found.");
740ignored_lines.push_back(line);
744update_pairs.emplace(oldidh_it->second, updidh_it->second);
752 for(
auto&& it : update_pairs) {
758 if(nonident_updates.
find(old_idh) != nonident_updates.
end()) {
759 m_SeqList.emplace(old_id_label, old_idh);
764 if(identicals.
find(old_idh) != identicals.
end()) {
765 m_SeqList.emplace(old_id_label, old_idh);
784 if(!ignored_lines.empty()) {
785 string msg=
"These lines were ignored:";
786 for(
auto&& it : ignored_lines) {
788 msg.push_back(
'"');
790 msg.push_back(
'"');
801 if(noupdate_sel == wxNOT_FOUND || unmatched_sel == wxNOT_FOUND) {
802 NcbiMessageBox(
"Please select one ID from each of the above two lists.");
819pair.emplace(oldidh_it->second, updidh_it->second);
829 if(nonident_updates.
find(old_idh) != nonident_updates.
end()) {
835 if(identicals.
find(old_idh) != identicals.
end()) {
872 if(selectNonIdent == wxNOT_FOUND && selectIdent == wxNOT_FOUND) {
873wxMessageBox(
wxT(
"No sequence was selected!"),
wxT(
"Info"), wxOK | wxICON_INFORMATION);
878 if(selectNonIdent != wxNOT_FOUND) {
883 else if(selectIdent != wxNOT_FOUND) {
902 if(seq_name.empty())
907wxMessageBox(
wxT(
"This sequence could not be updated!"),
wxT(
"Error"), wxOK | wxICON_INFORMATION);
943 if(selectNonIdent == wxNOT_FOUND && selectIdent == wxNOT_FOUND) {
944wxMessageBox(
wxT(
"No sequence was selected!"),
wxT(
"Info"), wxOK | wxICON_INFORMATION);
948 if(selectNonIdent != wxNOT_FOUND) {
952 else if(selectIdent != wxNOT_FOUND) {
966 stringseq_name =
ToStdString(sel_list.GetString(selected));
969wxMessageBox(
wxT(
"This sequence could not be skipped!"),
wxT(
"Info"), wxOK | wxICON_INFORMATION);
974sel_list.Delete(selected);
975 if( ! sel_list.IsEmpty()) {
976 if(selected > sel_list.GetCount() - 1) {
977selected = sel_list.GetCount() - 1;
979sel_list.SetSelection(selected);
980seq_name =
ToStdString(sel_list.GetString(selected));
983 else if(other_list && !other_list->IsEmpty()) {
984other_list->SetSelection(0);
985seq_name =
ToStdString(other_list->GetString(selected));
996 for(
unsigned intselected = 0; selected <
m_NonIdenticalList->GetCount(); ++selected) {
1011 for(
unsigned intselected = 0; selected <
m_IdenticalList->GetCount(); ++selected) {
1050oss <<
", "<<
m_Skipped<<
" skipped";
1057 if(!
msg.empty()) {
1058wxMessageBox(
ToWxString(
msg),
wxT(
"Info"), wxOK | wxICON_INFORMATION);
1064 intretcode = (
m_Updated> 0) ? wxOK : wxCLOSE;
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
void AddCommand(IEditCommand &command)
virtual void EndModal(int retCode)
virtual void SetRegistryPath(const string &path)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
class CRegistryReadView provides a nested hierarchical view at a particular key.
CRegistryReadView GetReadView(const string §ion) const
CRegistryWriteView GetWriteView(const string §ion)
Sequence update exception class.
Class responsible for executing the sequence update for one old-update sequence pair.
bool IsReverseComplemented() const
void GetNotImportedFeatsReport(CNcbiOstream &out) const
CRef< CCmdComposite > Update(bool create_general_only)
Main function responsible to update the old sequence with the update sequence.
TNameToIDHandleMap m_UnmatchedUpdSeqs
wxButton * m_MapSelection
wxListBox * m_UnmatchedList
void OnIdle(wxIdleEvent &event)
virtual void x_SaveSettings(CRegistryWriteView view) const
void x_CreatePairwiseAlignments()
void x_FillNoUpdateList()
void x_LaunchJobs(const CUpdateMultipleSeq_Input::TIDToUpdInputMap &updates)
CRef< CCmdComposite > x_UpdateSelected(const string &seq_name, bool create_general_only)
CUpdateMultipleSeq_Input * m_UpdMultiSeqInput
void OnUpdateAllSequenceClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_OKALL
wxListBox * m_NoUpdateList
virtual void x_LoadSettings(const CRegistryReadView &view)
override these functions in derived classes
void x_SkipSelected(wxListBox &sel_list, unsigned int selected, wxListBox *other_list)
void x_CreateAlignmentForIdenticalUpdates()
void OnStopUpdatingClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_STOP
TNameToIDHandleMap m_SeqList
void x_FillNonIdenticalList()
string x_GetCurrentSelection()
static bool ShowToolTips()
Should we show tooltips?
static void s_ReportIdenticalPairs(const CUpdateMultipleSeq_Input &input)
void x_FillIdenticalList()
void OnUpdateThisSequenceClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_OKTHIS
void OnMapSelectionUpdate(wxUpdateUIEvent &event)
void Init()
Initialises member variables.
void OnSkipThisSequenceClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_SKIP
@ ID_UPDMULTSEQ_PNL2_LISTBOX1
@ ID_UPDMULTSEQ_PNL1_LISTBOX2
@ ID_UPDMULTSEQ_PNL2_BTN1
@ ID_UPDMULTSEQ_PNL2_LISTBOX2
@ ID_UPDMULTSEQ_PNL1_LISTBOX1
@ ID_UPDMULTSEQ_PNL2_BTN2
void x_GenerateAlignments(const CUpdateMultipleSeq_Input::TOldToUpdateMap &update_pairs)
void x_FillUnmatchedList()
CUpdateMultiSeq_Dlg()
Constructors.
static string s_GetSeqIDLabel(const objects::CSeq_id_Handle &idh)
void OnIdentSeqSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_UPDMULTSEQ_PNL1_LISTBOX2
set< objects::CSeq_id_Handle > m_Running
void OnLoadMapClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_PNL2_BTN1
list< job_future< TAlignResult > > m_Futures
~CUpdateMultiSeq_Dlg()
Destructor.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_CUPDATEMULTISEQ_DLG
wxListBox * m_IdenticalList
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnMapSelectionClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_PNL2_BTN2
void OnCancelClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
wxButton * m_IdenticalUpdBtn
void x_UpdateAlignmentPanel(const string &seq_name)
wxListBox * m_NonIdenticalList
void OnNonIdentSeqSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_UPDMULTSEQ_PNL1_LISTBOX1
void OnRemoveIdenticalsClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_PNL1_BTN
CUpdateSeqPanel * m_UpdSeqPanel
void OnRemoveIdenticalUpdate(wxUpdateUIEvent &event)
TNameToIDHandleMap m_UnmatchedOldSeqs
CRef< CCmdComposite > m_UpdateCmd
bool Create(wxWindow *parent, wxWindowID id=ID_CUPDATEMULTISEQ_DLG, const wxString &caption=_("Multiple Sequence Update"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void CreateControls()
Creates the controls and sizers.
void x_UpdateNotebookAfterMapping(void)
const TSeqIDHVector & GetSeqsWithoutUpdates() const
const TIDToUpdInputMap & GetNonIdenticalUpdates() const
vector< objects::CSeq_id_Handle > TSeqIDHVector
bool HaveIdenticalResidues(const objects::CSeq_id_Handle &idh1, const objects::CSeq_id_Handle &idh2)
CRef< CUpdateSeq_Input > GetUpdateInput(const objects::CSeq_id_Handle &idh) const
const TSeqIDHVector & GetUnmatchedUpdateSeqs() const
const TIDToUpdInputMap & GetIdenticalUpdates() const
void PrepareMultipleSequenceInputs()
bool AppendOld_UpdateSeqPairs(const TOldToUpdateMap &update_pairs)
objects::CSeq_entry_Handle GetOldEntry()
SUpdateSeqParams GetData()
void LoadSettings(const CRegistryReadView &view)
void SaveSettings(CRegistryWriteView view) const
void UpdatePanel(bool running, const CUpdateSeq_Input *updseq_in=nullptr)
Function updates the panel with new (old, update) sequence pair.
void SetData(const SUpdateSeqParams ¶ms)
void SetAlignment(const objects::CSeq_align *align)
static CRef< objects::CSeq_annot > s_Align2IdenticalSeq(const objects::CBioseq_Handle &subject, const objects::CBioseq_Handle &query)
const objects::CBioseq_Handle & GetUpdateBioseq(void) const
const objects::CBioseq_Handle & GetOldBioseq(void) const
Interface for testing cancellation request in a long lasting operation.
Stores parameters regarding the type of sequence update, on how to handle existing features and on ho...
@ eSeqUpdateReplace
do not change the old sequence
const_iterator end() const
const_iterator find(const key_type &key) const
static bool CompareAlignments(const objects::CSeq_align &align_first, const objects::CSeq_align &align_sec)
Returns true if the first alignment is 'better' than the second one Compares the Blast scores and in ...
static vector< CConstRef< objects::CSeq_align > > RunBlast2Seq(const objects::CBioseq_Handle &subject, const objects::CBioseq_Handle &query, bool accept_atleast_one, ICanceled *canceled=nullptr)
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
const string & GetMsg(void) const
Get message string.
void Info(CExceptionArgs_Base &args)
EDialogReturnValue NcbiInfoBox(const string &message, const string &title="Info")
specialized Message Box function for reporting general information messages
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
CTempString GetCurrentLine(void) const
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
virtual bool AtEOF(void) const =0
Indicates (negatively) whether there is any more input.
CConstRef< CSeq_id > GetSeqId(void) const
@ eContent
Untagged human-readable accession or the like.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
bool IsNull(void) const THROWS_NONE
Check if pointer is null â same effect as Empty().
bool Empty(void) const THROWS_NONE
Check if CRef is empty â not pointing to any object, which means having a null value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
bool IsOssEmpty(CNcbiOstrstream &oss)
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
static const char label[]
const TAlign & GetAlign(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
job_function_traits< _Fty >::future job_async(const _Fty &_Fnarg, const string &descr)
Lightweight interface for getting lines of data with minimal memory copying.
void ReportUsage(const wxString &dialog_name)
Report opening & accepting events in the editing package.
const struct ncbi::grid::netcache::search::fields::SIZE size
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static tuple< objects::CSeq_id_Handle, CConstRef< objects::CSeq_align > > s_CreateAlign(CSeq_id_Handle idH, CBioseq_Handle subject, CBioseq_Handle query, ICanceled &canceled)
wxString ToWxString(const string &s)
string ToStdString(const wxString &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