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

Go to the SVN repository for this file.

1 /* $Id: correct_interval_order.cpp 42430 2019-02-22 13:19:16Z filippov $
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: Igor Filippov
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 ////@begin includes
33 ////@end includes
34 #include <sstream>
35 #include <objmgr/scope.hpp>
37 #include <objmgr/feat_ci.hpp>
38 #include <objmgr/seq_annot_ci.hpp>
39 #include <objmgr/bioseq_ci.hpp>
41 #include <objmgr/util/feature.hpp>
45 #include <gui/objutils/utils.hpp>
49 
50 //#include <gui/widgets/text_widget/draw_styled_text.hpp>
51 #include <gui/objutils/label.hpp>
55 
56 
57 #include <wx/button.h>
58 #include <wx/statbox.h>
59 #include <wx/msgdlg.h>
60 
61 ////@begin XPM images
62 ////@end XPM images
63 
66 
67 
68 IMPLEMENT_DYNAMIC_CLASS( CCorrectIntervalOrder, CBulkCmdDlg )
69 
70 
71 BEGIN_EVENT_TABLE( CCorrectIntervalOrder, CBulkCmdDlg )
72 
73 
75 
77 {
78  Init();
79 }
80 
82  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
83  : CBulkCmdDlg(wb)
84 {
85  Init();
86  Create(parent, id, caption, pos, size, style);
87 }
88 
89 
90 bool CCorrectIntervalOrder::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
91 {
92  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
93  CBulkCmdDlg::Create( parent, id, caption, pos, size, style );
94 
96  if (GetSizer())
97  {
98  GetSizer()->SetSizeHints(this);
99  }
100  Centre();
101 
102  SetSize(wxSize(280, 750));
103  return true;
104 }
105 
106 
108 {
109 }
110 
111 
112 /*!
113  * Member initialisation
114  */
115 
117 {
118  set<string> existing;
119  m_Types.clear();
120  m_Descriptions.clear();
121 
123  vector<const CFeatListItem *> feat_list = GetSortedFeatList(m_TopSeqEntry);
124  ITERATE(vector<const CFeatListItem *>, ft_it, feat_list) {
125  const CFeatListItem& item = **ft_it;
126  string desc = item.GetDescription();
127  int feat_type = item.GetType();
128  int feat_subtype = item.GetSubtype();
129  m_Types[pair<int,int>(feat_type,feat_subtype)] = desc;
130  if (existing.find(desc) == existing.end())
131  {
132  existing.insert(desc);
133  m_Descriptions.push_back(desc);
134  if (feat_subtype == CSeqFeatData::eSubtype_any)
135  m_SubtypeAnyFlag.push_back(true);
136  else
137  m_SubtypeAnyFlag.push_back(false);
138  }
139  }
140 
141  m_ListCtrl = NULL;
142  m_TopSeqEntry.Reset();
143  m_ErrorMessage = "No feature found";
144 }
145 
146 
147 
148 
150 {
151  CCorrectIntervalOrder* itemDialog1 = this;
152 
153  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
154  itemDialog1->SetSizer(itemBoxSizer2);
155 
156  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
157  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
158 
159  m_ListCtrl = new wxListCtrl( itemDialog1, ID_LISTCTRL_CORRECT_INTERVAL_ORDER, wxDefaultPosition, wxSize(250, 200), wxLC_REPORT );
160  itemBoxSizer3->Add(m_ListCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
161 
162  m_ListCtrl->InsertColumn(0," Feature",wxLIST_FORMAT_LEFT,237);
163 
164  for (unsigned int i=0; i<m_Descriptions.size(); i++)
165  m_ListCtrl->InsertItem(i,ToWxString(m_Descriptions[i]));
166 
167  wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
168  itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
169 
170  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
171  itemBoxSizer5->Add(itemBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
172 
173  wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Optional String Constraint"));
174  wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
175  itemBoxSizer6->Add(itemStaticBoxSizer7, 0, wxALIGN_LEFT|wxALL, 5);
176 
177  m_RadioButton = new wxRadioButton( itemDialog1, ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON, _("Remove When Text Is Present"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
178  m_RadioButton->SetValue(true);
179  itemStaticBoxSizer7->Add(m_RadioButton, 0, wxALIGN_LEFT|wxALL, 5);
180 
181  wxRadioButton* itemRadioButton9 = new wxRadioButton( itemDialog1, ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON1, _("Remove When Text Is Not Present"));
182  itemRadioButton9->SetValue(false);
183  itemStaticBoxSizer7->Add(itemRadioButton9, 0, wxALIGN_LEFT|wxALL, 5);
184 
185  m_TextCtrl = new wxTextCtrl( itemDialog1, ID_CORRECT_INTERVAL_ORDER_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(237, -1), 0 );
186  itemStaticBoxSizer7->Add(m_TextCtrl, 0, wxALIGN_LEFT|wxALL, 5);
187 
188  m_CheckBox = new wxCheckBox( itemDialog1, ID_CORRECT_INTERVAL_ORDER_CHECKBOX, _("Case Insensitive"), wxDefaultPosition, wxDefaultSize, 0 );
189  m_CheckBox->SetValue(false);
190  itemStaticBoxSizer7->Add(m_CheckBox, 0, wxALIGN_LEFT|wxALL, 5);
191 
192  wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Optional Seq-id Constraint"));
193  wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer(itemStaticBoxSizer15Static, wxVERTICAL);
194  itemBoxSizer6->Add(itemStaticBoxSizer15, 0, wxALIGN_LEFT|wxALL, 5);
195 
196  m_RadioButton_id = new wxRadioButton( itemDialog1, ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON2, _("Remove When Text Is Present"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
197  m_RadioButton_id->SetValue(true);
198  itemStaticBoxSizer15->Add(m_RadioButton_id, 0, wxALIGN_LEFT|wxALL, 5);
199 
200  wxRadioButton* itemRadioButton16 = new wxRadioButton( itemDialog1, ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON3, _("Remove When Text Is Not Present"));
201  itemRadioButton16->SetValue(false);
202  itemStaticBoxSizer15->Add(itemRadioButton16, 0, wxALIGN_LEFT|wxALL, 5);
203 
204  m_TextCtrl_id = new wxTextCtrl( itemDialog1, ID_CORRECT_INTERVAL_ORDER_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(237, -1), 0 );
205  itemStaticBoxSizer15->Add(m_TextCtrl_id, 0, wxALIGN_LEFT|wxALL, 5);
206 
207  m_CheckBox_id = new wxCheckBox( itemDialog1, ID_CORRECT_INTERVAL_ORDER_CHECKBOX1, _("Case Insensitive"), wxDefaultPosition, wxDefaultSize, 0 );
208  m_CheckBox->SetValue(false);
209  itemStaticBoxSizer15->Add(m_CheckBox_id, 0, wxALIGN_LEFT|wxALL, 5);
210 
211  wxStaticBox* itemStaticBoxSizer17Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Optional Location Constraint"));
212  wxStaticBoxSizer* itemStaticBoxSizer17 = new wxStaticBoxSizer(itemStaticBoxSizer17Static, wxVERTICAL);
213  itemBoxSizer6->Add(itemStaticBoxSizer17, 0, wxALIGN_LEFT|wxALL, 5);
214 
215  wxArrayString strands,types;
216  strands.Add(wxT("Any Strand"));
217  strands.Add(wxT("Plus Strand"));
218  strands.Add(wxT("Minus Strand"));
219  types.Add(wxT("Nucleotide and protein sequences"));
220  types.Add(wxT("Nucleotide sequences only"));
221  types.Add(wxT("Protein sequences only"));
222 
223  m_ChoiceStrand = new wxChoice(itemDialog1, ID_CORRECT_INTERVAL_ORDER_CHOICE1, wxDefaultPosition, wxDefaultSize, strands,0,wxDefaultValidator,"Strand");
224  m_ChoiceStrand->SetSelection(0);
225  itemStaticBoxSizer17->Add(m_ChoiceStrand, 0, wxALIGN_LEFT|wxALL, 5);
226  m_ChoiceType = new wxChoice(itemDialog1, ID_CORRECT_INTERVAL_ORDER_CHOICE2, wxDefaultPosition, wxDefaultSize, types,0,wxDefaultValidator,"Type");
227  m_ChoiceType->SetSelection(0);
228  itemStaticBoxSizer17->Add(m_ChoiceType, 0, wxALIGN_LEFT|wxALL, 5);
229 
230  COkCancelPanel *OkCancel = new COkCancelPanel( itemDialog1, ID_CORRECT_INTERVAL_ORDER_OKCANCEL, wxDefaultPosition, wxSize(100, 100), 0 );
231  itemBoxSizer2->Add(OkCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
232 }
233 
234 
235 /*!
236  * Should we show tooltips?
237  */
238 
240 {
241  return true;
242 }
243 
244 /*!
245  * Get bitmap resources
246  */
247 
248 wxBitmap CCorrectIntervalOrder::GetBitmapResource( const wxString& name )
249 {
250  // Bitmap retrieval
251  wxUnusedVar(name);
252  return wxNullBitmap;
253 }
254 
255 /*!
256  * Get icon resources
257  */
258 
259 wxIcon CCorrectIntervalOrder::GetIconResource( const wxString& name )
260 {
261  // Icon retrieval
262  wxUnusedVar(name);
263  return wxNullIcon;
264 }
265 
267 {
268  long item = -1;
269  CRef<CCmdComposite> cmd( new CCmdComposite("Correct Interval Order") );
270  bool modified = false;
271  if (m_ListCtrl && m_TopSeqEntry)
272  {
273  for ( ;; )
274  {
275  item = m_ListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
276  if ( item == -1 ) break;
277  string name = ToStdString(m_ListCtrl->GetItemText(item));
278  bool subtypeAnyFlag = m_SubtypeAnyFlag[item];
279  ApplyToCSeq_entry (m_TopSeqEntry, cmd, name, subtypeAnyFlag, modified);
280  }
281  }
282 
283  if (!modified)
284  cmd.Reset();
285  return cmd;
286 }
287 
288 static void s_RenderAccList(
289  stringstream& ostream, const CUser_field::TData::TStrs& item_data, const string& title)
290 {
291  string s(title);
292  if ( !s.empty() ) {
293  s += ": ";
294  }
295 
296  list<string> refseq;
297  list<string> non_refseq;
298  ITERATE (CUser_field::TData::TStrs, it, item_data) {
301  refseq.push_back(*it);
302  } else {
303  non_refseq.push_back(*it);
304  }
305  }
306 
307  string accs;
308  if (refseq.size()) {
309  accs += NStr::Join(refseq, ", ");
310  }
311 
312  if (non_refseq.size()) {
313  if ( !accs.empty() ) {
314  accs += ", ";
315  }
316  accs += NStr::Join(non_refseq, ", ");
317  }
318 
319  if ( !accs.empty() ) {
320  s += accs;
321  } else {
322  s += "<unknown>";
323  }
324 
325  list<string> lines;
326  NStr::Wrap(s, 78, lines);
327  if ( !lines.empty() ) {
328  ITERATE (list<string>, iter, lines) {
329  if (iter != lines.begin()) {
330  ostream << " " << *iter << endl;
331  } else {
332  ostream << *iter << endl;
333  }
334  }
335  }
336 }
337 
339  stringstream& ostream, const CSeq_feat& feat, CScope& /*scope*/)
340 {
341  if ( !feat.IsSetExt() && !feat.IsSetExts()) {
342  return;
343  }
344 
345  list< CConstRef<CUser_object> > objs;
346  if (feat.IsSetExt()) {
347  CConstRef<CUser_object> o(&feat.GetExt());
348  if (o->IsSetType() && o->GetType().IsStr() && o->GetType().GetStr() == "CombinedFeatureUserObjects") {
349  ITERATE (CUser_object::TData, it, o->GetData()) {
350  const CUser_field& field = **it;
351  CConstRef<CUser_object> sub_o(&field.GetData().GetObject());
352  objs.push_back(sub_o);
353  }
354  } else {
355  objs.push_back(o);
356  }
357  }
358  if (feat.IsSetExts()) {
359  copy(feat.GetExts().begin(), feat.GetExts().end(), back_inserter(objs));
360  }
361 
362  ITERATE (list< CConstRef<CUser_object> >, obj_it, objs) {
363  const CUser_object& obj = **obj_it;
364  if ( !obj.IsSetType() ||
365  !obj.GetType().IsStr() ||
366  obj.GetType().GetStr() != "ModelEvidence") {
367  continue;
368  }
369 
370  string s;
372 
373  ostream << endl;
374 
375  ///
376  /// generation method
377  string method;
378  ostream << "Model Generation Method: ";
379  f = obj.GetFieldRef("Method");
380  if (f) {
381  method = f->GetData().GetStr();
382  ostream << method;
383  } else {
384  ostream << "<unknown>";
385  }
386 
387  ostream << endl;
388 
389  ///
390  /// list of support
391  if (method == "Chainer" || method == "Gnomon") {
392 
393  ///
394  /// scan for multiple 'Core' entries
395  f = obj.GetFieldRef("Support");
396  if (f) {
397  string core;
398  ITERATE (CUser_field::TData::TFields, it, f->GetData().GetFields()) {
399  const CUser_field& this_f = **it;
400  if (this_f.GetLabel().GetStr() == "Core") {
401  if ( !core.empty() ) {
402  core += ", ";
403  }
404  core += this_f.GetData().GetStr();
405  }
406  }
407  if ( !core.empty() ) {
408  s = "Model Based On: ";
409  s += core;
410  ostream << s << endl;
411  }
412  }
413 
414  ///
415  /// supporting proteins
416  f = obj.GetFieldRef("Support.Proteins");
417  if (f) {
418  s_RenderAccList(ostream, f->GetData().GetStrs(), "Source Proteins");
419  }
420 
421  ///
422  /// supporting proteins
423  f = obj.GetFieldRef("Support.mRNAs");
424  if (f) {
425  s_RenderAccList(ostream, f->GetData().GetStrs(), "Source mRNAs");
426  }
427  }
428  }
429 }
430 
431 static void s_Render_SeqFeat(
432  stringstream& ostream, const objects::CSeq_feat& feat, objects::CScope& scope)
433 {
434  try {
435  string text;
436  /// start with the description text
437  CLabel::GetLabel( feat, &text, CLabel::eDescription, &scope );
438  ostream << text << endl;
439 
440  /// add information about the feature's location
441  TSeqRange range = feat.GetLocation().GetTotalRange();
442  ostream << "Total Range: ";
443  switch( sequence::GetStrand(feat.GetLocation(), &scope) ){
444  case eNa_strand_plus:
445  ostream << "(+) ";
446  break;
447  case eNa_strand_minus:
448  ostream << "(-) ";
449  break;
450  default:
451  break;
452  }
453 
454  ostream << NStr::IntToString(range.GetFrom() + 1, NStr::fWithCommas)
455  << " - "
456  << NStr::IntToString(range.GetTo() + 1, NStr::fWithCommas)
457  << endl;
458 
459  ostream << "Total Length: "
460  << NStr::IntToString(range.GetLength(), NStr::fWithCommas)
461  << endl;
462 
463  ostream << "Processed Length: "
464  << NStr::IntToString(sequence::GetLength(feat.GetLocation(), &scope),
466  << endl;
467 
468  if (feat.IsSetProduct()) {
469  try {
470  string prod_len_str;
471  CBioseq_Handle h = scope.GetBioseqHandle(feat.GetProduct());
472  if (h) {
473  ostream << "Product Length: "
476  << endl;
477  }
478  }
479  catch (CException&) {
480  }
481  }
482  ostream << endl;
483 
484  /// next, include the flat file text for this feature
485  CFlatFileConfig cfg;
486  cfg.SetNeverTranslateCDS();
487 
488  /// hack: search for this feature using CFeat_CI
489  /// it'd be better to use CMappedFeat instead of CSeq_feat
491  sel.IncludeFeatSubtype(feat.GetData().GetSubtype());
492 
493  CFeat_CI feat_it(scope, feat.GetLocation(), sel);
494  for (; feat_it ; ++feat_it) {
495  if (&feat_it->GetOriginalFeature() != &feat){
496  continue;
497  }
498  string s =
499  CFlatFileGenerator::GetSeqFeatText(*feat_it, scope, cfg);
500  string::size_type pos = s.find_first_not_of(" \n\r\t");
501  if( pos != string::npos ){
502  s.erase(0, pos);
503  }
504 
505  string::size_type lpos = string::npos;
506  do {
507  pos = lpos +1;
508  lpos = s.find_first_of("\n\r", pos );
509 
510  if( lpos == string::npos ){
511  text = s.substr( pos );
512  } else {
513  text = s.substr( pos, lpos - pos );
514  }
515  ostream << text << endl;
516 
517  } while( lpos != string::npos );
518  } // for
519 
520  /// lastly, add items relating to model evidence
521  s_Render_Feat_Evidence(ostream, feat, scope);
522  }
523  catch (CException&) {
524  }
525 }
526 
527 void CCorrectIntervalOrder::ApplyToCSeq_entry (objects::CSeq_entry_Handle tse, CRef<CCmdComposite> composite, const string &name, bool subtypeAnyFlag, bool &modified) // see SeqEntryConstrainedFeaturesCallback
528 {
529  for (CFeat_CI feat (tse); feat; ++feat)
530  {
531  bool filter = false;
532  if (NStr::EqualNocase(name, "All"))
533  {
534  filter = true;
535  }
536  else if (subtypeAnyFlag)
537  {
538  int type = feat->GetOriginalFeature().GetData().Which();
539  int subtype = CSeqFeatData::eSubtype_any;
540  string desc = m_Types[pair<int,int>(type,subtype)];
541  if (desc == name)
542  filter = true;
543  }
544  else if (feat->GetOriginalFeature().CanGetData())
545  {
546  int type = feat->GetOriginalFeature().GetData().Which();
547  int subtype = feat->GetOriginalFeature().GetData().GetSubtype();
548  string desc = m_Types[pair<int,int>(type,subtype)];
549  if (desc == name)
550  filter = true;
551  }
552 
553  if (filter)
554  {
555  bool go = true;
556  if (m_TextCtrl->GetLineLength(0) > 0)
557  {
558  go = false;
559  stringstream str;
560  CScope &scope = tse.GetScope();
561  s_Render_SeqFeat(str, feat->GetOriginalFeature(), scope);
562  string pattern = m_TextCtrl->GetLineText(0).ToStdString();
563  bool match(false);
564  if (m_CheckBox->GetValue())
565  match = NStr::FindNoCase(str.str(), pattern) != NPOS;
566  else
567  match = NStr::Find(str.str(), pattern) != NPOS;
568  if (match && m_RadioButton->GetValue()) go = true;
569  else if (!match && !m_RadioButton->GetValue()) go = true;
570  }
571  if (go && m_TextCtrl_id->GetLineLength(0) > 0)
572  {
573  go = false;
574  string pattern = m_TextCtrl_id->GetLineText(0).ToStdString();
575  bool match = false;
576  bool no_case = m_CheckBox_id->GetValue();
577 
578  CBioseq_Handle bsh = tse.GetScope().GetBioseqHandle(feat->GetLocation());
579  if (bsh && bsh.IsSetId())
580  {
581  for (CBioseq_Handle::TId::const_iterator idh = bsh.GetId().begin(); idh != bsh.GetId().end(); ++idh)
582  {
583  string str;
584  try
585  {
586  CConstRef<CSeq_id> id = idh->GetSeqId();
587  id->GetLabel(&str);
588  } catch(const CException&) {} catch (const exception&) {}
589  if (!str.empty())
590  {
591  if (no_case)
592  match = NStr::FindNoCase(str, pattern) != NPOS;
593  else
594  match = NStr::Find(str, pattern) != NPOS;
595  if (match)
596  break;
597  }
598  }
599  }
600  if (match && m_RadioButton_id->GetValue()) go = true;
601  else if (!match && !m_RadioButton_id->GetValue()) go = true;
602  }
603 
604  if (go && m_ChoiceStrand->GetSelection()>0)
605  {
606  go = false;
607  int n = m_ChoiceStrand->GetSelection();
608  wxString strand = m_ChoiceStrand->GetString(n);
609  if (strand == wxT("Plus Strand") && feat->GetOriginalFeature().IsSetLocation() && feat->GetOriginalFeature().GetLocation().GetStrand() == eNa_strand_plus) go = true;
610  if (strand == wxT("Minus Strand") && feat->GetOriginalFeature().IsSetLocation() && feat->GetOriginalFeature().GetLocation().GetStrand() == eNa_strand_minus) go = true;
611  }
612 
613  if (go && m_ChoiceType->GetSelection()>0)
614  {
615  go = false;
616  int n = m_ChoiceType->GetSelection();
617  wxString type = m_ChoiceType->GetString(n);
618  if (type == wxT("Nucleotide sequences only") && feat->GetOriginalFeature().IsSetLocation())
619  {
620  CBioseq_Handle bsh = tse.GetScope().GetBioseqHandle(feat->GetLocation());
621  if (bsh.IsNa())
622  go = true;
623  }
624  if (type == wxT("Protein sequences only") && feat->GetOriginalFeature().IsSetLocation())
625  {
626  CBioseq_Handle bsh = tse.GetScope().GetBioseqHandle(feat->GetLocation());
627  if (bsh.IsAa())
628  go = true;
629  }
630  }
631  if (go)
632  {
633  CSeq_feat_Handle fh = feat->GetSeq_feat_Handle();
634  if (fh)
635  {
636  CRef<CSeq_feat> new_feat(new CSeq_feat());
637  new_feat->Assign(feat->GetOriginalFeature());
638  if (edit::CorrectIntervalOrder(new_feat->SetLocation()))
639  {
640  composite->AddCommand(*CRef<CCmdChangeSeq_feat>(new CCmdChangeSeq_feat(feat->GetSeq_feat_Handle(), *new_feat)));
641  modified = true;
642  }
643  }
644  }
645  }
646  }
647 }
648 
649 
650 
CBioseq_Handle –.
objects::CSeq_entry_Handle m_TopSeqEntry
bool Create(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
string m_ErrorMessage
bool GetTopLevelSeqEntryAndProcessor()
void AddCommand(IEditCommand &command)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void ApplyToCSeq_entry(objects::CSeq_entry_Handle tse, CRef< CCmdComposite > composite, const string &name, bool subtypeAnyFlag, bool &modified)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
static bool ShowToolTips()
Should we show tooltips?
void CreateControls()
Creates the controls and sizers.
map< pair< int, int >, string > m_Types
virtual CRef< CCmdComposite > GetCommand()
bool Create(wxWindow *parent, wxWindowID id=11000, const wxString &caption=_("Correct Interval Order"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void Init()
Initialises member variables.
CFeatListItem - basic configuration data for one "feature" type.
int GetSubtype() const
string GetDescription() const
int GetType() const
CFeat_CI –.
Definition: feat_ci.hpp:64
CFlatFileConfig & SetNeverTranslateCDS(bool val=true)
static string GetSeqFeatText(const CMappedFeat &feat, CScope &scope, const CFlatFileConfig &cfg, CRef< feature::CFeatTree > ftree=null)
CScope –.
Definition: scope.hpp:92
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Definition: User_object.cpp:84
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
void clear()
Definition: map.hpp:169
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator find(const key_type &key) const
Definition: set.hpp:137
const_iterator end() const
Definition: set.hpp:136
USING_SCOPE(objects)
static void s_Render_SeqFeat(stringstream &ostream, const objects::CSeq_feat &feat, objects::CScope &scope)
static void s_RenderAccList(stringstream &ostream, const CUser_field::TData::TStrs &item_data, const string &title)
static void s_Render_Feat_Evidence(stringstream &ostream, const CSeq_feat &feat, CScope &)
#define ID_CORRECT_INTERVAL_ORDER_TEXTCTRL
#define ID_CORRECT_INTERVAL_ORDER_CHECKBOX1
#define ID_CORRECT_INTERVAL_ORDER_CHECKBOX
#define ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON3
#define ID_LISTCTRL_CORRECT_INTERVAL_ORDER
#define ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON1
#define ID_CORRECT_INTERVAL_ORDER_TEXTCTRL1
#define ID_CORRECT_INTERVAL_ORDER_CHOICE2
#define ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON2
#define ID_CORRECT_INTERVAL_ORDER_RADIOBUTTON
#define ID_CORRECT_INTERVAL_ORDER_CHOICE1
#define ID_CORRECT_INTERVAL_ORDER_OKCANCEL
#define _(proto)
Definition: ct_nlmzip_i.h:78
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static void Init(void)
Definition: cursor6.c:76
static const char * str(char *buf, int n)
Definition: stats.c:84
static const struct type types[]
Definition: type.c:22
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NULL
Definition: ncbistd.hpp:225
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
Definition: utils.cpp:167
vector< const objects::CFeatListItem * > GetSortedFeatList(objects::CSeq_entry_Handle seh, size_t max=numeric_limits< size_t >::max())
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
Definition: label.cpp:140
@ eDescription
Definition: label.hpp:68
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
Definition: Seq_id.cpp:1634
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2040
EAccessionInfo
For IdentifyAccession (below)
Definition: Seq_id.hpp:220
@ eAcc_type_mask
Definition: Seq_id.hpp:247
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
TSeqPos GetBioseqLength(void) const
bool IsAa(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
bool IsSetId(void) const
bool IsNa(void) const
const TId & GetId(void) const
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
#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 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 IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5086
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2882
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
Definition: ncbistr.hpp:2699
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5355
static void Wrap(const string &str, SIZE_TYPE width, IWrapDest &dest, TWrapFlags flags, const string *prefix, const string *prefix1)
Definition: ncbistr.cpp:5338
@ fWithCommas
Use commas as thousands separator.
Definition: ncbistr.hpp:254
const TStr & GetStr(void) const
Get the variant data.
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
const TData & GetData(void) const
Get the Data member data.
vector< CRef< CUser_field > > TFields
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
const TData & GetData(void) const
Get the Data member data.
const TObject & GetObject(void) const
Get the variant data.
const TLabel & GetLabel(void) const
Get the Label member data.
const TType & GetType(void) const
Get the Type member data.
vector< CStringUTF8 > TStrs
vector< CRef< CUser_field > > TData
const TExts & GetExts(void) const
Get the Exts member data.
Definition: Seq_feat_.hpp:1477
bool IsSetExt(void) const
user defined structure extension Check if a value has been assigned to Ext data member.
Definition: Seq_feat_.hpp:1207
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
bool IsSetExts(void) const
set of extensions; will replace 'ext' field Check if a value has been assigned to Exts data member.
Definition: Seq_feat_.hpp:1465
const TExt & GetExt(void) const
Get the Ext member data.
Definition: Seq_feat_.hpp:1219
@ eNa_strand_plus
Definition: Na_strand_.hpp:66
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ e_Other
for historical reasons, 'other' = 'refseq'
Definition: Seq_id_.hpp:104
END_EVENT_TABLE()
int i
yy_size_t n
bool CorrectIntervalOrder(CSeq_loc &loc)
Correct the order of consecutive intervals with the same Seq-id on the same strand.
Definition: loc_edit.cpp:2346
static void text(MDB_val *v)
Definition: mdb_dump.c:62
static MDB_envinfo info
Definition: mdb_load.c:37
#define wxT(x)
Definition: muParser.cpp:41
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
static int match(register const pcre_uchar *eptr, register const pcre_uchar *ecode, const pcre_uchar *mstart, int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
Definition: pcre_exec.c:513
static static static wxID_ANY
SAnnotSelector –.
Definition: type.c:6
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Wed Jul 17 13:19:59 2024 by modify_doxy.py rev. 669887