NCBI C++ ToolKit
update_multi_seq_dlg.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: update_multi_seq_dlg.cpp 43773 2019-08-29 17:37:48Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Andrea Asztalos
27  */
28 
29 #include <ncbi_pch.hpp>
34 #include <util/line_reader.hpp>
38 #include "update_seq_panel.hpp"
43 
44 #include <wx/sizer.h>
45 #include <wx/button.h>
46 #include <wx/listbox.h>
47 #include <wx/notebook.h>
48 #include <wx/msgdlg.h>
49 #include <wx/filedlg.h>
50 #include <wx/wupdlock.h>
51 
54 
55 /*!
56  * CUpdateMultiSeq_Dlg type definition
57  */
58 
59 IMPLEMENT_DYNAMIC_CLASS( CUpdateMultiSeq_Dlg, CDialog )
60 
61 
62 /*!
63  * CUpdateMultiSeq_Dlg event table definition
64  */
65 
66 BEGIN_EVENT_TABLE( CUpdateMultiSeq_Dlg, CDialog )
67 ////@begin CUpdateMultiSeq_Dlg event table entries
69  EVT_LISTBOX( ID_UPDMULTSEQ_PNL1_LISTBOX1, CUpdateMultiSeq_Dlg::OnNonIdentSeqSelected )
70  EVT_LISTBOX( ID_UPDMULTSEQ_PNL1_LISTBOX2, CUpdateMultiSeq_Dlg::OnIdentSeqSelected )
71  EVT_BUTTON( ID_UPDMULTSEQ_PNL1_BTN, CUpdateMultiSeq_Dlg::OnRemoveIdenticalsClick )
72  EVT_BUTTON( ID_UPDMULTSEQ_PNL2_BTN1, CUpdateMultiSeq_Dlg::OnLoadMapClick )
73  EVT_BUTTON( ID_UPDMULTSEQ_PNL2_BTN2, CUpdateMultiSeq_Dlg::OnMapSelectionClick )
74 
75  EVT_BUTTON( ID_UPDMULTSEQ_OKTHIS, CUpdateMultiSeq_Dlg::OnUpdateThisSequenceClick )
76  EVT_BUTTON( ID_UPDMULTSEQ_SKIP, CUpdateMultiSeq_Dlg::OnSkipThisSequenceClick )
77  EVT_BUTTON( ID_UPDMULTSEQ_OKALL, CUpdateMultiSeq_Dlg::OnUpdateAllSequenceClick )
78  EVT_BUTTON( ID_UPDMULTSEQ_STOP, CUpdateMultiSeq_Dlg::OnStopUpdatingClick )
79  EVT_BUTTON( wxID_CANCEL, CUpdateMultiSeq_Dlg::OnCancelClick )
80 
83 
84 ////@end CUpdateMultiSeq_Dlg event table entries
85 
88 
89 
90 /*!
91  * CUpdateMultiSeq_Dlg constructors
92  */
93 
95  : m_UpdMultiSeqInput(0), m_Updated(0), m_Skipped(0)
96 {
97  Init();
98 }
99 
101  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style)
102  : m_UpdMultiSeqInput(&updmultiseq_in), m_UpdateCmd(cmd), m_Updated(0), m_Skipped(0)
103 {
104  Init();
105  Create(parent, id, caption, pos, size, style);
107 }
108 
110 {
111  size_t identNum = input.GetIdenticalUpdates().size();
112  if (identNum == 0) {
113  return;
114  }
115 
116  size_t nonIdentNum = input.GetNonIdenticalUpdates().size();
117  CNcbiOstrstream oss;
118  if (identNum == 1) {
119  oss << "One sequence out of " << identNum + nonIdentNum << " is identical to its update sequence.";
120  }
121  else if (identNum > 1) {
122  oss << identNum << " sequences out of ";
123  oss << identNum + nonIdentNum << " are identical to their update sequences.";
124  }
125 
126  string msg;
127  for (auto&& it : input.GetIdenticalUpdates()) {
128  msg.append(s_GetSeqIDLabel(it.first));
129  msg.append("\n");
130  }
131 
132  wxMessageBox(ToWxString(CNcbiOstrstreamToString(oss)), wxT("Info"), wxOK | wxICON_INFORMATION);
133 }
134 
135 /*!
136  * CUpdateMultiSeq_Dlg creator
137  */
138 
139 bool CUpdateMultiSeq_Dlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption,
140  const wxPoint& pos, const wxSize& size, long style )
141 {
142 ////@begin CUpdateMultiSeq_Dlg creation
143  SetExtraStyle(wxWS_EX_BLOCK_EVENTS | wxWS_EX_VALIDATE_RECURSIVELY);
144  CDialog::Create( parent, id, caption, pos, size, style );
145 
146  CreateControls();
147  if (GetSizer())
148  {
149  GetSizer()->SetSizeHints(this);
150  }
151  Centre();
152 
154 ////@end CUpdateMultiSeq_Dlg creation
155  return true;
156 }
157 
158 
159 /*!
160  * CUpdateMultiSeq_Dlg destructor
161  */
162 
164 {
165 }
166 
167 
168 /*!
169  * Member initialisation
170  */
171 
173 {
174 ////@begin CUpdateMultiSeq_Dlg member initialisation
175  m_Notebook = NULL;
181  m_LoadMap = NULL;
184 ////@end CUpdateMultiSeq_Dlg member initialisation
185 }
186 
187 
188 /*!
189  * Control creation for CUpdateMultiSeq_Dlg
190  */
191 
193 {
194 ////@begin CUpdateMultiSeq_Dlg content construction
195  CUpdateMultiSeq_Dlg* itemDialog1 = this;
196 
197  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
198  itemDialog1->SetSizer(itemBoxSizer2);
199 
200  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
201  itemBoxSizer2->Add(itemBoxSizer3, 1, wxEXPAND | wxALL, 5);
202 
203  m_Notebook = new wxNotebook( itemDialog1, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_TOP );
204 
205  wxPanel* itemPanel5 = new wxPanel( m_Notebook, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
206  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
207  itemPanel5->SetSizer(itemBoxSizer6);
209 
210  wxStaticText* itemStaticText7 = new wxStaticText( itemPanel5, wxID_STATIC, _("Nonidentical updates"), wxDefaultPosition, wxDefaultSize, 0 );
211  itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
212 
213  wxArrayString m_NonIdenticalListStrings;
214  m_NonIdenticalList = new wxListBox( itemPanel5, ID_UPDMULTSEQ_PNL1_LISTBOX1, wxDefaultPosition, wxDefaultSize, m_NonIdenticalListStrings, wxLB_SINGLE | wxLB_SORT);
215  itemBoxSizer6->Add(m_NonIdenticalList, 1, wxEXPAND | wxALL, 5);
217  if (!m_NonIdenticalList->IsEmpty()) {
218  m_NonIdenticalList->SetSelection(0);
219  }
220 
221  wxStaticText* itemStaticText9 = new wxStaticText( itemPanel5, wxID_STATIC, _("Identical updates"), wxDefaultPosition, wxDefaultSize, 0 );
222  itemBoxSizer6->Add(itemStaticText9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
223 
224  wxArrayString m_IdenticalListStrings;
225  m_IdenticalList = new wxListBox(itemPanel5, ID_UPDMULTSEQ_PNL1_LISTBOX2, wxDefaultPosition, wxDefaultSize, m_IdenticalListStrings, wxLB_SINGLE | wxLB_SORT);
226  itemBoxSizer6->Add(m_IdenticalList, 1, wxEXPAND | wxALL, 5);
228  if (m_NonIdenticalList->IsEmpty() && !m_IdenticalList->IsEmpty()) {
229  m_IdenticalList->SetSelection(0);
230  }
231 
232  m_IdenticalUpdBtn = new wxButton( itemPanel5, ID_UPDMULTSEQ_PNL1_BTN, _("Remove Identical Updates"), wxDefaultPosition, wxDefaultSize, 0 );
233  itemBoxSizer6->Add(m_IdenticalUpdBtn, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
234 
235  m_Notebook->AddPage(itemPanel5, _("Update"));
236 
237  wxPanel* itemPanel12 = new wxPanel( m_Notebook, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
238  wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
239  itemPanel12->SetSizer(itemBoxSizer13);
240 
241  wxStaticText* itemStaticText14 = new wxStaticText( itemPanel12, wxID_STATIC, _("No updates"), wxDefaultPosition, wxDefaultSize, 0 );
242  itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
243 
244  wxArrayString m_NoUpdateListStrings;
245  m_NoUpdateList = new wxListBox(itemPanel12, ID_UPDMULTSEQ_PNL2_LISTBOX1, wxDefaultPosition, wxDefaultSize, m_NoUpdateListStrings, wxLB_SINGLE | wxLB_SORT);
246  itemBoxSizer13->Add(m_NoUpdateList, 1, wxEXPAND| wxALL, 5);
248 
249  wxStaticText* itemStaticText16 = new wxStaticText( itemPanel12, wxID_STATIC, _("Unmatched sequences"), wxDefaultPosition, wxDefaultSize, 0 );
250  itemBoxSizer13->Add(itemStaticText16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
251 
252  wxArrayString m_UnmatchedListStrings;
253  m_UnmatchedList = new wxListBox(itemPanel12, ID_UPDMULTSEQ_PNL2_LISTBOX2, wxDefaultPosition, wxDefaultSize, m_UnmatchedListStrings, wxLB_SINGLE | wxLB_SORT);
254  itemBoxSizer13->Add(m_UnmatchedList, 1, wxEXPAND | wxALL, 5);
256 
257  wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL);
258  itemBoxSizer13->Add(itemBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
259  m_LoadMap = new wxButton( itemPanel12, ID_UPDMULTSEQ_PNL2_BTN1, _("Load Map"), wxDefaultPosition, wxDefaultSize, 0 );
260  itemBoxSizer18->Add(m_LoadMap, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
261 
262  m_MapSelection = new wxButton( itemPanel12, ID_UPDMULTSEQ_PNL2_BTN2, _("Map Selection"), wxDefaultPosition, wxDefaultSize, 0 );
263  itemBoxSizer18->Add(m_MapSelection, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
264 
265  m_Notebook->AddPage(itemPanel12, _("Map"));
266 
267  itemBoxSizer3->Add(m_Notebook, 0, wxGROW|wxALL, 2);
268 
269  // for the first update pair, form the panel
270  string seq_name;
271  if (m_NonIdenticalList && !m_NonIdenticalList->IsEmpty()) {
272  seq_name = ToStdString(m_NonIdenticalList->GetString(0));
273  }
274  else if (m_IdenticalList && !m_IdenticalList->IsEmpty()) {
275  seq_name = ToStdString(m_IdenticalList->GetString(0));
276  }
277  auto idh_it = m_SeqList.find(seq_name);
278  if (idh_it != m_SeqList.end()) {
280  m_UpdSeqPanel = new CUpdateSeqPanel(itemDialog1, upd_input.GetPointer(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
281  }
282  else { // when the pairs need to be manually selected
283  m_UpdSeqPanel = new CUpdateSeqPanel(itemDialog1, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
284  }
285  itemBoxSizer3->Add(m_UpdSeqPanel, 1, wxGROW|wxALL, 5);
286 
287  wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL);
288  itemBoxSizer2->Add(itemBoxSizer22, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
289 
290  wxButton* itemButton23 = new wxButton( itemDialog1, ID_UPDMULTSEQ_OKTHIS, _("Update This Sequence"), wxDefaultPosition, wxDefaultSize, 0 );
291  itemBoxSizer22->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
292 
293  wxButton* itemButton24 = new wxButton( itemDialog1, ID_UPDMULTSEQ_SKIP, _("Skip This Sequence"), wxDefaultPosition, wxDefaultSize, 0 );
294  itemBoxSizer22->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
295 
296  wxButton* itemButton25 = new wxButton( itemDialog1, ID_UPDMULTSEQ_OKALL, _("Update All Sequences"), wxDefaultPosition, wxDefaultSize, 0 );
297  itemBoxSizer22->Add(itemButton25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
298 
299  wxButton* itemButton26 = new wxButton( itemDialog1, ID_UPDMULTSEQ_STOP, _("Stop Updating"), wxDefaultPosition, wxDefaultSize, 0 );
300  itemBoxSizer22->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
301 
302  wxButton* itemButton27 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
303  itemBoxSizer22->Add(itemButton27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
304 
305 ////@end CUpdateMultiSeq_Dlg content construction
306 
307  if (!m_Futures.empty()) {
308  // disabel the update/skip buttons only if there are alignments to be generated in the background
309  itemButton23->Disable();
310  itemButton24->Disable();
311  itemButton25->Disable();
312  }
313  x_SetUp();
314 
315 }
316 
317 
319 {
320  // fills the m_UpdateList listbox with sequence IDs
322  if (!m_NonIdenticalList) {
323  return;
324  }
326 
327  for (auto&& it : updates) {
328  string label = s_GetSeqIDLabel(it.first);
329  m_SeqList.emplace(label, it.first);
331  }
332 }
333 
335 {
336  if (!m_IdenticalList) {
337  return;
338  }
339 
341  for (auto&& it : identicals) {
342  string label = s_GetSeqIDLabel(it.first);
343  m_SeqList.emplace(label, it.first);
344  m_IdenticalList->Append(ToWxString(label));
345  }
346 }
347 
348 // list of old sequences without updates
350 {
353  for (auto&& it : noUpdates) {
354  string label = s_GetSeqIDLabel(it);
355  m_UnmatchedOldSeqs.emplace(label, it);
356  m_NoUpdateList->Append(ToWxString(label));
357  }
358 }
359 
360 // list of update sequences that were not matched to any old sequences
362 {
364  for (auto&& it : noUpdates) {
365  string label = s_GetSeqIDLabel(it);
366  m_UnmatchedUpdSeqs.emplace(label, it);
367  m_UnmatchedList->Append(ToWxString(label));
368  }
369 }
370 
372 {
373  SetRegistryPath("Dialogs.CUpdateMultiSeq_Dlg");
374 
375  if (m_NonIdenticalList->IsEmpty() && (!m_NoUpdateList->IsEmpty() || !m_UnmatchedList->IsEmpty())) {
376  m_Notebook->ChangeSelection(1);
377  }
378 
380  if (m_UpdSeqPanel) {
381  m_UpdSeqPanel->SetData(params);
382  }
383 }
384 
386 {
387  const CSeq_id& id = *(idh.GetSeqId());
388  string label;
389  id.GetLabel(&label, CSeq_id::eContent);
390  return label;
391 }
392 
393 static tuple<objects::CSeq_id_Handle, CConstRef<objects::CSeq_align> > s_CreateAlign(
394  CSeq_id_Handle idH,
397  ICanceled& canceled)
398 {
399  tuple<objects::CSeq_id_Handle, CConstRef<objects::CSeq_align> > result(idH, CConstRef<CSeq_align>());
400 
401  if (canceled.IsCanceled())
402  return result;
403 
404  try {
405  bool accept_atleast_one = (subject.GetBioseqLength() < query.GetBioseqLength());
406 
407  auto align_vector = sequpd::RunBlast2Seq(subject, query, accept_atleast_one, &canceled);
408 
409  if (align_vector.size() > 1)
410  LOG_POST(Info << "More than one alignment was found");
411 
412  if (align_vector.empty())
413  LOG_POST(Info << "Could not form alignment between old and update sequence");
414  else {
415  // choose the 'better' alignment
416  size_t best_align = 0;
417  for (size_t i = 0; i < align_vector.size(); ++i) {
418  for (size_t j = i + 1; j < align_vector.size(); ++j) {
419  best_align = sequpd::CompareAlignments(*align_vector[i], *align_vector[j]) ? i : j;
420  }
421  }
422  _ASSERT(best_align < align_vector.size());
423  std::get<1>(result) = align_vector[best_align];
424  }
425 
426  } NCBI_CATCH("CUpdateMultiSeq_Dlg::s_CreateAlign()");
427 
428  return result;
429 }
430 
431 void CUpdateMultiSeq_Dlg::OnIdle(wxIdleEvent& event)
432 {
433  if (m_Futures.empty()) {
434  event.Skip();
435  return;
436  }
437 
438  bool skip = true;
439  auto it = m_Futures.begin();
440  while (it != m_Futures.end()) {
441  if (it->IsComplete()) {
442  skip = false;
443 
444  auto& res = (*it)();
445  const CSeq_id_Handle& idH = std::get<0>(res);
446  m_Running.erase(idH);
447 
449  upd_input->SetAlignment(std::get<1>(res).GetPointerOrNull());
450 
451  // update the panel for the one that's been selected
452  const string seq_name = x_GetCurrentSelection();
453  if (!seq_name.empty()) {
454  auto idh_it = m_SeqList.find(seq_name);
455  if (idh_it != m_SeqList.end() && idh_it->second == idH)
456  x_UpdateAlignmentPanel(seq_name);
457  }
458 
459  it = m_Futures.erase(it);
460  }
461  else
462  ++it;
463  }
464 
465  if (m_Futures.empty()) {
466  LOG_POST(Info << "Alignments for sequence update have been generated in: " << m_StopWatch.Elapsed() << "s");
467  FindWindow(ID_UPDMULTSEQ_OKALL)->Enable();
468  FindWindow(ID_UPDMULTSEQ_OKTHIS)->Enable();
469  FindWindow(ID_UPDMULTSEQ_SKIP)->Enable();
470  }
471 
472  if (skip)
473  event.Skip();
474 }
475 
477 {
482 }
483 
485 {
487  for (auto&& it : ident_updates) {
488  CRef<CSeq_annot> annot = CUpdateSeq_Input::s_Align2IdenticalSeq(it.second->GetOldBioseq(), it.second->GetUpdateBioseq());
489  if (annot && annot->IsAlign()) {
491  upd_input->SetAlignment(annot->GetData().GetAlign().front());
492  }
493  }
494 }
495 
497 {
498  for (const auto& it : updates) {
499  m_Futures.push_back(job_async(
500  [idH = it.first, subject = it.second->GetOldBioseq(), query = it.second->GetUpdateBioseq()](ICanceled& canceled)
501  {
502  return s_CreateAlign(idH, subject, query, canceled);
503  }, "Update Sequence Align"));
504  m_Running.insert(it.first);
505  }
506 }
507 
509 {
510  for (auto&& it : update_pairs) {
512  _ASSERT(seq_input);
513  if (!seq_input) {
514  NcbiMessageBox("Error in processing mapped sequence pairs.");
515  return;
516  }
517 
518  if (m_UpdMultiSeqInput->HaveIdenticalResidues(it.first, it.second)) {
520  if (annot && annot->IsAlign()) {
521  seq_input->SetAlignment(annot->GetData().GetAlign().front());
522  }
523  }
524  else {
525  m_Futures.push_back(job_async(
526  [idH = it.first, subject = seq_input->GetOldBioseq(), query = seq_input->GetUpdateBioseq()](ICanceled& canceled)
527  {
528  return s_CreateAlign(idH, subject, query, canceled);
529  }, "Update Sequence Align"));
530  m_Running.insert(it.first);
531  }
532  }
533 }
534 
535 /*!
536  * Should we show tooltips?
537  */
538 
540 {
541  return true;
542 }
543 
544 /*!
545  * Get bitmap resources
546  */
547 
548 wxBitmap CUpdateMultiSeq_Dlg::GetBitmapResource( const wxString& name )
549 {
550  // Bitmap retrieval
551 ////@begin CUpdateMultiSeq_Dlg bitmap retrieval
552  wxUnusedVar(name);
553  return wxNullBitmap;
554 ////@end CUpdateMultiSeq_Dlg bitmap retrieval
555 }
556 
557 /*!
558  * Get icon resources
559  */
560 
561 wxIcon CUpdateMultiSeq_Dlg::GetIconResource( const wxString& name )
562 {
563  // Icon retrieval
564 ////@begin CUpdateMultiSeq_Dlg icon retrieval
565  wxUnusedVar(name);
566  return wxNullIcon;
567 ////@end CUpdateMultiSeq_Dlg icon retrieval
568 }
569 
571 {
572  if (m_UpdSeqPanel)
573  m_UpdSeqPanel->LoadSettings(view.GetReadView("Panel"));
574 }
575 
577 {
578  if (m_UpdSeqPanel)
579  m_UpdSeqPanel->SaveSettings(view.GetWriteView("Panel"));
580 }
581 
583 {
584  int selected = wxNOT_FOUND;
585  string seq_name;
586  if (m_NonIdenticalList && !m_NonIdenticalList->IsEmpty()) {
587  selected = m_NonIdenticalList->GetSelection();
588  if (selected != wxNOT_FOUND) {
589  seq_name = ToStdString(m_NonIdenticalList->GetString(selected));
590  }
591  }
592 
593  if (seq_name.empty()) {
594  if (m_IdenticalList && !m_IdenticalList->IsEmpty()) {
595  selected = m_IdenticalList->GetSelection();
596  if (selected != wxNOT_FOUND) {
597  seq_name = ToStdString(m_IdenticalList->GetString(selected));
598  }
599  }
600  }
601  return seq_name;
602 }
603 
605 {
606  if (seq_name.empty())
607  return;
608 
609  auto idh_it = m_SeqList.find(seq_name);
610  if (idh_it == m_SeqList.end()) {
611  wxMessageBox(wxT("This sequence could not be updated!"), wxT("Info"), wxOK | wxICON_INFORMATION);
612  return;
613  }
614 
615  CRef<CUpdateSeq_Input> upd_input = m_UpdMultiSeqInput->GetUpdateInput(idh_it->second);
616  if (upd_input.IsNull()) {
617  wxMessageBox(wxT("This sequence could not be updated!"), wxT("Info"), wxOK | wxICON_INFORMATION);
618  return;
619  }
620 
621  m_UpdSeqPanel->UpdatePanel(m_Running.find(idh_it->second) != m_Running.end(), upd_input);
622  Layout();
623 }
624 
625 
627 {
628  if (m_IdenticalList) {
629  event.Enable(!m_IdenticalList->IsEmpty());
630  return;
631  }
632  event.Enable(false);
633 }
634 
635 void CUpdateMultiSeq_Dlg::OnMapSelectionUpdate(wxUpdateUIEvent& event)
636 {
637  if (m_NoUpdateList->IsEmpty() && m_UnmatchedList->IsEmpty()) {
638  event.Enable(false);
639  return;
640  }
641  event.Enable(true);
642 }
643 
645 {
646  int selected = m_NonIdenticalList->GetSelection();
647  if (selected != wxNOT_FOUND) {
648  const string seq_name = ToStdString(m_NonIdenticalList->GetString(selected));
649  x_UpdateAlignmentPanel(seq_name);
650 
651  if (m_IdenticalList && m_IdenticalList->GetSelection() != wxNOT_FOUND) {
652  m_IdenticalList->Deselect(m_IdenticalList->GetSelection());
653  }
654  }
655 }
656 
657 void CUpdateMultiSeq_Dlg::OnIdentSeqSelected(wxCommandEvent& event)
658 {
659  int selected = m_IdenticalList->GetSelection();
660  if (selected != wxNOT_FOUND) {
661  const string seq_name = ToStdString(m_IdenticalList->GetString(selected));
662  x_UpdateAlignmentPanel(seq_name);
663 
664  if (m_NonIdenticalList && m_NonIdenticalList->GetSelection() != wxNOT_FOUND) {
665  m_NonIdenticalList->Deselect(m_NonIdenticalList->GetSelection());
666  }
667  }
668 }
669 
671 {
672  // remove sequences from the update list whose updates are identical with the sequences
673  m_IdenticalList->Clear();
674 
676  for (auto&& it : identicals) {
677  string label = s_GetSeqIDLabel(it.first);
679  }
680 }
681 
682 void CUpdateMultiSeq_Dlg::OnLoadMapClick(wxCommandEvent& event)
683 {
684  wxString ext = wxT("Text Documents (*.txt)|*.txt|All Files (*.*)|*.*");
685  wxFileDialog open_dlg(this, wxT("Select a file"), wxEmptyString, wxEmptyString, ext, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
686  if (open_dlg.ShowModal() == wxID_CANCEL) {
687  return;
688  }
689 
690  wxString filename = open_dlg.GetPath();
691  CNcbiIfstream fstream(filename.fn_str(), ios_base::binary);
692  CRef<ILineReader> line_reader(ILineReader::New(fstream));
693  if (line_reader.Empty()) {
694  NcbiMessageBox("Could not open file.");
695  return;
696  }
697 
698  auto unmatchedOldSeqs = m_UnmatchedOldSeqs;
699  for (const auto& s : m_UnmatchedOldSeqs) {
700  auto pos = s.first.find('.');
701  if (string::npos != pos)
702  unmatchedOldSeqs.emplace(s.first.substr(0, pos), s.second);
703  }
704 
705  vector<string> ignored_lines;
706  string line;
708  while (!line_reader->AtEOF()) {
709  line_reader->ReadLine();
710  line = line_reader->GetCurrentLine();
711 
712  vector<string> ids;
713  NStr::Split(line, "\t", ids, NStr::fSplit_MergeDelimiters);
714  for (auto&& it : ids) {
716  }
717 
718  if (ids.size() != 2) {
719  ignored_lines.push_back(line);
720  continue;
721  }
722 
723  // first assume that the first column corresponds to old IDs
724  auto oldidh_it = unmatchedOldSeqs.find(ids[0]);
725  auto updidh_it = m_UnmatchedUpdSeqs.find(ids[1]);
726  if (oldidh_it == unmatchedOldSeqs.end()) {
727  // the second column corrresponds to old IDs
728  oldidh_it = unmatchedOldSeqs.find(ids[1]);
729  updidh_it = m_UnmatchedUpdSeqs.find(ids[0]);
730  }
731 
732  if (updidh_it == m_UnmatchedUpdSeqs.end()) {
733  // ignore that ID and report it
734  ignored_lines.push_back(line);
735  continue;
736  }
737 
738  if (oldidh_it == unmatchedOldSeqs.end()) {
739  NcbiMessageBox("Old sequence id " + ids[1] + " was not found.");
740  ignored_lines.push_back(line);
741  continue;
742  }
743 
744  update_pairs.emplace(oldidh_it->second, updidh_it->second);
745  }
746 
747  if (m_UpdMultiSeqInput->AppendOld_UpdateSeqPairs(update_pairs)) {
748  // the pairs don't have their corresponding alignments up till here
749  x_GenerateAlignments(update_pairs);
750 
751  wxWindowUpdateLocker locker(m_Notebook);
752  for (auto&& it : update_pairs) {
753  // add the old_id to either the nonidentical or to the identical list
754 
755  CSeq_id_Handle old_idh = it.first;
756  string old_id_label = s_GetSeqIDLabel(old_idh);
758  if (nonident_updates.find(old_idh) != nonident_updates.end()) {
759  m_SeqList.emplace(old_id_label, old_idh);
760  m_NonIdenticalList->Append(ToWxString(old_id_label));
761  }
762  else {
764  if (identicals.find(old_idh) != identicals.end()) {
765  m_SeqList.emplace(old_id_label, old_idh);
766  m_IdenticalList->Append(ToWxString(old_id_label));
767  }
768  }
769 
770  auto oldidh_it = m_UnmatchedOldSeqs.find(old_id_label);
771 
772  string upd_id_label = s_GetSeqIDLabel(it.second);
773  auto updidh_it = m_UnmatchedUpdSeqs.find(upd_id_label);
774 
775  m_UnmatchedOldSeqs.erase(oldidh_it);
776  m_UnmatchedUpdSeqs.erase(updidh_it);
777  m_NoUpdateList->Delete(m_NoUpdateList->FindString(old_id_label));
778  m_UnmatchedList->Delete(m_UnmatchedList->FindString(upd_id_label));
779  }
780  }
781 
783 
784  if (!ignored_lines.empty()) {
785  string msg = "These lines were ignored:";
786  for (auto&& it : ignored_lines) {
787  msg.append("\n");
788  msg.push_back('"');
789  msg.append(it);
790  msg.push_back('"');
791  }
793  }
794 }
795 
796 void CUpdateMultiSeq_Dlg::OnMapSelectionClick(wxCommandEvent& event)
797 {
798  int noupdate_sel = m_NoUpdateList->GetSelection(); // from the list of old sequences
799  int unmatched_sel = m_UnmatchedList->GetSelection(); // from the list of update sequences
800 
801  if (noupdate_sel == wxNOT_FOUND || unmatched_sel == wxNOT_FOUND) {
802  NcbiMessageBox("Please select one ID from each of the above two lists.");
803  return;
804  }
805 
806  const string old_seq = ToStdString(m_NoUpdateList->GetString(noupdate_sel));
807  const string upd_seq = ToStdString(m_UnmatchedList->GetString(unmatched_sel));
808 
809  auto oldidh_it = m_UnmatchedOldSeqs.find(old_seq);
810  auto updidh_it = m_UnmatchedUpdSeqs.find(upd_seq);
811  if (oldidh_it == m_UnmatchedOldSeqs.end() || updidh_it == m_UnmatchedUpdSeqs.end()) {
812  NcbiMessageBox("This pair could not be selected.");
813  return;
814  }
815 
816  // update the m_UpdMultiSeqInput with this pair
817 
819  pair.emplace(oldidh_it->second, updidh_it->second);
821  x_GenerateAlignments(pair);
822 
823  wxWindowUpdateLocker locker(m_Notebook);
824  // add the pair to either the nonidentical or to the identical list
825  CSeq_id_Handle old_idh = oldidh_it->second;
826  string label = s_GetSeqIDLabel(old_idh);
827 
829  if (nonident_updates.find(old_idh) != nonident_updates.end()) {
830  m_SeqList.emplace(label, old_idh);
832  }
833  else {
835  if (identicals.find(old_idh) != identicals.end()) {
836  m_SeqList.emplace(label, old_idh);
837  m_IdenticalList->Append(ToWxString(label));
838  }
839  }
840 
841  m_UnmatchedOldSeqs.erase(oldidh_it);
842  m_UnmatchedUpdSeqs.erase(updidh_it);
843  m_NoUpdateList->Delete(noupdate_sel);
844  m_UnmatchedList->Delete(unmatched_sel);
845  }
846 
848 }
849 
851 {
852  if (m_NoUpdateList->IsEmpty() && m_UnmatchedList->IsEmpty()) {
853  m_Notebook->ChangeSelection(0);
854  string seq_name;
855  if (!m_NonIdenticalList->IsEmpty()) {
856  seq_name = ToStdString(m_NonIdenticalList->GetString(0));
857  m_NonIdenticalList->SetSelection(0);
858  }
859  else if (!m_IdenticalList->IsEmpty()) {
860  seq_name = ToStdString(m_IdenticalList->GetString(0));
861  m_IdenticalList->SetSelection(0);
862  }
863 
864  x_UpdateAlignmentPanel(seq_name);
865  }
866 }
867 
869 {
870  int selectNonIdent = (m_NonIdenticalList) ? m_NonIdenticalList->GetSelection() : wxNOT_FOUND;
871  int selectIdent = (m_IdenticalList) ? m_IdenticalList->GetSelection() : wxNOT_FOUND;
872  if (selectNonIdent == wxNOT_FOUND && selectIdent == wxNOT_FOUND) {
873  wxMessageBox(wxT("No sequence was selected!"), wxT("Info"), wxOK | wxICON_INFORMATION);
874  return;
875  }
876  bool create_general_only = objects::edit::IsGeneralIdProtPresent(m_UpdMultiSeqInput->GetOldEntry().GetTopLevelEntry());
878  if (selectNonIdent != wxNOT_FOUND) {
879  const string seq_name = ToStdString(m_NonIdenticalList->GetString(selectNonIdent));
880  cmd.Reset(x_UpdateSelected(seq_name, create_general_only));
881  x_SkipSelected(*m_NonIdenticalList, (unsigned int)selectNonIdent, m_IdenticalList);
882  }
883  else if (selectIdent != wxNOT_FOUND) {
884  const string seq_name = ToStdString(m_IdenticalList->GetString(selectIdent));
885  cmd.Reset(x_UpdateSelected(seq_name, create_general_only));
886  x_SkipSelected(*m_IdenticalList, (unsigned int)selectIdent, m_NonIdenticalList);
887  }
888 
889  if (cmd) {
891  m_Updated++;
892  }
893 
894  if (((m_NonIdenticalList && m_NonIdenticalList->IsEmpty()) || !m_NonIdenticalList) &&
895  ((m_IdenticalList && m_IdenticalList->IsEmpty()) || !m_IdenticalList)) {
896  x_CloseDialog();
897  }
898 }
899 
900 CRef<CCmdComposite> CUpdateMultiSeq_Dlg::x_UpdateSelected(const string& seq_name, bool create_general_only)
901 {
902  if (seq_name.empty())
903  return CRef<CCmdComposite>();
904 
905  auto idh_it = m_SeqList.find(seq_name);
906  if (idh_it == m_SeqList.end()) {
907  wxMessageBox(wxT("This sequence could not be updated!"), wxT("Error"), wxOK | wxICON_INFORMATION);
908  return CRef<CCmdComposite>();
909  }
910 
912  if (!upd_input) {
913  return CRef<CCmdComposite>();
914  }
915 
916  try {
918  CSequenceUpdater updater(*upd_input, params);
919  CRef<CCmdComposite> cmd = updater.Update(create_general_only);
920  if (updater.IsReverseComplemented()) {
921  m_RevCompReport.append("Reverse complemented ");
922  m_RevCompReport.append(seq_name);
923  m_RevCompReport.append("\n");
924  }
925  CNcbiOstrstream oss;
926  updater.GetNotImportedFeatsReport(oss);
927  if (!IsOssEmpty(oss)) {
928  NcbiInfoBox(string(CNcbiOstrstreamToString(oss)));
929  }
930  return cmd;
931  }
932  catch (const CSeqUpdateException& e) {
933  NcbiMessageBox(seq_name + " could not be updated.\n" + e.GetMsg());
934  }
935 
936  return CRef<CCmdComposite>();
937 }
938 
940 {
941  int selectNonIdent = (m_NonIdenticalList) ? m_NonIdenticalList->GetSelection() : wxNOT_FOUND;
942  int selectIdent = (m_IdenticalList) ? m_IdenticalList->GetSelection() : wxNOT_FOUND;
943  if (selectNonIdent == wxNOT_FOUND && selectIdent == wxNOT_FOUND) {
944  wxMessageBox(wxT("No sequence was selected!"), wxT("Info"), wxOK | wxICON_INFORMATION);
945  return;
946  }
947 
948  if (selectNonIdent != wxNOT_FOUND) {
950  m_Skipped++;
951  }
952  else if (selectIdent != wxNOT_FOUND) {
954  m_Skipped++;
955  }
956 
957  if (((m_NonIdenticalList && m_NonIdenticalList->IsEmpty()) || !m_NonIdenticalList) &&
958  ((m_IdenticalList && m_IdenticalList->IsEmpty()) || !m_IdenticalList)) {
959  x_CloseDialog();
960  }
961 }
962 
963 
964 void CUpdateMultiSeq_Dlg::x_SkipSelected(wxListBox& sel_list, unsigned int selected, wxListBox* other_list)
965 {
966  string seq_name = ToStdString(sel_list.GetString(selected));
967  auto idh_it = m_SeqList.find(seq_name);
968  if (idh_it == m_SeqList.end()) {
969  wxMessageBox(wxT("This sequence could not be skipped!"), wxT("Info"), wxOK | wxICON_INFORMATION);
970  return;
971  }
972 
973  m_SeqList.erase(idh_it);
974  sel_list.Delete(selected);
975  if ( ! sel_list.IsEmpty()) {
976  if (selected > sel_list.GetCount() - 1) {
977  selected = sel_list.GetCount() - 1;
978  }
979  sel_list.SetSelection(selected);
980  seq_name = ToStdString(sel_list.GetString(selected));
981  x_UpdateAlignmentPanel(seq_name);
982  }
983  else if (other_list && !other_list->IsEmpty()) {
984  other_list->SetSelection(0);
985  seq_name = ToStdString(other_list->GetString(selected));
986  x_UpdateAlignmentPanel(seq_name);
987  }
988 }
989 
990 
992 {
993  bool create_general_only = objects::edit::IsGeneralIdProtPresent(m_UpdMultiSeqInput->GetOldEntry().GetTopLevelEntry());
994  // update nonidentical as well as identical update-seq pairs
995  if (m_NonIdenticalList) {
996  for (unsigned int selected = 0; selected < m_NonIdenticalList->GetCount(); ++selected) {
997  const string seq_name = ToStdString(m_NonIdenticalList->GetString(selected));
998  CRef<CCmdComposite> cmd = x_UpdateSelected(seq_name, create_general_only);
999  if (cmd) {
1001  m_Updated++;
1002  }
1003  auto idh_it = m_SeqList.find(seq_name);
1004  if (idh_it != m_SeqList.end()) {
1005  m_SeqList.erase(idh_it);
1006  }
1007  }
1008  }
1009 
1010  if (m_IdenticalList) {
1011  for (unsigned int selected = 0; selected < m_IdenticalList->GetCount(); ++selected) {
1012  const string seq_name = ToStdString(m_IdenticalList->GetString(selected));
1013  CRef<CCmdComposite> cmd = x_UpdateSelected(seq_name, create_general_only);
1014  if (cmd) {
1016  m_Updated++;
1017  }
1018  auto idh_it = m_SeqList.find(seq_name);
1019  if (idh_it != m_SeqList.end()) {
1020  m_SeqList.erase(idh_it);
1021  }
1022  }
1023  }
1024 
1025  x_CloseDialog();
1026 }
1027 
1028 void CUpdateMultiSeq_Dlg::OnCancelClick(wxCommandEvent& event)
1029 {
1030  EndModal(wxCANCEL);
1031 }
1032 
1033 void CUpdateMultiSeq_Dlg::OnStopUpdatingClick(wxCommandEvent& event)
1034 {
1035  // has the role of CLOSE
1036  x_CloseDialog();
1037 }
1038 
1039 void CUpdateMultiSeq_Dlg::OnCloseWindow(wxCloseEvent& event)
1040 {
1041  x_CloseDialog();
1042 }
1043 
1045 {
1046  CNcbiOstrstream oss;
1047  if (m_Updated > 0) {
1048  oss << m_Updated << " updated";
1049  if (m_Skipped > 0) {
1050  oss << ", " << m_Skipped << " skipped";
1051  }
1052  }
1053  else if (m_Skipped > 0) {
1054  oss << m_Skipped << " skipped";
1055  }
1056  string msg = CNcbiOstrstreamToString(oss);
1057  if (!msg.empty()) {
1058  wxMessageBox(ToWxString(msg), wxT("Info"), wxOK | wxICON_INFORMATION);
1059  }
1060 }
1061 
1063 {
1064  int retcode = (m_Updated > 0) ? wxOK : wxCLOSE;
1065  EndModal(retcode);
1066 }
1067 
1069 
1070 
EVT_UPDATE_UI(eCmdAlnShowMethodsDlg, CAlnMultiWidget::OnUpdateShowMethodDlg) EVT_UPDATE_UI(eCmdMethodProperties
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
CBioseq_Handle –.
void AddCommand(IEditCommand &command)
CDialog.
Definition: dialog.hpp:47
virtual void EndModal(int retCode)
Definition: dialog.cpp:142
virtual void SetRegistryPath(const string &path)
Definition: dialog.cpp:59
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
CRegistryReadView GetReadView(const string &section) const
Definition: reg_view.cpp:74
CRegistryWriteView GetWriteView(const string &section)
Definition: reg_view.cpp:491
Sequence update exception class.
bool IsAlign(void) const
Definition: Seq_annot.cpp:182
Class responsible for executing the sequence update for one old-update sequence pair.
Definition: update_seq.hpp:57
bool IsReverseComplemented() const
Definition: update_seq.hpp:97
void GetNotImportedFeatsReport(CNcbiOstream &out) const
CRef< CCmdComposite > Update(bool create_general_only)
Main function responsible to update the old sequence with the update sequence.
Definition: update_seq.cpp:564
TNameToIDHandleMap m_UnmatchedUpdSeqs
void OnIdle(wxIdleEvent &event)
virtual void x_SaveSettings(CRegistryWriteView view) const
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
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 OnStopUpdatingClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_UPDMULTSEQ_STOP
TNameToIDHandleMap m_SeqList
static bool ShowToolTips()
Should we show tooltips?
static void s_ReportIdenticalPairs(const CUpdateMultipleSeq_Input &input)
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
void x_GenerateAlignments(const CUpdateMultipleSeq_Input::TOldToUpdateMap &update_pairs)
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
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_CUPDATEMULTISEQ_DLG
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
void x_UpdateAlignmentPanel(const string &seq_name)
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.
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
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 &params)
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.
Definition: icanceled.hpp:51
Stores parameters regarding the type of sequence update, on how to handle existing features and on ho...
@ eSeqUpdateReplace
do not change the old sequence
void erase(iterator pos)
Definition: map.hpp:167
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
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 ...
Definition: sequpd.cpp:613
static vector< CConstRef< objects::CSeq_align > > RunBlast2Seq(const objects::CBioseq_Handle &subject, const objects::CBioseq_Handle &query, bool accept_atleast_one, ICanceled *canceled=nullptr)
Definition: sequpd.cpp:351
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator find(const key_type &key) const
Definition: set.hpp:137
void erase(iterator pos)
Definition: set.hpp:151
const_iterator end() const
Definition: set.hpp:136
#define _(proto)
Definition: ct_nlmzip_i.h:78
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
Definition: ncbiexpt.hpp:580
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
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)
Definition: message_box.cpp:48
CTempString GetCurrentLine(void) const
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
Definition: line_reader.cpp:49
void ReadLine(void)
Definition: line_reader.hpp:88
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.
Definition: Seq_id.hpp:605
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:735
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
virtual bool IsCanceled(void) const =0
bool IsOssEmpty(CNcbiOstrstream &oss)
Definition: ncbistre.hpp:831
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
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.
Definition: ncbistr.cpp:3461
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3201
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Definition: ncbistr.hpp:2498
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
Definition: ncbitime.hpp:2817
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
Definition: ncbitime.hpp:2776
static const char label[]
const TAlign & GetAlign(void) const
Get the variant data.
Definition: Seq_annot_.hpp:641
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_annot_.hpp:873
@ eIcon_Exclamation
Definition: types.hpp:65
@ eDialog_Ok
Definition: types.hpp:47
job_function_traits< _Fty >::future job_async(const _Fty &_Fnarg, const string &descr)
Definition: job_future.hpp:428
END_EVENT_TABLE()
static int input()
int i
Lightweight interface for getting lines of data with minimal memory copying.
#define wxT(x)
Definition: muParser.cpp:41
void ReportUsage(const wxString &dialog_name)
Report opening & accepting events in the editing package.
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
static string subject
static string query
#define _ASSERT
else result
Definition: token2.c:20
USING_SCOPE(objects)
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)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Wed Apr 24 14:13:09 2024 by modify_doxy.py rev. 669887