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

Go to the SVN repository for this file.

1 /* $Id: six_frames_trans_track.cpp 47479 2023-05-02 13:24:02Z ucko $
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: Liangshou Wu
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
42 #include <gui/utils/rgba_color.hpp>
43 
47 
48 #include <objmgr/util/sequence.hpp>
49 
50 #include <wx/menu.h>
51 
54 
55 static const string kTrackTitle = "Six-frame translation";
56 /// largest sequence range we will do sequence translations.
57 static const TSeqPos kTransRangeLimit = 100000;
58 
59 static const int kMaxOrfLen = 100000000;
60 
61 // content menu item base id
62 static const int kContentBaseID = 10001;
63 
64 static const string kBaseKey = "GBPlugins.SixframeTrans";
65 static const string kDefProfile = "Default";
66 
67 ///////////////////////////////////////////////////////////////////////////////
68 /// CSFTranslationJob - Graphical view six-frame translation job.
69 ///
71 {
72 public:
73  CSFTranslationJob(const string& desc, CBioseq_Handle handle,
74  const TSeqRange& range, ENa_strand strand = eNa_strand_both)
75  : CSeqGraphicJob(desc)
76  , m_Handle(handle)
77  , m_Range(range)
78  , m_Strand(strand)
79  , m_GeneticCode(-1)
80  , m_AltStart(false)
82  {
83  SetTaskName("Translating in six-frame...");
84  }
85 
86  void SetGeneticCode(int id);
87  void SetAltStart(bool f);
89 
90 protected:
91  virtual EJobState x_Execute();
92 
93 private:
94  /// Do translation for three frame shifts.
95  /// This method creates only one translation glyph for each frame
96  /// shift. It returns the translated seuence regardless of the
97  /// settings.
98  bool x_Translate(CSeqGlyph::TObjects& objs, const string& orig_seq,
99  const CTrans_table& tbl, TSeqPos start, bool negative);
100 
101  void x_InitGeneticCode();
102 
103 private:
104  CBioseq_Handle m_Handle; ///< target sequence
105  TSeqRange m_Range; ///< target range
106  ENa_strand m_Strand; ///< Translated strand (plus, minus, both)
108  bool m_AltStart; ///< allow alternative start codon
109  bool m_SubsetAltStart; ///< allow ATG (Met) and two alternative start codons: GTG (Val), TTG (Leu) for gcode = 11
110 };
111 
112 inline
114 {
115  m_GeneticCode = id;
116 }
117 
118 inline
120 {
121  m_AltStart = f;
122 }
123 
125 {
128 
129  CSeqGlyph::TObjects& objs = result->m_ObjectList;
130  if (m_Range.GetLength() < 3)
131  return eCompleted;
132 
133  // positive strand translation
134  TSeqPos start = m_Range.GetFrom() / 3 * 3;
135  TSeqPos to = m_Range.GetTo() / 3 * 3 + 3;
136  auto seq_len = m_Handle.GetBioseqLength();
137  int t_off = (seq_len - to) % 3;
138  to += t_off;
139 
141  string orig_seq;
142  seq_vector.GetSeqData(start, to, orig_seq);
143 
144  if (m_GeneticCode < 0) {
147  }
148 
150 
151  SetTaskTotal((to - start) * 2);
152  SetTaskCompleted(0);
153 
155  SetTaskName("Translating in postive strand...");
156  if (!x_Translate(objs, orig_seq, tbl, start, false)) {
157  return eCanceled;
158  }
159  }
161  string rev_comp_seq;
162  CSeqManip::ReverseComplement(orig_seq, CSeqUtil::e_Iupacna, 0, static_cast<TSeqPos>(orig_seq.size()), rev_comp_seq);
163  SetTaskName("Translating in negative strand...");
164  if (!x_Translate(objs, rev_comp_seq, tbl, start, true)) {
165  return eCanceled;
166  }
167  }
168  SetTaskCompleted((to - start) * 2);
169 
170  return eCompleted;
171 }
172 
173 
175  const string& orig_seq,
176  const CTrans_table& tbl,
177  TSeqPos start, bool negative)
178 {
179  // main loop through bases
180  size_t shift = 0;
181  int state = 0;
182  size_t length = orig_seq.size();
183 
184  typedef vector< CRef<CTranslationGlyph> > TTRans;
185  TTRans prots;
186 
187  int frame_base = negative ? 3 : 0;
188  for (size_t idx = 0; idx < 3; ++idx) {
189  CTranslationGlyph::EFrame frame = (CTranslationGlyph::EFrame)(frame_base + idx);
190  CRef<CTranslationGlyph> prot(new CTranslationGlyph(start, start + static_cast<TSeqPos>(length) -1, frame));
191  prot->GetTranslation().reserve(length/3);
192  prots.push_back(prot);
193  }
194 
195  if (negative) {
196  start += length - 1;
197  }
198 
199  string tmp_codon = "NNN";
200  int orf_starts[3] = {-1, -1, -1};
201  size_t i = 0;
202  while (i < 2) {
203  state = tbl.NextCodonState(state, orig_seq[i]);
204  tmp_codon[shift] = orig_seq[i];
205  ++shift;
206  ++i;
207  }
208 
209  string codon = tmp_codon;
210  while (i < length) {
211  if (IsCanceled()) {
212  return false;
213  }
214 
215  state = tbl.NextCodonState(state, orig_seq[i]);
216  char res = tbl.GetCodonResidue(state);
217 
218  tmp_codon[2] = orig_seq[i];
219  codon = tmp_codon; // codon in this step
220  tmp_codon[0] = tmp_codon[1];
221  tmp_codon[1] = tmp_codon[2];
222 
223  if (++shift == 3) {
224  shift = 0;
225  }
226 
227  prots[shift]->GetTranslation().push_back(res);
228 
229  TSeqPos curr_pos = static_cast<TSeqPos>(start + (negative ? -1 : 1) * (i - 1));
230  if (res == '*') {
231  prots[shift]->GetStopCodons().push_back(curr_pos);
232  if (orf_starts[shift] > -1) {
233  prots[shift]->GetOrfs().push_back(TSeqRange(orf_starts[shift], curr_pos));
234  orf_starts[shift] = -1;
235  }
236  }
237  if (res == 'M' || (m_AltStart && tbl.IsAltStart(state)) ||
238  (m_SubsetAltStart && tbl.IsAltStart(state) && (codon == "GTG" || codon == "TTG"))) {
239  prots[shift]->GetStartCodons().push_back(curr_pos);
240  if (orf_starts[shift] == -1) {
241  orf_starts[shift] = curr_pos;
242  }
243  }
244  AddTaskCompleted(1);
245  ++i;
246  }
247 
248  for (size_t idx = 0; idx < 3; ++idx) {
249  objs.push_back(CRef<CSeqGlyph>(prots[idx].GetPointer()));
250  }
251 
252  return true;
253 }
254 
255 
257 {
258  // get an appropriate translation table. For the full list of tables,
259  // please refer to https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi
260  short gc_id = -1;
261 
262  try {
263  const COrg_ref& org = sequence::GetOrg_ref(m_Handle);
265  gc_id = org.GetMgcode();
266  } else if (CSGUtils::IsPlastid(m_Handle) && org.IsSetPgcode()) {
267  gc_id = org.GetPgcode();
268  } else if (org.IsSetGcode()) {
269  gc_id = org.GetGcode();
270  }
271  } catch (CException&) {
272  // ignore it, will try other approach
273  }
274 
275  if (gc_id < 0) {
276  gc_id = 1; // use standard genetic code table by default
277  CTaxon1 tax;
278  STimeout time_out;
279  time_out.sec = 5;
280  time_out.usec = 0;
281 
282  if (tax.Init(&time_out, 3)) { // 5 second time out, and 3 attempts
283  // first, get the tax id
284  TTaxId tax_id = INVALID_TAX_ID;
287  if (gi_h && gi_h.GetGi() > ZERO_GI) {
288  TGi gi = gi_h.GetGi();
289  tax.GetTaxId4GI(gi, tax_id);
290  } else {
291  // try using another way for sequences that don't have a gi
293  }
294 
295  if (tax_id > INVALID_TAX_ID) {
296  ITaxon1Node* node;
297  if (tax.LoadNode(tax_id, (const ITaxon1Node**)(&node))) {
299  gc_id = node->GetMGC();
300  } else {
301  gc_id = node->GetGC();
302  }
303  }
304  }
305  }
306  }
307 
308  m_GeneticCode = gc_id;
309 }
310 
311 
312 ///////////////////////////////////////////////////////////////////////////////
313 /// CSFTransDS
314 ///
316  : CSGGenBankDS(scope, id)
317  , m_GeneticCode(-1)
318  , m_AltStart(false)
319  , m_SubsetAltStart(false)
320 {}
321 
322 
324 {
326  job( new CSFTranslationJob("Six-frame translation",
327  m_Handle, range, strand) );
328  job->SetGeneticCode(m_GeneticCode);
329  job->SetAltStart(m_AltStart);
330  job->SetSubsetAltStart(m_SubsetAltStart);
331  x_LaunchJob(*job);
332 }
333 
334 
335 ///////////////////////////////////////////////////////////////////////////////
336 /// CSFTransDSType
337 ///
340 {
341  const CSeq_id& id = dynamic_cast<const CSeq_id&>(object.object.GetObject());
342  return new CSFTransDS(object.scope.GetObject(), id);
343 }
344 
345 
347 {
348  static string sid("six_frames_trans_ds_type");
349  return sid;
350 }
351 
352 
354 {
355  static string slabel("Six-frame Translation Data Source Type");
356  return slabel;
357 }
358 
359 
361 {
362  return false;
363 }
364 
365 
366 ///////////////////////////////////////////////////////////////////////////////
367 /// CSixFramesTransTrack
368 ///
370 static const TTranslationStr s_TransStrs[] = {
373 };
374 
377 
378 
380 {
381  TTransMap::const_iterator iter = sm_TransMap.find(trans);
382  if (iter != sm_TransMap.end()) {
383  return iter->second;
384  }
385  NCBI_THROW(CException, eInvalid, "Invalid translation option string: " + trans);
386 }
387 
388 
390 {
392  for (iter = sm_TransMap.begin(); iter != sm_TransMap.end(); ++iter) {
393  if (iter->second == trans) {
394  return iter->first;
395  }
396  }
397  return kEmptyStr;
398 }
399 
400 
402 static const TOptionStr s_OptionStrs[] = {
404  { "Forward", CSixFramesTransTrack::eOpt_Forward },
405  { "Reverse", CSixFramesTransTrack::eOpt_Reverse },
407 };
408 
411 
412 
414 {
415  TOptionMap::const_iterator iter = sm_OptionMap.find(opt);
416  if (iter != sm_OptionMap.end()) {
417  return iter->second;
418  }
419  NCBI_THROW(CException, eInvalid, "Invalid translation option string: " + opt);
420 }
421 
422 
424 {
426  for (iter = sm_OptionMap.begin(); iter != sm_OptionMap.end(); ++iter) {
427  if (iter->second == opt) {
428  return iter->first;
429  }
430  }
431  return kEmptyStr;
432 }
433 
434 
435 CTrackTypeInfo CSixFramesTransTrack::m_TypeInfo("six_frames_translation",
436  "Graphical View Six-frame Translation Track");
437 
438 
440  : CDataTrack(r_cntx)
441  , m_DS(ds)
442  , m_Trans(eTrans_Adaptive)
443  , m_Option(eOpt_All)
444  , m_TransStrand(eNa_strand_both)
445 {
446  m_DS->SetJobListener(this);
447  x_RegisterIcon(SIconInfo(eIcon_Help, "Help on genetic code", true, "track_help"));
448  x_RegisterIcon(SIconInfo(eIcon_Content, "Content", true, "track_content"));
449  x_RegisterIcon(SIconInfo(eIcon_Genetic, "Genetic Code", true, "track_genetic_code"));
450  x_RegisterIcon(SIconInfo(eIcon_Settings, "Settings", true, "track_settings"));
452 }
453 
454 
456 {
457  if ( !m_DS->AllJobsFinished() ) {
458  m_DS->DeleteAllJobs();
459  }
460 }
461 
462 
464 {
465  return m_TypeInfo;
466 }
467 
468 
470 {
471  if (GetTitle().empty()) {
472  return kTrackTitle;
473  }
474  return GetTitle();
475 }
476 
477 void CSixFramesTransTrack::Update(bool layout_only)
478 {
479  if (layout_only) {
480  if (m_Option == eOpt_LeftToRight) {
483  if (!layout_only) {
484  m_TransRange.Set(0, 0);
485  x_UpdateTitle();
486  }
487  }
488  }
489  CDataTrack::Update(layout_only);
490 }
491 
492 void CSixFramesTransTrack::x_LoadSettings(const string& preset_style,
493  const TKeyValuePairs& settings)
494 {
497 
498  if ( !m_Config) {
500  }
501 
502  if ( !m_GroupConf ) {
506  }
507 
508  if (preset_style.empty()) {
510  } else {
511  SetProfile(preset_style);
512  }
513 
515  CRegistryReadView view;
517  m_Option = OptionStrToValue(view.GetString("ShowOption"));
518  m_Config->SetOrfThreshold(view.GetInt("OrfThreshold", 20));
519  m_Config->SetHighlightCodons(view.GetBool("HighlightCodons", true));
521 
524 
526  CSGConfigUtils::GetColor(view, "StartCodonColor", color);
528  CSGConfigUtils::GetColor(view, "StopCodonColor", color);
530  CSGConfigUtils::GetColor(view, "OrfHighlightColor", color);
532  CSGConfigUtils::GetColor(view, "SeqColor", color);
534  CSGConfigUtils::GetColor(view, "OrfSeqColor", color);
536  CSGConfigUtils::GetColor(view, "BgColor", color);
538  CSGConfigUtils::GetColor(view, "LabelBgColor", color);
540  CSGConfigUtils::GetColor(view, "CommentColor", color);
542 
543 
546  m_Config->SetBarHeight(view.GetInt("BarHeight", 12));
547  CSGConfigUtils::GetFont(view, "SeqFontFace", "SeqFontSize", m_Config->GetSeqFont());
548  CSGConfigUtils::GetFont(view, "StrandFontFace", "StrandFontSize", m_Config->GetStrandFont());
549 
550 
551  ITERATE (TKeyValuePairs, iter, settings) {
552  try {
553  if (NStr::EqualNocase(iter->first, "Translation")) {
554  m_Trans = TransStrToValue(iter->second);
555  } else if (NStr::EqualNocase(iter->first, "OrfThreshold")) {
557  } else if (NStr::EqualNocase(iter->first, "ShowOption")) {
558  m_Option = OptionStrToValue(iter->second);
559  } else if (NStr::EqualNocase(iter->first, "HighlightCodons")) {
561  } else if (NStr::EqualNocase(iter->first, "AltStart")) {
562  m_DS->SetAltStart(NStr::StringToBool(iter->second));
563  }
564  else if (NStr::EqualNocase(iter->first, "SubsetAltStart")) {
565  m_DS->SetSubsetAltStart(NStr::StringToBool(iter->second));
566  }
567  } catch (CException&) {
568  LOG_POST(Warning << "CSixFramesTransTrack::x_LoadSettings() "
569  "invalid translation setting:" << iter->second);
570  }
571  }
572 
573  x_UpdateTitle();
574 }
575 
576 
577 void CSixFramesTransTrack::x_SaveSettings(const string& preset_style)
578 {
579  TKeyValuePairs settings;
580 
581  if ( !preset_style.empty() ) {
582  settings["profile"] = preset_style;
583  }
584 
585  settings["ShowOption"] = OptionValueToStr(m_Option);
586  settings["OrfThreshold"] = NStr::IntToString(m_Config->GetOrfThreshold());
587  settings["HighlightCodons"] = NStr::BoolToString(m_Config->GetHighlightCodons());
588  settings["AltStart"] = NStr::BoolToString(m_DS->GetAltStart());
589  settings["SubsetAltStart"] = NStr::BoolToString(m_DS->GetSubsetAltStart());
590  SetProfile("Translation:" + TransValueToStr(m_Trans));
591 
593 }
594 
595 
597 {
598  switch (id) {
599  case eIcon_Help:
600  {{
601  string link = "https://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/index.cgi?chapter=tgencodes#SG";
603  ::wxLaunchDefaultBrowser(ToWxString(link));
604  }}
605  break;
606  case eIcon_Content:
608  break;
609  case eIcon_Settings:
611  break;
612  case eIcon_Genetic:
614  break;
615  default:
616  // use default handlers
618  }
619 }
620 
621 
623 {
625  if (range.GetLength() < 3)
626  return;
627 
628 
629  if (m_Trans == eTrans_Always ||
630  (m_Trans == eTrans_Adaptive &&
631  range.GetLength() < kTransRangeLimit)) {
632  TSeqPos buffer_len = kTransRangeLimit/8;
634  TSeqPos max_r = seq_ds->GetSequenceLength() - 1;
635  TSeqRange b_range(
636  range.GetFrom() > buffer_len ? range.GetFrom() - buffer_len : 0,
637  range.GetTo() + buffer_len > max_r ? max_r : range.GetTo() + buffer_len);
638  if (m_TransRange.IntersectionWith(b_range) != b_range) {
639  SetGroup().Clear();
640  m_TransRange.Set(0, 0);
641  TSeqRange trans_range = x_GetCurrentTransRange();
642  m_DS->DeleteAllJobs();
644  ", Translating in six-frame..." : ", Translating in three-frame..."
645  , 0);
646  ENa_strand strand = (ENa_strand)m_Option;
647  if (m_Option == eOpt_LeftToRight)
649  m_DS->DoTranslation(trans_range, strand);
650  m_TransStrand = strand;
651  }
652  } else {
653  SetGroup().Clear();
654  m_TransRange.Set(0, 0);
655  ENa_strand strand = (ENa_strand)m_Option;
656  if (m_Option == eOpt_LeftToRight)
658  m_TransStrand = strand;
659 
660  CRef<CCommentConfig> c_config(new CCommentConfig);
661  c_config->m_ShowBoundary = false;
662  c_config->m_ShowConnection = false;
663  c_config->m_Centered = true;
664  c_config->m_LabelColor.Set(1.0f, 0.0f, 0.0f);
665  c_config->m_LineColor.Set(1.0f, 1.0f, 1.0f);
667  c_config->m_Font.SetFontSize(12);
668 
669  string msg = "No translation is available with visible range > " +
671  " nucleotide bases";
672  TModelUnit x = (range.GetFrom() + range.GetTo()) * 0.5;
674  new CCommentGlyph(msg, TModelPoint(x, 0.0)));
675  label->SetConfig(c_config);
676  Add(label.GetPointer());
677 
678  SetMsg("");
679  }
680 }
681 
682 
684 {
685  m_DS->ClearJobID(notify.GetJobID());
686  CRef<CObject> res_obj = notify.GetResult();
687  CSGJobResult* result = dynamic_cast<CSGJobResult*>(&*res_obj);
688  if (result) {
690  } else {
691  x_SetStatus(", failed on doing translatinon", 100);
692  LOG_POST(Error << "CSixFramesTransTrack::x_OnJobCompleted() "
693  "notification for job does not contain results.");
694  return;
695  }
696 }
697 
698 
700 {
701  //TIME_ME("x_AddTranslationsLayout()");
702 
703  // update genetic code and code name
704  if (m_DS->GetGeneticCode() < 0 && !result.m_Desc.empty()) {
705  try {
706  int gc_id = NStr::StringToInt(result.m_Desc);
707  if (gc_id != m_DS->GetGeneticCode()) {
708  m_DS->SetGeneticCode(gc_id);
709  x_InitGeneticCodeName(gc_id);
710  x_UpdateTitle();
711  }
712  } catch (CException&) {
713  // ignore
714  }
715  }
716 
717 
718  SetGroup().Clear();
719  TObjects objs = result.m_ObjectList;
720 
721  if ( !objs.empty() ) {
722  // update cached translation range
724 
725  NON_CONST_ITERATE (CSeqGlyph::TObjects, iter, objs) {
726  CTranslationGlyph* trans = dynamic_cast<CTranslationGlyph*>(iter->GetPointer());
727  trans->SetConfig(m_Config);
728  }
729  if (m_Option == eOpt_All && objs.size() > 3) {
730  // separate translation into two groups,
731  // and add a shaded background for reverse translations
732  CRef<CLayoutGroup> group1(new CLayoutGroup);
733  Add(group1);
734  group1->SetLayoutPolicy(m_Simple);
735  CRef<CLayoutGroup> group2(new CLayoutGroup);
736  Add(group2);
737  group2->SetLayoutPolicy(m_Simple);
738  group2->SetConfig(m_GroupConf.GetPointer());
739  int i = 0;
740  NON_CONST_ITERATE (CSeqGlyph::TObjects, iter, objs) {
741  if (i < 3) {
742  group1->PushBack(*iter);
743  } else {
744  group2->PushBack(*iter);
745  }
746  ++i;
747  }
748  } else {
749  SetObjects(objs);
750  }
751 
752  x_SetStatus("", 100);
753  } else {
754  x_SetStatus(", failed on doing translatinon", 100);
755  }
756 
757  x_UpdateLayout();
758 }
759 
760 
762 {
763  wxMenu menu;
764  UseDefaultMarginWidth(menu);
765 
766  vector<pair<EStrandOption, wxString> > options =
767  {
768  { eOpt_Forward, wxT("Forward translations") },
769  { eOpt_Reverse, wxT("Reverse translations") },
770  { eOpt_LeftToRight, wxT("Left-to-right translations") },
771  { eOpt_All, wxT("Show all") }
772  };
773  for (auto&& opt : options) {
774  wxMenuItem* item;
775  item = menu.AppendRadioItem(kContentBaseID + opt.first, opt.second);
776  item->Check(m_Option == opt.first);
777  }
778 
779  m_LTHost->LTH_PopupMenu(&menu);
780  wxMenuItemList& item_list = menu.GetMenuItems();
781  ITERATE (wxMenuItemList, iter, item_list) {
782  EStrandOption option = (EStrandOption)((*iter)->GetId() - kContentBaseID);
783  if ((*iter)->IsChecked() && option != m_Option) {
784  m_Option = option;
785  // force to update data
786  m_TransRange.Set(0, 0);
787  x_UpdateTitle();
788  x_UpdateData();
789  }
790  }
791 }
792 
793 
795 {
796  wxMenu menu;
797  UseDefaultMarginWidth(menu);
798 
799  wxMenuItem* item = NULL;
800 
801  // add menu item for Codon setting
802  int radio_item_base = 0;
803  item = menu.AppendCheckItem(kContentBaseID + radio_item_base++, wxT("Highlight Codons"));
804  item->Check(m_Config->GetHighlightCodons());
805  item = menu.AppendCheckItem(kContentBaseID + radio_item_base++, wxT("Enable alternative Start"));
806  item->Check(m_DS->GetAltStart());
807  item = menu.AppendCheckItem(kContentBaseID + radio_item_base++, wxT("ATG/GTG/TTG Start Codons"));
808  item->Check(m_DS->GetSubsetAltStart());
809  item->Enable(m_DS->GetGeneticCode() == 11);
810 
811 
812  // add a separator
813  menu.AppendSeparator();
814 
815  // add menu items for ORF threshold setting
816  typedef vector< pair<int, string> > TItems;
817  TItems items;
818  items.push_back(TItems::value_type(0, string("Highlight all ORFs")));
819  items.push_back(TItems::value_type(20, string("Highlight ORFs (>= 20 Codons)")));
820  items.push_back(TItems::value_type(100, string("Highlight ORFs (>= 100 Codons)")));
821  items.push_back(TItems::value_type(250, string("Highlight ORFs (>= 250 Codons)")));
822  items.push_back(TItems::value_type(kMaxOrfLen, string("Don't highlight ORFs")));
823 
824  for (size_t i = 0; i < items.size(); ++i) {
825  item = menu.AppendRadioItem(kContentBaseID + radio_item_base + static_cast<int>(i),
826  ToWxString(items[i].second));
827  item->Check(m_Config->GetOrfThreshold() == items[i].first);
828  }
829 
830  m_LTHost->LTH_PopupMenu(&menu);
831  wxMenuItemList& item_list = menu.GetMenuItems();
832  ITERATE (wxMenuItemList, iter, item_list) {
833  int id = (*iter)->GetId() - kContentBaseID;
834  bool checked = (*iter)->IsChecked();
835  if (id == 0) {
836  if (checked != m_Config->GetHighlightCodons()) {
837  m_Config->SetHighlightCodons(checked);
838  break;
839  }
840  } else if (id == 1) {
841  if (checked != m_DS->GetAltStart()) {
842  m_DS->SetAltStart(checked);
843  // force to update data
844  m_TransRange.Set(0, 0);
845  x_UpdateData();
846  break;
847  }
848  }
849  else if (id == 2) {
850  if (checked != m_DS->GetSubsetAltStart()) {
851  m_DS->SetSubsetAltStart(checked);
852  // force to update data
853  m_TransRange.Set(0, 0);
854  x_UpdateData();
855  break;
856  }
857  }
858  else if (checked) {
859  id -= radio_item_base;
860  if (m_Config->GetOrfThreshold() != items[id].first) {
861  m_Config->SetOrfThreshold(items[id].first);
862  x_UpdateLayout();
863  break;
864  }
865  }
866  }
867 }
868 
869 
871 {
872  int curr_gc = m_DS->GetGeneticCode();
873  if (curr_gc < 0) {
874  return;
875  }
876 
877  wxMenu menu;
878  UseDefaultMarginWidth(menu);
879 
880  wxMenuItem* item = NULL;
881  // add menu items for ORF threshold setting
882  typedef vector< pair<int, string> > TItems;
883  TItems items;
886  items.push_back(TItems::value_type((*code)->GetId(), (*code)->GetName()));
887  }
888 
889  for (size_t i = 0; i < items.size(); ++i) {
890  item = menu.AppendRadioItem(kContentBaseID + static_cast<int>(i), ToWxString(items[i].second));
891  if (items[i].first == curr_gc) {
892  item->Check(true);
893  }
894  }
895 
896  m_LTHost->LTH_PopupMenu(&menu);
897  wxMenuItemList& item_list = menu.GetMenuItems();
898  ITERATE (wxMenuItemList, iter, item_list) {
899  int id = (*iter)->GetId() - kContentBaseID;
900  bool checked = (*iter)->IsChecked();
901  if (checked) {
902  if (curr_gc != items[id].first) {
903  m_DS->SetGeneticCode(items[id].first);
904  m_GCName = items[id].second;
905 
906  // force to update data
907  m_TransRange.Set(0, 0);
908  x_UpdateTitle();
909  x_UpdateData();
910  }
911  break;
912  }
913  }
914 }
915 
916 
918 {
919  ENa_strand strand = (ENa_strand)m_Option;
920  if (m_Option == eOpt_LeftToRight) {
922  }
923  string frames_b = "Three";
924  string frames_a;
925  switch (strand) {
926  case eNa_strand_plus:
927  frames_a = "+1, +2, +3)";
928  break;
929  case eNa_strand_both:
930  frames_b = "Six";
931  frames_a = "+1, +2, +3, -1, -2, -3)";
932  break;
933  case eNa_strand_minus:
934  frames_a = "-1, -2, -3)";
935  break;
936  default:
937  break;
938  }
939 
940  string title = frames_b;
941  title += "-frame translations (top -> bottom: ";
942  title += frames_a;
943 
944  if (!m_GCName.empty()) {
945  title += ", Genetic code: ";
946  title += m_GCName;
947  title += " (" + NStr::IntToString(m_DS->GetGeneticCode()) + ")";
948  }
949 
950  SetTitle(title);
951 }
952 
953 
955 {
956  // get genetic code name
958  const CGenetic_code_table::Tdata& codes = code_table.Get();
960  if ((*code)->GetId() == gc_id) {
961  SetGCName((*code)->GetName());;
962  break;
963  }
964  }
965 }
966 
967 
969 {
972  TSeqPos max_r = seq_ds->GetSequenceLength() - 1;
973  TSeqRange vis_range = m_Context->GetVisSeqRange();
974  TSeqPos center = (vis_range.GetFrom() + vis_range.GetTo()) / 2;
975  range.SetFrom(center > kTransRangeLimit ? center - kTransRangeLimit : 0);
976  range.SetTo(center + kTransRangeLimit > max_r ? max_r : center + kTransRangeLimit);
977  return range;
978 }
979 
980 
981 ///////////////////////////////////////////////////////////////////////////////
982 /// CSixFramesTransTrackFactory
983 ///
986  ISGDataSourceContext* ds_context,
987  CRenderingContext* r_cntx,
988  const SExtraParams& params,
989  const TAnnotMetaDataList& /*src_annots*/) const
990 {
991  // create data source
992  CIRef<ISGDataSource> ds = ds_context->GetDS(
993  typeid(CSFTransDSType).name(), object);
994  CSFTransDS* ds_pointer = dynamic_cast<CSFTransDS*>(ds.GetPointer());
995  ds_pointer->SetDepth(params.m_Level);
996 
997  TTrackMap tracks;
998 
999  // make sure we don't create six-frame translation track for protein sequence.
1000  CRef<CSGSequenceDS> seq_ds = r_cntx->GetSeqDS();
1001  CSeq_id_Handle idh = seq_ds->GetBestIdHandle();
1003  if (info & CSeq_id::fAcc_prot) {
1004  return tracks;
1005  }
1006 
1007  // create track
1008  CRef<CSixFramesTransTrack> track(new CSixFramesTransTrack(ds_pointer, r_cntx));
1009  tracks[kTrackTitle] = track.GetPointer();
1010 
1011  return tracks;
1012 }
1013 
1014 
1017  const TKeyValuePairs& settings,
1018  const CTempTrackProxy* /*track_proxy*/) const
1019 {
1020  CRef<CTrackConfigSet> config_set(new CTrackConfigSet);
1021  // create a track configure
1023  config_set->Set().push_back(config);
1024  config->SetLegend_text("anchor_10");
1025 
1027  CRegistryReadView view =
1029  string option = view.GetString("ShowOption");
1030  int orf_threshold = view.GetInt("OrfThreshold", 20);
1031  bool hl_codons = view.GetBool("HighlightCodons", true);
1032  bool alt_start = false;
1033  bool subset_alt_start = false;
1034  ITERATE (TKeyValuePairs, iter, settings) {
1035  try {
1036  if (NStr::EqualNocase(iter->first, "OrfThreshold")) {
1037  orf_threshold = NStr::StringToInt(iter->second);
1038  if (orf_threshold != 0 && orf_threshold != 20 &&
1039  orf_threshold != 100 && orf_threshold != 250 &&
1040  orf_threshold != kMaxOrfLen) {
1041  orf_threshold = 20;
1042  }
1043  } else if (NStr::EqualNocase(iter->first, "ShowOption")) {
1044  option = iter->second;
1045  } else if (NStr::EqualNocase(iter->first, "HighlightCodons")) {
1046  hl_codons = NStr::StringToBool(iter->second);
1047  } else if (NStr::EqualNocase(iter->first, "AltStart")) {
1048  alt_start = NStr::StringToBool(iter->second);
1049  }
1050  else if (NStr::EqualNocase(iter->first, "SubsetAltStart")) {
1051  subset_alt_start = NStr::StringToBool(iter->second);
1052  }
1053  } catch (CException&) {
1054  LOG_POST(Warning << "CSixFramesTransTrack::x_LoadSettings() "
1055  "invalid translation setting:" << iter->second);
1056  }
1057  }
1058 
1059  string help = "Six-frame translations<br>";
1062  help += "From top to bottom: forward translation +1, +2 and +3<br>";
1063  break;
1065  help += "From top to bottom: reverse translation -1, -2 and -3<br>";
1066  break;
1068  help += "From top to bottom: forward translation +1, +2 and +3 or reverse translation -1, -2 and -3 based on current orientaion<br>";
1069  break;
1071  help += "From top to bottom: forward translation +1, +2 and +3, and reverse translation -1, -2 and -3<br>";
1072  default:
1073  break;
1074  }
1075 
1076  help += "Regions highlighted with Green are start codons<br>";
1077  help += "Regions highlighted with Red are stop codons<br>";
1078  help += "Regions highlighted with Gray are ORFs<br>";
1079  config->SetHelp() = help;
1080 
1082  "ShowOption", "Translation strand", option,
1083  "Translation direction option");
1084  choice->SetValues().push_back(
1087  "Forward translations",
1088  "Show forward direction translations (+1, +2, +3)",
1089  ""));
1090  choice->SetValues().push_back(
1093  "Reverse translations",
1094  "Show reverse direction translations (-1, -2, -3)",
1095  ""));
1096  choice->SetValues().push_back(
1099  "Left-to-right translations",
1100  "Show left-to-right translations",
1101  ""));
1102  choice->SetValues().push_back(
1105  "Show all",
1106  "Show all six-frame translations",
1107  ""));
1108  config->SetChoice_list().push_back(choice);
1109 
1111  "OrfThreshold", "Highlight ORFs", NStr::IntToString(orf_threshold),
1112  "Setting for highlighting ORFs based on number of codons"
1113  "");
1114 
1115  orf_choice->SetValues().push_back(
1117  "0", "Highlight all ORFs", "Highlight all ORFs", ""));
1118 
1119  orf_choice->SetValues().push_back(
1121  "20", "Highlight ORFs (>= 20 codons)",
1122  "Highlight ORFs equal or longer than 20 codons", ""));
1123 
1124  orf_choice->SetValues().push_back(
1126  "100", "Highlight ORFs (>= 100 codons)",
1127  "Highlight ORFs equal or longer than 100 codons", ""));
1128 
1129  orf_choice->SetValues().push_back(
1131  "250", "Highlight ORFs (>= 250 codons)",
1132  "Highlight ORFs equal or longer than 250 codons", ""));
1133 
1134  orf_choice->SetValues().push_back(
1136  NStr::IntToString(kMaxOrfLen), "Don't highlight ORFs",
1137  "Do not highlight ORFs", ""));
1138 
1139  config->SetChoice_list().push_back(orf_choice);
1140 
1141  config->SetCheck_boxes().push_back(
1143  "HighlightCodons","Highlight codons",
1144  "Highlight codon", "",
1145  hl_codons));
1146 
1147  config->SetCheck_boxes().push_back(
1149  "AltStart","Enable alternative start",
1150  "Enable alternative initiation codon", "",
1151  alt_start));
1152 
1153  config->SetCheck_boxes().push_back(
1155  "SubsetAltStart", "ATG/GTG/TTG Start Codons",
1156  "Enable ATG and two other alternative start codons (gcode = 11)", "",
1157  subset_alt_start));
1158 
1159  return config_set;
1160 }
1161 
1162 
1164 {
1165  CLayoutTrack::RegisterIconImage("track_genetic_code", "track_genetic_code.png");
1166 }
1167 
1168 
1170 {
1172 }
1173 
1174 
1176 {
1178 }
1179 
1180 
#define false
Definition: bool.h:36
CAppJobNotification Notification send by CAppJobEventTranslator.
CBioseq_Handle –.
IBoundaryParams.
void SetShowBackground(bool flag)
void SetBgColor(const CRgbaColor &flag)
void SetShowBoundary(bool flag)
CCommentConfig – help config class for holding a set of settings for a comment glyph.
CRgbaColor m_LineColor
CGlTextureFont m_Font
CRgbaColor m_LabelColor
bool m_Centered
label is centered against the target.
bool m_ShowConnection
display a connection between the comment and target.
CCommentGlyph – utility class for having comments in graphical glyphs.
CDataTrack - a abstract base class for layout tracks which need to deal with background data retrieva...
Definition: data_track.hpp:55
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
Definition: data_track.cpp:52
void x_UpdateLayout()
Definition: data_track.hpp:127
static const CTrans_table & GetTransTable(int id)
static const CGenetic_code_table & GetCodeTable(void)
void Add(CSeqGlyph *obj)
Append a layout object to the end.
void SetObjects(const CLayoutGroup::TObjectList &objs)
CLayoutGroup & SetGroup()
CRef< CLayeredLayout > m_Layered
CRef< CSimpleLayout > m_Simple
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CLayoutGroup is a container of CSeqGlyphs (layout objects).
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
void SetConfig(const CBoundaryParams *conf)
Set composition boundary parameters.
void PushBack(CSeqGlyph *obj)
Append a layout object to the end.
void SetTitle(const string &label, const string &default_title=NcbiEmptyString)
@ eIcon_Content
icon id for setting content
@ eIcon_Settings
icon id for track settings
@ eIcon_Help
icon id for track help
ILayoutTrackHost * m_LTHost
Top level host owning the tracks.
string GetTitle() const
get the track title.
virtual void x_OnIconClicked(TIconID id)
Mouse left-click event handler on an icon.
const string & GetProfile() const
void x_SetStatus(const string &msg, int progress)
void SetMsg(const string &msg)
static void RegisterIconImage(const TIconAlias &key, const string &img_file)
register the image for an icon.
void SetProfile(const string &preset_style)
CLayoutTrack inline method implmentation.
CRef< CSeqGraphicConfig > m_gConfig
global configuration.
int TIconID
use int as TIconID instead of EIconID.
void x_RegisterIcon(const SIconInfo &icon)
register track icons.
int GetPgcode(void) const
Definition: Org_ref.cpp:154
bool IsSetPgcode(void) const
Definition: Org_ref.cpp:149
bool IsSetGcode(void) const
Definition: Org_ref.cpp:129
bool IsSetMgcode(void) const
Definition: Org_ref.cpp:139
int GetMgcode(void) const
Definition: Org_ref.cpp:144
int GetGcode(void) const
Definition: Org_ref.cpp:134
CRef –.
Definition: ncbiobj.hpp:618
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
Definition: reg_view.cpp:230
bool GetBool(const string &key, bool default_val=false) const
Definition: reg_view.cpp:241
string GetString(const string &key, const string &default_val=kEmptyStr) const
Definition: reg_view.cpp:246
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
CRef< CSGSequenceDS > GetSeqDS() const
const TSeqRange & GetVisSeqRange() const
bool IsFlippedStrand() const
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
CSFTransDSType - Six-frames translation data source type.
virtual bool IsSharable() const
check if the data source can be shared.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual ISGDataSource * CreateDS(SConstScopedObject &object) const
create an instance of the layout track type using default settings.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
CSFTransDS - Six-frames translation data source.
bool m_SubsetAltStart
allow ATG (Met) and two alternative start codons: GTG (Val), TTG (Leu) for gcode = 11
bool m_AltStart
allow alternative start codon
CSFTransDS(objects::CScope &scope, const objects::CSeq_id &id)
CSFTransDS.
void DoTranslation(const TSeqRange &range, objects::ENa_strand strand=objects::eNa_strand_both)
do Six-frames translation.
void SetAltStart(bool f)
void SetGeneticCode(int id)
CSFTransDS inline methods.
int GetGeneticCode() const
bool GetSubsetAltStart() const
bool GetAltStart() const
void SetSubsetAltStart(bool value)
CSFTranslationJob - Graphical view six-frame translation job.
bool m_SubsetAltStart
allow ATG (Met) and two alternative start codons: GTG (Val), TTG (Leu) for gcode = 11
CSFTranslationJob(const string &desc, CBioseq_Handle handle, const TSeqRange &range, ENa_strand strand=eNa_strand_both)
bool x_Translate(CSeqGlyph::TObjects &objs, const string &orig_seq, const CTrans_table &tbl, TSeqPos start, bool negative)
Do translation for three frame shifts.
ENa_strand m_Strand
Translated strand (plus, minus, both)
TSeqRange m_Range
target range
virtual EJobState x_Execute()
method truly doing the job.
void SetSubsetAltStart(bool value)
bool m_AltStart
allow alternative start codon
CBioseq_Handle m_Handle
target sequence
static CRegistryReadView GetSizeReadView(const CGuiRegistry &reg, const string &base_key, const string &sect, const string &key, const string &def_sect="")
static void GetFont(const CRegistryReadView &view, const string &face_key, const string &size_key, CGlTextureFont &f)
static string ComposeProfileString(const TKeyValuePairs &settings)
static CRegistryReadView GetColorReadView(const CGuiRegistry &reg, const string &base_key, const string &sect, const string &key, const string &def_sect="")
Create a read view specifically for 'Color' section.
static CRegistryReadView GetReadView(const CGuiRegistry &reg, const string &base_key, const string &curr_key, const string &def_key1="", const string &def_key2="", const string &def_key3="")
read/readwrite view creation helper methods.
static void GetColor(const CRegistryReadView &view, const string &key, CRgbaColor &color)
TJobID x_LaunchJob(IAppJob &job, int report_period=1, const string &pool="ObjManagerEngine")
Launch either a background or foreground job.
virtual bool AllJobsFinished() const
void SetJobListener(CEventHandler *listener)
Set JobDispatcher listener.
virtual void ClearJobID(TJobID job_id)
void SetDepth(int depth)
Set the annotation selector resolving depth.
virtual void DeleteAllJobs()
Remove waiting jobs from queue or cancel the unfinished jobs.
objects::CBioseq_Handle m_Handle
CSGJobResult – the data structure holding the seqgraphic job results.
TSeqPos GetSequenceLength() const
objects::CSeq_id_Handle GetBestIdHandle() const
static bool IsMitochondrion(const objects::CBioseq_Handle &handle)
static bool IsPlastid(const objects::CBioseq_Handle &handle)
CScope –.
Definition: scope.hpp:92
CRenderingContext * m_Context
the rendering context
Definition: seq_glyph.hpp:346
list< CRef< CSeqGlyph > > TObjects
Definition: seq_glyph.hpp:85
const string & GetSizeLevel() const
int GetObjectSpace() const
bool GetShowComments() const
const string & GetColorTheme() const
CSeqGraphicJob – the base class of seqgraphic job for handling the job status such as reporting the p...
CRef< CObject > m_Result
virtual void SetTaskTotal(int total)
virtual void SetTaskName(const string &name)
virtual void SetTaskCompleted(int completed)
set total finished task number.
virtual void AddTaskCompleted(int delta)
set to add newly finished task number.
static SIZE_TYPE ReverseComplement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
@ e_Iupacna
Definition: sequtil.hpp:47
CSeqVector –.
Definition: seq_vector.hpp:65
virtual TTrackMap CreateTracks(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams &params=SExtraParams(), const TAnnotMetaDataList &src_annots=TAnnotMetaDataList()) const
create a layout track based on the input objects and extra parameters.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual CRef< objects::CTrackConfigSet > GetSettings(const string &profile, const TKeyValuePairs &settings, const CTempTrackProxy *track_proxy) const
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
CSixFramesTransTrack – A special track for doing six-frames translation of the current sequence.
virtual const CTrackTypeInfo & GetTypeInfo() const override
virtual void Update(bool layout_only) override
Update content and layout including the bounding box.
@ eTrans_Adaptive
do translation only for under certain zoom level
@ eTrans_Always
do translation for all resolution
@ eOpt_All
show translation for both directions
@ eOpt_LeftToRight
Choose what to show based on orientation.
@ eOpt_Forward
show forward translations
@ eOpt_Reverse
show reverse translations
string m_GCName
genetic code name.
void x_InitGeneticCodeName(int gc_id)
virtual string GetFullTitle() const override
get a more meaningful title.
objects::ENa_strand m_TransStrand
the sequence strand for the current translation
CSixFramesTransTrack(CSFTransDS *ds, CRenderingContext *r_cntx)
static const string & OptionValueToStr(EStrandOption opt)
static CTrackTypeInfo m_TypeInfo
TSeqRange x_GetCurrentTransRange() const
TSeqRange m_TransRange
the sequence range current translation is done.
void x_AddTranslations(const CSGJobResult &result)
virtual void x_LoadSettings(const string &preset_style, const TKeyValuePairs &settings) override
load the track settings.
static const string & TransValueToStr(ETranslation trans)
virtual void x_OnJobCompleted(CAppJobNotification &notify) override
CRef< CBoundaryParams > m_GroupConf
virtual void x_UpdateData() override
update track content.
static EStrandOption OptionStrToValue(const string &opt)
virtual void x_OnIconClicked(TIconID id) override
Mouse left-click event handler on an icon.
virtual void x_SaveSettings(const string &preset_style) override
save part of settings to a profile string.
static ETranslation TransStrToValue(const string &trans)
void SetGCName(const string &gc_name)
CRef< CTranslationConfig > m_Config
class CStaticArrayMap<> provides access to a static array in much the same way as CStaticArraySet<>,...
Definition: static_map.hpp:175
TBase::const_iterator const_iterator
Definition: static_map.hpp:179
bool GetTaxId4GI(TGi gi, TTaxId &tax_id_out)
Definition: taxon1.cpp:1371
bool Init(void)
Definition: taxon1.cpp:101
bool LoadNode(TTaxId tax_id, const ITaxon1Node **ppNode=NULL)
Definition: taxon1.hpp:488
File Description:
CTrackConfigSet –.
static CRef< objects::CChoice > CreateChoice(const string &name, const string &disp_name, const string &curr_val, const string &help, bool optional=false)
Definition: layout_conf.hpp:79
static CRef< objects::CCheckBox > CreateCheckBox(const string &name, const string &disp_n, const string &help_text, const string &legend_txt, bool value, bool optional=false)
Definition: layout_conf.hpp:96
static CRef< objects::CChoiceItem > CreateChoiceItem(const string &name, const string &disp_name, const string &help, const string &legend_txt, bool optional=false)
Definition: layout_conf.hpp:61
CTrackConfig –.
Definition: TrackConfig.hpp:66
CTrackTypeInfo - holds description of a layout track type.
const string & GetDescr() const
const string & GetId() const
char GetCodonResidue(int state) const
bool IsAltStart(int state) const
static int NextCodonState(int state, unsigned char ch)
void SetOrfHighlightColor(const CRgbaColor &color)
void SetSeqColor(const CRgbaColor &color)
void SetLabelBgColor(const CRgbaColor &color)
CGlTextureFont & GetSeqFont()
bool GetHighlightCodons() const
void SetStartCodonColor(const CRgbaColor &color)
CTranslationConfig inline methods.
void SetOrfSeqColor(const CRgbaColor &color)
CGlTextureFont & GetStrandFont()
void SetStopCodonColor(const CRgbaColor &color)
void SetHighlightCodons(bool f)
void SetCommentColor(const CRgbaColor &color)
void SetOrfThreshold(int val)
void SetConfig(CTranslationConfig *config)
CTranslationGlyph inline methods.
virtual void LTH_PopupMenu(wxMenu *menu)=0
show track-specific context menu.
ISGDSManager is seqgraphic data source manage that serves as an data source context.
virtual CIRef< ISGDataSource > GetDS(const string &type, SConstScopedObject &object)=0
Get a seqgraphic data source instance of the specified type.
File Description:
virtual TTaxGeneticCode GetMGC() const =0
virtual TTaxGeneticCode GetGC() const =0
static CMemoryRegistry registry
Definition: cn3d_tools.cpp:81
char value[7]
Definition: config.c:431
#define option
struct config config
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
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
#define INVALID_TAX_ID
Definition: ncbimisc.hpp:1116
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
#define TAX_ID_FROM(T, value)
Definition: ncbimisc.hpp:1111
#define ZERO_GI
Definition: ncbimisc.hpp:1088
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
GLdouble TModelUnit
Definition: gltypes.hpp:48
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
void SetFontSize(unsigned int size)
Set/get font size in points.
CGlPoint< TModelUnit > TModelPoint
Definition: gltypes.hpp:51
void Set(float r, float g, float b)
set the color from an Fl_Color
Definition: rgba_color.cpp:226
CRef< CObject > GetResult() const
returns non-null pointer only if Completed or Running and has temporary results available
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
Definition: app_job.hpp:86
@ eCanceled
Definition: app_job.hpp:91
@ eCompleted
Definition: app_job.hpp:89
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
CConstRef< CSeq_id > GetSeqId(void) const
EAccessionInfo
For IdentifyAccession (below)
Definition: Seq_id.hpp:220
TGi GetGi(void) const
@ fAcc_prot
Definition: Seq_id.hpp:227
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
const COrg_ref & GetOrg_ref(const CBioseq_Handle &handle)
Return the org-ref associated with a given sequence.
Definition: sequence.cpp:264
@ eGetId_ForceGi
return only a gi-based seq-id
Definition: sequence.hpp:99
TTaxId GetTaxId(const CSeq_id &id, TGetFlags flags=0)
Get taxonomy id of bioseq Return -1 if sequence is not found Return 0 if sequence doesn't have taxono...
Definition: scope.cpp:474
TSeqPos GetBioseqLength(void) const
const CSeq_id_Handle & GetSeq_id_Handle(void) const
Get handle of id used to obtain this bioseq handle.
CScope & GetScope(void) const
Get scope this handle belongs to.
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
Definition: seq_vector.cpp:304
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
position_type GetLength(void) const
Definition: range.hpp:158
TThisType IntersectionWith(const TThisType &r) const
Definition: range.hpp:312
TThisType & Set(position_type from, position_type to)
Definition: range.hpp:188
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
Definition: range.hpp:419
#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 bool StringToBool(const CTempString str)
Convert string to bool.
Definition: ncbistr.cpp:2819
#define kEmptyStr
Definition: ncbistr.hpp:123
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
Definition: ncbistr.cpp:630
static const string BoolToString(bool value)
Convert bool to string.
Definition: ncbistr.cpp:2813
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
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:5353
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
@ fWithCommas
Use commas as thousands separator.
Definition: ncbistr.hpp:254
unsigned int usec
microseconds (modulo 1,000,000)
Definition: ncbi_types.h:78
unsigned int sec
seconds
Definition: ncbi_types.h:77
static const char label[]
TTo GetTo(void) const
Get the To member data.
Definition: Range_.hpp:269
TFrom GetFrom(void) const
Get the From member data.
Definition: Range_.hpp:222
Tdata & Set(void)
Assign a value to data member.
list< CRef< CGenetic_code > > Tdata
const Tdata & Get(void) const
Get the member data.
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
@ eNa_strand_plus
Definition: Na_strand_.hpp:66
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ eNa_strand_both
in forward orientation
Definition: Na_strand_.hpp:68
n background color
int i
static MDB_envinfo info
Definition: mdb_load.c:37
#define wxT(x)
Definition: muParser.cpp:41
vector< CItem * > TItems
Definition: pt_item.hpp:113
range(_Ty, _Ty) -> range< _Ty >
constexpr bool empty(list< Ts... >) noexcept
double value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:228
T negative(T x_)
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
static void help(void)
Definition: pcregrep.c:870
USING_SCOPE(objects)
SStaticPair< const char *, CSixFramesTransTrack::ETranslation > TTranslationStr
CSixFramesTransTrack.
DEFINE_STATIC_ARRAY_MAP(TTransMap, sm_TransMap, s_TransStrs)
static const string kDefProfile
static const int kMaxOrfLen
static const TTranslationStr s_TransStrs[]
static const string kTrackTitle
SStaticPair< const char *, CSixFramesTransTrack::EStrandOption > TOptionStr
static const TOptionStr s_OptionStrs[]
CStaticArrayMap< string, CSixFramesTransTrack::ETranslation > TTransMap
CStaticArrayMap< string, CSixFramesTransTrack::EStrandOption > TOptionMap
static const TSeqPos kTransRangeLimit
largest sequence range we will do sequence translations.
static const int kContentBaseID
static const string kBaseKey
A help struct for storing information about a icon.
extra parameter for initializing a track.
int m_Level
layout level that limits feature retrieving used by annotation selector.
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
Definition: static_set.hpp:60
Timeout structure.
Definition: ncbi_types.h:76
Definition: inftrees.h:24
else result
Definition: token2.c:20
void UseDefaultMarginWidth(wxMenu &menu)
Using default menu item margin width.
Definition: wx_utils.cpp:693
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Thu Mar 28 17:09:36 2024 by modify_doxy.py rev. 669887