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

Go to the SVN repository for this file.

1 /* $Id: vectortrimpanel.cpp 47464 2023-04-20 00:19:10Z evgeniev $
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: Yoon Choi
27  */
28 
29 
30 #include <ncbi_pch.hpp>
32 
33 ////@begin includes
34 ////@end includes
35 
36 #include <wx/panel.h>
37 #include <wx/sizer.h>
38 #include <wx/button.h>
39 #include <wx/textctrl.h>
40 #include <wx/msgdlg.h>
41 #include <wx/log.h>
42 #include <wx/stattext.h>
43 #include <wx/radiobox.h>
44 
65 #include <objects/seq/Seq_inst.hpp>
66 #include <objects/seq/Seq_ext.hpp>
68 #include <objects/seq/Pubdesc.hpp>
69 #include <objects/pub/Pub.hpp>
71 #include <objmgr/feat_ci.hpp>
72 #include <objmgr/align_ci.hpp>
73 #include <objmgr/graph_ci.hpp>
74 #include <objmgr/seqdesc_ci.hpp>
77 #include <objmgr/util/sequence.hpp>
79 
80 #include <sstream>
81 
82 ////@begin XPM images
83 ////@end XPM images
84 
87 
88 void ShowDebugMessage(const wxString& message)
89 {
90  wxMessageDialog msgdlg( NULL, message, _("Debug") );
91  msgdlg.ShowModal();
92 }
93 
94 // Ids do not need to be globally unique as long as they are
95 // unique within the local context (e.g., unique per dialog)
96 enum
97 {
98  MYID_BUTTON_RUN_VECSCREEN = wxID_HIGHEST + 1,
114 };
115 
116 /*!
117  * CVectorTrimPanel type definition
118  */
119 
120 IMPLEMENT_DYNAMIC_CLASS( CVectorTrimPanel, wxPanel )
121 
122 
123 /*!
124  * CVectorTrimPanel event table definition
125  */
126 
127 BEGIN_EVENT_TABLE( CVectorTrimPanel, wxPanel )
128 
129 ////@begin CVectorTrimPanel event table entries
130 
131 ////@end CVectorTrimPanel event table entries
138  //EVT_CHECKBOX(MYID_CHECKBOX_VIEWGRAPHIC, CVectorTrimPanel::OnViewAlignmentGraphic)
144 
146 
147 
148 /*!
149  * CVectorTrimPanel constructors
150  */
151 
153 {
154  m_pParentWindow = NULL;
155  Init();
156 }
157 
158 CVectorTrimPanel::CVectorTrimPanel( wxWindow* parent,
159  CSeq_entry_Handle seh,
160  ICommandProccessor* cmdProcessor,
161  wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
162  : m_TopSeqEntry(seh),
163  m_CmdProcessor(cmdProcessor),
164  m_pParentWindow(parent)
165 {
166  Init();
167  Create(parent, id, pos, size, style);
168 }
169 
170 
171 /*!
172  * CVectorTrimPanel creator
173  */
174 
175 bool CVectorTrimPanel::Create( wxWindow* parent,
176  wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
177 {
178 ////@begin CVectorTrimPanel creation
179  wxPanel::Create( parent, id, pos, size, style );
180  m_pParentWindow = parent;
181 
182  CreateControls();
183  if (GetSizer())
184  {
185  GetSizer()->SetSizeHints(this);
186  }
187  Centre();
188 ////@end CVectorTrimPanel creation
189  return true;
190 }
191 
192 
193 /*!
194  * CVectorTrimPanel destructor
195  */
196 
198 {
199 ////@begin CVectorTrimPanel destruction
200 ////@end CVectorTrimPanel destruction
201 }
202 
203 
204 /*!
205  * Member initialisation
206  */
207 
209 {
210 ////@begin CVectorTrimPanel member initialisation
211 ////@end CVectorTrimPanel member initialisation
212 }
213 
214 
215 /*!
216  * Control creation for CVectorTrimPanel
217  */
218 
220 {
221 ////@begin CVectorTrimPanel content construction
222  CVectorTrimPanel* itemPanel1 = this;
223 
224  // Top level sizer
225  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
226  itemPanel1->SetSizer(itemBoxSizer2);
227 
228 ////@end CVectorTrimPanel content construction
229 
230  // Row 0 - heading labels
231  wxBoxSizer* sizerLabels = new wxBoxSizer(wxHORIZONTAL);
232  wxStaticText* matches =
233  new wxStaticText( this, wxID_ANY, _( "Sequences with Vector Match" ),
234  wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_VERTICAL );
235  wxStaticText* locations =
236  new wxStaticText( this, wxID_ANY, _( "Location of Vector Match" ),
237  wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_VERTICAL );
238  sizerLabels->Add(matches, 1, wxEXPAND|wxALL, 5);
239  sizerLabels->Add(locations, 1, wxEXPAND|wxALL, 5);
240  itemBoxSizer2->Add(sizerLabels, 0, wxEXPAND|wxALL, 5);
241 
242  // Row 1 - display results
243  m_sizerVectorResults = new wxBoxSizer(wxHORIZONTAL);
244  m_listMatches = new CMatchesListCtrl( this, MYID_LISTCTRL_MATCHES, wxDefaultPosition, wxDefaultSize,
245  wxLC_REPORT | wxLC_SINGLE_SEL );
246 
247  // Workaround for Windows only!
248  // Highlight the entire row not just the first column in the row.
249 #ifdef __WXMSW__
250  DWORD dwStyle = ::SendMessage((HWND)m_listMatches->GetHandle(), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
251  dwStyle |= LVS_EX_FULLROWSELECT;
252  ::SendMessage((HWND)m_listMatches->GetHandle(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
253 #endif
254 
255 
256  // This sizer contains 2 elements in the same location.
257  // A toggle will show/hide the appropriate element.
258  m_sizerVectorResults->Add(m_listMatches, 1, wxEXPAND|wxALL, 5);
259 
260  m_viewAlignGraphic = new wxHtmlWindow( this, MYID_WEBVIEW_GRAPHIC );
261  m_sizerVectorResults->Add(m_viewAlignGraphic, 1, wxEXPAND|wxALL, 5);
263 
264  m_listLocations = new CLocationsListCtrl( this, MYID_LISTCTRL_LOCATIONS, wxDefaultPosition, wxDefaultSize,
265  wxLC_REPORT | wxLC_SINGLE_SEL );
266  m_sizerVectorResults->Add(m_listLocations, 1, wxEXPAND|wxALL, 5);
268 
269  // By default show m_listLocations, hide m_viewAlignGraphic
271  m_sizerVectorResults->Layout();
272 
273 
274  itemBoxSizer2->Add(m_sizerVectorResults, 1, wxEXPAND|wxALL, 5);
275 
276  // Row 2 - run blast vecscreen against UniVec db
277  wxBoxSizer* sizerSearchVector = new wxBoxSizer(wxHORIZONTAL);
278  m_buttonRunVecscreen = new wxButton( this, MYID_BUTTON_RUN_VECSCREEN, _("Search UniVec_Core") );
279  sizerSearchVector->Add(m_buttonRunVecscreen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
281  m_gaugeProgressBar = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_SMOOTH );
282  sizerSearchVector->Add(m_gaugeProgressBar, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
283  itemBoxSizer2->Add(sizerSearchVector, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
284 
285  // Row 3 - Find text
286  wxBoxSizer* sizerFindText = new wxBoxSizer(wxHORIZONTAL);
287  wxStaticText* findtext =
288  new wxStaticText( this, wxID_ANY, _( "Find Text" ), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL );
289  sizerFindText->Add(findtext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
290  m_textFind = new wxTextCtrl( this, wxID_ANY );
291  sizerFindText->Add(m_textFind, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
292  m_buttonFindReverse = new wxButton( this, MYID_BUTTON_FIND_REVERSE, _("<<") );
293  sizerFindText->Add(m_buttonFindReverse, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
294  m_buttonFindForward = new wxButton( this, MYID_BUTTON_FIND_FORWARD, _(">>") );
295  sizerFindText->Add(m_buttonFindForward, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
296  itemBoxSizer2->Add(sizerFindText, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
297 
298  // Row 4 - Sort results
299  wxArrayString buttons;
300  buttons.Add(_("Internal, 5', 3'"));
301  buttons.Add(_("Strength"));
302  buttons.Add(_("Marked"));
303  buttons.Add(_("Accession"));
304  m_radioBoxSort = new wxRadioBox( this, MYID_RADIOBOX_SORT, _("Order By"), wxDefaultPosition, wxDefaultSize,
305  buttons, 0, wxRA_SPECIFY_COLS );
306  itemBoxSizer2->Add(m_radioBoxSort, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
307 
308  // Row 5 - Internal Trim Options
309  wxArrayString buttons2;
310  buttons2.Add(_("Trim to closest end"));
311  buttons2.Add(_("Trim to 5' end"));
312  buttons2.Add(_("Trim to 3' end"));
314  _("Internal Trim Options"),
315  wxDefaultPosition, wxDefaultSize,
316  buttons2, 0, wxRA_SPECIFY_COLS );
317  itemBoxSizer2->Add(m_radioBoxInternalTrimOptions, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
318 
319  // Row 6 - select results
320  wxBoxSizer* sizerSelectResults = new wxBoxSizer(wxHORIZONTAL);
321  m_buttonSelectAll = new wxButton( this, MYID_BUTTON_SELECT_ALL, _("Select All") );
322  sizerSelectResults->Add(m_buttonSelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
323  m_buttonUnselectAll = new wxButton( this, MYID_BUTTON_UNSELECT_ALL, _("Unselect All") );
324  sizerSelectResults->Add(m_buttonUnselectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
325  m_buttonUnselectInternal = new wxButton( this, MYID_BUTTON_UNSELECT_INTERNAL, _("Unselect Internal") );
326  sizerSelectResults->Add(m_buttonUnselectInternal, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
327  m_buttonSelectStrongModerate = new wxButton( this, MYID_BUTTON_SELECT_STRONG_MODERATE, _("Select Only Strong and Moderate") );
328  sizerSelectResults->Add(m_buttonSelectStrongModerate, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
329  //m_checkboxViewGraphic = new wxCheckBox( this, MYID_CHECKBOX_VIEWGRAPHIC, _("View Alignment Graphic") );
330  //sizerSelectResults->Add(m_checkboxViewGraphic, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
331  itemBoxSizer2->Add(sizerSelectResults, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
332 
333  m_CitSub = new wxCheckBox( this, wxID_ANY, _("Add CitSub Update to trimmed sequences"), wxDefaultPosition, wxDefaultSize, 0 );
334  m_CitSub->SetValue(false);
335  itemBoxSizer2->Add(m_CitSub, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
336 
337  // Row 7 - Trim selected sequences
338  wxBoxSizer* sizerTrimSelected = new wxBoxSizer(wxHORIZONTAL);
339  m_buttonMakeReport = new wxButton( this, MYID_BUTTON_MAKE_REPORT, _("Make Report") );
340  sizerTrimSelected->Add(m_buttonMakeReport, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
341  m_buttonTrimSelected = new wxButton( this, MYID_BUTTON_TRIM_SELECTED, _("Trim Selected Sequences") );
342  sizerTrimSelected->Add(m_buttonTrimSelected, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
343  m_buttonTrimSelected->Disable();
344  m_buttonDismiss = new wxButton( this, MYID_BUTTON_DISMISS, _("Dismiss") );
345  sizerTrimSelected->Add(m_buttonDismiss, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
346  itemBoxSizer2->Add(sizerTrimSelected, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
347 }
348 
349 
351 {
352  if (!wxPanel::TransferDataToWindow())
353  return false;
354 
355 
356  return true;
357 }
358 
359 
361 {
362  if (!wxPanel::TransferDataFromWindow())
363  return false;
364 
365 
366  return true;
367 }
368 
369 
370 /*!
371  * Should we show tooltips?
372  */
373 
375 {
376  return true;
377 }
378 
379 /*!
380  * Get bitmap resources
381  */
382 
383 wxBitmap CVectorTrimPanel::GetBitmapResource( const wxString& name )
384 {
385  // Bitmap retrieval
386 ////@begin CVectorTrimPanel bitmap retrieval
387  wxUnusedVar(name);
388  return wxNullBitmap;
389 ////@end CVectorTrimPanel bitmap retrieval
390 }
391 
392 /*!
393  * Get icon resources
394  */
395 
396 wxIcon CVectorTrimPanel::GetIconResource( const wxString& name )
397 {
398  // Icon retrieval
399 ////@begin CVectorTrimPanel icon retrieval
400  wxUnusedVar(name);
401  return wxNullIcon;
402 ////@end CVectorTrimPanel icon retrieval
403 }
404 
405 
406 void CVectorTrimPanel::OnRunVecscreen(wxCommandEvent &event)
407 {
410  m_buttonTrimSelected->Enable();
411 }
412 
413 
414 void CVectorTrimPanel::OnSort(wxCommandEvent &event)
415 {
416  // selection value is 0-based
417  int selection = m_radioBoxSort->GetSelection();
418 
419  CMatchesListCtrl::ESortOption eSortOption;
420  switch (selection) {
421  case 0:
423  break;
424  case 1:
425  eSortOption = CMatchesListCtrl::eSortStrength;
426  break;
427  case 2:
428  eSortOption = CMatchesListCtrl::eSortMarked;
429  break;
430  case 3:
431  eSortOption = CMatchesListCtrl::eSortAccession;
432  break;
433  default:
435  break;
436  }
437 
438  m_listMatches->Sort(eSortOption, true);
439 }
440 
441 
442 void CVectorTrimPanel::OnSelectAll(wxCommandEvent &event)
443 {
445 }
446 
447 
448 void CVectorTrimPanel::OnSelectStrongModerate(wxCommandEvent &event)
449 {
451 }
452 
453 
454 void CVectorTrimPanel::OnUnselectAll(wxCommandEvent &event)
455 {
457 }
458 
459 
460 void CVectorTrimPanel::OnUnselectInternal(wxCommandEvent &event)
461 {
463 }
464 
465 
466 
467 void CVectorTrimPanel::OnMakeReport(wxCommandEvent &event)
468 {
469  CVecscreenReport* vecscreenReport = new CVecscreenReport(this);
470  wxString report;
471  m_listMatches->GetReport(report);
472  vecscreenReport->SetReport(report);
473  vecscreenReport->Show();
474 }
475 
476 
477 void CVectorTrimPanel::OnTrimSelected(wxCommandEvent &event)
478 {
479  // Did the user trim or cancel?
480  bool bTrimmed = x_TrimSelected();
481  m_buttonTrimSelected->Disable();
482  // Was ALL contamination selected?
483  bool bAllSelected = m_listMatches->AllSelected();
484 
485  // If the user trimmed all contamination, then close the window,
486  // otherwise update the window with the remaining contamination.
487  if (m_pParentWindow && bTrimmed && bAllSelected) {
488  m_pParentWindow->Close();
489  }
490 }
491 
492 
493 void CVectorTrimPanel::OnDismiss(wxCommandEvent &event)
494 {
495  if (m_pParentWindow) {
496  m_pParentWindow->Close();
497  }
498 }
499 
500 
501 void CVectorTrimPanel::OnFindForward(wxCommandEvent &event)
502 {
503  m_listMatches->FindForward(m_textFind->GetValue());
504 }
505 
506 
507 void CVectorTrimPanel::OnFindReverse(wxCommandEvent &event)
508 {
509  m_listMatches->FindReverse(m_textFind->GetValue());
510 }
511 
512 
514 {
515 public:
517  {
520  };
521 
522  explicit CRangeCmp(ESortOrder sortorder = eAscending)
523  : m_sortorder(sortorder)
524  {
525  };
526 
527  bool operator()(const SRangeMatch& a1, const SRangeMatch& a2)
528  {
529  if (m_sortorder == eAscending)
530  {
531  // Tiebreaker
532  if (a1.m_range.GetTo() == a2.m_range.GetTo()) {
533  return a1.m_range.GetFrom() < a2.m_range.GetFrom();
534  }
535  return a1.m_range.GetTo() < a2.m_range.GetTo();
536  }
537  else
538  {
539  // Tiebreaker
540  if (a1.m_range.GetTo() == a2.m_range.GetTo()) {
541  return a1.m_range.GetFrom() > a2.m_range.GetFrom();
542  }
543  return a1.m_range.GetTo() > a2.m_range.GetTo();
544  }
545  };
546 
547 private:
549 };
550 
551 
553  CRef<CSeq_inst> inst,
554  const TCuts& sorted_cuts)
555 {
556  // Should be a nuc!
557  if (!bsh.IsNucleotide()) {
558  return;
559  }
560 
561  // Add the complete bioseq to scope
562  CRef<CBioseq> bseq(new CBioseq);
563  bseq->Assign(*bsh.GetCompleteBioseq());
564  CScope& scope = bsh.GetTopLevelEntry().GetScope();
565  CBioseq_Handle complete_bsh = scope.AddBioseq(*bseq);
566 
567  // Determine the "good" range sequence coordinates
568  TSeqPos left_pos = 0;
569  TSeqPos right_pos = inst->GetLength() - 1;
570  for (const auto& cut : sorted_cuts) {
571  if (cut.m_range.GetTo() == right_pos) {
572  right_pos = cut.m_range.GetFrom() - 1;
573  }
574 
575  if (cut.m_range.GetFrom() == left_pos) {
576  left_pos = cut.m_range.GetTo() + 1;
577  }
578  }
579 
580  // Create a new Delta-ext
581  CAutoInitRef<CDelta_ext> pDeltaExt;
582  CSeqMap_CI seqmap_ci = complete_bsh.GetSeqMap().ResolvedRangeIterator(&complete_bsh.GetScope(),
583  left_pos,
584  1 + (right_pos - left_pos));
585  for (; seqmap_ci; ++seqmap_ci) {
586  switch (seqmap_ci.GetType()) {
587  case CSeqMap::eSeqGap:
588  {
589  // Sequence gaps
590  const TSeqPos uGapLength = seqmap_ci.GetLength();
591  const bool bIsLengthKnown = !seqmap_ci.IsUnknownLength();
592  CConstRef<CSeq_literal> pOriginalGapSeqLiteral =
593  seqmap_ci.GetRefGapLiteral();
594  CAutoInitRef<CDelta_seq> pDeltaSeq;
595  CAutoInitRef<CSeq_literal> pNewGapLiteral;
596  if (pOriginalGapSeqLiteral) {
597  pNewGapLiteral->Assign(*pOriginalGapSeqLiteral);
598  }
599  if (!bIsLengthKnown) {
600  pNewGapLiteral->SetFuzz().SetLim(CInt_fuzz::eLim_unk);
601  }
602  pNewGapLiteral->SetLength(uGapLength);
603  pDeltaSeq->SetLiteral(*pNewGapLiteral);
604  pDeltaExt->Set().push_back(ncbi::Ref(&*pDeltaSeq));
605  }
606  break;
607  case CSeqMap::eSeqData:
608  {
609  // Sequence data
610  string new_data;
611  CSeqVector seqvec(complete_bsh, CBioseq_Handle::eCoding_Iupac);
612  seqvec.GetSeqData(seqmap_ci.GetPosition(), seqmap_ci.GetEndPosition(),
613  new_data);
614  CRef<CSeq_data> pSeqData(new CSeq_data());
615  pSeqData->SetIupacna(*new CIUPACna(new_data));
616  CSeqportUtil::Pack(pSeqData);
617  CAutoInitRef<CDelta_seq> pDeltaSeq;
618  pDeltaSeq->SetLiteral().SetLength(seqmap_ci.GetLength());
619  pDeltaSeq->SetLiteral().SetSeq_data(*pSeqData);
620  pDeltaExt->Set().push_back(ncbi::Ref(&*pDeltaSeq));
621  }
622  break;
623  default:
624  break;
625  }
626  }
627 
628  scope.RemoveBioseq(complete_bsh);
629 
630  // Update sequence repr, length and data
631  inst->ResetExt();
632  inst->ResetSeq_data();
633  inst->SetLength(1 + (right_pos - left_pos));
634  if (pDeltaExt->Set().size() == 1) {
635  // Repr raw
637  CRef<CDelta_seq> pDeltaSeq = *pDeltaExt->Set().begin();
638  CSeq_data & seq_data = pDeltaSeq->SetLiteral().SetSeq_data();
639  inst->SetSeq_data(seq_data);
640  }
641  else {
642  // Repr delta
643  inst->SetExt().SetDelta(*pDeltaExt);
644  }
645 }
646 
647 
649  TSeqPos cut_from, TSeqPos cut_to,
650  const CSeq_id* seqid,
651  bool& bCompleteCut,
652  bool& bTrimmed)
653 {
654  // These are required fields
655  if ( !(interval->CanGetFrom() && interval->CanGetTo()) )
656  {
657  return;
658  }
659 
660  // Feature location
661  TSeqPos feat_from = interval->GetFrom();
662  TSeqPos feat_to = interval->GetTo();
663 
664  // Size of the cut
665  TSeqPos cut_size = cut_to - cut_from + 1;
666 
667  // Case 1: feature is located completely before the cut
668  if (feat_to < cut_from)
669  {
670  // Nothing needs to be done - cut does not affect feature
671  return;
672  }
673 
674  // Case 2: feature is completely within the cut
675  if (feat_from >= cut_from && feat_to <= cut_to)
676  {
677  // Feature should be deleted
678  bCompleteCut = true;
679  return;
680  }
681 
682  // Case 3: feature is completely past the cut
683  if (feat_from > cut_to)
684  {
685  // Shift the feature by the cut_size
686  feat_from -= cut_size;
687  feat_to -= cut_size;
688  interval->SetFrom(feat_from);
689  interval->SetTo(feat_to);
690  bTrimmed = true;
691  return;
692  }
693 
694  /***************************************************************************
695  * Cases below are partial overlapping cases
696  ***************************************************************************/
697  // Case 4: Cut is completely inside the feature
698  // OR
699  // Cut is to the "left" side of the feature (i.e., feat_from is
700  // inside the cut)
701  // OR
702  // Cut is to the "right" side of the feature (i.e., feat_to is
703  // inside the cut)
704  if (feat_to > cut_to) {
705  // Left side cut or cut is completely inside feature
706  feat_to -= cut_size;
707  }
708  else {
709  // Right side cut
710  feat_to = cut_from - 1;
711  }
712 
713  // Take care of the feat_from from the left side cut case
714  if (feat_from >= cut_from) {
715  feat_from = cut_to + 1;
716  feat_from -= cut_size;
717  }
718 
719  interval->SetFrom(feat_from);
720  interval->SetTo(feat_to);
721  bTrimmed = true;
722 }
723 
724 
726  TSeqPos from, TSeqPos to,
727  const CSeq_id* seqid,
728  bool& bCompleteCut,
729  bool& bTrimmed)
730 {
731  // Given a seqloc and a range, cut the seqloc
732 
733  switch(loc->Which())
734  {
735  // Single interval
736  case CSeq_loc::e_Int:
737  {
738  CRef<CSeq_interval> interval(new CSeq_interval);
739  interval->Assign(loc->GetInt());
740  x_SeqIntervalDelete(interval, from, to, seqid,
741  bCompleteCut, bTrimmed);
742  loc->SetInt(*interval);
743  }
744  break;
745 
746  // Multiple intervals
748  {
750  intervals->Assign(loc->GetPacked_int());
751  if (intervals->CanGet()) {
752  // Process each interval in the list
753  CPacked_seqint::Tdata::iterator it;
754  for (it = intervals->Set().begin();
755  it != intervals->Set().end(); )
756  {
757  // Initial value: assume that all intervals
758  // will be deleted resulting in bCompleteCut = true.
759  // Later on if any interval is not deleted, then set
760  // bCompleteCut = false
761  if (it == intervals->Set().begin()) {
762  bCompleteCut = true;
763  }
764 
765  bool bDeleted = false;
766  x_SeqIntervalDelete(*it, from, to, seqid,
767  bDeleted, bTrimmed);
768 
769  // Should interval be deleted from list?
770  if (bDeleted) {
771  it = intervals->Set().erase(it);
772  }
773  else {
774  ++it;
775  bCompleteCut = false;
776  }
777  }
778 
779  // Update the original list
780  loc->SetPacked_int(*intervals);
781  }
782  }
783  break;
784 
785  // Multiple seqlocs
786  case CSeq_loc::e_Mix:
787  {
789  mix->Assign(loc->GetMix());
790  if (mix->CanGet()) {
791  // Process each seqloc in the list
792  CSeq_loc_mix::Tdata::iterator it;
793  for (it = mix->Set().begin();
794  it != mix->Set().end(); )
795  {
796  // Initial value: assume that all seqlocs
797  // will be deleted resulting in bCompleteCut = true.
798  // Later on if any seqloc is not deleted, then set
799  // bCompleteCut = false
800  if (it == mix->Set().begin()) {
801  bCompleteCut = true;
802  }
803 
804  bool bDeleted = false;
805  x_SeqLocDelete(*it, from, to, seqid, bDeleted, bTrimmed);
806 
807  // Should seqloc be deleted from list?
808  if (bDeleted) {
809  it = mix->Set().erase(it);
810  }
811  else {
812  ++it;
813  bCompleteCut = false;
814  }
815  }
816 
817  // Update the original list
818  loc->SetMix(*mix);
819  }
820  }
821  break;
822 
823  // Other choices not supported yet
824  default:
825  {
826  }
827  break;
828  }
829 }
830 
831 
833  const TCuts& sorted_cuts,
834  const CSeq_id* seqid,
835  bool& bFeatureDeleted,
836  bool& bFeatureTrimmed,
837  bool& bProdDeleted,
838  bool& bProdTrimmed)
839 {
840  for (int ii = 0; ii < sorted_cuts.size(); ++ii)
841  {
842  const SRangeMatch& cut = sorted_cuts[ii];
843  TSeqPos from = cut.m_range.GetFrom();
844  TSeqPos to = cut.m_range.GetTo();
845 
846  // Update Seqloc "feature made from"
847  if (feat->CanGetLocation())
848  {
850  new_location->Assign(feat->GetLocation());
851  x_SeqLocDelete(new_location, from, to, seqid,
852  bFeatureDeleted, bFeatureTrimmed);
853  feat->SetLocation(*new_location);
854 
855  // No need to cut anymore nor update. Feature will be completely
856  // deleted.
857  if (bFeatureDeleted) {
858  return;
859  }
860  }
861 
862  // Update Seqloc "product of process"
863  if (feat->CanGetProduct())
864  {
866  new_product->Assign(feat->GetProduct());
867  x_SeqLocDelete(new_product, from, to, seqid, bProdDeleted, bProdTrimmed);
868  feat->SetProduct(*new_product);
869  }
870  }
871 }
872 
874  TSeqPos seq_length)
875 {
876  EInternalTrimType eInternalTrimType =
877  static_cast<EInternalTrimType>(m_radioBoxInternalTrimOptions->GetSelection());
878 
879  for (int ii = 0; ii < cuts.size(); ++ii)
880  {
881  SRangeMatch& cut = cuts[ii];
882  TSeqPos from = cut.m_range.GetFrom();
883  TSeqPos to = cut.m_range.GetTo();
884 
885  // Is it an internal cut?
886  if (from != 0 && to != seq_length-1) {
887  if (eInternalTrimType == eTrimToClosestEnd) {
888  // Extend the cut to the closest end
889  if (from - 0 < seq_length-1 - to) {
890  cut.m_range.SetFrom(0);
891  }
892  else {
893  cut.m_range.SetTo(seq_length-1);
894  }
895  }
896  else
897  if (eInternalTrimType == eTrimTo5PrimeEnd) {
898  // Extend the cut to 5' end
899  cut.m_range.SetFrom(0);
900  }
901  else {
902  // Extend the cut to 3' end
903  cut.m_range.SetTo(seq_length-1);
904  }
905  }
906  }
907 }
908 
909 
911 {
912  // Assume cuts are sorted in Ascending order.
913 
914  // Merge abutting and overlapping cuts
915  TCuts::iterator it;
916  for (it = sorted_cuts.begin(); it != sorted_cuts.end(); )
917  {
918  SRangeMatch& cut = *it;
919  TSeqPos from = cut.m_range.GetFrom();
920  TSeqPos to = cut.m_range.GetTo();
921 
922  // Does next cut exist?
923  if ( it+1 != sorted_cuts.end() ) {
924  SRangeMatch& next_cut = *(it+1);
925  TSeqPos next_from = next_cut.m_range.GetFrom();
926  TSeqPos next_to = next_cut.m_range.GetTo();
927 
928  if ( next_from <= (to + 1) ) {
929  // Current and next cuts abut or overlap
930  // So adjust current cut and delete next cut
931  cut.m_range.SetTo(next_to);
932  sorted_cuts.erase(it+1);
933 
934  // Post condition after erase:
935  // Since "it" is before the erase, "it" stays valid
936  // and still refers to current cut
937  }
938  else {
939  ++it;
940  }
941  }
942  else {
943  // I'm done
944  break;
945  }
946  }
947 }
948 
949 
952  CRef<CSeq_feat> cds)
953 {
954  // Assumption: cds has been verified to be Cdregion with Product
955 
956  // Use Cdregion.Product to get handle to protein bioseq
957  CBioseq_Handle prot_bsh = scope.GetBioseqHandle(cds->GetProduct());
958 
959  // Should be a protein!
960  if (!prot_bsh.IsProtein())
961  {
962  return;
963  }
964 
965  // Make a copy of existing CSeq_inst
966  CRef<CSeq_inst> new_inst(new CSeq_inst());
967  new_inst->Assign(prot_bsh.GetInst());
968 
969  // Make edits to the CSeq_inst copy
970  CRef<CBioseq> new_protein_bioseq;
971  if (new_inst->IsSetSeq_data())
972  {
973  // Generate new protein sequence data and length
974  new_protein_bioseq = CSeqTranslator::TranslateToProtein(*cds, scope);
975  if (new_protein_bioseq->GetInst().GetSeq_data().IsIupacaa())
976  {
977  new_inst->SetSeq_data().SetIupacaa().Set(
978  new_protein_bioseq->GetInst().GetSeq_data().GetIupacaa().Get());
979  new_inst->SetLength( new_protein_bioseq->GetInst().GetLength() );
980  }
981  else if (new_protein_bioseq->GetInst().GetSeq_data().IsNcbieaa())
982  {
983  new_inst->SetSeq_data().SetNcbieaa().Set(
984  new_protein_bioseq->GetInst().GetSeq_data().GetNcbieaa().Get());
985  new_inst->SetLength( new_protein_bioseq->GetInst().GetLength() );
986  }
987  }
988 
989  if ( !new_protein_bioseq ) {
990  return;
991  }
992 
993  // Update protein sequence data and length
994  CRef<CCmdChangeBioseqInst> chgInst (new CCmdChangeBioseqInst(prot_bsh,
995  *new_inst));
996  command->AddCommand(*chgInst);
997 
998  // If protein feature exists, update it
1000  CFeat_CI prot_feat_ci(prot_bsh, sel);
1001  for ( ; prot_feat_ci; ++prot_feat_ci ) {
1002  CRef<CSeq_feat> new_feat(new CSeq_feat());
1003  new_feat->Assign(prot_feat_ci->GetOriginalFeature());
1004 
1005  if ( new_feat->CanGetLocation() &&
1006  new_feat->GetLocation().IsInt() &&
1007  new_feat->GetLocation().GetInt().CanGetTo() )
1008  {
1009  new_feat->SetLocation().SetInt().SetTo(
1010  new_protein_bioseq->GetLength() - 1);
1011 
1012  CIRef<IEditCommand> chgFeat(new CCmdChangeSeq_feat(*prot_feat_ci,
1013  *new_feat));
1014  command->AddCommand(*chgFeat);
1015  }
1016  }
1017 }
1018 
1019 
1022  TSeqPos pos,
1023  CDense_seg::TNumseg& seg,
1024  TSeqPos& seg_start) const
1025 {
1026  for (seg = 0; seg < denseg.GetNumseg(); ++seg) {
1027  TSignedSeqPos start = denseg.GetStarts()[seg * denseg.GetDim() + row];
1028  TSignedSeqPos len = denseg.GetLens()[seg];
1029  if (start != -1) {
1030  if (pos >= start && pos < start + len) {
1031  seg_start = start;
1032  return true;
1033  }
1034  }
1035  }
1036  return false;
1037 }
1038 
1039 
1042  TSeqPos pos)
1043 {
1044  // Find the segment where pos occurs for the sequence (identified by
1045  // row).
1046  // If pos is not the start of the segment, cut the segment in two, with
1047  // one of the segments using pos as the new start.
1048 
1049 
1050  // Find the segment where pos lies
1051  const CDense_seg& denseg = align->GetSegs().GetDenseg();
1052  CDense_seg::TNumseg foundseg;
1053  TSeqPos seg_start;
1054  if ( !x_FindSegment(denseg, row, pos, foundseg, seg_start) ) {
1055  return;
1056  }
1057 
1058  // Found our segment seg
1059  // If pos falls on segment boundary, do nothing
1060  if (pos == seg_start) {
1061  return;
1062  }
1063 
1064 
1065  // Cut the segment :
1066  // 1) Allocate a new denseg with numseg size = original size + 1
1067  // 2) Copy elements before the cut
1068  // 3) Split segment at pos
1069  // 4) Copy elements after the cut
1070  // 5) Replace old denseg with new denseg
1071 
1072  // Allocate a new denseg with numseg size = original size + 1
1073  CRef<CDense_seg> new_denseg(new CDense_seg);
1074  new_denseg->SetDim( denseg.GetDim() );
1075  new_denseg->SetNumseg( denseg.GetNumseg() + 1 );
1076  ITERATE( CDense_seg::TIds, idI, denseg.GetIds() ) {
1077  CSeq_id *si = new CSeq_id;
1078  si->Assign(**idI);
1079  new_denseg->SetIds().push_back( CRef<CSeq_id>(si) );
1080  }
1081 
1082  // Copy elements (starts, lens, strands) before the cut (up to and including
1083  // foundseg-1 in original denseg)
1084  for (CDense_seg::TNumseg curseg = 0; curseg < foundseg; ++curseg) {
1085  // Copy starts
1086  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
1087  TSeqPos index = curseg * denseg.GetDim() + curdim;
1088  new_denseg->SetStarts().push_back( denseg.GetStarts()[index] );
1089  }
1090 
1091  // Copy lens
1092  new_denseg->SetLens().push_back( denseg.GetLens()[curseg] );
1093 
1094  // Copy strands
1095  if ( denseg.IsSetStrands() ) {
1096  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim();
1097  ++curdim)
1098  {
1099  TSeqPos index = curseg * denseg.GetDim() + curdim;
1100  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
1101  }
1102  }
1103  }
1104 
1105  // Split segment at pos
1106  // First find the lengths of the split segments, first_len and second_len
1107  TSeqPos first_len, second_len;
1108  TSeqPos index = foundseg * denseg.GetDim() + row;
1109  if ( !denseg.IsSetStrands() || denseg.GetStrands()[index] != eNa_strand_minus )
1110  {
1111  first_len = pos - seg_start;
1112  second_len = denseg.GetLens()[foundseg] - first_len;
1113  }
1114  else {
1115  second_len = pos - seg_start;
1116  first_len = denseg.GetLens()[foundseg] - second_len;
1117  }
1118 
1119  // Set starts, strands, and lens for the split segments (foundseg and foundseg+1)
1120  // Populate foundseg in new denseg
1121  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
1122  TSeqPos index = foundseg * denseg.GetDim() + curdim;
1123  if (denseg.GetStarts()[index] == -1) {
1124  new_denseg->SetStarts().push_back(-1);
1125  }
1126  else if (!denseg.IsSetStrands() || denseg.GetStrands()[index] != eNa_strand_minus) {
1127  new_denseg->SetStarts().push_back(denseg.GetStarts()[index]);
1128  }
1129  else {
1130  new_denseg->SetStarts().push_back(denseg.GetStarts()[index] + second_len);
1131  }
1132 
1133  if (denseg.IsSetStrands()) {
1134  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
1135  }
1136  }
1137  new_denseg->SetLens().push_back(first_len);
1138  // Populate foundseg+1 in new denseg
1139  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
1140  TSeqPos index = foundseg * denseg.GetDim() + curdim;
1141  if (denseg.GetStarts()[index] == -1) {
1142  new_denseg->SetStarts().push_back(-1);
1143  }
1144  else if (!denseg.IsSetStrands() || denseg.GetStrands()[index] != eNa_strand_minus) {
1145  new_denseg->SetStarts().push_back(denseg.GetStarts()[index] + first_len);
1146  }
1147  else {
1148  new_denseg->SetStarts().push_back(denseg.GetStarts()[index]);
1149  }
1150 
1151  if (denseg.IsSetStrands()) {
1152  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
1153  }
1154  }
1155  new_denseg->SetLens().push_back(second_len);
1156 
1157  // Copy elements (starts, lens, strands) after the cut (starting from foundseg+1 in
1158  // original denseg)
1159  for (CDense_seg::TNumseg curseg = foundseg+1; curseg < denseg.GetNumseg(); ++curseg) {
1160  // Copy starts
1161  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim(); ++curdim) {
1162  TSeqPos index = curseg * denseg.GetDim() + curdim;
1163  new_denseg->SetStarts().push_back( denseg.GetStarts()[index] );
1164  }
1165 
1166  // Copy lens
1167  new_denseg->SetLens().push_back( denseg.GetLens()[curseg] );
1168 
1169  // Copy strands
1170  if ( denseg.IsSetStrands() ) {
1171  for (CDense_seg::TDim curdim = 0; curdim < denseg.GetDim();
1172  ++curdim)
1173  {
1174  TSeqPos index = curseg * denseg.GetDim() + curdim;
1175  new_denseg->SetStrands().push_back(denseg.GetStrands()[index]);
1176  }
1177  }
1178  }
1179 
1180  // Update
1181  align->SetSegs().SetDenseg(*new_denseg);
1182 }
1183 
1184 
1187  const TCuts& sorted_cuts)
1188 {
1189  for (int ii = 0; ii < sorted_cuts.size(); ++ii)
1190  {
1191  const SRangeMatch& cut = sorted_cuts[ii];
1192  TSeqPos cut_from = cut.m_range.GetFrom();
1193  TSeqPos cut_to = cut.m_range.GetTo();
1194 
1195  TSeqPos cut_len = cut_to - cut_from + 1;
1196  if (cut_to < cut_from) {
1197  cut_len = cut_from - cut_to + 1;
1198  cut_from = cut_to;
1199  }
1200 
1201  // Note: row is 0-based
1202 
1203  // May need to cut the segment at both start and stop positions
1204  // if they do not fall on segment boundaries
1205  x_CutDensegSegment(align, row, cut_from);
1206  x_CutDensegSegment(align, row, cut_from + cut_len);
1207 
1208  // Update segment start values for the trimmed sequence row
1209  const CDense_seg& denseg = align->GetSegs().GetDenseg();
1210  for (CDense_seg::TNumseg curseg = 0; curseg < denseg.GetNumseg(); ++curseg) {
1211  TSeqPos index = curseg * denseg.GetDim() + row;
1212  TSeqPos seg_start = denseg.GetStarts()[index];
1213  if (seg_start < 0) {
1214  // This indicates a gap, no change needed
1215  }
1216  else if (seg_start < cut_from) {
1217  // This is before the cut, no change needed
1218  }
1219  else if (seg_start >= cut_from &&
1220  seg_start + denseg.GetLens()[curseg] <= cut_from + cut_len) {
1221  // This is in the gap, indicate it with a -1
1222  align->SetSegs().SetDenseg().SetStarts()[index] = -1;
1223  }
1224  else {
1225  // This is after the cut - subtract the cut_len
1226  align->SetSegs().SetDenseg().SetStarts()[index] -= cut_len;
1227  }
1228  }
1229  }
1230 }
1231 
1233 {
1234  const auto num_cuts = sorted_cuts.size();
1235  _ASSERT(num_cuts == 1 || num_cuts == 2); // Should only include terminal cuts
1236 
1238  const auto& first_cut = sorted_cuts[0].m_range;
1239  if (num_cuts == 1) { // Need to figure out which end was cut
1240  if (first_cut.GetFrom() == 0) {
1241  range.SetFrom(first_cut.GetTo() + 1);
1242  range.SetTo(seqLength - 1);
1243  }
1244  else {
1245  range.SetFrom(0);
1246  range.SetTo(first_cut.GetFrom() - 1);
1247  }
1248  return range;
1249  }
1250 
1251  // num_cuts==2 case:
1252  _ASSERT(first_cut.GetFrom() > 0);
1253  range.SetTo(first_cut.GetFrom() - 1);
1254  range.SetFrom(sorted_cuts[1].m_range.GetTo() + 1);
1255  return range;
1256 }
1257 
1259  const CSeq_id* seqid,
1260  const SVecscreenResult& vecres)
1261 {
1262  CScope& scope = m_TopSeqEntry.GetScope();
1263  CBioseq_Handle bsh = scope.GetBioseqHandle(*seqid);
1264 
1265  // Should be a nuc!
1266  if (!bsh.IsNucleotide())
1267  {
1268  return;
1269  }
1270 
1271 
1272  TCuts sorted_cuts(vecres.m_arrRangeMatch);
1273  x_GetSortedCuts(sorted_cuts, seqid);
1274 
1275  /***************************************************************************
1276  * Trim nuc sequence
1277  ***************************************************************************/
1278  // Make a copy of existing CSeq_inst
1279  CRef<CSeq_inst> new_inst(new CSeq_inst());
1280  new_inst->Assign(bsh.GetInst());
1281 
1282  // Make edits to the CSeq_inst copy
1283  x_SetSeqData(bsh, new_inst, sorted_cuts);
1284 
1285  // Swap in the edited CSeq_inst copy against the original
1286  CRef<CCmdChangeBioseqInst> chgInst (new CCmdChangeBioseqInst(bsh, *new_inst));
1287  command->AddCommand(*chgInst);
1288 
1289 
1290  /***************************************************************************
1291  * Trim all annotation that reference the nuc
1292  ***************************************************************************/
1293  // Trim features
1295  CRef<CSeq_id> copy_id(new CSeq_id());
1296  copy_id->Assign(*seqid);
1297  CRef<CSeq_loc> search_loc( new CSeq_loc );
1298  search_loc->SetWhole(*copy_id);
1299  CFeat_CI feat_ci(scope, *search_loc, feat_sel);
1300  for (; feat_ci; ++feat_ci)
1301  {
1302  // Make a copy of the feature
1303  CRef<CSeq_feat> new_feat(new CSeq_feat());
1304  new_feat->Assign(feat_ci->GetOriginalFeature());
1305 
1306  // Detect complete deletions of feature
1307  bool bFeatureDeleted = false;
1308 
1309  // Detect case where feature was not deleted but merely trimmed
1310  bool bFeatureTrimmed = false;
1311 
1312  bool bProdDeleted = false;
1313  bool bProdTrimmed = false;
1314 
1315  // Make edits to the copy
1316  x_TrimFeatureLocations(new_feat, sorted_cuts, seqid,
1317  bFeatureDeleted, bFeatureTrimmed,
1318  bProdDeleted, bProdTrimmed);
1319 
1320  if (bFeatureDeleted) {
1321  // Delete original feature
1322  CIRef<IEditCommand> delFeat(new CCmdDelSeq_feat(*feat_ci));
1323  command->AddCommand(*delFeat);
1324 
1325  // If this feat is a Cdregion, then delete the protein sequence
1326  if ( feat_ci->IsSetData() &&
1327  feat_ci->GetData().Which() == CSeqFeatData::e_Cdregion &&
1328  feat_ci->IsSetProduct() )
1329  {
1330  // Use Cdregion feat.product seqloc to get protein bioseq handle
1331  CBioseq_Handle prot_h =
1332  scope.GetBioseqHandle(feat_ci->GetProduct());
1333 
1334  // Should be a protein!
1335  if ( prot_h.IsProtein() ) {
1336  // NOTE:
1337  // CCmdDelBioseqInst implementation already takes care of
1338  // renormalizing the nuc-prot set if necessary.
1340  delProt(new CCmdDelBioseqInst(prot_h));
1341  command->AddCommand(*delProt);
1342  }
1343  }
1344  }
1345  else {
1346  if (bFeatureTrimmed) {
1347  // If this feat is a Cdregion, then RETRANSLATE the protein
1348  // sequence AND adjust any protein feature
1349  if ( new_feat->IsSetData() &&
1350  new_feat->GetData().Which() == CSeqFeatData::e_Cdregion &&
1351  new_feat->IsSetProduct() )
1352  {
1353 
1354  const auto retainedRange = x_GetRetainedRange(sorted_cuts, vecres.m_SeqLen);
1355  auto new_frame = sequence::CFeatTrim::GetCdsFrame(feat_ci->GetOriginalFeature(), retainedRange);
1356  new_feat->SetData().SetCdregion().SetFrame(new_frame);
1357  // In order to retranslate correctly, we need to create a
1358  // new scope with the trimmed sequence data.
1359 
1360  // Keep track of original seqinst
1361  CRef<CSeq_inst> orig_inst(new CSeq_inst());
1362  orig_inst->Assign(bsh.GetInst());
1363 
1364  // Update the seqinst to the trimmed version, set the scope
1365  // and retranslate
1366  CBioseq_EditHandle bseh = bsh.GetEditHandle();
1367  bseh.SetInst(*new_inst);
1368  CScope& new_scope = bseh.GetScope();
1369  x_RetranslateCDS(new_scope, command, new_feat);
1370 
1371  // Restore the original seqinst
1372  bseh.SetInst(*orig_inst);
1373  }
1374 
1375  // Swap edited copy with original feature
1376  CIRef<IEditCommand> chgFeat(new CCmdChangeSeq_feat(*feat_ci,
1377  *new_feat));
1378  command->AddCommand(*chgFeat);
1379  }
1380  }
1381  }
1382 
1383  if (m_CitSub->GetValue()) {// add cit-sub update
1384 
1385  CConstRef<CSeqdesc> changedSeqdesc;
1386  CSeq_entry_Handle seh_for_desc;
1387  string msg;
1388  CRef<CSeqdesc> changedORadded_citsub = CCitSubUpdater::s_GetCitSubForTrimmedSequence(bsh, msg, changedSeqdesc, seh_for_desc);
1389  if (changedORadded_citsub) {
1390  if (changedSeqdesc && seh_for_desc) {
1391  CRef<CCmdChangeSeqdesc> change_cmd(new CCmdChangeSeqdesc(seh_for_desc, *changedSeqdesc, *changedORadded_citsub));
1392  command->AddCommand(*change_cmd);
1393  }
1394  else if (!changedSeqdesc) {
1397  if (bssh &&
1398  bssh.CanGetClass() &&
1400  seh = bssh.GetParentEntry();
1401  }
1402  CIRef<IEditCommand> cmdAddDesc(new CCmdCreateDesc(seh, *changedORadded_citsub));
1403  command->AddCommand(*cmdAddDesc);
1404  }
1405  }
1406  }
1407 }
1408 
1409 
1411  const CSeq_id* seqid)
1412 {
1413  CScope& scope = m_TopSeqEntry.GetScope();
1414  CBioseq_Handle bsh = scope.GetBioseqHandle(*seqid);
1415 
1416  /***************************************************************************
1417  * Adjust internal cuts to 3' end
1418  * Merge abutting and overlapping cuts
1419  ***************************************************************************/
1421  sort(sorted_cuts.begin(), sorted_cuts.end(), asc);
1422 
1423  // Adjust internal cuts
1424  x_AdjustInternalCutLocations(sorted_cuts, bsh.GetBioseqLength());
1425 
1426  // Merge abutting and overlapping cuts
1427  x_MergeCuts(sorted_cuts);
1428 
1429  /***************************************************************************
1430  * Sort the cuts in descending order
1431  ***************************************************************************/
1432  // Sort the ranges from greatest to least so that sequence
1433  // data and metadata will be deleted from greatest loc to smallest loc.
1434  // That way we don't have to adjust coordinate values after
1435  // each delete.
1437  sort(sorted_cuts.begin(), sorted_cuts.end(), descend);
1438 }
1439 
1440 
1442  const TVecscreenSummaryBySeqid& trimOnly)
1443 {
1444  // Adjust alignments
1446  CAlign_CI align_ci(m_TopSeqEntry, align_sel);
1447  for (; align_ci; ++align_ci)
1448  {
1449  // So far, handle DENSEG type only
1450  const CSeq_align& align = *align_ci;
1451  if ( align.CanGetSegs() &&
1453  {
1454  // Make sure mandatory fields are present in the denseg
1455  const CDense_seg& denseg = align.GetSegs().GetDenseg();
1456  if (! (denseg.CanGetDim() && denseg.CanGetNumseg() &&
1457  denseg.CanGetIds() && denseg.CanGetStarts() &&
1458  denseg.CanGetLens()) )
1459  {
1460  continue;
1461  }
1462 
1463  // Make a copy of the alignment
1464  CRef<CSeq_align> new_align(new CSeq_align());
1465  new_align->Assign(align_ci.GetOriginalSeq_align());
1466 
1467  // Make edits to the copy
1469  for (cit = trimOnly.begin(); cit != trimOnly.end(); ++cit)
1470  {
1471  const CSeq_id* seqid = cit->first;
1472  const SVecscreenResult& result = cit->second;
1473 
1474  // On which "row" does the seqid lie?
1475  const CDense_seg::TIds& ids = denseg.GetIds();
1476  CDense_seg::TDim row = -1;
1477  for (int ii = 0; ii < ids.size(); ++ii) {
1478  if ( ids[ii]->Match(*seqid) ) {
1479  row = ii;
1480  break;
1481  }
1482  }
1483  if ( row < 0 || !denseg.CanGetDim() || row >= denseg.GetDim() ) {
1484  continue;
1485  }
1486 
1487  TCuts sorted_cuts(result.m_arrRangeMatch);
1488  x_GetSortedCuts(sorted_cuts, seqid);
1489  x_AdjustDensegAlignment(new_align, row, sorted_cuts);
1490  }
1491 
1492  // Swap edited copy with the original alignment
1493  CIRef<IEditCommand> chgAlign(
1494  new CCmdChangeAlign( align_ci.GetSeq_align_Handle(),
1495  *new_align ));
1496  command->AddCommand(*chgAlign);
1497  }
1498  else {
1499  // For other alignment types, delete them. This is what
1500  // C Toolkit does (see AdjustAlignmentsInAnnot)
1501  CIRef<IEditCommand> delAlign(
1502  new CCmdDelSeq_align( align_ci.GetSeq_align_Handle() ));
1503  command->AddCommand(*delAlign);
1504  }
1505  }
1506 }
1507 
1508 
1510  const TCuts& sorted_cuts,
1511  const CSeq_id* seqid)
1512 {
1513  for (int ii = 0; ii < sorted_cuts.size(); ++ii)
1514  {
1515  const SRangeMatch& cut = sorted_cuts[ii];
1516  TSeqPos from = cut.m_range.GetFrom();
1517  TSeqPos to = cut.m_range.GetTo();
1518 
1519  if (new_graph->CanGetLoc())
1520  {
1522  new_loc->Assign(new_graph->GetLoc());
1523  bool bDeleted = false;
1524  bool bTrimmed = false;
1525  x_SeqLocDelete(new_loc, from, to, seqid, bDeleted, bTrimmed);
1526  new_graph->SetLoc(*new_loc);
1527  }
1528  }
1529 }
1530 
1531 
1533  const CSeq_id* seqid,
1534  TSeqPos& trim_start,
1535  TSeqPos& trim_stop)
1536 {
1537  CScope& scope = m_TopSeqEntry.GetScope();
1538  CBioseq_Handle bsh = scope.GetBioseqHandle(*seqid);
1539 
1540  // Set defaults
1541  trim_start = 0;
1542  trim_stop = bsh.GetInst().GetLength() - 1;
1543 
1544  // Assumptions :
1545  // All cuts have been sorted. Internal cuts were converted to terminal.
1546  for (int ii = 0; ii < sorted_cuts.size(); ++ii)
1547  {
1548  const SRangeMatch& cut = sorted_cuts[ii];
1549  TSeqPos from = cut.m_range.GetFrom();
1550  TSeqPos to = cut.m_range.GetTo();
1551 
1552  // Left-side terminal cut. Update trim_start if necessary.
1553  if ( from == 0 ) {
1554  if ( trim_start <= to ) {
1555  trim_start = to + 1;
1556  }
1557  }
1558 
1559  // Right-side terminal cut. Update trim_stop if necessary.
1560  if ( to == bsh.GetInst().GetLength() - 1 ) {
1561  if ( trim_stop >= from ) {
1562  trim_stop = from - 1;
1563  }
1564  }
1565  }
1566 }
1567 
1568 
1570  const CMappedGraph& orig_graph,
1571  const TCuts& sorted_cuts,
1572  const CSeq_id* seqid)
1573 {
1574  // Get range that original seqgraph data covers
1575  TSeqPos graph_start = new_graph->GetLoc().GetStart(eExtreme_Positional);
1576  TSeqPos graph_stop = new_graph->GetLoc().GetStop(eExtreme_Positional);
1577 
1578  // Get range of trimmed sequence
1579  TSeqPos trim_start;
1580  TSeqPos trim_stop;
1581  x_GetTrimCoordinates(sorted_cuts, seqid, trim_start, trim_stop);
1582 
1583  // Determine range over which to copy seqgraph data from old to new
1584  TSeqPos copy_start = graph_start;
1585  if (trim_start > graph_start) {
1586  copy_start = trim_start;
1587  }
1588  TSeqPos copy_stop = graph_stop;
1589  if (trim_stop < graph_stop) {
1590  copy_stop = trim_stop;
1591  }
1592 
1593  // Copy over seqgraph data values. Handle BYTE type only (see
1594  // C Toolkit's GetGraphsProc function in api/sqnutil2.c)
1595  CSeq_graph::TGraph& dst_data = new_graph->SetGraph();
1596  dst_data.Reset();
1597  const CSeq_graph::TGraph& src_data = orig_graph.GetGraph();
1598  switch ( src_data.Which() ) {
1600  // Keep original min, max, axis
1601  dst_data.SetByte().SetMin(src_data.GetByte().GetMin());
1602  dst_data.SetByte().SetMax(src_data.GetByte().GetMax());
1603  dst_data.SetByte().SetAxis(src_data.GetByte().GetAxis());
1604 
1605  // Copy start/stop values are relative to bioseq coordinate system.
1606  // Change them so that they are relative to graph location.
1607  copy_start -= graph_start;
1608  copy_stop -= graph_start;
1609 
1610  // Update data values
1611  dst_data.SetByte().SetValues();
1612  dst_data.SetByte().SetValues().insert(
1613  dst_data.SetByte().SetValues().end(),
1614  src_data.GetByte().GetValues().begin() + copy_start,
1615  src_data.GetByte().GetValues().begin() + copy_stop + 1);
1616 
1617  // Update numvals
1618  new_graph->SetNumval(copy_stop - copy_start + 1);
1619 
1620  // Update seqloc
1621  x_UpdateSeqGraphLoc(new_graph, sorted_cuts, seqid);
1622  break;
1623  default:
1624  break;
1625  }
1626 }
1627 
1628 
1630  const TVecscreenSummaryBySeqid& trimOnly)
1631 {
1633  CGraph_CI graph_ci(m_TopSeqEntry, graph_sel);
1634  for (; graph_ci; ++graph_ci)
1635  {
1636  // Only certain types of graphs are supported.
1637  // See C Toolkit function GetGraphsProc in api/sqnutil2.c
1638  const CMappedGraph& graph = *graph_ci;
1639  if ( graph.IsSetTitle() &&
1640  (NStr::CompareNocase( graph.GetTitle(), "Phrap Quality" ) == 0 ||
1641  NStr::CompareNocase( graph.GetTitle(), "Phred Quality" ) == 0 ||
1642  NStr::CompareNocase( graph.GetTitle(), "Gap4" ) == 0) )
1643  {
1644  // Make a copy of the graph
1645  CRef<CSeq_graph> new_graph(new CSeq_graph());
1646  new_graph->Assign(graph.GetOriginalGraph());
1647 
1648  // Make edits to the copy
1650  for (cit = trimOnly.begin(); cit != trimOnly.end(); ++cit)
1651  {
1652  const CSeq_id* seqid = cit->first;
1653  const SVecscreenResult& result = cit->second;
1654 
1655  // Find matching seqid referred to by the graph
1656  if ( graph.GetLoc().GetId()->Match(*seqid) ) {
1657  TCuts sorted_cuts(result.m_arrRangeMatch);
1658  x_GetSortedCuts(sorted_cuts, seqid);
1659 
1660  x_TrimSeqGraphData(new_graph, graph, sorted_cuts, seqid);
1661 
1662  // Swap edited copy with the original graph
1663  CIRef<IEditCommand> chgGraph(
1664  new CCmdChangeGraph( graph.GetSeq_graph_Handle(),
1665  *new_graph ));
1666  command->AddCommand(*chgGraph);
1667  break;
1668  }
1669  }
1670  }
1671  }
1672 }
1673 
1674 
1675 bool CVectorTrimPanel::x_IsCompleteCut(const TCuts& sorted_cuts,
1676  TSeqPos seq_length)
1677 {
1678  // Assume cuts are sorted in Ascending order.
1679 
1680 
1681  // Special case: no cuts
1682  if (sorted_cuts.empty()) {
1683  return false;
1684  }
1685 
1686 
1687  // Special case: only one cut
1688  if (sorted_cuts.size() == 1) {
1689  const SRangeMatch& cut = sorted_cuts[0];
1690  TSeqPos from = cut.m_range.GetFrom();
1691  TSeqPos to = cut.m_range.GetTo();
1692  if (from == 0 && to == seq_length - 1) {
1693  return true;
1694  }
1695  else {
1696  return false;
1697  }
1698  }
1699 
1700 
1701  // 2 or more cuts exist
1702  TSeqPos min_from = -1;
1703  TSeqPos max_to = -1;
1704  for (int ii = 0; ii < sorted_cuts.size(); ++ii)
1705  {
1706  const SRangeMatch& cut = sorted_cuts[ii];
1707  TSeqPos from = cut.m_range.GetFrom();
1708  TSeqPos to = cut.m_range.GetTo();
1709 
1710  if (ii == 0) {
1711  min_from = from;
1712  max_to = to;
1713  }
1714  else {
1715  // If the current cut is discontiguous with previous cut(s)
1716  // then we do NOT have a complete cut
1717  if (from > max_to + 1) {
1718  // Gap exists, so this is a discontiguous cut
1719  return false;
1720  }
1721 
1722  min_from = min(min_from, from);
1723  max_to = max(max_to, to);
1724  }
1725  }
1726 
1727  if (min_from == 0 && max_to == seq_length - 1) {
1728  return true;
1729  }
1730 
1731  return false;
1732 }
1733 
1734 
1736  TVecscreenSummaryBySeqid& completeDeletions,
1737  TVecscreenSummaryBySeqid& trimOnly)
1738 {
1739  // Put complete deletions into completeDeletions container
1740  // Put partial cuts into trimOnly container
1741 
1742  CScope& scope = m_TopSeqEntry.GetScope();
1743 
1745  for (cit = seqidSummary.begin(); cit != seqidSummary.end(); ++cit)
1746  {
1747  const CSeq_id* seqid = cit->first;
1748  const SVecscreenResult& vecres = cit->second;
1749 
1750  // Will the sequence be completely deleted by the trim?
1751  CBioseq_Handle bsh = scope.GetBioseqHandle(*seqid);
1752 
1753  // Should be a nuc!
1754  if ( !bsh.IsNucleotide() ) {
1755  continue;
1756  }
1757 
1758  // Sort ranges in ascending order
1759  TCuts sorted_cuts(vecres.m_arrRangeMatch);
1761  sort(sorted_cuts.begin(), sorted_cuts.end(), asc);
1762 
1763  // Merge abutting and overlapping cuts
1764  x_MergeCuts(sorted_cuts);
1765 
1766  // Adjust internal cuts
1767  TSeqPos nuc_length = bsh.GetBioseqLength();
1768  x_AdjustInternalCutLocations(sorted_cuts, nuc_length);
1769 
1770  // Is it a complete cut of the entire sequence?
1771  if (x_IsCompleteCut(sorted_cuts, nuc_length)) {
1772  completeDeletions.insert(TVecscreenSummaryBySeqid::value_type(seqid,
1773  vecres));
1774  }
1775  else {
1777  vecres));
1778  }
1779  }
1780 }
1781 
1782 
1784  const CSeq_id* seqid)
1785 {
1786  CScope& scope = m_TopSeqEntry.GetScope();
1787  CBioseq_Handle bsh = scope.GetBioseqHandle(*seqid);
1788 
1789  // Should be a nuc!
1790  if (!bsh.IsNucleotide())
1791  {
1792  return;
1793  }
1794 
1795  // Is nuc bioseq part of a nucprot set? If so, delete the nucprot
1796  // set. Otherwise delete just the nuc.
1798  if (bssh && bssh.CanGetClass() &&
1800  {
1801  // Delete the nucprot set
1802  CRef<CCmdDelBioseqSet> delSet(new CCmdDelBioseqSet(bssh));
1803  command->AddCommand(*delSet);
1804  }
1805  else
1806  {
1807  // Delete just the nuc
1808  CRef<CCmdDelBioseqInst> delSeq(new CCmdDelBioseqInst(bsh));
1809  command->AddCommand(*delSeq);
1810  }
1811 }
1812 
1813 
1815 {
1816 
1817  const TVecscreenSummaryBySeqid& seqidSummary =
1819 
1820 
1821  // Detect if some sequences are 100% contamination sequences.
1822  // Warn user that these sequences will be completely removed.
1823  // Give user chance to CANCEL.
1824  TVecscreenSummaryBySeqid completeDeletions;
1825  TVecscreenSummaryBySeqid trimOnly;
1826  x_FindCompleteDeletions(seqidSummary, completeDeletions, trimOnly);
1827  if ( !completeDeletions.empty() ) {
1828  CListReportDlg* listReport = new CListReportDlg(this);
1829 
1830  wxString header;
1831  header << "The following " << completeDeletions.size()
1832  << " sequences are 100% matches to vector and \n"
1833  << "will be deleted from your submission:";
1834  listReport->SetHeader(header);
1835 
1836  wxString list;
1838  for (cit = completeDeletions.begin(); cit != completeDeletions.end(); ++cit)
1839  {
1840  const CSeq_id* seqid = cit->first;
1841  const SVecscreenResult& vecres = cit->second;
1842 
1843  list << seqid->AsFastaString() << "\n";
1844  }
1845  listReport->SetList(list);
1846 
1847  wxString footer;
1848  footer << "Do you want to continue?";
1849  listReport->SetFooter(footer);
1850 
1851  if ( listReport->ShowModal() == wxID_CANCEL ) {
1852  // User canceled
1853  return false;
1854  }
1855  }
1856 
1857 
1858  CRef<CCmdComposite> command( new CCmdComposite( "Trim Vector" ) );
1859 
1860 
1861  // Delete selected sequences
1863  for (cit = completeDeletions.begin(); cit != completeDeletions.end(); ++cit)
1864  {
1865  const CSeq_id* seqid = cit->first;
1866 
1867  x_DeleteSelected(command, seqid);
1868  }
1869 
1870 
1871  // Trim selected sequences
1872  for (cit = trimOnly.begin(); cit != trimOnly.end(); ++cit)
1873  {
1874  const CSeq_id* seqid = cit->first;
1875  const SVecscreenResult& result = cit->second;
1876 
1877  x_TrimSelected(command, seqid, result);
1878  }
1879 
1880  // Trim alignments
1881  x_TrimAlignments(command, trimOnly);
1882 
1883  // Trim seq-graphs
1884  x_TrimSeqGraphs(command, trimOnly);
1885 
1886 
1887  EInternalTrimType eInternalTrimType =
1888  static_cast<EInternalTrimType>(m_radioBoxInternalTrimOptions->GetSelection());
1889  wxString report;
1890  m_listMatches->GetSelectedLocations(report, eInternalTrimType);
1891  if (!report.IsEmpty()) {
1892  // Popup report of locations trimmed.
1893  // Set parent window to NULL and add style wxDIALOG_NO_PARENT, so that the report stays up
1894  // even when the vector trim dialog is closed.
1895  CVecscreenReport* vecscreenReport = new CVecscreenReport(GetGrandParent(),
1896  wxID_ANY,
1897  _("Trimmed Location(s)"),
1898  wxDefaultPosition,
1899  wxDefaultSize,
1900  wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX);
1901  vecscreenReport->SetReport(report);
1902  vecscreenReport->Show();
1903  }
1904 
1905 
1906  // Keep track of ALL commands executed so that later you can
1907  // unexecute them all if the user cancels
1909  return true;
1910 }
1911 
1912 
1915  vecscreen_summary)
1916 {
1917  m_listMatches->UpdateData(vecscreen_summary);
1918 }
1919 
1920 
1921 
1922 IMPLEMENT_DYNAMIC_CLASS( CMatchesListCtrl, wxCheckedListCtrl )
1923 
1924 
1925 BEGIN_EVENT_TABLE(CMatchesListCtrl, wxCheckedListCtrl)
1927  EVT_LIST_ITEM_SELECTED(MYID_LISTCTRL_MATCHES, CMatchesListCtrl::OnSelected)
1928  EVT_LIST_ITEM_CHECKED(MYID_LISTCTRL_MATCHES, CMatchesListCtrl::OnChecked)
1930 
1931 
1933 {
1934 }
1935 
1936 
1938  const wxWindowID id,
1939  const wxPoint& pos,
1940  const wxSize& size,
1941  long style)
1942 {
1943  Create(parent, id, pos, size, style);
1944 }
1945 
1946 
1948 {
1949 }
1950 
1951 
1952 bool CMatchesListCtrl::Create(wxWindow *parent,
1953  wxWindowID id,
1954  const wxPoint &pos,
1955  const wxSize &size,
1956  long style)
1957 {
1958  wxCheckedListCtrl::Create(parent, id, pos, size, style);
1959 
1960  // Init state variables
1962  m_SortAscending = true;
1963  m_SelectedRow = -1;
1964 
1965  // Set line item graphic properties
1966  m_listItemAttr.SetTextColour(*wxBLUE);
1967  m_listItemAttr.SetBackgroundColour(*wxLIGHT_GREY);
1968  m_listItemAttr.SetFont(wxNullFont);
1969 
1970  // Set up the column properties
1971 
1972  InsertColumn( 0, _("Select"), wxLIST_FORMAT_LEFT);
1973  InsertColumn( 1, _("Location"), wxLIST_FORMAT_LEFT);
1974  InsertColumn( 2, _("Seqid"), wxLIST_FORMAT_LEFT );
1975  InsertColumn( 3, _("Match"), wxLIST_FORMAT_LEFT );
1976 
1977  return true;
1978 }
1979 
1980 
1981 void CMatchesListCtrl::SetAlignGraphicView( wxHtmlWindow* view )
1982 {
1983  m_AlignView = view;
1984 }
1985 
1986 
1988 {
1989  m_RangeView = view;
1990 }
1991 
1992 
1994 {
1995  return hitloc.m_Selected;
1996 }
1997 
1998 
2000 {
2001  switch(hitloc.m_HitLocation) {
2002  case CUVHitLoc::e5Prime:
2003  return _( "5' End" );
2004  case CUVHitLoc::eInternal:
2005  {
2006  if (hitloc.m_matches.size() != 1) {
2007  return _( "Internal" );
2008  }
2009 
2010  TSeqPos start = hitloc.m_matches[0].m_range.GetFrom();
2011  TSeqPos stop = hitloc.m_matches[0].m_range.GetTo();
2012  stringstream ss;
2013  ss << _( "Internal: " ) << start << _( " from 5' end, " )
2014  << hitloc.m_SeqLen - stop << _( " from 3' end" );
2015  return _( ss.str() );
2016  }
2017  case CUVHitLoc::e3Prime:
2018  return _( "3' End" );
2019  default:
2020  return _( "Unknown" );
2021  }
2022 }
2023 
2024 
2026 {
2027  return _( hitloc.m_FastaSeqid );
2028 }
2029 
2030 
2032 {
2033  // Concatenate the match type(s)
2034  stringstream ssMatchType;
2035  for (int ii = 0; ii < hitloc.m_matches.size(); ++ii)
2036  {
2037  if (ii > 0)
2038  {
2039  ssMatchType << "; ";
2040  }
2041  ssMatchType << hitloc.m_matches[ii].m_match_type;
2042  }
2043  return _( ssMatchType.str() );
2044 }
2045 
2046 
2047 // Note :
2048 // TVecscreenSummaryBySeqid is CMatchesListCtrl's interface to the outside.
2049 // Internally CMatchesListCtrl uses TVecscreenSummaryByLocation to display
2050 // data.
2052 {
2053  // Transform internal TVecscreenSummaryByLocation selections to
2054  // TVecscreenSummaryBySeqid data type for callers
2056  return m_seqidSummaryBySeqid;
2057 }
2058 
2059 
2061  vecscreen_summary)
2062 {
2063  // Transform TVecscreenSummaryBySeqid to internal data type
2065 
2066  // Clean slate
2067  DeleteAllItems();
2068  if (m_RangeView) {
2069  m_RangeView->DeleteAllItems();
2070  }
2071 
2072  // Display message if no vector contamination was found
2073  if (m_seqidSummaryByLocation.empty()) {
2074  wxListItem item;
2075  int row = 0;
2076  int col = 0;
2077  item.SetId(row);
2078  InsertItem(item);
2079  SetItem(row, col, _("No vector contamination found")); // TODO
2080 
2081  // Adjust the first column width
2082  wxListItem objcol;
2083  GetColumn(col, objcol);
2084  objcol.SetWidth(450);
2085  SetColumn(col, objcol);
2086 
2087  return true;
2088  }
2089 
2090  // Re-adjust the first column width
2091  int col = 0;
2092  wxListItem objcol;
2093  GetColumn(col, objcol);
2094  objcol.SetWidth(50);
2095  SetColumn(col, objcol);
2096 
2097  x_Redraw();
2098 
2099  return true;
2100 }
2101 
2102 
2104  TVecscreenSummaryBySeqid& seqidSummaryBySeqid) const
2105 {
2106  // Input container: TVecscreenSummaryByLocation
2107  // Output container: TVecscreenSummaryBySeqid
2108 
2109  // Combine matches separated by location into a single container for each seqid
2110 
2111  seqidSummaryBySeqid.clear();
2112  TVecscreenSummaryByLocation::const_iterator cit;
2113  for (cit = seqidSummaryByLocation.begin(); cit != seqidSummaryByLocation.end(); ++cit) {
2114  const CUVHitLoc& loc = *cit;
2115 
2116  if (!loc.m_Selected) {
2117  continue;
2118  }
2119 
2120  // Insert into output container.
2121  SVecscreenResult vecres(loc.m_FastaSeqid, loc.m_matches, loc.m_SeqLen);
2122  pair<TVecscreenSummaryBySeqid::iterator, bool> ins_res =
2123  seqidSummaryBySeqid.insert(TVecscreenSummaryBySeqid::value_type(loc.m_Seqid, vecres));
2124 
2125  // If insert fails, append element to existing key's value
2126  if (!ins_res.second) {
2127  SVecscreenResult& vecres = ins_res.first->second;
2128  vecres.m_arrRangeMatch.insert(vecres.m_arrRangeMatch.end(),
2129  loc.m_matches.begin(),
2130  loc.m_matches.end());
2131  }
2132  }
2133 }
2134 
2135 
2137  const vector<SRangeMatch>& sorted_matches,
2138  const CSeq_id* seqid,
2139  const SVecscreenResult& vecres) const
2140 {
2141  if (sorted_matches.empty()) {
2142  return;
2143  }
2144 
2145 
2146  // Use sorted_matches to determine location: 5' or 3' or Internal
2147  static const TSeqPos kTerminalLenFromEnd = 50;
2149  const TSeqPos loc_start = sorted_matches[0].m_range.GetFrom();
2150  const TSeqPos loc_stop = sorted_matches[sorted_matches.size()-1].m_range.GetTo();
2151  if (loc_start < kTerminalLenFromEnd) {
2153  }
2154  else
2155  if (vecres.m_SeqLen - loc_stop < kTerminalLenFromEnd) {
2157  }
2158  else {
2160  }
2161 
2162 
2163  // Use location to determine selected: Internal hits should not be selected by default.
2164  bool selected = true;
2165  if (location == CUVHitLoc::eInternal) {
2166  selected = false;
2167  }
2168 
2169 
2170  CUVHitLoc hits(selected, location, vecres, seqid, sorted_matches);
2171  seqidSummaryByLocation.push_back(hits);
2172 }
2173 
2174 
2176  TVecscreenSummaryByLocation& seqidSummaryByLocation) const
2177 {
2178  // Input container: TVecscreenSummaryBySeqid
2179  // Output container: TVecscreenSummaryByLocation
2180 
2181  // For each seqid, split matches out by location into separate containers.
2182  // Abutting locations are put into the same container.
2183 
2184  seqidSummaryByLocation.clear();
2186  for (cit = vecscreen_summary.begin(); cit != vecscreen_summary.end(); ++cit) {
2187  const CSeq_id* seqid = cit->first;
2188  SVecscreenResult vecres = cit->second;
2189 
2190  // Sort the matches in ascending order
2192  sort(vecres.m_arrRangeMatch.begin(), vecres.m_arrRangeMatch.end(), asc);
2193 
2194  // If location is by itself, put into separate container.
2195  // If location is abutting previous location, put into same container as previous.
2196  int previous_to = -99;
2197  vector<SRangeMatch> previous_matches;
2198  for (int ii = 0; ii < vecres.m_arrRangeMatch.size(); ++ii) {
2199  const SRangeMatch& match = vecres.m_arrRangeMatch[ii];
2200 
2201  if (match.m_range.GetFrom() <= previous_to+1) {
2202  // This location abuts previous location!
2203  // Put into same container as previous.
2204  previous_matches.push_back(match);
2205  }
2206  else {
2207  // Put into new separate container.
2208  vector<SRangeMatch> current_matches;
2209  current_matches.push_back(match);
2210 
2211  // And insert any previous_matches into Output container TVecscreenSummaryByLocation
2212  x_InsertMatches(seqidSummaryByLocation, previous_matches, seqid, vecres);
2213 
2214  // Update previous_matches container
2215  previous_matches.swap(current_matches);
2216  }
2217 
2218  previous_to = match.m_range.GetTo();
2219  }
2220 
2221  // Insert remaining previous_matches into Output container TVecscreenSummaryByLocation
2222  x_InsertMatches(seqidSummaryByLocation, previous_matches, seqid, vecres);
2223  }
2224 }
2225 
2226 
2227 void CMatchesListCtrl::GetReport(wxString& report)
2228 {
2229  if (m_seqidSummaryByLocation.empty()) {
2230  report << _("No vector contamination found");
2231  return;
2232  }
2233 
2234  // Generate report of current state of results
2235  TVecscreenSummaryByLocation::const_iterator cit;
2236  for (cit = m_seqidSummaryByLocation.begin(); cit != m_seqidSummaryByLocation.end(); ++cit)
2237  {
2238  const CUVHitLoc& hitloc = *cit;
2239 
2240  report << x_GetHitLocation(hitloc) << _(";")
2241  << x_GetSeqid(hitloc) << _(";")
2242  << x_GetMatchType(hitloc) << _("\n");
2243  }
2244 }
2245 
2246 
2248 {
2249  // Sort a copy of the seqidSummaryByLocation data structure by
2250  // Accession for reporting purposes.
2251  CUVHitCmp cmp(eSortAccession, true);
2252  TVecscreenSummaryByLocation seqidSummaryByLocation(m_seqidSummaryByLocation);
2253  sort(seqidSummaryByLocation.begin(), seqidSummaryByLocation.end(), cmp);
2254 
2255  TVecscreenSummaryByLocation::const_iterator cit;
2256  for (cit = seqidSummaryByLocation.begin(); cit != seqidSummaryByLocation.end(); ++cit)
2257  {
2258  if (cit->m_Selected && !cit->m_matches.empty()) {
2259  // Seqid
2260  report << cit->m_FastaSeqid << _(":");
2261 
2262  const SRangeMatch& firstrange = cit->m_matches[0];
2263  const SRangeMatch& lastrange = cit->m_matches[cit->m_matches.size()-1];
2264 
2265  // Since abutting hits are kept together in the same container,
2266  // get the "from" of the first element and get the "to" of the last
2267  // element to effectively MERGE abutting hits
2268  TSeqPos from = firstrange.m_range.GetFrom();
2269  TSeqPos to = lastrange.m_range.GetTo();
2270 
2271  // Adjust the cut location reports for any internal cut
2272  // adjustments that were made
2273  TSeqPos seq_length = cit->m_SeqLen;
2274  if (from != 0 && to != seq_length-1) {
2275  // We have an internal hit!
2276  // Internal hits are always adjusted to terminal using an option.
2277 
2278  if (eInternalTrimType == CVectorTrimPanel::eTrimToClosestEnd) {
2279  // Extend the cut to the closest end
2280  if (from - 0 < seq_length-1 - to) {
2281  from = 0;
2282  }
2283  else {
2284  to = seq_length-1;
2285  }
2286  }
2287  else
2288  if (eInternalTrimType == CVectorTrimPanel::eTrimTo5PrimeEnd) {
2289  // Extend the cut to 5' end
2290  from = 0;
2291  }
2292  else {
2293  // Extend the cut to 3' end
2294  to = seq_length-1;
2295  }
2296  }
2297 
2298  // Report the locations that were actually cut
2299  // Units are 1-based for reporting!
2300  report << from + 1 << "-" << to + 1 << _("\n");
2301  }
2302  }
2303 }
2304 
2305 
2306 void CMatchesListCtrl::Sort(ESortOption eSortOption, bool bAscending)
2307 {
2308  m_SortOption = eSortOption;
2309  m_SortAscending = bAscending;
2310 
2311  x_Redraw();
2312 }
2313 
2314 
2315 bool CMatchesListCtrl::x_Find(const CUVHitLoc& hitloc, const wxString& searchstr)
2316 {
2317  if (searchstr.empty()) {
2318  return false;
2319  }
2320 
2321  // Search hit location
2322  wxString s = x_GetHitLocation(hitloc);
2323  if (s.Find(searchstr) != wxNOT_FOUND) {
2324  return true;
2325  }
2326 
2327  // Search Seqid
2328  s = x_GetSeqid(hitloc);
2329  if (s.Find(searchstr) != wxNOT_FOUND) {
2330  return true;
2331  }
2332 
2333  // Search Strength
2334  s = x_GetMatchType(hitloc);
2335  if (s.Find(searchstr) != wxNOT_FOUND) {
2336  return true;
2337  }
2338 
2339  return false;
2340 }
2341 
2342 
2344 {
2345  return row >= 0 && row < m_seqidSummaryByLocation.size();
2346 }
2347 
2348 
2350 {
2351  if (bFound) {
2352  // If found, select that row as if user clicked on it
2353  SetItemState(row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
2354  m_SelectedRow = row;
2355  }
2356  else {
2357  // Popup a Not Found! dialog
2358  wxMessageDialog msg( NULL, _("Text not found!"), _("Info") );
2359  msg.ShowModal();
2360  }
2361 }
2362 
2363 
2364 void CMatchesListCtrl::FindForward(wxString searchstr)
2365 {
2366  bool bFound = false;
2367 
2368  // Start search from next
2369  auto row = m_SelectedRow + 1;
2370  if (!x_IsValidRow(row)) {
2371  // If not valid, init search from first row
2372  row = 0;
2373  }
2374 
2375  auto initialSearchRow = row;
2376  for (; row < m_seqidSummaryByLocation.size();) {
2377  const CUVHitLoc& hitloc = m_seqidSummaryByLocation[row];
2378  bFound = x_Find(hitloc, searchstr);
2379  if (bFound) {
2380  break;
2381  }
2382 
2383  // If you've reached the end and your initial search row was not the
2384  // beginning, then wrap around to the beginning and search again
2385  if (row == m_seqidSummaryByLocation.size() - 1 && initialSearchRow > 0) {
2386  row = 0;
2387  initialSearchRow = row;
2388  }
2389  else {
2390  ++row;
2391  }
2392  }
2393 
2394  x_DisplaySearchResult(bFound, row);
2395 }
2396 
2397 
2398 void CMatchesListCtrl::FindReverse(wxString searchstr)
2399 {
2400  bool bFound = false;
2401 
2402  // Start search from previous
2403  auto row = m_SelectedRow - 1;
2404  if (!x_IsValidRow(row)) {
2405  // If not valid, init search from last row
2406  row = m_seqidSummaryByLocation.size() - 1;
2407  }
2408 
2409  auto initialSearchRow = row;
2410  for (; row >= 0;) {
2411  const CUVHitLoc& hitloc = m_seqidSummaryByLocation[row];
2412  bFound = x_Find(hitloc, searchstr);
2413  if (bFound) {
2414  break;
2415  }
2416 
2417  // If you've reached the beginning and your initial search row was not the
2418  // end, then wrap around to the end and search again
2419  if (row == 0 && initialSearchRow < m_seqidSummaryByLocation.size() - 1) {
2420  row = m_seqidSummaryByLocation.size() - 1;
2421  initialSearchRow = row;
2422  }
2423  else {
2424  --row;
2425  }
2426  }
2427 
2428  x_DisplaySearchResult(bFound, row);
2429 }
2430 
2431 
2433 {
2434  TVecscreenSummaryByLocation::const_iterator cit;
2435  for (cit = m_seqidSummaryByLocation.begin(); cit != m_seqidSummaryByLocation.end(); ++cit)
2436  {
2437  if (!cit->m_Selected) {
2438  return false;
2439  }
2440  }
2441  return true;
2442 }
2443 
2444 
2446 {
2447  return m_SortAscending ?
2448  x_Compare(x, y) < 0 :
2449  x_Compare(x, y) > 0;
2450 }
2451 
2452 
2453 void CMatchesListCtrl::CUVHitCmp::x_FindStrongestMatchType(const vector<SRangeMatch>& matches,
2454  SRangeMatch::EMatchType& matchtype) const
2455 {
2456  // Iterate through container and keep track of the strongest matchtype found
2457  for (int ii = 0; ii < matches.size(); ++ii) {
2458  string matchstr = matches[ii].m_match_type;
2459  NStr::ToLower(matchstr);
2460 
2462  if (matchstr == "strong") {
2463  current = SRangeMatch::eStrong;
2464  }
2465  else
2466  if (matchstr == "moderate") {
2467  current = SRangeMatch::eModerate;
2468  }
2469  else
2470  if (matchstr == "weak") {
2471  current = SRangeMatch::eWeak;
2472  }
2473  else
2474  if (matchstr == "suspect") {
2475  current = SRangeMatch::eSuspect;
2476  }
2477 
2478  // Update to the strongest match defined by enum order
2479  if (current < matchtype) {
2480  matchtype = current;
2481  }
2482  }
2483 }
2484 
2485 
2486 int CMatchesListCtrl::CUVHitCmp::x_CompareMatches(const vector<SRangeMatch>& x,
2487  const vector<SRangeMatch>& y) const
2488 {
2490  x_FindStrongestMatchType(x, xMatchType);
2491 
2493  x_FindStrongestMatchType(y, yMatchType);
2494 
2495  return xMatchType - yMatchType;
2496 }
2497 
2498 
2500  const CUVHitLoc& y) const
2501 {
2502  switch (m_SortOption) {
2504  {
2505  int res = x.m_HitLocation - y.m_HitLocation;
2506  if (res != 0) {
2507  return res;
2508  }
2509  //else go to tiebreak
2510  }
2511  break;
2512 
2513  case eSortStrength:
2514  {
2515  int res = x_CompareMatches(x.m_matches, y.m_matches);
2516  if (res != 0) {
2517  return res;
2518  }
2519  //else go to tiebreak
2520  }
2521  break;
2522 
2523  case eSortMarked:
2524  {
2525  // Define ascending to be marked=true before marked=false
2526  if (x.m_Selected && !y.m_Selected) {
2527  return -1;
2528  }
2529  else if (!x.m_Selected && y.m_Selected) {
2530  return 1;
2531  }
2532  //else go to tiebreak
2533  }
2534  break;
2535 
2536  case eSortAccession:
2537  {
2538  return x.m_FastaSeqid.compare(y.m_FastaSeqid);
2539  }
2540  }
2541 
2542  // Tiebreak!
2543  return x.m_FastaSeqid.compare(y.m_FastaSeqid);
2544 }
2545 
2546 
2548 {
2549  // Sort
2552 
2553  // Clean slate
2554  DeleteAllItems();
2555 
2556  // Set value in each column of each row
2557  TVecscreenSummaryByLocation::const_iterator cit;
2558  int row = 0;
2559  for (cit = m_seqidSummaryByLocation.begin(); cit != m_seqidSummaryByLocation.end(); ++cit)
2560  {
2561  const CUVHitLoc& hitloc = *cit;
2562 
2563  // Insert a row
2564  wxListItem item;
2565  item.SetId(row);
2566  InsertItem(item);
2567 
2568  // Column to indicate selected or not
2569  SetChecked(row, x_GetSelected(hitloc));
2570  SetItem( row, 0, wxEmptyString );
2571 
2572  // 5` or 3` End
2573  SetItem( row, 1, x_GetHitLocation(hitloc) );
2574 
2575  // Seqid
2576  SetItem( row, 2, x_GetSeqid(hitloc) );
2577 
2578  // Match type
2579  SetItem( row, 3, x_GetMatchType(hitloc) );
2580 
2581  ++row;
2582  }
2583  SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
2584  SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER);
2585  SetColumnWidth(2, wxLIST_AUTOSIZE);
2586  SetColumnWidth(3, wxLIST_AUTOSIZE);
2587 }
2588 
2589 
2591 {
2592  TVecscreenSummaryByLocation::iterator it;
2593  int row = 0;
2594  for (it = m_seqidSummaryByLocation.begin(); it != m_seqidSummaryByLocation.end(); ++it)
2595  {
2596  CUVHitLoc& hitloc = *it;
2597 
2598  hitloc.m_Selected = true;
2599  }
2600 
2601  x_Redraw();
2602 }
2603 
2604 
2606 {
2607  TVecscreenSummaryByLocation::iterator it;
2608  int row = 0;
2609  for (it = m_seqidSummaryByLocation.begin(); it != m_seqidSummaryByLocation.end(); ++it)
2610  {
2611  CUVHitLoc& hitloc = *it;
2612 
2613  hitloc.m_Selected = false;
2614  for (int ii = 0; ii < hitloc.m_matches.size(); ++ii)
2615  {
2616  const SRangeMatch& rangematch = hitloc.m_matches[ii];
2617  if ( NStr::FindNoCase(rangematch.m_match_type, "strong") != NPOS ||
2618  NStr::FindNoCase(rangematch.m_match_type, "moderate") != NPOS )
2619  {
2620  hitloc.m_Selected = true;
2621  break;
2622  }
2623  }
2624  }
2625 
2626  x_Redraw();
2627 }
2628 
2629 
2631 {
2632  TVecscreenSummaryByLocation::iterator it;
2633  int row = 0;
2634  for (it = m_seqidSummaryByLocation.begin(); it != m_seqidSummaryByLocation.end(); ++it)
2635  {
2636  CUVHitLoc& hitloc = *it;
2637 
2638  hitloc.m_Selected = false;
2639  }
2640 
2641  x_Redraw();
2642 }
2643 
2644 
2646 {
2647  TVecscreenSummaryByLocation::iterator it;
2648  int row = 0;
2649  for (it = m_seqidSummaryByLocation.begin(); it != m_seqidSummaryByLocation.end(); ++it)
2650  {
2651  CUVHitLoc& hitloc = *it;
2652 
2653  if (hitloc.m_HitLocation == CUVHitLoc::eInternal) {
2654  hitloc.m_Selected = false;
2655  }
2656  }
2657 
2658  x_Redraw();
2659 }
2660 
2661 
2662 void CMatchesListCtrl::OnColClick(wxListEvent& event)
2663 {
2664  // Use this callback to sort.
2665 
2666  // Column integer value is 0 based.
2667  int col = event.GetColumn();
2668 
2669  ESortOption eSortOption;
2670  switch (col) {
2671  case 0:
2672  eSortOption = eSortMarked;
2673  break;
2674  case 1:
2675  eSortOption = eSortInternal5Prime3Prime;
2676  break;
2677  case 2:
2678  eSortOption = eSortAccession;
2679  break;
2680  case 3:
2681  eSortOption = eSortStrength;
2682  break;
2683  default:
2684  eSortOption = eSortInternal5Prime3Prime;
2685  break;
2686  }
2687 
2688  // If sort option did not change, then toggle sort ascending
2689  if (m_SortOption == eSortOption) {
2691  }
2692  else {
2693  m_SortOption = eSortOption;
2694  }
2695 
2696  x_Redraw();
2697 }
2698 
2699 
2700 void CMatchesListCtrl::OnSelected(wxListEvent& event)
2701 {
2702  if ( GetWindowStyle() & wxLC_REPORT )
2703  {
2704  auto selected_row = event.GetIndex();
2705 
2706  TVecscreenSummaryByLocation::const_iterator cit;
2707  long count = 0;
2708  for (cit = m_seqidSummaryByLocation.begin(); cit != m_seqidSummaryByLocation.end(); ++cit)
2709  {
2710  if (count == selected_row)
2711  {
2712  m_SelectedRow = selected_row;
2713 
2714  if (m_RangeView)
2715  {
2716  m_RangeView->UpdateData(cit->m_FastaSeqid, cit->m_matches);
2717  }
2718  break;
2719  }
2720 
2721  ++count;
2722  }
2723  }
2724 }
2725 
2726 void CMatchesListCtrl::OnChecked(wxListEvent& event)
2727 {
2728  auto selected_row = event.GetIndex();
2729  m_seqidSummaryByLocation[selected_row].m_Selected = IsChecked(selected_row);
2730  event.Skip();
2731 }
2732 
2733 
2734 
2735 IMPLEMENT_DYNAMIC_CLASS( CLocationsListCtrl, wxListCtrl )
2736 
2737 
2738 BEGIN_EVENT_TABLE(CLocationsListCtrl, wxListCtrl)
2741 
2742 
2744 {
2745 }
2746 
2747 
2749  const wxWindowID id,
2750  const wxPoint& pos,
2751  const wxSize& size,
2752  long style)
2753 {
2754  Create(parent, id, pos, size, style);
2755 }
2756 
2757 
2759 {
2760 }
2761 
2762 
2763 bool CLocationsListCtrl::Create(wxWindow *parent,
2764  wxWindowID id,
2765  const wxPoint &pos,
2766  const wxSize &size,
2767  long style)
2768 {
2769  wxListCtrl::Create(parent, id, pos, size, style);
2770 
2771  // Set line item graphic properties
2772  m_listItemAttr.SetTextColour(*wxBLUE);
2773  m_listItemAttr.SetBackgroundColour(*wxLIGHT_GREY);
2774  m_listItemAttr.SetFont(wxNullFont);
2775 
2776  // Set up the column properties
2777  wxListItem col0;
2778  col0.SetColumn(0);
2779  col0.SetText( _("Seqid") );
2780  col0.SetWidth(200);
2781  InsertColumn( 0, col0 );
2782 
2783  wxListItem col1;
2784  col1.SetColumn(1);
2785  col1.SetText( _("Range") );
2786  col1.SetWidth(220);
2787  InsertColumn( 1, col1 );
2788 
2789  return true;
2790 }
2791 
2792 
2793 bool CLocationsListCtrl::UpdateData(const string& fastaseqid,
2794  const vector<SRangeMatch>& matches)
2795 {
2796  // Clean slate
2797  DeleteAllItems();
2798 
2799  // Set value in each column of each row
2800  for (int ii = 0; ii < matches.size(); ++ii)
2801  {
2802  const SRangeMatch& rangematch = matches[ii];
2803 
2804  // Insert a row
2805  wxListItem row;
2806  row.SetId(ii);
2807  InsertItem(row);
2808 
2809  // Seqid
2810  SetItem( ii, 0, _( fastaseqid ) );
2811 
2812  // Range
2813  stringstream ssRange;
2814  ssRange << rangematch.m_range.GetFrom() + 1
2815  << "-" << rangematch.m_range.GetTo() + 1;
2816  SetItem( ii, 1, _( ssRange.str() ) );
2817  }
2818 
2819  return true;
2820 }
2821 
2822 
2823 void CLocationsListCtrl::OnSelected(wxListEvent& event)
2824 {
2825  if ( GetWindowStyle() & wxLC_REPORT )
2826  {
2827  wxListItem info;
2828  info.m_itemId = event.GetIndex();
2829 
2830  }
2831 }
2832 
2833 
2834 IMPLEMENT_DYNAMIC_CLASS( CListReportDlg, wxDialog )
2835 
2836 
2837 BEGIN_EVENT_TABLE( CListReportDlg, wxDialog )
2839 
2840 
2842 {
2843  Init();
2844 }
2845 
2846 CListReportDlg::CListReportDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
2847 {
2848  Init();
2849  Create(parent, id, caption, pos, size, style);
2850 }
2851 
2852 
2853 bool CListReportDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
2854 {
2855  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
2856  wxDialog::Create( parent, id, caption, pos, size, style );
2857 
2858  CreateControls();
2859  if (GetSizer())
2860  {
2861  GetSizer()->SetSizeHints(this);
2862  }
2863  Centre();
2864  return true;
2865 }
2866 
2867 
2869 {
2870 }
2871 
2872 
2874 {
2875 }
2876 
2877 
2879 {
2880  wxBoxSizer* dialogSizer = new wxBoxSizer(wxVERTICAL);
2881  this->SetSizer(dialogSizer);
2882 
2883 
2884  // Display header portion of dialog
2885  m_textHeader = new wxStaticText( this,
2886  wxID_ANY,
2887  _( "" ),
2888  wxDefaultPosition,
2889  wxDefaultSize,
2890  wxALIGN_LEFT );
2891  dialogSizer->Add(m_textHeader, 0, wxEXPAND|wxALL, 5);
2892 
2893 
2894  // Display message list in a scrollable text field
2895  m_textList = new wxTextCtrl( this,
2896  wxID_ANY,
2897  wxEmptyString,
2898  wxDefaultPosition,
2899  wxSize(600, 450),
2900  wxTE_MULTILINE|wxTE_READONLY );
2901  dialogSizer->Add(m_textList, 1, wxEXPAND|wxALL, 5);
2902 
2903 
2904  // Display footer portion of dialog
2905  m_textFooter = new wxStaticText( this,
2906  wxID_ANY,
2907  _( "" ),
2908  wxDefaultPosition,
2909  wxDefaultSize,
2910  wxALIGN_LEFT );
2911  dialogSizer->Add(m_textFooter, 0, wxEXPAND|wxALL, 5);
2912 
2913 
2914  // Display Ok/Cancel buttons
2915  wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
2916  wxButton* okButton = new wxButton( this, wxID_OK, _( "Ok" ), wxDefaultPosition, wxDefaultSize, 0 );
2917  wxButton* cancelButton = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
2918  buttonSizer->Add(okButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
2919  buttonSizer->Add(cancelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
2920  dialogSizer->Add(buttonSizer, 0, wxEXPAND|wxALL, 5);
2921 }
2922 
2923 
2924 void CListReportDlg::SetHeader(const wxString& header)
2925 {
2926  m_textHeader->SetLabel(header);
2927 }
2928 
2929 
2930 void CListReportDlg::SetList(const wxString& list)
2931 {
2932  m_textList->SetValue(list);
2933 }
2934 
2935 
2936 void CListReportDlg::SetFooter(const wxString& footer)
2937 {
2938  m_textFooter->SetLabel(footer);
2939 }
2940 
2941 
2942 IMPLEMENT_DYNAMIC_CLASS( CVecscreenReportPanel, wxPanel )
2943 
2944 
2945 BEGIN_EVENT_TABLE( CVecscreenReportPanel, wxPanel )
2947 
2948 
2950 {
2951  Init();
2952 }
2953 
2954 CVecscreenReportPanel::CVecscreenReportPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
2955 {
2956  Init();
2957  Create(parent, id, pos, size, style);
2958 }
2959 
2960 
2961 bool CVecscreenReportPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
2962 {
2963  wxPanel::Create( parent, id, pos, size, style );
2964 
2965  CreateControls();
2966  if (GetSizer())
2967  {
2968  GetSizer()->SetSizeHints(this);
2969  }
2970  Centre();
2971  return true;
2972 }
2973 
2974 
2976 {
2977 }
2978 
2979 
2981 {
2982 }
2983 
2984 
2986 {
2987  wxBoxSizer* panelSizer = new wxBoxSizer(wxVERTICAL);
2988  this->SetSizer(panelSizer);
2989 
2990 
2991  // Display message list in a scrollable text field
2992  m_textReport = new wxTextCtrl( this,
2993  wxID_ANY,
2994  wxEmptyString,
2995  wxDefaultPosition,
2996  wxSize(600, 450),
2997  wxTE_MULTILINE );
2998  panelSizer->Add(m_textReport, 1, wxEXPAND|wxALL, 5);
2999 }
3000 
3001 
3002 void CVecscreenReportPanel::SetReport(const wxString& report)
3003 {
3004  m_textReport->SetValue(report);
3005 }
3006 
3007 
3008 IMPLEMENT_DYNAMIC_CLASS( CVecscreenReport, wxDialog )
3009 
3010 
3011 BEGIN_EVENT_TABLE( CVecscreenReport, wxDialog )
3013 
3014 
3016 {
3017  Init();
3018 }
3019 
3020 CVecscreenReport::CVecscreenReport( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
3021 {
3022  Init();
3023  Create(parent, id, caption, pos, size, style);
3024 }
3025 
3026 
3027 bool CVecscreenReport::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
3028 {
3029  wxDialog::Create( parent, id, caption, pos, size, style );
3030 
3031  CreateControls();
3032  if (GetSizer())
3033  {
3034  GetSizer()->SetSizeHints(this);
3035  }
3036  Centre();
3037  return true;
3038 }
3039 
3040 
3042 {
3043 }
3044 
3045 
3047 {
3048 }
3049 
3050 
3052 {
3053  wxBoxSizer* dialogSizer = new wxBoxSizer(wxVERTICAL);
3054  this->SetSizer(dialogSizer);
3055 
3056  m_panel = new CVecscreenReportPanel(this);
3057  dialogSizer->Add(m_panel, 1, wxEXPAND|wxALL, 5);
3058 }
3059 
3060 
3061 void CVecscreenReport::SetReport(const wxString& report)
3062 {
3063  m_panel->SetReport(report);
3064 }
3065 
3066 
3068 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
User-defined methods of the data storage class.
CAlign_CI –.
Definition: align_ci.hpp:63
CAutoInitRef<>::
void Set(T *object)
Initialize with an existing object.
CBioseq_EditHandle –.
CBioseq_Handle –.
CBioseq_set_Handle –.
TSeqPos GetLength(void) const
Definition: Bioseq.cpp:360
static CRef< objects::CSeqdesc > s_GetCitSubForTrimmedSequence(const objects::CBioseq_Handle &bsh, string &message, CConstRef< objects::CSeqdesc > &changedSeqdesc, objects::CSeq_entry_Handle &seh)
CConstRef –.
Definition: ncbiobj.hpp:1266
CFeat_CI –.
Definition: feat_ci.hpp:64
CGraph_CI –.
Definition: graph_ci.hpp:234
CIUPACna –.
Definition: IUPACna.hpp:66
void SetHeader(const wxString &header)
~CListReportDlg()
Destructor.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Report Dialog"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
CListReportDlg()
Constructors.
void CreateControls()
Creates the controls and sizers.
void Init()
Initialises member variables.
void SetList(const wxString &list)
void SetFooter(const wxString &footer)
bool Create(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_ICON)
void OnSelected(wxListEvent &event)
bool UpdateData(const string &fastaseqid, const vector< SRangeMatch > &matches)
CMappedGraph –.
Definition: graph_ci.hpp:61
int x_Compare(const CUVHitLoc &x, const CUVHitLoc &y) const
void x_FindStrongestMatchType(const vector< SRangeMatch > &matches, SRangeMatch::EMatchType &matchtype) const
int x_CompareMatches(const vector< SRangeMatch > &x, const vector< SRangeMatch > &y) const
bool operator()(const CUVHitLoc &x, const CUVHitLoc &y) const
vector< SRangeMatch > m_matches
bool x_Find(const CUVHitLoc &hitloc, const wxString &searchstr)
void x_DisplaySearchResult(bool bFound, long row)
void x_InsertMatches(TVecscreenSummaryByLocation &seqidSummaryByLocation, const vector< SRangeMatch > &sorted_matches, const CSeq_id *seqid, const SVecscreenResult &vecres) const
vector< CUVHitLoc > TVecscreenSummaryByLocation
bool UpdateData(const TVecscreenSummaryBySeqid &vecscreen_summary)
TVecscreenSummaryBySeqid m_seqidSummaryBySeqid
void Sort(ESortOption eSortOption, bool bAscending)
const TVecscreenSummaryBySeqid & GetSelectedVecscreenSummaryBySeqid()
void x_ConvertSelectedToBySeqid(const TVecscreenSummaryByLocation &seqidSummaryByLocation, TVecscreenSummaryBySeqid &seqidSummaryBySeqid) const
bool Create(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_ICON)
void OnSelected(wxListEvent &event)
void SetAlignGraphicView(wxHtmlWindow *view)
void OnColClick(wxListEvent &event)
void SetRangeView(CLocationsListCtrl *view)
CLocationsListCtrl * m_RangeView
ESortOption m_SortOption
wxString x_GetSeqid(const CUVHitLoc &hitloc)
void OnChecked(wxListEvent &event)
void GetSelectedLocations(wxString &report, CVectorTrimPanel::EInternalTrimType eInternalTrimType)
wxListItemAttr m_listItemAttr
wxString x_GetHitLocation(const CUVHitLoc &hitloc)
wxHtmlWindow * m_AlignView
bool x_GetSelected(const CUVHitLoc &hitloc)
void FindReverse(wxString searchstr)
TVecscreenSummaryByLocation m_seqidSummaryByLocation
void GetReport(wxString &report)
bool x_IsValidRow(long row)
wxString x_GetMatchType(const CUVHitLoc &hitloc)
void x_ConvertAllToByLocation(const TVecscreenSummaryBySeqid &vecscreen_summary, TVecscreenSummaryByLocation &seqidSummaryByLocation) const
void FindForward(wxString searchstr)
Helper functor to compare cuts during sorting.
ESortOrder m_sortorder
bool operator()(const SRangeMatch &a1, const SRangeMatch &a2)
CRangeCmp(ESortOrder sortorder=eAscending)
CScope –.
Definition: scope.hpp:92
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:252
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_entry_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
static TSeqPos Pack(CSeq_data *in_seq, TSeqPos uLength=ncbi::numeric_limits< TSeqPos >::max())
void SetReport(const wxString &report)
void Init()
Initialises member variables.
void CreateControls()
Creates the controls and sizers.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxBORDER_SIMPLE)
Creation.
~CVecscreenReportPanel()
Destructor.
CVecscreenReportPanel()
Constructors.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("VecScreen Report"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
Creation.
void CreateControls()
Creates the controls and sizers.
void SetReport(const wxString &report)
void Init()
Initialises member variables.
~CVecscreenReport()
Destructor.
CVecscreenReport()
Constructors.
void Run(objects::CSeq_entry_Handle seh, wxGauge &progress)
static bool IsDbAvailable()
const TVecscreenSummaryBySeqid & GetVecscreenSummaryBySeqid() const
void OnTrimSelected(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=ID_CVECTORTRIMPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
void OnDismiss(wxCommandEvent &event)
CLocationsListCtrl * m_listLocations
wxButton * m_buttonSelectStrongModerate
void x_RetranslateCDS(CScope &scope, CRef< CCmdComposite > command, CRef< CSeq_feat > cds)
wxHtmlWindow * m_viewAlignGraphic
void x_SeqLocDelete(CRef< CSeq_loc > loc, TSeqPos from, TSeqPos to, const CSeq_id *seqid, bool &bCompleteCut, bool &bTrimmed)
void OnUnselectInternal(wxCommandEvent &event)
objects::CSeq_entry_Handle m_TopSeqEntry
void OnFindReverse(wxCommandEvent &event)
CRange< TSeqPos > x_GetRetainedRange(const TCuts &sorted_cuts, TSeqPos seqLength)
void x_TrimSeqGraphs(CRef< CCmdComposite > command, const TVecscreenSummaryBySeqid &trimOnly)
void OnSort(wxCommandEvent &event)
void Init()
Initialises member variables.
bool x_FindSegment(const CDense_seg &denseg, CDense_seg::TDim row, TSeqPos pos, CDense_seg::TNumseg &seg, TSeqPos &seg_start) const
wxGauge * m_gaugeProgressBar
void x_TrimSeqGraphData(CRef< CSeq_graph > new_graph, const CMappedGraph &orig_graph, const TCuts &sorted_cuts, const CSeq_id *seqid)
void x_TrimFeatureLocations(CRef< CSeq_feat > feat, const TCuts &sorted_cuts, const CSeq_id *seqid, bool &bFeatureDeleted, bool &bFeatureTrimmed, bool &bProdDeleted, bool &bProdTrimmed)
~CVectorTrimPanel()
Destructor.
void x_CutDensegSegment(CRef< CSeq_align > align, CDense_seg::TDim row, TSeqPos pos)
void x_AdjustDensegAlignment(CRef< CSeq_align > align, CDense_seg::TDim row, const TCuts &sorted_cuts)
wxButton * m_buttonUnselectInternal
wxButton * m_buttonUnselectAll
wxCheckBox * m_CitSub
void x_GetSortedCuts(TCuts &sorted_cuts, const CSeq_id *seqid)
wxButton * m_buttonMakeReport
void CreateControls()
Creates the controls and sizers.
wxButton * m_buttonFindForward
static bool ShowToolTips()
Should we show tooltips?
wxRadioBox * m_radioBoxInternalTrimOptions
void OnSelectStrongModerate(wxCommandEvent &event)
void x_AdjustInternalCutLocations(TCuts &cuts, TSeqPos seq_length)
void OnUnselectAll(wxCommandEvent &event)
wxButton * m_buttonSelectAll
void x_MergeCuts(TCuts &sorted_cuts)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void DisplaySummaryBySeqid(const TVecscreenSummaryBySeqid &vecscreen_summary)
wxButton * m_buttonDismiss
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxTextCtrl * m_textFind
void x_FindCompleteDeletions(const TVecscreenSummaryBySeqid &seqidSummary, TVecscreenSummaryBySeqid &completeDeletions, TVecscreenSummaryBySeqid &trimOnly)
CVectorScreen m_vectorscreen
void OnSelectAll(wxCommandEvent &event)
void x_SetSeqData(const CBioseq_Handle &bsh, CRef< objects::CSeq_inst > inst, const TCuts &sorted_cuts)
void x_DeleteSelected(CRef< CCmdComposite > command, const CSeq_id *seqid)
void OnFindForward(wxCommandEvent &event)
void x_TrimAlignments(CRef< CCmdComposite > command, const TVecscreenSummaryBySeqid &trimOnly)
wxButton * m_buttonRunVecscreen
void OnRunVecscreen(wxCommandEvent &event)
void x_SeqIntervalDelete(CRef< CSeq_interval > interval, TSeqPos cut_from, TSeqPos cut_to, const CSeq_id *seqid, bool &bCompleteCut, bool &bTrimmed)
ICommandProccessor * m_CmdProcessor
void x_UpdateSeqGraphLoc(CRef< CSeq_graph > new_graph, const TCuts &sorted_cuts, const CSeq_id *seqid)
void OnMakeReport(wxCommandEvent &event)
bool x_IsCompleteCut(const TCuts &sorted_cuts, TSeqPos seq_length)
vector< SRangeMatch > TCuts
wxWindow * m_pParentWindow
CMatchesListCtrl * m_listMatches
void x_GetTrimCoordinates(const TCuts &sorted_cuts, const CSeq_id *seqid, TSeqPos &trim_start, TSeqPos &trim_stop)
wxRadioBox * m_radioBoxSort
CVectorTrimPanel()
Constructors.
virtual bool TransferDataToWindow()
wxButton * m_buttonTrimSelected
virtual bool TransferDataFromWindow()
wxBoxSizer * m_sizerVectorResults
wxButton * m_buttonFindReverse
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
size_type size() const
Definition: map.hpp:148
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
bool empty() const
Definition: map.hpp:149
void clear()
Definition: map.hpp:169
bool Create(wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_REPORT, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxListCtrlNameStr)
bool IsChecked(long item) const
void SetChecked(long item, bool checked)
#define _(proto)
Definition: ct_nlmzip_i.h:78
static const char si[8][64]
Definition: des.c:146
#define false
Definition: bool.h:36
static char col1[256]
Definition: compute.c:13
static void Init(void)
Definition: cursor6.c:76
static const char location[]
Definition: config.c:97
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
#define NULL
Definition: ncbistd.hpp:225
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
const TPrim & Get(void) const
Definition: serialbase.hpp:347
const string AsFastaString(void) const
Definition: Seq_id.cpp:2266
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
void SetPacked_int(TPacked_int &v)
Definition: Seq_loc.hpp:984
void SetMix(TMix &v)
Definition: Seq_loc.hpp:987
void SetWhole(TWhole &v)
Definition: Seq_loc.hpp:982
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:915
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:963
static CRef< CBioseq > TranslateToProtein(const CSeq_feat &cds, CScope &scope)
Definition: sequence.cpp:3839
CBioseq_Handle AddBioseq(CBioseq &bioseq, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add bioseq, return bioseq handle.
Definition: scope.cpp:530
void RemoveBioseq(const CBioseq_Handle &seq)
Revoke Bioseq previously added using AddBioseq().
Definition: scope.cpp:382
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
bool IsNucleotide(void) const
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
TClass GetClass(void) const
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
bool CanGetClass(void) const
const CSeqFeatData & GetData(void) const
TSeqPos GetBioseqLength(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
bool IsSetProduct(void) const
void SetInst(TInst &v) const
bool IsProtein(void) const
CBioseq_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CSeq_entry_Handle GetParentEntry(void) const
Return a handle for the parent seq-entry of the bioseq.
CScope & GetScope(void) const
Get scope this handle belongs to.
CScope & GetScope(void) const
Get scope this handle belongs to.
const CSeqMap & GetSeqMap(void) const
Get sequence map.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
bool IsSetData(void) const
const TInst & GetInst(void) const
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
TSeqPos GetEndPosition(void) const
return end position of current segment in sequence (exclusive)
Definition: seq_map_ci.hpp:679
const string & GetTitle(void) const
Definition: graph_ci.hpp:112
bool IsSetTitle(void) const
Definition: graph_ci.hpp:108
const CSeq_align & GetOriginalSeq_align(void) const
Get original alignment.
Definition: align_ci.cpp:225
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
const CSeq_loc & GetProduct(void) const
CSeqMap::ESegmentType GetType(void) const
Definition: seq_map_ci.hpp:651
bool IsUnknownLength(void) const
return true if current segment is a gap of unknown length
Definition: seq_map_ci.cpp:302
const CSeq_graph & GetOriginalGraph(void) const
Get original graph with unmapped location/product.
Definition: graph_ci.hpp:70
const CSeq_loc & GetLoc(void) const
Definition: graph_ci.hpp:126
CSeq_align_Handle GetSeq_align_Handle(void) const
Get original alignment handle.
Definition: align_ci.cpp:233
TSeqPos GetPosition(void) const
return position of current segment in sequence
Definition: seq_map_ci.hpp:665
TSeqPos GetLength(void) const
return length of current segment
Definition: seq_map_ci.hpp:672
CConstRef< CSeq_literal > GetRefGapLiteral(void) const
return CSeq_literal with gap data, or null if either the segment is not a gap, or an unspecified gap
Definition: seq_map_ci.cpp:292
const CSeq_graph::C_Graph & GetGraph(void) const
Definition: graph_ci.cpp:192
CSeq_graph_Handle GetSeq_graph_Handle(void) const
Get original graph handle.
Definition: graph_ci.cpp:93
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
Definition: seq_vector.cpp:304
CSeqMap_CI ResolvedRangeIterator(CScope *scope, TSeqPos from, TSeqPos length, ENa_strand strand=eNa_strand_plus, size_t maxResolve=size_t(-1), TFlags flags=fDefaultFlags) const
Iterate segments in the range with specified strand coordinates.
Definition: seq_map.cpp:868
@ eSeqData
real sequence data
Definition: seq_map.hpp:98
@ eSeqGap
gap
Definition: seq_map.hpp:97
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
Definition: ncbistr.cpp:219
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.
Definition: ncbistr.cpp:2984
#define NPOS
Definition: ncbistr.hpp:133
static string & ToLower(string &str)
Convert string to lower case – string& version.
Definition: ncbistr.cpp:405
void SetFrom(TFrom value)
Assign a value to From data member.
Definition: Range_.hpp:231
TTo GetTo(void) const
Get the To member data.
Definition: Range_.hpp:269
TFrom GetFrom(void) const
Get the From member data.
Definition: Range_.hpp:222
void SetTo(TTo value)
Assign a value to To data member.
Definition: Range_.hpp:278
@ eLim_unk
unknown
Definition: Int_fuzz_.hpp:210
bool CanGetDim(void) const
Check if it is safe to call GetDim method.
Definition: Dense_seg_.hpp:402
const TDenseg & GetDenseg(void) const
Get the variant data.
Definition: Seq_align_.cpp:153
TLens & SetLens(void)
Assign a value to Lens data member.
Definition: Dense_seg_.hpp:561
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_align_.hpp:691
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
Definition: Dense_seg_.hpp:568
const TStarts & GetStarts(void) const
Get the Starts member data.
Definition: Dense_seg_.hpp:530
void SetSegs(TSegs &value)
Assign a value to Segs data member.
Definition: Seq_align_.cpp:310
const TLens & GetLens(void) const
Get the Lens member data.
Definition: Dense_seg_.hpp:555
bool CanGetNumseg(void) const
Check if it is safe to call GetNumseg method.
Definition: Dense_seg_.hpp:452
void SetDim(TDim value)
Assign a value to Dim data member.
Definition: Dense_seg_.hpp:427
bool CanGetIds(void) const
Check if it is safe to call GetIds method.
Definition: Dense_seg_.hpp:499
vector< CRef< CSeq_id > > TIds
Definition: Dense_seg_.hpp:106
bool CanGetSegs(void) const
Check if it is safe to call GetSegs method.
Definition: Seq_align_.hpp:915
TDim GetDim(void) const
Get the Dim member data.
Definition: Dense_seg_.hpp:421
TStarts & SetStarts(void)
Assign a value to Starts data member.
Definition: Dense_seg_.hpp:536
TStrands & SetStrands(void)
Assign a value to Strands data member.
Definition: Dense_seg_.hpp:586
void SetNumseg(TNumseg value)
Assign a value to Numseg data member.
Definition: Dense_seg_.hpp:474
const TIds & GetIds(void) const
Get the Ids member data.
Definition: Dense_seg_.hpp:505
bool CanGetStarts(void) const
Check if it is safe to call GetStarts method.
Definition: Dense_seg_.hpp:524
TNumseg GetNumseg(void) const
Get the Numseg member data.
Definition: Dense_seg_.hpp:465
TIds & SetIds(void)
Assign a value to Ids data member.
Definition: Dense_seg_.hpp:511
const TStrands & GetStrands(void) const
Get the Strands member data.
Definition: Dense_seg_.hpp:580
const TSegs & GetSegs(void) const
Get the Segs member data.
Definition: Seq_align_.hpp:921
bool CanGetLens(void) const
Check if it is safe to call GetLens method.
Definition: Dense_seg_.hpp:549
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
E_Choice Which(void) const
Which variant is currently selected.
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
void SetProduct(TProduct &value)
Assign a value to Product data member.
Definition: Seq_feat_.cpp:110
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
bool CanGetLocation(void) const
Check if it is safe to call GetLocation method.
Definition: Seq_feat_.hpp:1111
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
bool CanGetProduct(void) const
Check if it is safe to call GetProduct method.
Definition: Seq_feat_.hpp:1090
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
Definition: Seq_feat_.hpp:1084
void SetTo(TTo value)
Assign a value to To data member.
TFrom GetFrom(void) const
Get the From member data.
bool CanGetTo(void) const
Check if it is safe to call GetTo method.
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_loc_.hpp:475
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
bool IsInt(void) const
Check if variant Int is selected.
Definition: Seq_loc_.hpp:528
const TInt & GetInt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:194
const TMix & GetMix(void) const
Get the variant data.
Definition: Seq_loc_.cpp:282
const TPacked_int & GetPacked_int(void) const
Get the variant data.
Definition: Seq_loc_.cpp:216
bool CanGetFrom(void) const
Check if it is safe to call GetFrom method.
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ e_Int
from to
Definition: Seq_loc_.hpp:101
void SetMin(TMin value)
Assign a value to Min data member.
TByte & SetByte(void)
Select the variant.
Definition: Seq_graph_.cpp:159
void SetNumval(TNumval value)
Assign a value to Numval data member.
TAxis GetAxis(void) const
Get the Axis member data.
TValues & SetValues(void)
Assign a value to Values data member.
TMax GetMax(void) const
Get the Max member data.
const TByte & GetByte(void) const
Get the variant data.
Definition: Seq_graph_.cpp:153
void SetGraph(TGraph &value)
Assign a value to Graph data member.
Definition: Seq_graph_.cpp:250
bool CanGetLoc(void) const
Check if it is safe to call GetLoc method.
Definition: Seq_graph_.hpp:863
void SetMax(TMax value)
Assign a value to Max data member.
TMin GetMin(void) const
Get the Min member data.
const TValues & GetValues(void) const
Get the Values member data.
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_graph_.hpp:716
void SetLoc(TLoc &value)
Assign a value to Loc data member.
Definition: Seq_graph_.cpp:224
const TLoc & GetLoc(void) const
Get the Loc member data.
Definition: Seq_graph_.hpp:869
void SetAxis(TAxis value)
Assign a value to Axis data member.
void Reset(void)
Reset the whole object.
Definition: Seq_graph_.cpp:54
@ eClass_nuc_prot
nuc acid and coded proteins
Definition: Bioseq_set_.hpp:99
const TIupacaa & GetIupacaa(void) const
Get the variant data.
Definition: Seq_data_.hpp:530
bool IsSetSeq_data(void) const
the sequence Check if a value has been assigned to Seq_data data member.
Definition: Seq_inst_.hpp:805
bool IsNcbieaa(void) const
Check if variant Ncbieaa is selected.
Definition: Seq_data_.hpp:644
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:336
bool IsIupacaa(void) const
Check if variant Iupacaa is selected.
Definition: Seq_data_.hpp:524
void SetExt(TExt &value)
Assign a value to Ext data member.
Definition: Seq_inst_.cpp:147
TIupacna & SetIupacna(void)
Select the variant.
Definition: Seq_data_.hpp:517
TLength GetLength(void) const
Get the Length member data.
Definition: Seq_inst_.hpp:659
const TNcbieaa & GetNcbieaa(void) const
Get the variant data.
Definition: Seq_data_.hpp:650
void SetRepr(TRepr value)
Assign a value to Repr data member.
Definition: Seq_inst_.hpp:574
void SetLength(TLength value)
Assign a value to Length data member.
Definition: Seq_inst_.hpp:668
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
Definition: Seq_inst_.cpp:130
void ResetExt(void)
Reset Ext data member.
Definition: Seq_inst_.cpp:142
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
Definition: Seq_inst_.hpp:817
void ResetSeq_data(void)
Reset Seq_data data member.
Definition: Seq_inst_.cpp:125
@ eRepr_raw
continuous sequence
Definition: Seq_inst_.hpp:94
#define wxCLOSE_BOX
Definition: gui.hpp:50
END_EVENT_TABLE()
int len
static MDB_envinfo info
Definition: mdb_load.c:37
range(_Ty, _Ty) -> range< _Ty >
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::SIZE size
const char * command
T max(T x_, T y_)
T min(T x_, T y_)
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
Definition: pcre2_match.c:594
#define count
static static static wxID_ANY
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void * HWND
Definition: sqltypes.h:73
unsigned int DWORD
Definition: sqltypes.h:98
#define row(bind, expected)
Definition: string_bind.c:73
SAnnotSelector –.
string m_match_type
CRange< TSeqPos > m_range
vector< SRangeMatch > m_arrRangeMatch
#define _ASSERT
else result
Definition: token2.c:20
USING_SCOPE(objects)
@ MYID_RADIOBOX_SORT
@ MYID_BUTTON_RUN_VECSCREEN
@ MYID_CHECKBOX_VIEWGRAPHIC
@ MYID_BUTTON_DISMISS
@ MYID_BUTTON_SELECT_STRONG_MODERATE
@ MYID_BUTTON_FIND_REVERSE
@ MYID_RADIOBOX_INTERNAL_TRIM_OPTIONS
@ MYID_WEBVIEW_GRAPHIC
@ MYID_BUTTON_UNSELECT_INTERNAL
@ MYID_BUTTON_UNSELECT_ALL
@ MYID_BUTTON_MAKE_REPORT
@ MYID_BUTTON_TRIM_SELECTED
@ MYID_LISTCTRL_MATCHES
@ MYID_BUTTON_FIND_FORWARD
@ MYID_LISTCTRL_LOCATIONS
@ MYID_BUTTON_SELECT_ALL
void ShowDebugMessage(const wxString &message)
Modified on Fri Sep 20 14:58:21 2024 by modify_doxy.py rev. 669887