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

Go to the SVN repository for this file.

1 /* $Id: cdd_annot_dialog.cpp 77983 2017-05-17 13:09:51Z ivanov $
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: Paul Thiessen
27 *
28 * File Description:
29 * dialogs for annotating CDD's
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
35 #include <corelib/ncbistd.hpp>
36 #include <util/xregexp/regexp.hpp>
37 
42 #include <objects/pub/Pub.hpp>
60 
62 
64 
65 #include "cdd_annot_dialog.hpp"
66 #include "structure_set.hpp"
67 #include "messenger.hpp"
68 #include "alignment_manager.hpp"
70 #include "sequence_set.hpp"
71 #include "cn3d_tools.hpp"
72 #include "chemical_graph.hpp"
73 #include "molecule_identifier.hpp"
74 #include "opengl_renderer.hpp"
75 #include "show_hide_manager.hpp"
76 
77 #include "pattern_dialog.hpp"
78 
79 ////////////////////////////////////////////////////////////////////////////////////////////////
80 // The following is taken unmodified from wxDesigner's C++ header from cdd_annot_dialog.wdr
81 ////////////////////////////////////////////////////////////////////////////////////////////////
82 
83 #include <wx/image.h>
84 #include <wx/statline.h>
85 #include <wx/spinbutt.h>
86 #include <wx/spinctrl.h>
87 #include <wx/splitter.h>
88 #include <wx/listctrl.h>
89 #include <wx/treectrl.h>
90 #include <wx/notebook.h>
91 
92 // Declare window functions
93 
94 #define ID_L_ANNOT 10000
95 #define ID_B_NEW_ANNOT 10001
96 #define ID_B_HIGHLIGHT 10002
97 #define ID_B_DEFINE_MOTIF 10003
98 #define ID_B_ANNOT_UP 10004
99 #define ID_B_EDIT_ANNOT 10005
100 #define ID_B_DEL_ANNOT 10006
101 #define ID_B_DEL_MOTIF 10007
102 #define ID_B_HIGHLIGHT_MOTIF 10008
103 #define ID_B_ANNOT_DOWN 10009
104 #define ID_L_EVID 10010
105 #define ID_B_NEW_EVID 10011
106 #define ID_B_SHOW 10012
107 #define ID_B_EVID_UP 10013
108 #define ID_B_EDIT_EVID 10014
109 #define ID_B_DEL_EVID 10015
110 #define ID_B_EVID_DOWN 10016
111 wxSizer *SetupCDDAnnotDialog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
112 
113 #define ID_R_COMMENT 10017
114 #define ID_ST_COMMENT 10018
115 #define ID_T_COMMENT 10019
116 #define ID_LINE 10020
117 #define ID_R_PMID 10021
118 #define ID_ST_PMID 10022
119 #define ID_T_PMID 10023
120 #define ID_R_STRUCTURE 10024
121 #define ID_ST_STRUCTURE 10025
122 #define ID_T_STRUCTURE 10026
123 #define ID_B_RERANGE 10027
124 #define ID_B_EDIT_OK 10028
125 #define ID_B_EDIT_CANCEL 10029
126 wxSizer *SetupEvidenceDialog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
127 
128 #define ID_ST_TYPE 10030
129 #define ID_C_TYPE 10031
130 #define ID_CB_PUTATIVE 10032
131 #define ID_ST_DESCR2 10033
132 #define ID_CMB_DESCR 10034
133 #define ID_B_DESCR_OK 10035
134 #define ID_B_DESCR_CANCEL 10036
135 wxSizer *SetupTypedDescriptionDialog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
136 
137 ////////////////////////////////////////////////////////////////////////////////////////////////
138 
141 
142 
143 BEGIN_SCOPE(Cn3D)
144 
145 
146 // This member is initialized from $CN3D_HOME/data/cdd_annot_types.ini; if
147 // it is not present no predefined types or site names are available to the user.
148 static const string STD_ANNOT_TYPES_FILE = "cdd_annot_types.ini";
149 
150 
151 // a "structure evidence" biostruc-annot-set has these qualities - basically, a specific
152 // comment tag as the first entry in the set's description, and a 'name' descr in the feature set
153 static const string STRUCTURE_EVIDENCE_COMMENT = "Used as Structure Evidence for CDD Annotation";
154 #define IS_STRUCTURE_EVIDENCE_BSANNOT(evidence) \
155  ((evidence).IsBsannot() && \
156  (evidence).GetBsannot().IsSetDescr() && \
157  (evidence).GetBsannot().GetDescr().size() > 0 && \
158  (evidence).GetBsannot().GetDescr().front()->IsOther_comment() && \
159  (evidence).GetBsannot().GetDescr().front()->GetOther_comment() == STRUCTURE_EVIDENCE_COMMENT && \
160  (evidence).GetBsannot().GetFeatures().size() > 0 && \
161  (evidence).GetBsannot().GetFeatures().front()->IsSetDescr() && \
162  (evidence).GetBsannot().GetFeatures().front()->GetDescr().size() > 0 && \
163  (evidence).GetBsannot().GetFeatures().front()->GetDescr().front()->IsName())
164 
165 
166 #define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type) \
167  type *var; \
168  var = wxDynamicCast(FindWindow(id), type); \
169  if (!var) { \
170  ERRORMSG("Can't find window with id " << id); \
171  return; \
172  }
173 
174 #define DECLARE_AND_FIND_WINDOW_RETURN_FALSE_ON_ERR(var, id, type) \
175  type *var; \
176  var = wxDynamicCast(FindWindow(id), type); \
177  if (!var) { \
178  ERRORMSG("Can't find window with id " << id); \
179  return false; \
180  }
181 
182 BEGIN_EVENT_TABLE(CDDAnnotateDialog, wxDialog)
183  EVT_BUTTON (-1, CDDAnnotateDialog::OnButton)
184  EVT_LISTBOX (-1, CDDAnnotateDialog::OnSelection)
187 
189  wxDialog(parent, -1, "CDD Annotations", wxPoint(400, 100), wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
190  dialogHandle(handle), structureSet(set), annotSet(set->GetCDDAnnotSet())
191 {
192 
193  if (annotSet.Empty()) {
194  Destroy();
195  return;
196  }
197 
198  // construct the panel
199  wxSizer *topSizer = SetupCDDAnnotDialog(this, false);
200 
201  // call sizer stuff
202  topSizer->Fit(this);
203  topSizer->SetSizeHints(this);
204  SetClientSize(topSizer->GetMinSize());
205 
206  // Load the pre-defined type categories and descriptions
207  if (!ncbi::cd_utils::CStdAnnotTypes::HasTypeData()) {
208  string typeFile = GetDataDir() + STD_ANNOT_TYPES_FILE;
209  if (!ncbi::cd_utils::CStdAnnotTypes::LoadTypes(typeFile)) {
210  wxMessageBox(wxString("Warning: error parsing standard annotation types from file\n") + wxString(typeFile.c_str()),
211  "Missing Annotation Type Definitions",
212  wxOK | wxCENTRE | wxICON_WARNING, this);
213  }
214  }
215 
216  // set initial GUI state
217  SetupGUIControls(0, 0);
218 }
219 
221 {
222  // so owner knows that this dialog has been destroyed
224  TRACEMSG("destroyed CDDAnnotateDialog");
225 }
226 
227 void CDDAnnotateDialog::OnCloseWindow(wxCloseEvent& event)
228 {
229  Destroy();
230 }
231 
232 static bool IsFirstResidueOfABlock(const BlockMultipleAlignment::ConstBlockList& blocks, unsigned int masterIndex)
233 {
234  BlockMultipleAlignment::ConstBlockList::const_iterator b, be = blocks.end();
235  for (b=blocks.begin(); b!=be; ++b) {
236  int from = (*b)->GetRangeOfRow(0)->from;
237  if (from == (int) masterIndex)
238  return true;
239  else if (from > (int) masterIndex)
240  return false;
241  }
242  return false;
243 }
244 
246 {
248  const Sequence *master = alignment->GetMaster();
250  alignment->GetBlocks(&blocks);
251 
252  // find intervals of aligned residues of the master sequence that are currently highlighted
253  intervals->clear();
254  unsigned int first = 0, last = 0;
255  while (first < master->Length()) {
256 
257  // find first highlighted residue
258  while (first < master->Length() &&
259  !(GlobalMessenger()->IsHighlighted(master, first) &&
260  alignment->IsAligned(0U, first))) ++first;
261  if (first >= master->Length()) break;
262 
263  // find last in contiguous stretch of highlighted residues, but not crossing block boundaries
264  last = first;
265  while (last + 1 < master->Length() &&
266  GlobalMessenger()->IsHighlighted(master, last + 1) &&
267  alignment->IsAligned(0U, last + 1) &&
269 
270  // create Seq-interval
271  CRef < CSeq_interval > interval(new CSeq_interval());
272  interval->SetFrom(first);
273  interval->SetTo(last);
274  master->FillOutSeqId(&(interval->SetId()));
275  intervals->push_back(interval);
276  first = last + 1;
277  }
278 }
279 
280 void CDDAnnotateDialog::OnButton(wxCommandEvent& event)
281 {
282  switch (event.GetId()) {
283  // annotation buttons
284  case ID_B_NEW_ANNOT:
285  NewAnnotation();
286  break;
287  case ID_B_DEL_ANNOT:
289  break;
290  case ID_B_EDIT_ANNOT:
291  EditAnnotation();
292  break;
293  case ID_B_HIGHLIGHT:
295  break;
296  case ID_B_DEFINE_MOTIF:
297  NewOrEditMotif();
298  break;
299  case ID_B_DEL_MOTIF:
300  DeleteMotif();
301  break;
303  HighlightMotif();
304  break;
305  case ID_B_ANNOT_UP: case ID_B_ANNOT_DOWN:
306  MoveAnnotation(event.GetId() == ID_B_ANNOT_UP);
307  break;
308 
309  // evidence buttons
310  case ID_B_NEW_EVID:
311  NewEvidence();
312  break;
313  case ID_B_DEL_EVID:
314  DeleteEvidence();
315  break;
316  case ID_B_EDIT_EVID:
317  EditEvidence();
318  break;
319  case ID_B_SHOW:
320  ShowEvidence();
321  break;
322  case ID_B_EVID_UP: case ID_B_EVID_DOWN:
323  MoveEvidence(event.GetId() == ID_B_EVID_UP);
324  break;
325 
326  default:
327  event.Skip();
328  }
329 }
330 
331 void CDDAnnotateDialog::OnSelection(wxCommandEvent& event)
332 {
335 
336  if (event.GetEventObject() == annots)
337  SetupGUIControls(annots->GetSelection(), 0);
338  else
339  SetupGUIControls(annots->GetSelection(), evids->GetSelection());
340 }
341 
342 void CDDAnnotateDialog::SetupGUIControls(int selectAnnot, int selectEvidence)
343 {
344  // get GUI control pointers
362 
363  bool readOnly;
365 
366  // fill out annots listbox
367  string typeStr;
368  wxString descr;
369  int pos = annots->GetScrollPos(wxVERTICAL);
370  annots->Clear();
371  CAlign_annot *selectedAnnot = NULL;
372  CAlign_annot_set::Tdata::iterator a, ae = annotSet->Set().end();
373  for (a=annotSet->Set().begin(); a!=ae; ++a) {
374  descr = "(no description)";
375  if ((*a)->IsSetDescription() && (*a)->GetDescription().length() > 0)
376  descr = (*a)->GetDescription().c_str();
377 
378  // The default type 0 ("other") is uninformative and not displayed.
379  if ((*a)->IsSetType() && ncbi::cd_utils::CStdAnnotTypes::GetTypeAsString((*a)->GetType(), typeStr)) {
380  if ((*a)->GetType() > 0) {
381  typeStr = " [" + typeStr + " Site]";
382  descr += wxString(typeStr.c_str());
383  }
384  }
385 
386  annots->Append(descr, a->GetPointer());
387  }
388 
389  if (selectAnnot < (int) annots->GetCount())
390  annots->SetSelection(selectAnnot);
391  else if (annots->GetCount() > 0)
392  annots->SetSelection(0);
393  if (annots->GetCount() > 0)
394  selectedAnnot = reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
395  annots->SetFirstItem(pos);
396 
397  // fill out evidence listbox
398  pos = evids->GetScrollPos(wxVERTICAL);
399  evids->Clear();
400  CFeature_evidence *selectedEvid = NULL;
401  if (selectedAnnot && selectedAnnot->IsSetEvidence()) {
402  CAlign_annot::TEvidence::iterator e, ee = selectedAnnot->SetEvidence().end();
403  for (e=selectedAnnot->SetEvidence().begin(); e!=ee; ++e) {
404  // get evidence "title" depending on type
405  wxString evidTitle;
406  if ((*e)->IsComment())
407  evidTitle.Printf("Comment: %s", (*e)->GetComment().c_str());
408  else if ((*e)->IsReference() && (*e)->GetReference().IsPmid())
409  evidTitle.Printf("PMID: %i", (*e)->GetReference().GetPmid().Get());
410  else if (IS_STRUCTURE_EVIDENCE_BSANNOT(**e))
411  evidTitle.Printf("Structure: %s",
412  (*e)->GetBsannot().GetFeatures().front()->GetDescr().front()->GetName().c_str());
413  else
414  evidTitle = "(unknown type)";
415  evids->Append(evidTitle, e->GetPointer());
416  }
417  if (selectEvidence < (int) evids->GetCount())
418  evids->SetSelection(selectEvidence);
419  else if (evids->GetCount() > 0)
420  evids->SetSelection(0);
421  if (evids->GetCount() > 0)
422  selectedEvid = reinterpret_cast<CFeature_evidence*>(evids->GetClientData(evids->GetSelection()));
423  evids->SetFirstItem(pos);
424  }
425 
426  // set button states
427  bNewAnnot->Enable(!readOnly);
428  bDelAnnot->Enable(selectedAnnot != NULL && !readOnly);
429  bEditAnnot->Enable(selectedAnnot != NULL && !readOnly);
430  if (selectedAnnot != NULL && selectedAnnot->IsSetMotif())
431  bNewEditMotif->SetLabel("Edit Motif");
432  else
433  bNewEditMotif->SetLabel("New Motif");
434  bNewEditMotif->Enable(selectedAnnot != NULL && !readOnly);
435  bDelMotif->Enable(selectedAnnot != NULL && !readOnly && selectedAnnot->IsSetMotif());
436  bHighlight->Enable(selectedAnnot != NULL);
437  bHighlightMotif->Enable(selectedAnnot != NULL && selectedAnnot->IsSetMotif());
438  bAnnotUp->Enable(annots->GetSelection() > 0 && !readOnly);
439  bAnnotDown->Enable(annots->GetSelection() < ((int) annots->GetCount()) - 1 && !readOnly);
440  bNewEvid->Enable(selectedAnnot != NULL && !readOnly);
441  bDelEvid->Enable(selectedEvid != NULL && !readOnly);
442  bEditEvid->Enable(selectedEvid != NULL && !readOnly);
443  bShow->Enable(selectedEvid != NULL &&
444  ((selectedEvid->IsReference() && selectedEvid->GetReference().IsPmid()) ||
445  IS_STRUCTURE_EVIDENCE_BSANNOT(*selectedEvid) || selectedEvid->IsComment()));
446  bEvidUp->Enable(evids->GetSelection() > 0 && !readOnly);
447  bEvidDown->Enable(evids->GetSelection() < ((int) evids->GetCount()) - 1 && !readOnly);
448 }
449 
451 {
452  IntervalList intervals;
453  GetCurrentHighlightedIntervals(&intervals);
454  if (intervals.size() == 0) {
455  ERRORMSG("No aligned+highlighted master residues!");
456  return;
457  }
458 
459  CRef < CAlign_annot > annot(new CAlign_annot());
460  CDDTypedAnnotDialog dialog(this, *annot, "New Annotation Description");
461  int result = dialog.ShowModal();
462  if (result == wxCANCEL) return;
463 
464  bool getDataResult = dialog.GetData(annot.GetPointer());
465 
466  // If there's no description, don't persist the annotation.
467  string descr = (annot->IsSetDescription()) ? annot->GetDescription() : kEmptyStr;
468  if (!getDataResult || descr.size() == 0) return;
469 
470  // fill out location
471  if (intervals.size() == 1) {
472  annot->SetLocation().SetInt(*(intervals.front()));
473  } else {
474  CPacked_seqint *packed = new CPacked_seqint();
475  packed->Set() = intervals; // copy list
476  annot->SetLocation().SetPacked_int(*packed);
477  }
478 
479  // add to annotation list
480  annotSet->Set().push_back(annot);
482 
483  // update GUI
484  SetupGUIControls(annotSet->Get().size() - 1, 0);
485 }
486 
488 {
489  // get selection
491  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
492  CAlign_annot *selectedAnnot =
493  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
494  if (!selectedAnnot) {
495  ERRORMSG("CDDAnnotateDialog::DeleteAnnotation() - error getting annotation pointer");
496  return;
497  }
498 
499  // confirm with user
500  int confirm = wxMessageBox("This will remove the selected annotation and all the\n"
501  "evidence associated with it. Is this correct?", "Confirm", wxOK | wxCANCEL | wxCENTRE, this);
502  if (confirm != wxOK) return;
503 
504  // actually delete the annotation
505  CAlign_annot_set::Tdata::iterator a, ae = annotSet->Set().end();
506  for (a=annotSet->Set().begin(); a!=ae; ++a) {
507  if (*a == selectedAnnot) {
508  annotSet->Set().erase(a);
510  break;
511  }
512  }
513 
514  // update GUI
515  SetupGUIControls(0, 0);
516 }
517 
519 {
522 
523  // get selection
524  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
525  CAlign_annot *selectedAnnot =
526  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
527  if (!selectedAnnot) {
528  ERRORMSG("CDDAnnotateDialog::EditAnnotation() - error getting annotation pointer");
529  return;
530  }
531 
532  IntervalList intervals;
533  GetCurrentHighlightedIntervals(&intervals);
534  if (intervals.size() > 0) {
535  // move the annotation?
536  int move = wxMessageBox("Do you want to move the annotation to the currently\n"
537  "highlighted and aligned residues?", "Move?", wxYES_NO | wxCANCEL | wxCENTRE, this);
538  if (move == wxCANCEL)
539  return;
540  else if (move == wxYES) {
541  // change location
542  if (intervals.size() == 1) {
543  selectedAnnot->SetLocation().SetInt(*(intervals.front()));
544  } else {
545  CPacked_seqint *packed = new CPacked_seqint();
546  packed->Set() = intervals; // copy list
547  selectedAnnot->SetLocation().SetPacked_int(*packed);
548  }
550  }
551  }
552 
553  // edit type or description
554  int initialType = wxNOT_FOUND, finalType = wxNOT_FOUND;
555  string initialDescr = kEmptyStr, finalDescr = kEmptyStr;
556  if (selectedAnnot->IsSetType()) initialType = selectedAnnot->GetType();
557  if (selectedAnnot->IsSetDescription()) initialDescr = selectedAnnot->GetDescription();
558 
559  CDDTypedAnnotDialog dialog(this, *selectedAnnot, "Edit Annotation Description");
560  int result = dialog.ShowModal();
561  if (result == wxOK) {
562  bool getDataResult = dialog.GetData(selectedAnnot);
563 
564  if (selectedAnnot->IsSetType()) finalType = selectedAnnot->GetType();
565  if (selectedAnnot->IsSetDescription()) finalDescr = selectedAnnot->GetDescription();
566 
567  if (finalDescr == kEmptyStr) {
568  if (initialType == wxNOT_FOUND) {
569  selectedAnnot->ResetType();
570  } else {
571  selectedAnnot->SetType(initialType);
572  }
573  selectedAnnot->SetDescription(initialDescr);
574  ERRORMSG("CDDAnnotateDialog::EditAnnotation() - edited annotation must have a non-empty description\nAnnotation is unchanged.");
575  return;
576  }
577 
578  if (getDataResult && ((initialType != finalType) || (finalDescr != initialDescr))) {
580  }
581  }
582 
583  // update GUI
584  SetupGUIControls(annots->GetSelection(), evids->GetSelection());
585 }
586 
587 // Return true if the regexp matches the string constructed by concatenating the
588 // highlighted residues of the sequence. [Note that the string thus created is not,
589 // in general, a true substring of the sequence.] Return false otherwise.
590 // If there are no highlighted residues, also return false.
591 bool DoesPatternMatchHighlightedResidues(const Sequence& sequence, const Sequence::MoleculeHighlightMap& restrictTo, CRegexp& regexp, set<unsigned int>* highlightedSeqIndicesPtr)
592 {
593  bool result = false;
594  unsigned int i = 0;
595  unsigned int len = sequence.sequenceString.length();
596  string highlightedResidues;
597 
598  if (highlightedSeqIndicesPtr) highlightedSeqIndicesPtr->clear();
599 
600  Sequence::MoleculeHighlightMap::const_iterator r = restrictTo.find(sequence.identifier);
601  if (r != restrictTo.end()) {
602  for (; i < len; ++i) {
603  if (r->second[i]) {
604  highlightedResidues += sequence.sequenceString[i];
605  if (highlightedSeqIndicesPtr) highlightedSeqIndicesPtr->insert(i);
606  }
607  }
608  }
609 
610  // do the search
611  if (highlightedResidues.length() > 0) {
612  string ignore = regexp.GetMatch(highlightedResidues, 0, 0, CRegexp::fMatch_default, true);
613  if (regexp.NumFound() > 0)
614  result = true;
615  }
616 
617  return result;
618 }
619 
620 // Returns the number of rows matched.
621 unsigned int DoHighlightMotif(StructureSet* structureSet, const string& regexPattern, Messenger::MoleculeHighlightMap& restrictTo)
622 {
623  if (!structureSet || regexPattern.length() == 0 || restrictTo.size() == 0) return 0;
624 
625  // Highlight matches of annotated residues to pattern from each (unique) sequence in the display
626  unsigned int nRowsMatched = 0;
627  map < const Sequence * , bool > usedSequences;
628  const BlockMultipleAlignment *alignment = structureSet->alignmentManager->GetCurrentMultipleAlignment();
629  CRegexp regexp(regexPattern, CRegexp::fCompile_ungreedy);
630  set<unsigned int> highlightedSeqIndices;
631 
632  for (unsigned int i=0; i<alignment->NRows(); ++i) {
633 
634  const Sequence *sequence = alignment->GetSequenceOfRow(i);
635  if (!sequence || usedSequences.find(sequence) != usedSequences.end()) continue;
636  usedSequences[sequence] = true;
637 
638  if (DoesPatternMatchHighlightedResidues(*sequence, restrictTo, regexp, &highlightedSeqIndices)) {
639  ++nRowsMatched;
640  ITERATE(set<unsigned int>, setIt, highlightedSeqIndices) {
641  GlobalMessenger()->AddHighlights(sequence, *setIt, *setIt);
642  }
643  }
644  }
645  return nRowsMatched;
646 }
647 
649 {
652 
653  // get selection
654  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
655  CAlign_annot *selectedAnnot =
656  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
657  if (!selectedAnnot) {
658  ERRORMSG("CDDAnnotateDialog::NewOrEditMotif() - error getting annotation pointer");
659  return;
660  }
661 
662  bool isMotifValid = true;
663  bool wasMotifSet = selectedAnnot->IsSetMotif();
664  int status = wxID_CANCEL, nGroups = 0;
665  TSeqPos from, to;
666  TSeqPos annotationLength = 0, patternLength = 0;
667  wxString msg, labelText;
668  wxString originalMotif = (wasMotifSet) ? selectedAnnot->GetMotif().c_str() : "";
669  wxString title = (wasMotifSet && originalMotif.length() > 0) ? "Edit Motif" : "New Motif";
670 
671  // Find the annotated residues on the master to display in PatternDialog
673  const Sequence *master = alignment->GetMaster();
674  string annotatedMasterResidues, masterSequence = master->sequenceString;
675  if (selectedAnnot->GetLocation().IsInt()) {
676  annotationLength = selectedAnnot->GetLocation().GetInt().GetLength();
677  from = selectedAnnot->GetLocation().GetInt().GetFrom();
678  to = selectedAnnot->GetLocation().GetInt().GetTo();
679  if (to < masterSequence.length()) {
680  for (; from <= to; ++from) annotatedMasterResidues += masterSequence[from];
681  }
682  } else if (selectedAnnot->GetLocation().IsPacked_int()) {
683  CPacked_seqint::Tdata::iterator s,
684  se = selectedAnnot->SetLocation().SetPacked_int().Set().end();
685  for (s=selectedAnnot->SetLocation().SetPacked_int().Set().begin(); s!=se; ++s) {
686  annotationLength += (**s).GetLength();
687  from = (**s).GetFrom();
688  to = (**s).GetTo();
689  if (to < masterSequence.length()) {
690  for (; from <= to; ++from) annotatedMasterResidues += masterSequence[from];
691  } else {
692  annotatedMasterResidues = kEmptyStr;
693  break;
694  }
695  }
696  }
697 
698  // Copied from OnFindPattern
699  PatternDialog dialog(this);
700  dialog.SetTitle(title);
701  dialog.m_Pattern->SetValue(originalMotif);
702  dialog.m_Pattern->SetSelection(-1, -1);
703  dialog.m_Mode->SetStringSelection("Within");
704  dialog.m_Mode->Show(false); // mode is not relevant in this context
705 
706  // Since user may not be able to see the entire annotation
707  // (and highlights will have been removed) include the annotated
708  // residues on the master as a hint for users in building a pattern.
709  if (annotatedMasterResidues.length() > 0) {
710 
711  // If this is a new motif, use the master annotated residues as the default
712  if (!wasMotifSet) {
713  wxString defaultMotif(annotatedMasterResidues.c_str());
714  dialog.m_Pattern->SetValue(defaultMotif);
715  }
716 
717  labelText = dialog.m_Text->GetLabelText();
718  annotatedMasterResidues = "\n[Annotated residues on master: " + annotatedMasterResidues + "]\n";
719  labelText += wxString(annotatedMasterResidues.c_str());
720  dialog.m_Text->SetLabel(labelText);
721  }
722 
723  dialog.Fit();
724  status = dialog.ShowModal();
725 
726  if (status != wxID_OK)
727  return;
728 
729  wxString newMotif = dialog.m_Pattern->GetValue();
730  string prositePattern(newMotif.c_str()), regexPattern;
731  patternLength = PrositePatternLength(prositePattern);
732 
733  // add trailing period if not present (convenience for the user;
734  // this must be done prior to calling Prosite2Regex)
735  if (prositePattern[prositePattern.size() - 1] != '.') prositePattern += '.';
736 
737  if (newMotif.size() == 0 || newMotif == originalMotif)
738  return;
739  else if (patternLength == 0) {
740  msg.Printf("The entered motif\n\n%s\n\ndoes not specify a valid Cn3D motif.\nMotif not created/modified.", newMotif.c_str());
741  wxMessageBox(msg, "Invalid Motif Specification", wxOK | wxICON_WARNING | wxCENTRE, this);
742  return;
743  } else if (patternLength != annotationLength) {
744  msg.Printf("The entered motif\n\n%s\n\nmust define the same number of residues as the annotation (%d).\nMotif not created/modified.", newMotif.c_str(), annotationLength);
745  wxMessageBox(msg, "Wrong Motif Length", wxOK | wxICON_WARNING | wxCENTRE, this);
746  return;
747  } else if (!Prosite2Regex(prositePattern, &regexPattern, &nGroups)) {
748  msg.Printf("The entered motif\n\n%s\n\ndid not parse as valid ProSite syntax.\nMotif not created/modified.", newMotif.c_str());
749  wxMessageBox(msg, "Motif Parsing Error", wxOK | wxICON_WARNING | wxCENTRE, this);
750  return;
751  }
752 
753  // The 'restrictTo' map will constrain the motif to the columns of the selected
754  // annotation. Temporarily highlight the annotation for the purpose of getting
755  // the set of residues in the annotation on each row. Immediately clear highlights
756  // again so that it will be obvious which rows matched the pattern.
759  GlobalMessenger()->GetHighlights(&restrictTo);
761 
762  // find & highlight rows for which motif is found
763  unsigned int nMatchesTotal = DoHighlightMotif(structureSet, regexPattern, restrictTo);
764 
765  // Perform some sort of sanity-check before accepting the new motif.
766  if (nMatchesTotal == 0) {
767  msg.Printf("For the entered motif\n\n%s\n\nno matches to annotated columns were found.\nMotif not created/modified.", newMotif.c_str());
768  wxMessageBox(msg, "Motif Not Found", wxOK | wxICON_WARNING | wxCENTRE, this);
769  return;
770  } else if (!isMotifValid) {
772  msg.Printf("The entered motif\n\n%s\n\ndid not satisfy validity checks.\nMotif not created/modified.", newMotif.c_str());
773  wxMessageBox(msg, "Motif Failed Validity Checks", wxOK | wxICON_WARNING | wxCENTRE, this);
774  return;
775  } else {
776  selectedAnnot->SetMotif(WX_TO_STD(newMotif));
777  selectedAnnot->SetMotifuse(0);
779  }
780 
781  // update GUI
782  SetupGUIControls(annots->GetSelection(), evids->GetSelection());
783 }
784 
786 {
789 
790  // get selection
791  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
792  CAlign_annot *selectedAnnot =
793  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
794  if (!selectedAnnot) {
795  ERRORMSG("CDDAnnotateDialog::DeleteMotif() - error getting annotation pointer");
796  return;
797  } else if (selectedAnnot->IsSetMotif()) {
798  selectedAnnot->ResetMotif();
799  selectedAnnot->ResetMotifuse();
801  }
802 
803  // update GUI
804  SetupGUIControls(annots->GetSelection(), evids->GetSelection());
805 }
806 
807 bool CDDAnnotateDialog::HighlightInterval(const ncbi::objects::CSeq_interval& interval)
808 {
810  const Sequence *master = alignment->GetMaster();
811 
812  // make sure annotation sequence matches master sequence
813  if (!master->identifier->MatchesSeqId(interval.GetId())) {
814  ERRORMSG("CDDAnnotateDialog::HighlightInterval() - interval Seq-id/master sequence mismatch");
815  return false;
816  }
817 
818  // do the highlighting
819  return alignment->HighlightAlignedColumnsOfMasterRange(interval.GetFrom(), interval.GetTo());
820 }
821 
823 {
825 
826  // get selection
827  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
828  CAlign_annot *selectedAnnot =
829  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
830  if (!selectedAnnot) {
831  ERRORMSG("CDDAnnotateDialog::HighlightAnnotation() - error getting annotation pointer");
832  return;
833  }
834 
835  // highlight annotation's intervals
837  bool okay = true;
838  if (selectedAnnot->GetLocation().IsInt()) {
839  okay = HighlightInterval(selectedAnnot->GetLocation().GetInt());
840  } else if (selectedAnnot->GetLocation().IsPacked_int()) {
841  CPacked_seqint::Tdata::iterator s,
842  se = selectedAnnot->SetLocation().SetPacked_int().Set().end();
843  for (s=selectedAnnot->SetLocation().SetPacked_int().Set().begin(); s!=se; ++s) {
844  if (!HighlightInterval(**s))
845  okay = false;
846  }
847  }
848  if (!okay)
849  wxMessageBox("WARNING: this annotation specifies master residues outside the aligned blocks;"
850  " see the message log for details.", "Annotation Error",
851  wxOK | wxCENTRE | wxICON_ERROR, this);
852 }
853 
855 {
857 
858  // get selection
859  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
860  CAlign_annot *selectedAnnot =
861  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
862  if (!selectedAnnot) {
863  ERRORMSG("CDDAnnotateDialog::HighlightMotif() - error getting annotation pointer");
864  return;
865  } else if (!selectedAnnot->IsSetMotif()) {
866  return;
867  }
868 
869  int nGroups = 0;
870  unsigned int patternLength;
871  wxString msg;
872  string prositePattern, regexPattern;
873  prositePattern = selectedAnnot->GetMotif();
874 
875  // add trailing period if not present (convenience for the user;
876  // this must be done prior to calling Prosite2Regex)
877  if (prositePattern[prositePattern.size() - 1] != '.') prositePattern += '.';
878 
879  patternLength = PrositePatternLength(prositePattern);
880  if (patternLength == 0) {
881  msg.Printf("The motif '%s' \n\ndoes not specify a valid Cn3D motif.", prositePattern.c_str());
882  wxMessageBox(msg, "Invalid Motif Specification", wxOK | wxICON_WARNING | wxCENTRE, this);
883  return;
884  } else if (!Prosite2Regex(prositePattern, &regexPattern, &nGroups)) {
885  msg.Printf("The motif '%s'\n\ndid not parse as valid ProSite syntax.", prositePattern.c_str());
886  wxMessageBox(msg, "Motif Parsing Error", wxOK | wxICON_WARNING | wxCENTRE, this);
887  return;
888  }
889 
890  // The 'restrictTo' map will constrain the motif to the columns of the selected
891  // annotation. Temporarily highlight the annotation for the purpose of getting
892  // the set of residues in the annotation on each row. Immediately clear highlights
893  // again so that it will be obvious which rows matched the pattern.
896  GlobalMessenger()->GetHighlights(&restrictTo);
898 
899  unsigned int nMatchesTotal = DoHighlightMotif(structureSet, regexPattern, restrictTo);
900  if (nMatchesTotal == 0) {
901  msg.Printf("For the motif '%s'\n\nno matches to annotated columns were found.", selectedAnnot->GetMotif().c_str());
902  wxMessageBox(msg, "Motif Not Found", wxOK | wxICON_WARNING | wxCENTRE, this);
903  }
904 }
905 
907 {
908  // get selection
911  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
912  CAlign_annot *selectedAnnot =
913  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
914  if (!selectedAnnot) {
915  ERRORMSG("CDDAnnotateDialog::MoveAnnotation() - error getting annotation pointer");
916  return;
917  }
918 
919  CAlign_annot_set::Tdata::iterator a, ae = annotSet->Set().end(), aPrev = ae, aSwap = ae;
921  for (a=annotSet->Set().begin(); a!=ae; ++a) {
922 
923  if (*a == selectedAnnot) {
924  // figure out which (prev or next) annot field to swap with
925  if (moveUp && aPrev != ae)
926  aSwap = aPrev;
927  else if (!moveUp && (++(aSwap = a)) != ae)
928  ;
929  else
930  return;
931 
932  // do the swap and update GUI
933  tmp = *aSwap;
934  *aSwap = *a;
935  *a = tmp;
937  SetupGUIControls(annots->GetSelection() + (moveUp ? -1 : 1), evids->GetSelection());
938  return;
939  }
940 
941  aPrev = a;
942  }
943 
944  ERRORMSG("CDDAnnotateDialog::MoveAnnotation() - error finding selected annotation");
945 }
946 
948 {
950 
951  // get selected annotation
952  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
953  CAlign_annot *selectedAnnot =
954  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
955  if (!selectedAnnot) {
956  ERRORMSG("CDDAnnotateDialog::NewEvidence() - error getting annotation pointer");
957  return;
958  }
959 
960  // create default comment evidence
962  newEvidence->SetComment("");
963 
964  // bring up evidence editor
965  CDDEvidenceDialog dialog(this, *newEvidence);
966  int result = dialog.ShowModal();
967 
968  // add new evidence
969  if (result == wxOK) {
970  if (dialog.GetData(newEvidence.GetPointer())) {
971  selectedAnnot->SetEvidence().push_back(newEvidence);
972  SetupGUIControls(annots->GetSelection(), selectedAnnot->GetEvidence().size() - 1);
974  } else
975  ERRORMSG("CDDAnnotateDialog::NewEvidence() - error getting dialog data");
976  }
977 }
978 
980 {
981  // get selected annotation
983  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
984  CAlign_annot *selectedAnnot =
985  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
986  if (!selectedAnnot) {
987  ERRORMSG("CDDAnnotateDialog::DeleteEvidence() - error getting annotation pointer");
988  return;
989  }
990 
991  // get selected evidence
993  if (evids->GetCount() == 0 || evids->GetSelection() < 0) return;
994  CFeature_evidence *selectedEvidence =
995  reinterpret_cast<CFeature_evidence*>(evids->GetClientData(evids->GetSelection()));
996  if (!selectedEvidence) {
997  ERRORMSG("CDDAnnotateDialog::DeleteEvidence() - error getting evidence pointer");
998  return;
999  }
1000 
1001  // confirm with user
1002  int confirm = wxMessageBox("This will remove the selected evidence from\n"
1003  "the selected annotation. Is this correct?", "Confirm", wxOK | wxCANCEL | wxCENTRE, this);
1004  if (confirm != wxOK) return;
1005 
1006  // delete evidence from annotation's list
1007  CAlign_annot::TEvidence::iterator e, ee = selectedAnnot->SetEvidence().end();
1008  for (e=selectedAnnot->SetEvidence().begin(); e!=ee; ++e) {
1009  if (*e == selectedEvidence) {
1010  selectedAnnot->SetEvidence().erase(e);
1012  break;
1013  }
1014  }
1015  if (e == ee) {
1016  ERRORMSG("CDDAnnotateDialog::DeleteEvidence() - evidence pointer not found in annotation");
1017  return;
1018  }
1019 
1020  // update GUI
1021  SetupGUIControls(annots->GetSelection(), 0);
1022 }
1023 
1025 {
1026  // get selected evidence
1028  if (evids->GetCount() == 0 || evids->GetSelection() < 0) return;
1029  CFeature_evidence *selectedEvidence =
1030  reinterpret_cast<CFeature_evidence*>(evids->GetClientData(evids->GetSelection()));
1031  if (!selectedEvidence) {
1032  ERRORMSG("CDDAnnotateDialog::DeleteEvidence() - error getting evidence pointer");
1033  return;
1034  }
1035 
1036  // bring up evidence editor
1037  CDDEvidenceDialog dialog(this, *selectedEvidence);
1038  int result = dialog.ShowModal();
1039 
1040  // update evidence
1041  if (result == wxOK && dialog.HasDataChanged()) {
1042  if (dialog.GetData(selectedEvidence)) {
1045  SetupGUIControls(annots->GetSelection(), evids->GetSelection());
1046  } else
1047  ERRORMSG("CDDAnnotateDialog::EditEvidence() - error getting dialog data");
1048  }
1049 }
1050 
1051 typedef struct {
1053  int from, to;
1054  int hits;
1055 } ChainInfo;
1056 
1058 {
1059  try {
1060  if (!annot.IsSetId() || annot.GetId().size() == 0 || !annot.GetId().front()->IsMmdb_id())
1061  throw "no MMDB ID found in annotation";
1062  int mmdbID = annot.GetId().front()->GetMmdb_id().Get();
1063 
1064  // map object to aligned molecule ID and interval of alignment on that chain
1066  ObjectMap annotObjects;
1067 
1068  // first find all objects with the annotation's mmdbID; fill out chain id and interval
1069  const BlockMultipleAlignment *alignment = set->alignmentManager->GetCurrentMultipleAlignment();
1070  if (!alignment) throw "no alignment";
1072  alignment->GetUngappedAlignedBlocks(&alignedBlocks);
1073  if (alignedBlocks.size() == 0) throw "no aligned blocks";
1074  for (unsigned int row=0; row<alignment->NRows(); ++row) {
1075  const StructureObject *object;
1076  const Sequence *seq = alignment->GetSequenceOfRow(row);
1077  if (!seq->molecule || seq->molecule->identifier->mmdbID != mmdbID ||
1078  !seq->molecule->GetParentOfType(&object))
1079  continue;
1080  ChainInfo& ci = annotObjects[object];
1081  ci.alignedMoleculeID = seq->molecule->id;
1082  ci.from = alignedBlocks.front()->GetRangeOfRow(row)->from;
1083  ci.to = alignedBlocks.back()->GetRangeOfRow(row)->to;
1084  ci.hits = 0;
1085  }
1086  if (annotObjects.size() == 0)
1087  throw "no chain of annotation's MMDB ID in the alignment";
1088 
1090  CCn3d_style_settings globalStyleSettings;
1091  set->styleManager->GetGlobalStyle().SaveSettingsToASN(&globalStyleSettings);
1092 
1093  // iterate over molecule/residue intervals
1094  if (annot.GetFeatures().size() > 0 &&
1095  annot.GetFeatures().front()->GetFeatures().size() > 0 &&
1096  annot.GetFeatures().front()->GetFeatures().front()->IsSetLocation() &&
1097  annot.GetFeatures().front()->GetFeatures().front()->GetLocation().IsSubgraph() &&
1098  annot.GetFeatures().front()->GetFeatures().front()->GetLocation().
1099  GetSubgraph().IsResidues() &&
1100  annot.GetFeatures().front()->GetFeatures().front()->GetLocation().
1101  GetSubgraph().GetResidues().IsInterval() &&
1102  annot.GetFeatures().front()->GetFeatures().front()->GetLocation().
1103  GetSubgraph().GetResidues().GetInterval().size() > 0)
1104  {
1105 
1106  ObjectMap::iterator o, oe = annotObjects.end();
1107  CResidue_pntrs::TInterval::const_iterator i, ie =
1108  annot.GetFeatures().front()->GetFeatures().front()->GetLocation().
1109  GetSubgraph().GetResidues().GetInterval().end();
1110  for (i=annot.GetFeatures().front()->GetFeatures().front()->GetLocation().GetSubgraph().GetResidues().GetInterval().begin(); i!=ie; ++i)
1111  {
1112  // for each object
1113  for (o=annotObjects.begin(); o!=oe; ++o) {
1114 
1115  // find molecule with annotation's moleculeID
1116  ChemicalGraph::MoleculeMap::const_iterator
1117  m = o->first->graph->molecules.find((*i)->GetMolecule_id().Get());
1118  if (m == o->first->graph->molecules.end())
1119  throw "molecule with annotation's specified molecule ID not found in object";
1120 
1121  // make sure this stuff is visible in global style
1122  if (m->second->IsProtein()) {
1123  if (globalStyleSettings.GetProtein_backbone().GetType() == eCn3d_backbone_type_off &&
1124  !globalStyleSettings.GetProtein_sidechains().GetIs_on())
1125  {
1126  globalStyleSettings.SetProtein_backbone().SetType(eCn3d_backbone_type_trace);
1127  }
1128  } else if (m->second->IsNucleotide()) {
1129  if (globalStyleSettings.GetNucleotide_backbone().GetType() == eCn3d_backbone_type_off &&
1130  !globalStyleSettings.GetNucleotide_sidechains().GetIs_on())
1131  {
1132  globalStyleSettings.SetNucleotide_backbone().SetType(eCn3d_backbone_type_trace);
1133  }
1134  } else if (m->second->IsSolvent()) {
1135  globalStyleSettings.SetSolvents().SetIs_on(true);
1136  } else if (m->second->IsHeterogen()) {
1137  globalStyleSettings.SetHeterogens().SetIs_on(true);
1138  }
1139 
1140  // highlight residues in interval
1141  if (o == annotObjects.begin()) {
1142  if ((*i)->GetFrom().Get() >= 1 && (*i)->GetFrom().Get() <= (int)m->second->NResidues() &&
1143  (*i)->GetTo().Get() >= 1 && (*i)->GetTo().Get() <= (int)m->second->NResidues() &&
1144  (*i)->GetFrom().Get() <= (*i)->GetTo().Get())
1145  GlobalMessenger()->AddHighlights(m->second, (*i)->GetFrom().Get(), (*i)->GetTo().Get());
1146  else
1147  throw "annotation's residue ID out of molecule's residue range";
1148  }
1149 
1150  for (int r=(*i)->GetFrom().Get(); r<=(*i)->GetTo().Get(); ++r) {
1151  // count hits of annotated residues in aligned chain+interval
1152  if (o->second.alignedMoleculeID == m->second->id && r >= o->second.from && r <= o->second.to)
1153  ++(o->second.hits);
1154  }
1155  }
1156  }
1157 
1158  set->styleManager->SetGlobalStyle(globalStyleSettings);
1159 
1160  // return object with most hits of annotation to aligned chain region
1161  const StructureObject *bestObject = NULL;
1162  for (o=annotObjects.begin(); o!=oe; ++o)
1163  if (!bestObject || o->second.hits > annotObjects[bestObject].hits)
1164  bestObject = o->first;
1165  return bestObject;
1166 
1167  } else
1168  throw "unrecognized annotation structure";
1169 
1170  } catch (const char *err) {
1171  ERRORMSG("HighlightResidues() - " << err);
1172  }
1173  return NULL;
1174 }
1175 
1177 {
1178  // get selected evidence
1180  if (evids->GetCount() == 0 || evids->GetSelection() < 0) return;
1181  CFeature_evidence *selectedEvidence =
1182  reinterpret_cast<CFeature_evidence*>(evids->GetClientData(evids->GetSelection()));
1183  if (!selectedEvidence) {
1184  ERRORMSG("CDDAnnotateDialog::ShowEvidence() - error getting evidence pointer");
1185  return;
1186  }
1187 
1188  // launch URL given PMID
1189  if (selectedEvidence->IsReference() && selectedEvidence->GetReference().IsPmid()) {
1190  wxString url;
1191  url.Printf("https://www.ncbi.nlm.nih.gov/pubmed/%i", selectedEvidence->GetReference().GetPmid().Get());
1192  LaunchWebPage(url);
1193  }
1194 
1195  // highlight residues if structure evidence
1196  else if (IS_STRUCTURE_EVIDENCE_BSANNOT(*selectedEvidence)) {
1197  const StructureObject *bestObject = HighlightResidues(structureSet, selectedEvidence->GetBsannot());
1198  if (bestObject) {
1199 
1200  // first, set show/hide to make only objects with this mmdb id visible
1202  StructureSet::ObjectList::const_iterator o, oe = structureSet->objects.end();
1203  for (o=structureSet->objects.begin(); o!=oe; ++o) {
1204  if ((*o)->mmdbID != bestObject->mmdbID) {
1205  structureSet->showHideManager->Show(*o, false);
1206  }
1207 
1208  // on structure of interest, make visible only molecules with highlights
1209  else {
1210  ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
1211  for (m=(*o)->graph->molecules.begin(); m!=me; ++m)
1212  if (!GlobalMessenger()->IsHighlightedAnywhere(m->second))
1213  structureSet->showHideManager->Show(m->second, false);
1214  }
1215  }
1216 
1217  // now force redrawing of structures, so the frames that contains
1218  // these objects aren't empty (otherwise, renderer won't show selected frame)
1220 
1221  // now show the frame containing the "best" object (get display list from first molecule)
1222  unsigned int displayList = bestObject->graph->molecules.find(1)->second->displayLists.front();
1223  for (unsigned int frame=0; frame<structureSet->frameMap.size(); ++frame) {
1224  StructureSet::DisplayLists::const_iterator d, de = structureSet->frameMap[frame].end();
1225  for (d=structureSet->frameMap[frame].begin(); d!=de; ++d) {
1226  if (*d == displayList) { // is display list in this frame?
1228  frame = structureSet->frameMap.size(); // to exit out of next-up loop
1229  break;
1230  }
1231  }
1232  }
1233 
1234  wxMessageBox(
1235  selectedEvidence->GetBsannot().GetFeatures().front()->GetDescr().front()->GetName().c_str(),
1236  "Structure Evidence", wxOK | wxCENTRE, this);
1237  }
1238  }
1239 
1240  else if (selectedEvidence->IsComment()) {
1241  wxMessageBox(selectedEvidence->GetComment().c_str(), "Comment", wxOK | wxCENTRE, this);
1242  }
1243 
1244  else {
1245  ERRORMSG("CDDAnnotateDialog::ShowEvidence() - can't show that evidence type");
1246  }
1247 }
1248 
1250 {
1253 
1254  // get selected annotation
1255  if (annots->GetCount() == 0 || annots->GetSelection() < 0) return;
1256  CAlign_annot *selectedAnnot =
1257  reinterpret_cast<CAlign_annot*>(annots->GetClientData(annots->GetSelection()));
1258  if (!selectedAnnot) {
1259  ERRORMSG("CDDAnnotateDialog::MoveEvidence() - error getting annotation pointer");
1260  return;
1261  }
1262 
1263  // get selected evidence
1264  if (evids->GetCount() == 0 || evids->GetSelection() < 0) return;
1265  CFeature_evidence *selectedEvidence =
1266  reinterpret_cast<CFeature_evidence*>(evids->GetClientData(evids->GetSelection()));
1267  if (!selectedEvidence) {
1268  ERRORMSG("CDDAnnotateDialog::MoveEvidence() - error getting evidence pointer");
1269  return;
1270  }
1271 
1272  CAlign_annot::TEvidence::iterator e, ee = selectedAnnot->SetEvidence().end(), ePrev = ee, eSwap = ee;
1274  for (e=selectedAnnot->SetEvidence().begin(); e!=ee; ++e) {
1275 
1276  if (*e == selectedEvidence) {
1277  // figure out which (prev or next) evidence field to swap with
1278  if (moveUp && ePrev != ee)
1279  eSwap = ePrev;
1280  else if (!moveUp && (++(eSwap = e)) != ee)
1281  ;
1282  else
1283  return;
1284 
1285  // do the swap and update GUI
1286  tmp = *eSwap;
1287  *eSwap = *e;
1288  *e = tmp;
1290  SetupGUIControls(annots->GetSelection(), evids->GetSelection() + (moveUp ? -1 : 1));
1291  return;
1292  }
1293 
1294  ePrev = e;
1295  }
1296 }
1297 
1298 
1299 ///// CDDEvidenceDialog stuff /////
1300 
1301 BEGIN_EVENT_TABLE(CDDEvidenceDialog, wxDialog)
1303  EVT_BUTTON (-1, CDDEvidenceDialog::OnButton)
1304  EVT_RADIOBUTTON (-1, CDDEvidenceDialog::OnChange)
1305  EVT_TEXT (-1, CDDEvidenceDialog::OnChange)
1307 
1309  wxDialog(parent, -1, "CDD Annotations", wxPoint(400, 100), wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
1310  changed(false), rerange(false)
1311 {
1312  // construct the panel
1313  wxSizer *topSizer = SetupEvidenceDialog(this, false);
1314 
1315  // call sizer stuff
1316  topSizer->Fit(this);
1317  topSizer->SetSizeHints(this);
1318 
1319  // set initial states
1320  if (initial.IsComment()) {
1321  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(rComment, ID_R_COMMENT, wxRadioButton)
1323  rComment->SetValue(true);
1324  tComment->SetValue(initial.GetComment().c_str());
1325  tComment->SetFocus();
1326  } else if (initial.IsReference() && initial.GetReference().IsPmid()) {
1327  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(rPMID, ID_R_PMID, wxRadioButton)
1329  rPMID->SetValue(true);
1330  wxString pmid;
1331  pmid.Printf("%i", initial.GetReference().GetPmid().Get());
1332  tPMID->SetValue(pmid);
1333  tPMID->SetFocus();
1334  } else if (IS_STRUCTURE_EVIDENCE_BSANNOT(initial)) {
1335  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(rSTRUCTURE, ID_R_STRUCTURE, wxRadioButton)
1336  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tSTRUCTURE, ID_T_STRUCTURE, wxTextCtrl)
1337  rSTRUCTURE->SetValue(true);
1338  tSTRUCTURE->SetValue(
1339  initial.GetBsannot().GetFeatures().front()->GetDescr().front()->GetName().c_str());
1340  } else {
1341  ERRORMSG("CDDEvidenceDialog::CDDEvidenceDialog() - "
1342  "don't (yet) know how to edit this evidence type");
1343  }
1344  SetupGUIControls();
1345 }
1346 
1347 
1348 // same as hitting cancel button
1349 void CDDEvidenceDialog::OnCloseWindow(wxCloseEvent& event)
1350 {
1351  EndModal(wxCANCEL);
1352 }
1353 
1354 void CDDEvidenceDialog::OnButton(wxCommandEvent& event)
1355 {
1356  switch (event.GetId()) {
1357  case ID_B_EDIT_OK: {
1358  EndModal(wxOK);
1359  break;
1360  }
1361  case ID_B_EDIT_CANCEL:
1362  EndModal(wxCANCEL);
1363  break;
1364  case ID_B_RERANGE:
1365  rerange = changed = true;
1366  break;
1367  default:
1368  event.Skip();
1369  }
1370 }
1371 
1372 void CDDEvidenceDialog::OnChange(wxCommandEvent& event)
1373 {
1374  changed = true;
1375  SetupGUIControls();
1376 }
1377 
1379 {
1380  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(rComment, ID_R_COMMENT, wxRadioButton)
1381  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(stComment, ID_ST_COMMENT, wxStaticText)
1383  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(rPMID, ID_R_PMID, wxRadioButton)
1384  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(stPMID, ID_ST_PMID, wxStaticText)
1386  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(rStructure, ID_R_STRUCTURE, wxRadioButton)
1387  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(stStructure, ID_ST_STRUCTURE, wxStaticText)
1388  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tStructure, ID_T_STRUCTURE, wxTextCtrl)
1390 
1391 // stComment->Enable(rComment->GetValue());
1392  tComment->Enable(rComment->GetValue());
1393 // stPMID->Enable(rPMID->GetValue());
1394  tPMID->Enable(rPMID->GetValue());
1395 // stStructure->Enable(rStructure->GetValue());
1396  tStructure->Enable(rStructure->GetValue());
1397  bStructure->Enable(rStructure->GetValue());
1398 }
1399 
1400 bool CDDEvidenceDialog::GetData(ncbi::objects::CFeature_evidence *evidence)
1401 {
1405 
1406  if (rComment->GetValue()) {
1408  if (tComment->GetValue().size() > 0) {
1409  evidence->SetComment(WX_TO_STD(tComment->GetValue()));
1410  return true;
1411  } else {
1412  ERRORMSG("CDDEvidenceDialog::GetData() - comment must not be zero-length");
1413  return false;
1414  }
1415  }
1416 
1417  else if (rPMID->GetValue()) {
1419  unsigned long pmid;
1420  if (tPMID->GetValue().ToULong(&pmid)) {
1421  evidence->SetReference().SetPmid().Set(pmid);
1422  return true;
1423  } else {
1424  ERRORMSG("CDDEvidenceDialog::GetData() - PMID must be a positive integer");
1425  return false;
1426  }
1427  }
1428 
1429  else if (rSTRUCTURE->GetValue()) {
1431  // either leave existing range alone, or use new one if none present or rerange button pressed
1432  if (!evidence->IsBsannot() || rerange) {
1433  CBiostruc_annot_set *ref =
1435  if (ref)
1436  evidence->SetBsannot(*ref);
1437  else
1438  return false;
1439  }
1440  // reset structure evidence tag
1442  descr->SetOther_comment(STRUCTURE_EVIDENCE_COMMENT);
1443  evidence->SetBsannot().SetDescr().clear();
1444  evidence->SetBsannot().SetDescr().push_front(descr);
1445  // reset name
1447  name->SetName(WX_TO_STD(tSTRUCTURE->GetValue()));
1448  evidence->SetBsannot().SetFeatures().front()->SetDescr().clear();
1449  evidence->SetBsannot().SetFeatures().front()->SetDescr().push_front(name);
1450  return true;
1451  }
1452 
1453  ERRORMSG("CDDEvidenceDialog::GetData() - unknown evidence type");
1454  return false;
1455 }
1456 
1457 
1458 ///// CDDTypedAnnotDialog stuff /////
1459 
1460 BEGIN_EVENT_TABLE(CDDTypedAnnotDialog, wxDialog)
1462  EVT_BUTTON (-1, CDDTypedAnnotDialog::OnButton)
1463  EVT_CHOICE (-1, CDDTypedAnnotDialog::OnTypeChoice)
1464  EVT_COMBOBOX (-1, CDDTypedAnnotDialog::OnChange)
1465  EVT_TEXT (-1, CDDTypedAnnotDialog::OnChange)
1466  EVT_TEXT_ENTER (-1, CDDTypedAnnotDialog::OnChange)
1468 
1469 CDDTypedAnnotDialog::TPredefinedSites CDDTypedAnnotDialog::predefinedSites;
1470 
1471 CDDTypedAnnotDialog::CDDTypedAnnotDialog(wxWindow *parent, const ncbi::objects::CAlign_annot& initial, const string& title) :
1472  wxDialog(parent, -1, title.c_str(), wxPoint(400, 100), wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
1473  changed(false), isTypeDataRead(false)
1474 {
1475  bool isPutative = false;
1476  bool isPredefDescr = false;
1477  int type = 0;
1478  int predefType, predefTypeIndex;
1479  wxString descr;
1480 
1481  // construct the panel
1482  wxSizer *topSizer = SetupTypedDescriptionDialog(this, false);
1483 
1484  // call sizer stuff
1485  topSizer->Fit(this);
1486  topSizer->SetSizeHints(this);
1487 
1490  DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(cbPutative, ID_CB_PUTATIVE, wxCheckBox)
1491 
1492  // For convenience, recast the standard annot type data as wxStrings
1493  if (predefinedSites.empty() && ncbi::cd_utils::CStdAnnotTypes::HasTypeData()) {
1494  PopulatePredefinedSitesMap();
1495  }
1496 
1497  // Populate the wxChoice element
1498  if (!isTypeDataRead && predefinedSites.empty()) {
1499  string message = "Predefined types & names are unavailable;\nonly annotations of type 'Other' may be created.\n\nCheck that the file '" + STD_ANNOT_TYPES_FILE + "' is present in the Cn3D 'data' directory.";
1500  wxMessageBox(message.c_str(), "Predefined Types/Names Unavailable", wxICON_EXCLAMATION | wxCENTRE, this);
1501  } else {
1502  cType->Clear();
1503  ITERATE (TPredefinedSites, cit, predefinedSites) {
1504  cType->Append(cit->second.first);
1505  }
1506  }
1507 
1508  // Determine values with which to initialize the widgets.
1509  if (initial.IsSetType()) {
1510  if (ncbi::cd_utils::CStdAnnotTypes::IsValidType(initial.GetType())) {
1511  type = initial.GetType();
1512  }
1513  }
1514  if (initial.IsSetDescription() && !initial.GetDescription().empty()) {
1515 
1516  descr = wxString(initial.GetDescription().c_str());
1517  isPutative = NStr::StartsWith(initial.GetDescription(), "putative", NStr::eNocase);
1518  if (isPutative) {
1519  // remove the putative prefix for display in the widget
1520  descr = descr.Mid(8);
1521  descr.Trim(false);
1522  }
1523  isPredefDescr = ncbi::cd_utils::CStdAnnotTypes::IsPredefinedDescr(string(descr.c_str()), predefType, predefTypeIndex);
1524  if (isPredefDescr) {
1525  if (initial.IsSetType() && (type != predefType)) {
1526  WARNINGMSG("CDDTypedAnnotDialog::CDDTypedAnnotDialog() - stored type inconsistent with descriptions's designated type");
1527  }
1528  type = predefType;
1529  }
1530  }
1531 
1532  // Initialize the widgets.
1533  cType->SetSelection(type);
1534  AdjustComboboxForType(type);
1535  cbPutative->SetValue(isPutative);
1536  if (isPredefDescr) {
1537  cmbDescr->SetSelection(predefTypeIndex);
1538  } else if (descr.length() > 0) {
1539  cmbDescr->SetValue(descr);
1540  } else {
1541  cmbDescr->SetSelection(wxNOT_FOUND);
1542  }
1543  cmbDescr->SetFocus();
1544 
1545  SetupGUIControls();
1546 }
1547 
1549 {
1550  wxString typeName;
1551 
1552  const ncbi::cd_utils::TStandardTypesData& rawTypeData = ncbi::cd_utils::CStdAnnotTypes::GetAllTypeData();
1553  ncbi::cd_utils::TStandardTypesData::const_iterator rtCit = rawTypeData.begin();
1554  ncbi::cd_utils::TStandardTypesData::const_iterator rtCend = rawTypeData.end();
1555 
1556  predefinedSites.clear();
1557  for (; rtCit != rtCend; ++rtCit) {
1558  typeName = wxString(rtCit->second.first.c_str());
1559  const ncbi::cd_utils::TTypeNames& namesVector = rtCit->second.second;
1560 
1561  if (rtCit->first == ncbi::cd_utils::CStdAnnotTypes::m_invalidType || rtCit->first < 0) {
1562  WARNINGMSG("CDDTypedAnnotDialog::PopulatePredefinedSitesMap() - invalid code specified for type " << rtCit->second.first << "; skipped");
1563  } else {
1565  p.first = typeName;
1566  ITERATE (ncbi::cd_utils::TTypeNames, vit, namesVector) {
1567  p.second.Add(vit->c_str());
1568  }
1569  }
1570  }
1571 }
1572 
1574 {
1576  int sel = cmbDescr->GetSelection();
1577  wxString existingDescr = cmbDescr->GetValue();
1578 
1579  cmbDescr->Clear();
1580  TPredefinedSites::const_iterator cit = predefinedSites.find(type);
1581  if (cit != predefinedSites.end()) {
1582  cmbDescr->Append(cit->second.second);
1583  }
1584 
1585  // If there was free-form text displayed, keep displaying it.
1586  // Otherwise, make sure a pre-defined type name is *not* shown.
1587  if (sel == wxNOT_FOUND) {
1588  cmbDescr->SetValue(existingDescr);
1589  } else {
1590  cmbDescr->SetSelection(wxNOT_FOUND);
1591  }
1592 }
1593 
1594 // same as hitting cancel button
1595 void CDDTypedAnnotDialog::OnCloseWindow(wxCloseEvent& event)
1596 {
1597  EndModal(wxCANCEL);
1598 }
1599 
1600 void CDDTypedAnnotDialog::OnButton(wxCommandEvent& event)
1601 {
1602  switch (event.GetId()) {
1603  case ID_B_DESCR_OK: {
1604  EndModal(wxOK);
1605  break;
1606  }
1607  case ID_B_DESCR_CANCEL:
1608  EndModal(wxCANCEL);
1609  break;
1610  default:
1611  event.Skip();
1612  }
1613 }
1614 
1615 void CDDTypedAnnotDialog::OnChange(wxCommandEvent& event)
1616 {
1617  changed = true;
1618  SetupGUIControls();
1619 }
1620 
1621 void CDDTypedAnnotDialog::OnTypeChoice(wxCommandEvent& event)
1622 {
1624 
1625  changed = true;
1626  AdjustComboboxForType(cType->GetSelection());
1627  SetupGUIControls();
1628 }
1629 
1630 bool CDDTypedAnnotDialog::GetData(ncbi::objects::CAlign_annot* alignAnnot)
1631 {
1632  static const string ws(" \t\n\r");
1633  static const string leading(" \t\n\r.,;:!@#$%^&\\|/?}])>"); // no closing delimiter at start
1634  static const string trailing(" \t\n\r.,;:!@#$%^&\\|/?{[(<"); // no opening delimiter at end
1635 
1636  bool result = false;
1637  if (!alignAnnot) return result;
1638 
1642 
1643  bool isPredefDescr = false;
1644  bool isPutative = cbPutative->GetValue();
1645  int predefType, predefTypeIndex;
1646  int type = cType->GetSelection();
1647  string descr = string(cmbDescr->GetValue().c_str());
1648 
1649 
1650  // Remove disallowed leading/trailing characters.
1651  SIZE_TYPE firstGoodChar = descr.find_first_not_of(leading);
1652  if (firstGoodChar != NPOS && firstGoodChar > 0) {
1653  descr = descr.substr(firstGoodChar);
1654  }
1655  SIZE_TYPE lastGoodChar = descr.find_last_not_of(trailing);
1656  if (lastGoodChar != NPOS && lastGoodChar < descr.size() - 1) {
1657  descr = descr.substr(0, lastGoodChar + 1);
1658  }
1659 
1660  // Remove internal runs of whitespace.
1661  vector<string> tokens;
1663  if (tokens.size() > 0) {
1664  descr = tokens[0];
1665  for (unsigned int i = 1; i < tokens.size(); ++i) {
1666  descr += " " + tokens[i];
1667  }
1668  }
1669 
1670  // If user typed 'putative' as a prefix in the description, that
1671  // supercedes the checkbox state. Also, strip that prefix from
1672  // the string so it does not impact the predefined description check.
1673  if (NStr::StartsWith(descr, "putative", NStr::eNocase)) {
1674  isPutative = true; // override the checkbox
1675  descr = descr.substr(8);
1676  }
1678 
1679  // Simple attempt to regularize capitalization for predefined descriptions.
1680  // This is tricky, though, since descriptions may contain capitalized
1681  // substrings by convention (e.g., 'DNA binding site' and 'Cu binding site'
1682  // are acceptible, but 'Active Site' should become 'active site').
1683  predefType = wxNOT_FOUND;
1684  if (ncbi::cd_utils::CStdAnnotTypes::IsPredefinedDescr(descr, predefType, predefTypeIndex, true)) {
1685  isPredefDescr = true;
1686  } else if (ncbi::cd_utils::CStdAnnotTypes::IsPredefinedDescr(descr, predefType, predefTypeIndex, false)) {
1687  // For case-insensitive match, change 'descr' to have capitalization of the matched string.
1689  if (ncbi::cd_utils::CStdAnnotTypes::GetTypeNames(predefType, names) && predefTypeIndex < (int) names.size()) {
1690  descr = names[predefTypeIndex];
1691  isPredefDescr = true;
1692  }
1693  }
1694 
1695  // If 'descr' corresponds to a predefined descriptions, ensure the
1696  // predefined type was used (prevents a user from manually overriding
1697  // the standard type/name mappings defined in 'cdd_annot_types.ini').
1698  // Force the type back to the standard type for the given description,
1699  // and provide a warning to the user.
1700  if (isPredefDescr) {
1701  if (type != predefType) {
1702  wxString typeChosen = predefinedSites[type].first;
1703  wxString predefTypeStr = predefinedSites[predefType].first;
1704  wxString message;
1705  message.Printf("The predefined description '%s' corresponds to type '%s' and will be changed from your chosen type '%s'.\n"
1706  "Press 'OK' to reassign to the standard type '%s'.\nPress 'Cancel' to return and not create/edit the annotation.\n",
1707  cmbDescr->GetValue().c_str(), predefTypeStr.c_str(), typeChosen.c_str(), predefTypeStr.c_str());
1708  int reply = wxMessageBox(message, "Inconsistent type", wxOK | wxCANCEL | wxCENTRE, this);
1709  if (reply == wxOK) {
1710  type = predefType;
1711  } else {
1712  descr.erase();
1713  }
1714  }
1715  }
1716 
1717  if (descr.length() > 0) {
1718  // add 'putative' prefix if needed and not already present
1719  if (isPutative && !NStr::StartsWith(descr, "putative", NStr::eNocase)) {
1720  descr = "putative " + descr;
1721  }
1722  alignAnnot->SetDescription(descr);
1723  alignAnnot->SetType(type);
1724  result = true;
1725  }
1726  return result;
1727 }
1728 
1730 {
1731 }
1732 
1733 END_SCOPE(Cn3D)
1734 
1735 
1736 ////////////////////////////////////////////////////////////////////////////////////////////////
1737 // The following is taken unmodified from wxDesigner's C++ code from cdd_annot_dialog.wdr
1738 ////////////////////////////////////////////////////////////////////////////////////////////////
1739 
1740 wxSizer *SetupCDDAnnotDialog( wxWindow *parent, bool call_fit, bool set_sizer )
1741 {
1742  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
1743 
1744  wxFlexGridSizer *item1 = new wxFlexGridSizer( 1, 0, 0, 0 );
1745 
1746  wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Annotations") );
1747  wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
1748 
1749  wxString *strs4 = (wxString*) NULL;
1750  wxListBox *item4 = new wxListBox( parent, ID_L_ANNOT, wxDefaultPosition, wxSize(350,100), 0, strs4, wxLB_SINGLE|wxLB_HSCROLL|wxLB_NEEDED_SB|wxHSCROLL );
1751  item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1752 
1753  wxGridSizer *item5 = new wxGridSizer( 3, 0, 0, 0 );
1754 
1755  wxButton *item6 = new wxButton( parent, ID_B_NEW_ANNOT, wxT("New"), wxDefaultPosition, wxDefaultSize, 0 );
1756  item5->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
1757 
1758  wxButton *item7 = new wxButton( parent, ID_B_HIGHLIGHT, wxT("Highlight"), wxDefaultPosition, wxDefaultSize, 0 );
1759  item5->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
1760 
1761  wxButton *item8 = new wxButton( parent, ID_B_ANNOT_UP, wxT("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
1762  item5->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
1763 
1764  wxButton *item9 = new wxButton( parent, ID_B_EDIT_ANNOT, wxT("Edit"), wxDefaultPosition, wxDefaultSize, 0 );
1765  item5->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
1766 
1767  wxButton *item10 = new wxButton( parent, ID_B_DEL_ANNOT, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1768  item5->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
1769 
1770  wxButton *item11 = new wxButton( parent, ID_B_ANNOT_DOWN, wxT("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
1771  item5->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
1772 
1773  wxButton *item12 = new wxButton( parent, ID_B_DEFINE_MOTIF, wxT("Define Motif"), wxDefaultPosition, wxDefaultSize, 0 );
1774  item5->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
1775 
1776  wxButton *item13 = new wxButton( parent, ID_B_HIGHLIGHT_MOTIF, wxT("Highlight Motif"), wxDefaultPosition, wxDefaultSize, 0 );
1777  item5->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
1778 
1779  wxButton *item14 = new wxButton( parent, ID_B_DEL_MOTIF, wxT("Delete Motif"), wxDefaultPosition, wxDefaultSize, 0 );
1780  item5->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
1781 
1782  item2->Add( item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1783 
1784  item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
1785 
1786  wxStaticBox *item16 = new wxStaticBox( parent, -1, wxT("Evidence") );
1787  wxStaticBoxSizer *item15 = new wxStaticBoxSizer( item16, wxVERTICAL );
1788 
1789  wxString *strs17 = (wxString*) NULL;
1790  wxListBox *item17 = new wxListBox( parent, ID_L_EVID, wxDefaultPosition, wxSize(350,100), 0, strs17, wxLB_SINGLE );
1791  item15->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1792 
1793  wxGridSizer *item18 = new wxGridSizer( 2, 0, 0, 0 );
1794 
1795  wxButton *item19 = new wxButton( parent, ID_B_NEW_EVID, wxT("New"), wxDefaultPosition, wxDefaultSize, 0 );
1796  item18->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
1797 
1798  wxButton *item20 = new wxButton( parent, ID_B_SHOW, wxT("Show"), wxDefaultPosition, wxDefaultSize, 0 );
1799  item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
1800 
1801  wxButton *item21 = new wxButton( parent, ID_B_EVID_UP, wxT("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
1802  item18->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 );
1803 
1804  wxButton *item22 = new wxButton( parent, ID_B_EDIT_EVID, wxT("Edit"), wxDefaultPosition, wxDefaultSize, 0 );
1805  item18->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
1806 
1807  wxButton *item23 = new wxButton( parent, ID_B_DEL_EVID, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1808  item18->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
1809 
1810  wxButton *item24 = new wxButton( parent, ID_B_EVID_DOWN, wxT("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
1811  item18->Add( item24, 0, wxALIGN_CENTER|wxALL, 5 );
1812 
1813  item15->Add( item18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1814 
1815  item1->Add( item15, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
1816 
1817  item0->Add( item1, 0, wxALIGN_CENTER, 5 );
1818 
1819  if (set_sizer)
1820  {
1821  parent->SetSizer( item0 );
1822  if (call_fit)
1823  item0->SetSizeHints( parent );
1824  }
1825 
1826  return item0;
1827 }
1828 
1829 
1830 /* before added motif buttons, there were a couple extra lines at end;
1831  not sure if they were added by hand, or if wxDesigner simply no longer
1832  adds them...
1833 
1834  if (set_sizer)
1835  {
1836  parent->SetAutoLayout( TRUE );
1837  parent->SetSizer( item0 );
1838  if (call_fit)
1839  {
1840  item0->Fit( parent );
1841  item0->SetSizeHints( parent );
1842  }
1843  }
1844 */
1845 
1846 wxSizer *SetupEvidenceDialog( wxWindow *parent, bool call_fit, bool set_sizer )
1847 {
1848  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
1849 
1850  wxStaticBox *item2 = new wxStaticBox( parent, -1, "Evidence Options" );
1851  wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
1852 
1853  wxFlexGridSizer *item3 = new wxFlexGridSizer( 1, 0, 0, 0 );
1854  item3->AddGrowableCol( 2 );
1855 
1856  wxRadioButton *item4 = new wxRadioButton( parent, ID_R_COMMENT, "", wxDefaultPosition, wxDefaultSize, 0 );
1857  item3->Add( item4, 0, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
1858 
1859  wxStaticText *item5 = new wxStaticText( parent, ID_ST_COMMENT, "Comment:", wxDefaultPosition, wxDefaultSize, 0 );
1860  item3->Add( item5, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 );
1861 
1862  wxTextCtrl *item6 = new wxTextCtrl( parent, ID_T_COMMENT, "", wxDefaultPosition, wxSize(150,-1), 0 );
1863  item3->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1864 
1865  item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
1866 
1867  wxStaticLine *item7 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
1868  item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1869 
1870  wxFlexGridSizer *item8 = new wxFlexGridSizer( 1, 0, 0, 0 );
1871  item8->AddGrowableCol( 2 );
1872 
1873  wxRadioButton *item9 = new wxRadioButton( parent, ID_R_PMID, "", wxDefaultPosition, wxDefaultSize, 0 );
1874  item8->Add( item9, 0, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
1875 
1876  wxStaticText *item10 = new wxStaticText( parent, ID_ST_PMID, "Reference (PubMed ID):", wxDefaultPosition, wxDefaultSize, 0 );
1877  item8->Add( item10, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 );
1878 
1879  wxTextCtrl *item11 = new wxTextCtrl( parent, ID_T_PMID, "", wxDefaultPosition, wxDefaultSize, 0 );
1880  item8->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1881 
1882  item1->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
1883 
1884  wxStaticLine *item12 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
1885  item1->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1886 
1887  wxFlexGridSizer *item13 = new wxFlexGridSizer( 1, 0, 0, 0 );
1888  item13->AddGrowableCol( 2 );
1889 
1890  wxRadioButton *item14 = new wxRadioButton( parent, ID_R_STRUCTURE, "", wxDefaultPosition, wxDefaultSize, 0 );
1891  item13->Add( item14, 0, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
1892 
1893  wxStaticText *item15 = new wxStaticText( parent, ID_ST_STRUCTURE, "Structure:", wxDefaultPosition, wxDefaultSize, 0 );
1894  item13->Add( item15, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 );
1895 
1896  wxTextCtrl *item16 = new wxTextCtrl( parent, ID_T_STRUCTURE, "", wxDefaultPosition, wxSize(80,-1), 0 );
1897  item13->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1898 
1899  item1->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
1900 
1901  wxButton *item17 = new wxButton( parent, ID_B_RERANGE, "Reset Residues to Current Highlights", wxDefaultPosition, wxDefaultSize, 0 );
1902  item1->Add( item17, 0, wxALIGN_CENTRE|wxALL, 5 );
1903 
1904  item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1905 
1906  wxFlexGridSizer *item18 = new wxFlexGridSizer( 1, 0, 0, 0 );
1907 
1908  wxButton *item19 = new wxButton( parent, ID_B_EDIT_OK, "OK", wxDefaultPosition, wxDefaultSize, 0 );
1909  item19->SetDefault();
1910  item18->Add( item19, 0, wxALIGN_CENTRE|wxALL, 5 );
1911 
1912  item18->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
1913 
1914  wxButton *item20 = new wxButton( parent, ID_B_EDIT_CANCEL, "Cancel", wxDefaultPosition, wxDefaultSize, 0 );
1915  item18->Add( item20, 0, wxALIGN_CENTRE|wxALL, 5 );
1916 
1917  item0->Add( item18, 0, wxALIGN_CENTRE|wxALL, 5 );
1918 
1919  if (set_sizer)
1920  {
1921  parent->SetAutoLayout( TRUE );
1922  parent->SetSizer( item0 );
1923  if (call_fit)
1924  {
1925  item0->Fit( parent );
1926  item0->SetSizeHints( parent );
1927  }
1928  }
1929 
1930  return item0;
1931 }
1932 
1933 wxSizer *SetupTypedDescriptionDialog( wxWindow *parent, bool call_fit, bool set_sizer )
1934 {
1935  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
1936 
1937  wxStaticBox *item2 = new wxStaticBox( parent, -1, wxT("Typed Description") );
1938  wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
1939 
1940  wxFlexGridSizer *item3 = new wxFlexGridSizer( 1, 0, 0, 0 );
1941  item3->AddGrowableCol( 2 );
1942 
1943  wxStaticText *item4 = new wxStaticText( parent, ID_ST_TYPE, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
1944  item3->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5 );
1945 
1946  item3->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1947 
1948  wxString strs5[] =
1949  {
1950  wxT("Other")
1951  };
1952  wxChoice *item5 = new wxChoice( parent, ID_C_TYPE, wxDefaultPosition, wxSize(150,-1), 1, strs5, 0 );
1953  item3->Add( item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1954 
1955  item3->Add( 10, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1956 
1957  wxCheckBox *item6 = new wxCheckBox( parent, ID_CB_PUTATIVE, wxT("Is Putative?"), wxDefaultPosition, wxDefaultSize, 0 );
1958  item3->Add( item6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1959 
1960  item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1961 
1962  wxFlexGridSizer *item7 = new wxFlexGridSizer( 1, 0, 0, 0 );
1963  item7->AddGrowableCol( 1 );
1964 
1965  wxStaticText *item8 = new wxStaticText( parent, ID_ST_DESCR2, wxT("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
1966  item7->Add( item8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5 );
1967 
1968  wxString strs9[] =
1969  {
1970  wxT("ComboItem"),
1971  wxT("1Item"),
1972  wxT("222"),
1973  wxT("333"),
1974  wxT("444")
1975  };
1976  wxComboBox *item9 = new wxComboBox( parent, ID_CMB_DESCR, wxT(""), wxDefaultPosition, wxSize(200,-1), 5, strs9, wxCB_DROPDOWN );
1977  item7->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1978 
1979  item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1980 
1981  wxStaticLine *item10 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
1982  item1->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1983 
1984  wxFlexGridSizer *item11 = new wxFlexGridSizer( 1, 0, 0, 0 );
1985 
1986  wxButton *item12 = new wxButton( parent, ID_B_DESCR_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
1987  item12->SetDefault();
1988  item11->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
1989 
1990  wxButton *item13 = new wxButton( parent, ID_B_DESCR_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
1991  item11->Add( item13, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1992 
1993  item1->Add( item11, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
1994 
1995  item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1996 
1997  if (set_sizer)
1998  {
1999  parent->SetSizer( item0 );
2000  if (call_fit)
2001  item0->SetSizeHints( parent );
2002  }
2003 
2004  return item0;
2005 }
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.
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.
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.
#define static
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.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define ID_C_TYPE
USING_SCOPE(objects)
#define ID_LINE
#define ID_B_DEL_ANNOT
#define ID_ST_TYPE
#define ID_B_NEW_ANNOT
wxSizer * SetupEvidenceDialog(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
#define ID_B_EVID_UP
#define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type)
#define ID_CB_PUTATIVE
#define ID_B_SHOW
bool DoesPatternMatchHighlightedResidues(const Sequence &sequence, const Sequence::MoleculeHighlightMap &restrictTo, CRegexp &regexp, set< unsigned int > *highlightedSeqIndicesPtr)
unsigned int DoHighlightMotif(StructureSet *structureSet, const string &regexPattern, Messenger::MoleculeHighlightMap &restrictTo)
#define ID_ST_STRUCTURE
#define ID_B_DEL_MOTIF
#define ID_R_COMMENT
#define ID_B_DESCR_CANCEL
#define ID_R_STRUCTURE
#define ID_T_STRUCTURE
#define ID_B_EDIT_OK
#define ID_ST_COMMENT
static const StructureObject * HighlightResidues(const StructureSet *set, const CBiostruc_annot_set &annot)
static const string STRUCTURE_EVIDENCE_COMMENT
#define ID_CMB_DESCR
#define ID_L_ANNOT
#define ID_B_HIGHLIGHT
#define ID_T_PMID
#define ID_B_EVID_DOWN
#define ID_B_DESCR_OK
#define ID_L_EVID
#define ID_ST_DESCR2
#define ID_B_EDIT_EVID
#define ID_B_DEFINE_MOTIF
#define ID_B_DEL_EVID
wxSizer * SetupCDDAnnotDialog(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
#define ID_B_RERANGE
#define DECLARE_AND_FIND_WINDOW_RETURN_FALSE_ON_ERR(var, id, type)
static bool IsFirstResidueOfABlock(const BlockMultipleAlignment::ConstBlockList &blocks, unsigned int masterIndex)
#define ID_T_COMMENT
#define ID_B_HIGHLIGHT_MOTIF
#define ID_B_ANNOT_DOWN
#define ID_R_PMID
#define ID_B_EDIT_ANNOT
USING_NCBI_SCOPE
#define ID_B_NEW_EVID
static const string STD_ANNOT_TYPES_FILE
#define IS_STRUCTURE_EVIDENCE_BSANNOT(evidence)
#define ID_ST_PMID
wxSizer * SetupTypedDescriptionDialog(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
#define ID_B_ANNOT_UP
#define ID_B_EDIT_CANCEL
const BlockMultipleAlignment * GetCurrentMultipleAlignment(void) const
void GetBlocks(ConstBlockList *blocks) const
const Sequence * GetMaster(void) const
std::vector< const UngappedAlignedBlock * > UngappedAlignedBlockList
const Sequence * GetSequenceOfRow(unsigned int row) const
void GetUngappedAlignedBlocks(UngappedAlignedBlockList *blocks) const
bool HighlightAlignedColumnsOfMasterRange(unsigned int from, unsigned int to) const
bool IsAligned(unsigned int row, unsigned int seqIndex) const
std::vector< ncbi::CConstRef< Block > > ConstBlockList
CAlign_annot –.
Definition: Align_annot.hpp:66
CBiostruc_annot_set –.
CBiostruc_descr –.
CBiostruc_feature_set_descr –.
CCn3d_style_settings –.
CDDAnnotateDialog ** dialogHandle
void OnButton(wxCommandEvent &event)
void HighlightAnnotation(void)
std::list< ncbi::CRef< ncbi::objects::CSeq_interval > > IntervalList
void SetupGUIControls(int selectAnnot, int selectEvidence)
bool HighlightInterval(const ncbi::objects::CSeq_interval &interval)
void OnCloseWindow(wxCloseEvent &event)
ncbi::CRef< ncbi::objects::CAlign_annot_set > annotSet
void GetCurrentHighlightedIntervals(IntervalList *intervals)
void OnSelection(wxCommandEvent &event)
void MoveAnnotation(bool moveUp)
void MoveEvidence(bool moveUp)
StructureSet * structureSet
bool HasDataChanged(void) const
void OnButton(wxCommandEvent &event)
void OnChange(wxCommandEvent &event)
bool GetData(ncbi::objects::CFeature_evidence *evidence)
void OnCloseWindow(wxCloseEvent &event)
bool GetData(ncbi::objects::CAlign_annot *alignAnnot)
void OnChange(wxCommandEvent &event)
void OnTypeChoice(wxCommandEvent &event)
std::pair< wxString, wxArrayString > TTypeNamesPair
void OnButton(wxCommandEvent &event)
static TPredefinedSites predefinedSites
void OnCloseWindow(wxCloseEvent &event)
void AdjustComboboxForType(int type)
std::map< int, TTypeNamesPair > TPredefinedSites
CFeature_evidence –.
CRegexp –.
Definition: regexp.hpp:70
TSeqPos GetLength(void) const
MoleculeMap molecules
void GetHighlights(MoleculeHighlightMap *copyHighlights)
Definition: messenger.cpp:424
ncbi::objects::CBiostruc_annot_set * CreateBiostrucAnnotSetForHighlightsOnSingleObject(void) const
Definition: messenger.cpp:467
bool RemoveAllHighlights(bool postRedraws)
Definition: messenger.cpp:393
void AddHighlights(const Sequence *sequence, unsigned int seqIndexFrom, unsigned int seqIndexTo)
Definition: messenger.cpp:248
void ProcessRedraws(void)
Definition: messenger.cpp:123
std::map< const MoleculeIdentifier *, std::vector< bool > > MoleculeHighlightMap
Definition: messenger.hpp:99
bool MatchesSeqId(const ncbi::objects::CSeq_id &sid) const
int id
Definition: molecule.hpp:84
const MoleculeIdentifier * identifier
Definition: molecule.hpp:86
void ShowFrameNumber(int frame)
wxStaticText * m_Text
wxTextCtrl * m_Pattern
wxRadioBox * m_Mode
void FillOutSeqId(ncbi::objects::CSeq_id *sid) const
const Molecule * molecule
const MoleculeIdentifier * identifier
unsigned int Length(void) const
string sequenceString
Definition: cav_seqset.hpp:93
std::map< const MoleculeIdentifier *, std::vector< bool > > MoleculeHighlightMap
void Show(const StructureBase *entity, bool isShown)
bool GetParentOfType(const T **ptr, bool warnIfNotFound=true) const
const ChemicalGraph * graph
FrameMap frameMap
static const unsigned int eUserAnnotationData
ObjectList objects
AlignmentManager * alignmentManager
ShowHideManager * showHideManager
OpenGLRenderer * renderer
void SetDataChanged(unsigned int what) const
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: map.hpp:338
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
void clear()
Definition: set.hpp:153
const_iterator end() const
Definition: set.hpp:136
const string & GetDataDir(void)
Definition: cn3d_tools.cpp:330
bool RegistryGetBoolean(const string &section, const string &name, bool *value)
Definition: cn3d_tools.cpp:250
void LaunchWebPage(const char *url)
Definition: cn3d_tools.cpp:432
unsigned int PrositePatternLength(const string &prosite)
Definition: cn3d_tools.cpp:598
#define TRACEMSG(stream)
Definition: cn3d_tools.hpp:83
#define WARNINGMSG(stream)
Definition: cn3d_tools.hpp:85
static const std::string REG_ADVANCED_SECTION
Definition: cn3d_tools.hpp:191
static const std::string REG_CDD_ANNOT_READONLY
Definition: cn3d_tools.hpp:192
#define WX_TO_STD(wxstring)
Definition: cn3d_tools.hpp:285
#define ERRORMSG(stream)
Definition: cn3d_tools.hpp:86
Include a standard set of the NCBI C++ Toolkit most basic headers.
vector< string > TTypeNames
map< int, TTypeNamesPair > TStandardTypesData
bool Prosite2Regex(const std::string &prosite, std::string *regex, std::string *errString)
Definition: cuUtils.cpp:203
static const struct name_t names[]
#define false
Definition: bool.h:36
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:51
static int type
Definition: getdata.c:31
static char tmp[3200]
Definition: utf8.c:42
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
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
const TPrim & Get(void) const
Definition: serialbase.hpp:347
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
CTempString GetMatch(CTempString str, size_t offset=0, size_t idx=0, TMatch flags=fMatch_default, bool noreturn=false)
Get matching pattern and subpatterns.
Definition: regexp.cpp:182
int NumFound() const
Get number of patterns + subpatterns.
Definition: regexp.hpp:562
@ fCompile_ungreedy
Definition: regexp.hpp:106
@ fMatch_default
Definition: regexp.hpp:127
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
NCBI_NS_STD::string::size_type SIZE_TYPE
Definition: ncbistr.hpp:132
#define kEmptyStr
Definition: ncbistr.hpp:123
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3461
#define NPOS
Definition: ncbistr.hpp:133
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3201
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
@ fSplit_Truncate
Definition: ncbistr.hpp:2501
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Definition: ncbistr.hpp:2498
@ eNocase
Case insensitive compare.
Definition: ncbistr.hpp:1206
const TFeatures & GetFeatures(void) const
Get the Features member data.
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
const TId & GetId(void) const
Get the Id member data.
const TComment & GetComment(void) const
Get the variant data.
bool IsSetMotif(void) const
to validate mapping of sites Check if a value has been assigned to Motif data member.
const TDescription & GetDescription(void) const
Get the Description member data.
void SetType(TType value)
Assign a value to Type data member.
void SetDescription(const TDescription &value)
Assign a value to Description data member.
void SetMotif(const TMotif &value)
Assign a value to Motif data member.
bool IsSetType(void) const
for typing annotated features 0 .
void ResetMotifuse(void)
Reset Motifuse data member.
bool IsReference(void) const
Check if variant Reference is selected.
TType GetType(void) const
Get the Type member data.
TEvidence & SetEvidence(void)
Assign a value to Evidence data member.
void SetLocation(TLocation &value)
Assign a value to Location data member.
void ResetMotif(void)
Reset Motif data member.
void ResetType(void)
Reset Type data member.
const TBsannot & GetBsannot(void) const
Get the variant data.
const TReference & GetReference(void) const
Get the variant data.
void SetMotifuse(TMotifuse value)
Assign a value to Motifuse data member.
bool IsSetEvidence(void) const
evidence we can compute with Check if a value has been assigned to Evidence data member.
const TMotif & GetMotif(void) const
Get the Motif member data.
const TLocation & GetLocation(void) const
Get the Location member data.
const TEvidence & GetEvidence(void) const
Get the Evidence member data.
bool IsComment(void) const
Check if variant Comment is selected.
bool IsSetDescription(void) const
to hold descriptions/names like "Heme binding site" or "catalytic triad" etc., something that should ...
TIs_on GetIs_on(void) const
Get the Is_on member data.
const TNucleotide_backbone & GetNucleotide_backbone(void) const
Get the Nucleotide_backbone member data.
const TNucleotide_sidechains & GetNucleotide_sidechains(void) const
Get the Nucleotide_sidechains member data.
void SetHeterogens(THeterogens &value)
Assign a value to Heterogens data member.
const TProtein_backbone & GetProtein_backbone(void) const
Get the Protein_backbone member data.
TType GetType(void) const
Get the Type member data.
void SetSolvents(TSolvents &value)
Assign a value to Solvents data member.
void SetNucleotide_backbone(TNucleotide_backbone &value)
Assign a value to Nucleotide_backbone data member.
void SetProtein_backbone(TProtein_backbone &value)
Assign a value to Protein_backbone data member.
const TProtein_sidechains & GetProtein_sidechains(void) const
Get the Protein_sidechains member data.
@ eCn3d_backbone_type_off
@ eCn3d_backbone_type_trace
bool IsPmid(void) const
Check if variant Pmid is selected.
Definition: Pub_.hpp:677
const TPmid & GetPmid(void) const
Get the variant data.
Definition: Pub_.hpp:683
void SetTo(TTo value)
Assign a value to To data member.
Tdata & Set(void)
Assign a value to data member.
void SetId(TId &value)
Assign a value to Id data member.
TFrom GetFrom(void) const
Get the From member data.
void SetFrom(TFrom value)
Assign a value to From data member.
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
Definition: Seq_loc_.hpp:534
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
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
END_EVENT_TABLE()
for(len=0;yy_str[len];++len)
int i
int len
Messenger * GlobalMessenger(void)
Definition: messenger.cpp:73
#define wxT(x)
Definition: muParser.cpp:41
string GetTypeAsString(EBaseType et)
const struct ncbi::grid::netcache::search::fields::SIZE size
Magic spell ;-) needed for some weird compilers... very empiric.
unsigned int a
Definition: ncbi_localip.c:102
#define TRUE
bool replacment for C indicating true.
Definition: ncbi_std.h:97
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
#define row(bind, expected)
Definition: string_bind.c:73
static DP_BlockInfo * blocks
Definition: type.c:6
else result
Definition: token2.c:20
C++ wrappers for the Perl-compatible regular expression (PCRE) library.
#define const
Definition: zconf.h:232
Modified on Wed Jun 19 17:00:11 2024 by modify_doxy.py rev. 669887