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

Go to the SVN repository for this file.

1 /* $Id: seqgraphic_alignment_ds.cpp 46423 2021-05-03 13:07:27Z shkeda $
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  */
29 
30 #include <ncbi_pch.hpp>
39 #include <objmgr/data_loader.hpp>
40 #include <objmgr/graph_ci.hpp>
41 
44 
45 #include <util/checksum.hpp>
46 #include <objmgr/util/sequence.hpp>
48 
49 
52 
53 
54 ///////////////////////////////////////////////////////////////////////////////
55 /// CSGAlignmentDS
56 ///////////////////////////////////////////////////////////////////////////////
57 
58 /// number of gradient colors in alignment
59 static const int kColorGradNumber = 64;
60 
62  : CSGGenBankDS(scope, id)
63  , m_AlnType(IAlnExplorer::fInvalid)
64  , m_Enabled(false)
65  , m_LinkMatePairs(true)
66  , m_HasCoverageGraph(false)
67  , m_HasQualityMap(false)
68  , m_ScoreToken(kInvalidJobToken)
69  , m_ScoringJobID(-1)
70  , m_HideSra(CAlignmentConfig::eHide_None)
71  , m_UnalignedTailsMode(CAlignmentConfig::eTails_ShowGlyph)
72  , m_MaxStartTail(0)
73  , m_MaxEndTail(0)
74 {
75 }
76 
78 {
79  // gbench: always release memory
80  // sviewer: release memory if there is a need
81  if (!m_CgiMode || NeedReleaseMemory())
82  ReleaseMemory();
83 }
84 
86  string protein_method)
87 {
88  m_DNAMethod = dna_method;
89  m_ProtMethod = protein_method;
90 }
91 
92 
93 void CSGAlignmentDS::x_GetGraphCacheKey(string& data_key) const
94 {
95  string remote_path = m_RemotePath.empty() ? m_AnnotName : m_RemotePath;
96  data_key = CPileUpGraph::CreateCacheKey(m_Handle.GetScope(), *m_Handle.GetSeqId(), remote_path);
97 }
98 
99 
101 {
102 
103  if (range.GetLength() == 0)
104  return 0;
105 
106  vector<TSeqRange> missing_ranges;
107  missing_ranges.emplace_back(range.GetFrom(), range.GetTo());
108  if (m_HasPileUpCache) {
109  string cache_key;
110  x_GetGraphCacheKey(cache_key);
112  if (data) {
113  missing_ranges.clear();
114  data->GetMissingRegions(range, missing_ranges);
115  }
116  }
117 
118  double cost_in_sec = 0.;
119  if (!missing_ranges.empty()) {
120  SAnnotSelector graph_sel =
122  CSeqUtils::SetAnnot(graph_sel, m_AnnotName + " pileup graphs");
124  graph_sel.SetCollectCostOfLoading();
125  for (auto& r : missing_ranges) {
126  CGraph_CI graph_iter(m_Handle, r, graph_sel);
127  auto cost = graph_iter.GetCostOfLoadingInSeconds();
128  cost_in_sec = max(cost_in_sec, cost);
129  }
130  }
131  return cost_in_sec;
132 }
133 
135 {
136  if (!m_HasPileUpCache)
137  return false;
138 
139  if (range.GetLength() == 0)
140  return false;
141 
142  string cache_key;
143  x_GetGraphCacheKey(cache_key);
145  vector<TSeqRange> missing_ranges;
146  if (data) {
147  data->GetMissingRegions(range, missing_ranges);
148  } else {
149  missing_ranges.emplace_back(range.GetFrom(), range.GetTo());
150  }
151  int len = 0;
152  for (auto& r : missing_ranges) {
153  len += r.GetLength();
154  }
155  return len <= 40000;
156 }
157 
159 {
160  double cost_in_sec = 0.;
161  SAnnotSelector aln_sel =
165  aln_sel.SetCollectCostOfLoading();
166  CAlign_CI align_iter(m_Handle, range, aln_sel);
167  cost_in_sec = align_iter.GetCostOfLoadingInSeconds();
168  return cost_in_sec;
169 }
170 
171 string s_fromatstr(Uint8 bytes)
172 {
173  static const double log_1024 = log(1024);
174  if (bytes < 1024)
175  return NStr::NumericToString(bytes) + " B";
176  int exp = (int)(log(bytes) / log_1024);
177  string suffix = "KMGTPE";
178  suffix = suffix.substr(exp - 1, 1);
179  return ToStdString(wxString::Format(_T("%.1f %sB"), bytes / pow(1024, exp), suffix.c_str()));
180 }
181 
183 {
184  if (m_HasCoverageGraph == false || !m_DataHandle)
185  return false;
186  auto used_memory = m_DataHandle.GetUsedMemory();
187  return used_memory > m_MemoryLimit;
188 }
189 
190 
192 {
193  if (m_HasCoverageGraph == false || !m_DataHandle)
194  return;
195  try {
196  DeleteAllJobs();
198  auto used_memory = m_DataHandle.GetUsedMemory();
199  GetScope().RemoveFromHistory(m_DataHandle, CScope::eThrowIfLocked);// CScope::eKeepIfLocked)
200  if (used_memory > m_MemoryLimit)
201  ERR_POST(Info << "Alignments high memory usage: " << s_fromatstr(used_memory) << " released");
202  } catch (CException& /*e*/) {
203  // Ignore errors
204  //ERR_POST(Error << e.GetMsg());
205  }
206 
207 }
208 
210  TModelUnit window,
211  TJobToken token)
212 {
214 
216  SAnnotSelector graph_sel =
218  CSeqUtils::SetResolveDepth(graph_sel, true, m_Depth);
219  CSeqUtils::SetAnnot(graph_sel, m_AnnotName);
220 
221  job.Reset(new CSGAlignmentJob("Alignment coverage graph",
222  m_Handle, graph_sel, range, window, m_MaxStartTail, m_MaxEndTail));
223 
224  if (job) {
225  job->SetToken(token);
226  job->SetHideSra(m_HideSra);
227  job->SetUnalignedTailsMode(m_UnalignedTailsMode);
228  job->SetShowSecondPass(m_ShowSecondPass);
229  x_LaunchJob(*job);
230  }
231 }
232 
233 
235  TModelUnit window,
236  int align_limit,
237  bool smear_if_overlimit,
238  TJobToken token)
239 {
241 
242  SAnnotSelector sel =
246 
247  CSGAlignmentJob* aln_job =
248  new CSGAlignmentJob("Alignment", m_Handle, sel, range, window, align_limit,
249  smear_if_overlimit, m_LinkMatePairs, m_MaxStartTail, m_MaxEndTail);
250  job.Reset(aln_job);
251  aln_job->SetSortBy(m_SortBy);
252 
253  if (job) {
254  job->SetToken(token);
255  job->SetHideSra(m_HideSra);
256  job->SetUnalignedTailsMode(m_UnalignedTailsMode);
257  job->SetShowSecondPass(m_ShowSecondPass);
258  job->SetLayoutPolicy(m_LayoutPolicy);
259  x_LaunchJob(*job);
260  }
261 }
262 
263 /*
264 void CSGAlignmentDS::LoadAlignments(const TSeqRange& range,
265  TModelUnit window, int smear_cutoff,
266  TJobToken token)
267 {
268  CRef<CSGAnnotJob> job;
269 
270  SAnnotSelector sel =
271  CSeqUtils::GetAnnotSelector(CSeq_annot::C_Data::e_Align);
272  CSeqUtils::SetAnnot(sel, m_AnnotName);
273  CSeqUtils::SetResolveDepth(sel, m_Adaptive, m_Depth);
274 
275  if (m_HasCoverageGraph) {
276  SAnnotSelector graph_sel =
277  CSeqUtils::GetAnnotSelector(CSeq_annot::C_Data::e_Graph);
278  CSeqUtils::SetResolveDepth(graph_sel, true, m_Depth);
279  CSeqUtils::SetAnnot(graph_sel, m_AnnotName);
280 
281  job.Reset(new CSGAlignmentJob("Alignment", m_Handle, sel, graph_sel, range,
282  window, smear_cutoff, m_LinkMatePairs, true));
283  } else {
284  job.Reset(new CSGAlignmentJob("Alignment", m_Handle, sel, sel, range,
285  window, smear_cutoff, m_LinkMatePairs, false));
286  }
287 
288  if (job) {
289  job->SetToken(token);
290  x_LaunchJob(*job);
291  }
292 }
293 */
294 
295 bool CSGAlignmentDS::CanShowRange(const TSeqRange& range, int align_limit)
296 {
297  if (!m_HasPileUpCache)
298  return true;
299  bool res = true;
300  string cache_key;
301  x_GetGraphCacheKey(cache_key);
303  if (data) {
304  auto num_reads = data->GetNumberOfReads(range);
305  if (num_reads > 0)
306  res = num_reads < align_limit;
307  }
308  return res;
309 }
310 
311 
313 {
314  if (!m_HasPileUpCache)
315  return false;
316  string cache_key;
317  x_GetGraphCacheKey(cache_key);
319  if (!data)
320  return false;
321 
322  vector<TSeqRange> missing_ranges;
323  data->GetMissingRegions(range, missing_ranges);
324  if (missing_ranges.empty())
325  return true;
326 
327  return false;
328 }
329 
330 
332  const TSeqRange& range,
333  TModelUnit window,
334  TJobToken token)
335 {
336 
337  SAnnotSelector aln_sel =
341 
342  SAnnotSelector graph_sel =
344  CSeqUtils::SetAnnot(graph_sel, m_AnnotName + " pileup graphs");
346 
347  string cache_key;
348 
349  if (m_HasPileUpCache)
350  x_GetGraphCacheKey(cache_key);
351 
353  "pileup graph", m_Handle, aln_sel, graph_sel, range, aligns, window, cache_key));
354  job->SetToken(token);
355  x_LaunchJob(*job);
356 }
357 
358 
360  TModelUnit window,
361  vector< CRef<CAlignGlyph> > aligns,
362  const vector<int>& projected_feats,
363  TJobToken token)
364 {
366  ITERATE (vector<int>, iter, projected_feats) {
367  if (*iter < CSeqFeatData::eSubtype_max &&
368  *iter > CSeqFeatData::eSubtype_bad) {
370  }
371  }
372  CRef<CSGAlignmentJob> job(new CSGAlignmentJob("AlignmentFeature", m_Handle,
373  sel, range, window, aligns, m_MaxStartTail, m_MaxEndTail));
374  job->SetToken(token);
375  job->SetHideSra(m_HideSra);
376  job->SetUnalignedTailsMode(m_UnalignedTailsMode);
377  job->SetShowSecondPass(m_ShowSecondPass);
378  x_LaunchJob(*job);
379 }
380 
381 
383  const CSeqGlyph* obj) const
384 {
386  try {
387  if (const CAlignGlyph* aln =
388  dynamic_cast<const CAlignGlyph*>(obj)) {
389  alnType = aln->GetAlignMgr().GetAlignType();
390  } else if (const CMatePairGlyph* mp =
391  dynamic_cast<const CMatePairGlyph*>(obj)){
392  const CAlignGlyph* aln = mp->GetSeqAligns().front();
393  alnType = aln->GetAlignMgr().GetAlignType();
394  }
395  } catch (CException& e) {
396  LOG_POST(Warning << "Can't determine alignment type due to an error: "
397  << e.GetMsg()); }
398 
399  return alnType;
400 }
401 
402 
404 {
406  vector<string> annots;
407  annots.push_back(m_AnnotName);
411  }
412 
413  return m_AlnType;
414 }
415 
416 const string& CSGAlignmentDS::GetDataLoader() const
417 {
418  if (m_DataLoader == "none") {
419  m_DataLoader.clear();
420  vector<string> annots;
421  annots.push_back(m_AnnotName);
423  sel.SetMaxSize(1);
424  sel.SetCollectNames(false);
425  CAlign_CI aln_iter(m_Handle, TSeqRange::GetWhole(), sel);
426  if (aln_iter.GetSize()) {
427  CDataLoader* loader = aln_iter.GetAnnot().GetTSE_Handle().GetDataLoader();
428  if (loader) {
429  if (dynamic_cast<CBAMDataLoader*>(loader))
431  else if (dynamic_cast<CCSRADataLoader*>(loader))
433  else
434  m_DataLoader = loader->GetName();
435  }
436  }
437  }
438  return m_DataLoader;
439 }
440 
442 {
443 public:
444  virtual bool Select(const IUITool& tool)
445  {
446  return dynamic_cast<const IScoringMethod*>(&tool) != NULL;
447  }
448 };
449 
450 
453 {
454  x_InitScoringMethods(aln_type);
455 
456  if (aln_type == IAlnExplorer::fMixed ||
457  aln_type == IAlnExplorer::fProtein) {
458  return m_ProteinMethods;
459  }
460 
461  return m_DNAMethods;
462 }
463 
464 
466 {
467  if (m_ProteinMethods.empty()) {
469  }
470 
472  CIRef<IScoringMethod> tmp_meth = *it;
473  if (tmp_meth->GetName() == name) {
474  return true;
475  }
476  }
477  return false;
478 }
479 
480 
482 {
484  return true;
485  }
486 
487  if (m_DNAMethods.empty()) {
489  }
490 
491  ITERATE (TMethods, it, m_DNAMethods) {
492  CIRef<IScoringMethod> tmp_meth = *it;
493  if (tmp_meth->GetName() == name) {
494  return true;
495  }
496  }
497  return false;
498 }
499 
500 
501 ////////////////////////////////////////////////////////////////
503 {
504  if (aln->GetAlignMgr().GetBaseWidth(0) != (TSeqPos)-1) {
505  const TAlnAnchorPair& align_pair = aln->GetAlnAnchorPair();
506  IAlnExplorer::EAlignType sc_type = GetAlignType(aln);
507  if (sc_type == IAlnExplorer::fDNA &&
509  aln->GetAlignMgr().GetNumRows() == 2) {
510  InitAlignQualityScore(aln, align_pair, sc_type);
511  } else {
512  InitAlignScoreCache(aln, align_pair, sc_type);
513  }
514  }
515 }
516 
517 
519  const TAlnAnchorPair& align_pair,
520  IAlnExplorer::EAlignType sc_type)
521 {
522  const IAlnGraphicDataSource& aln_mgr = aln->GetAlignMgr();
523  bool new_score = true;
524  if (aln_mgr.IsPartial() == false) {
525  TAlnScoreMap::iterator iter = m_AlnScoreMap.find(align_pair);
526  if (iter != m_AlnScoreMap.end() && iter->second->HasScores()) {
527  aln->SetScore(*iter->second);
528  new_score = false;
529  }
530  }
531  else {
532  m_PartialAlnSet.insert(align_pair);
533  }
534  if (new_score) {
535  CIRef<ISGAlnScore> cache(new CSGAlnQualityScore(aln_mgr.GetAnchor(), aln->GetAlignment(), GetScope()));
536  aln->SetScore(*cache);
537  m_AlnScoreMap[align_pair] = cache;
538  }
539 }
540 
541 
543  const TAlnAnchorPair& align_pair,
544  IAlnExplorer::EAlignType sc_type)
545 {
546  CRef<CScoreCache> cache;
547  const IAlnGraphicDataSource& aln_mgr = aln->GetAlignMgr();
548  if (aln_mgr.IsPartial() == false) {
549  TAlnScoreMap::iterator iter = m_AlnScoreMap.find(align_pair);
550  if (iter != m_AlnScoreMap.end() && iter->second->HasScores()) {
551  aln->SetScore(*iter->second);
552  CSGAlnOtherScore* other_score = dynamic_cast<CSGAlnOtherScore*>(iter->second.GetPointer());
553  _ASSERT(other_score);
554  cache.Reset(&other_score->GetScoreCache());
555  }
556  } else {
557  m_PartialAlnSet.insert(align_pair);
558  }
559  if (!cache) {
560  // add to map
561  cache.Reset(new CScoreCache());
562  cache->EnableBackgoundProcessing(false);
563  cache->SetListener(NULL);
565  CIRef<ISGAlnScore> score(new CSGAlnOtherScore(*cache));
566 
567  //CRef<CScoreAlignmentDS> sa_ds(new CScoreAlignmentDS(aln_mgr) );
568  cache->SetAlignment(&aln_mgr);
569  m_AlnScoreMap[align_pair] = score;
570  aln->SetScore(*score);
571  }
572 
573  x_InitScoringMethods(sc_type);
574 
575  TMethods* methods = NULL;
576  string name = kEmptyStr;
577  if (sc_type == IAlnExplorer::fDNA && m_DNAMethod != "") {
578  methods = &m_DNAMethods;
579  name = m_DNAMethod;
580  } else if ((sc_type == IAlnExplorer::fProtein ||
581  sc_type == IAlnExplorer::fMixed) && m_ProtMethod != "") {
582  methods = &m_ProteinMethods;
583  name = m_ProtMethod;
584  }
585 
586  if (methods) {
587  IScoringMethod* method = NULL;
588  ITERATE (TMethods, it, *methods) {
589  CIRef<IScoringMethod> tmp_meth = *it;
590  if (tmp_meth->GetName() == name) { // found it
591  method = tmp_meth.GetPointer();
592  break;
593  }
594  }
595 
596  if (method) {
597  if (cache->GetScoringMethod() != method) {
598  if (cache->HasScores()) {
599  cache->ResetScores();
600  }
601  cache->SetScoringMethod(method);
602  }
603  }
604  }
605 }
606 
607 
609  TJobToken token)
610 {
611  if (objs.empty()) return;
612 
613  if (x_IsScoringJobRunning()) {
615  } else {
617  }
618 
619  CAlignGlyph* first_aln = dynamic_cast<CAlignGlyph*>(objs.front().GetPointer());
620  if ( !first_aln ) {
621  CMatePairGlyph* first_mp = dynamic_cast<CMatePairGlyph*>(objs.front().GetPointer());
622  first_aln = first_mp->SetSeqAligns().front().GetPointer();
623  }
624 
625  if (GetDNAScoringMethod() == "Show Differences" && first_aln &&
626  first_aln->GetAlignMgr().IsCigarUnambiguous()) {
628  NON_CONST_ITERATE (CSeqGlyph::TObjects, iter, objs) {
629  CAlignGlyph* aln = dynamic_cast<CAlignGlyph*>(iter->GetPointer());
630  CMatePairGlyph* mp = dynamic_cast<CMatePairGlyph*>(iter->GetPointer());
631  if (aln) {
632  CConstIRef<ISGAlnScore> cigar_score(new CAlignCigarScore(aln->GetAlignMgr()));
633  aln->SetScore(*cigar_score);
634  } else if (mp) {
636  NON_CONST_ITERATE(CMatePairGlyph::TAlignList, aln_iter, aligns) {
637  CConstIRef<ISGAlnScore> cigar_score(new CAlignCigarScore(aln->GetAlignMgr()));
638  aln->SetScore(*cigar_score);
639  }
640  }
641  }
642  } else {
643  if ( !m_AlnScoreMap.empty() ) {
644  const string& used_method = m_AlnScoreMap.begin()->second->GetScoringMethod();
646  used_method == CSGAlnQualityScore::GetScoreName()) &&
647  GetDNAScoringMethod() != used_method) {
649  }
650  }
651 
652  // Remove all the unfinished score caches.
653  // Maybe some of unfinished alignments (score) are not visible in the
654  // current viewed range. To avoid calculating scores for invisible alignments
655  // and long alignment score calculating time, remove the unfinished ones. It
656  // is possible some of the removed ones are in current visible range. Those will
657  // be added latter
658  TAlnScoreMap temp_map;
660  if (iter->second->HasScores()) {
661  temp_map.emplace(iter->first, iter->second);
662  }
663  }
664  m_AlnScoreMap.swap(temp_map);
665 
666  NON_CONST_ITERATE (CSeqGlyph::TObjects, iter, objs) {
667  CAlignGlyph* aln = dynamic_cast<CAlignGlyph*>(iter->GetPointer());
668  CMatePairGlyph* mp = dynamic_cast<CMatePairGlyph*>(iter->GetPointer());
669  if (aln) {
670  InitAlignScore(aln);
671  } else if (mp) {
673  for_each(aligns.begin(), aligns.end(), [this](CRef<CAlignGlyph>& aln) {
674  InitAlignScore(aln.GetPointer());
675  });
676  }
677  }
678 
679  //// fire the scoring job
680  m_ScoringJob = new CSGAlignScoringJob("Align scoring", m_AlnScoreMap);
681  m_ScoringJob->SetToken(token);
683  if (!m_PartialAlnSet.empty()) {
684  auto it = m_AlnScoreMap.begin();
685  auto it_end = m_AlnScoreMap.end();
686  for (; it != it_end; ) {
687  if (m_PartialAlnSet.find(it->first) != m_PartialAlnSet.end()) {
688  it = m_AlnScoreMap.erase(it);
689  } else {
690  ++it;
691  }
692  }
694  }
695  }
696 }
697 
698 
700 {
701  if (m_ScoringJobID > -1 || m_ScoringJob) {
703  m_ScoringJobID = -1;
705  }
706 }
707 
708 
710 {
711  if (job_id == m_ScoringJobID) {
713  }
714  CSGGenBankDS::ClearJobID(job_id);
715 }
716 
717 
719 {
720  if (m_ScoringJobID > -1 && m_ScoringJob) {
722  }
724 }
725 
726 
728 {
729  // make sure it has not been deleted
730  return IsJobNeeded(m_ScoringJobID) &&
732 }
733 
734 
736 {
738 
742 }
743 
744 
746 {
747  if (aln_type == IAlnExplorer::fMixed) {
748  // use protein's scoring methods for mixed alignments
749  aln_type = IAlnExplorer::fProtein;
750  } else if (aln_type == IAlnExplorer::fInvalid) {
751  // using DNA scoring methods by default
752  aln_type = IAlnExplorer::fDNA;
753  }
754 
755  TMethods* methods = &m_DNAMethods;
756  if (aln_type == IAlnExplorer::fProtein) {
757  methods = &m_ProteinMethods;
758  }
759 
760  if (methods->empty()) {
762  vector<CConstIRef<IUITool> > tools;
764  reg->GetTools(tools, sel);
765 
766  for (size_t i = 0; i < tools.size(); i++) {
767  const IScoringMethod* method =
768  dynamic_cast<const IScoringMethod*>(tools[i].GetPointer());
769  _ASSERT(method);
770  if(method && method->GetType() & aln_type) {
771  CIRef<IUITool> tool = reg->CreateToolInstance(method->GetName());
772  if (!tool) {
773  break;
774  }
775 
776  IScoringMethod* method_clone =
777  dynamic_cast<IScoringMethod*>(tool.GetPointer());
778  if (method_clone) {
779  methods->push_back(CIRef<IScoringMethod>(method_clone));
780  }
781  }
782  }
783  }
784 }
785 
786 void CSGAlignmentDS::EnablePileUpCache(bool enable, bool enable_icache)
787 {
788  m_HasPileUpCache = enable;
789  if (m_HasPileUpCache)
791 }
792 
794 {
795  if (!m_HasPileUpCache)
796  return;
797  try {
798  string cache_key;
799  x_GetGraphCacheKey(cache_key);
801  } catch (exception& e) {
802  ERR_POST(Error << e.what());
803  }
804 }
805 
806 ///////////////////////////////////////////////////////////////////////////////
807 /// CSGAlignmentDSType
808 ///////////////////////////////////////////////////////////////////////////////
810 {
811  static string sid("seqgraphic_alignment_ds_type");
812  return sid;
813 }
814 
815 
817 {
818  static string slabel("Graphical View Alignment Data Source Type");
819  return slabel;
820 }
821 
822 
825 {
826  const CSeq_id& id = dynamic_cast<const CSeq_id&>(object.object.GetObject());
827  return new CSGAlignmentDS(object.scope.GetObject(), id);
828 }
829 
830 
832 {
833  return false;
834 }
835 
836 
Checksum and hash calculation classes.
CAlign_CI –.
Definition: align_ci.hpp:63
File Description:
virtual bool Select(const IUITool &tool)
size_t GetSize(void) const
CSeq_annot_Handle GetAnnot(void) const
double GetCostOfLoadingInSeconds(void) const
Get collected cost of loading requested data in seconds.
CAppJobDispatcher.
void RemoveData(const string &data_key)
Removes Data from in-memory cache.
void EnableICache(bool value)
CRef< TData > GetData(const string &data_key)
Retrieves TData from in-memory cache or if not found calls TData::Init to initialize new TData instan...
static CGraphCache & GetInstance()
Definition: graph_cache.hpp:97
CRef< TData > GetCachedData(const string &data_key)
Retrieves TData from in-memory cache.
CGraph_CI –.
Definition: graph_ci.hpp:234
TAlignList & SetSeqAligns()
vector< CRef< CAlignGlyph > > TAlignList
static string CreateCacheKey(objects::CScope &scope, const objects::CSeq_id &seq_id, const string &remote_path)
CPileUpGraph.
CRef –.
Definition: ncbiobj.hpp:618
CSGAlignScoreJob.
CSGAlignStatJob.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual bool IsSharable() const
check if the data source can be shared.
virtual string GetExtensionIdentifier() const
CSGAlignmentDSType.
virtual ISGDataSource * CreateDS(SConstScopedObject &object) const
create an instance of the layout track type using default settings.
bool m_LinkMatePairs
link mate pair alignments
void InitAlignScoreCache(CAlignGlyph *aln, const TAlnAnchorPair &align_pair, IAlnExplorer::EAlignType sc_type)
IAlnExplorer::EAlignType GetAlignType() const
CSGAlignmentDS inline methods.
CAlignmentConfig::EHideSraAlignments m_HideSra
Flag, indicating whether to hide duplicates and/or bad reads.
bool IsRangeCached(const TSeqRange &range) const
void InitAlignScore(CAlignGlyph *aln)
Alignment scoring.
void x_GetGraphCacheKey(string &data_key) const
TJobID m_ScoringJobID
alignment scoring job id
bool x_IsScoringJobRunning() const
void LoadAlignments(const TSeqRange &range, TModelUnit window, int align_limit, bool smear_if_overlimit, TJobToken token)
bool IsGraphCached(const TSeqRange &range) const
bool CanShowRange(const TSeqRange &range, int align_limit)
TMethods m_DNAMethods
registered DNA scoring methods
TSignedSeqPos m_MaxEndTail
Max length of unaligned tail at the end of the sequence.
TSignedSeqPos m_MaxStartTail
> Flag to show second-pass alignments (relevant to assembly to assembly alignments)
bool IsValidProteinScoringMethod(const string &name)
string m_RemotePath
url to the remote data
CAlignmentConfig::EUnalignedTailsMode m_UnalignedTailsMode
Flag, indicating whether and how to display unaligned tails.
void LoadAlignFeats(const TSeqRange &range, TModelUnit window, vector< CRef< CAlignGlyph > > aligns, const vector< int > &projected_feats, TJobToken token)
bool m_HasQualityMap
Has quality map? (e.g. cSRA alignments)
void SetDefaultScoringMethods(string dna_method, string protein_method)
objects::CTSE_Handle m_DataHandle
The last loaded data.
void EnablePileUpCache(bool enable, bool enable_icache)
Uint8 m_MemoryLimit
NeedReleaseMemory's default limit 2GB.
TMethods m_ProteinMethods
registered Protein scoring methods
const TMethods & GetScoringMethods(IAlnExplorer::EAlignType aln_type)
get all the existing align scoring methods.
virtual void DeleteAllJobs()
Remove waiting jobs from queue or cancel the unfinished jobs.
CRef< CSGAlignScoringJob > m_ScoringJob
IAlnExplorer::EAlignType InitAlignType(bool isFastConfig=false)
This method might need object manager to connect to ID, and it is a block call.
set< TAlnAnchorPair > m_PartialAlnSet
bool m_CgiMode
sviewer context
list< CIRef< IScoringMethod > > TMethods
keep instances of score methods here.
double GetAlignmentCost(const TSeqRange &range) const
void CalculateAlignmentScore(CSeqGlyph::TObjects &objs, TJobToken token)
void LoadCoverageGraph(const TSeqRange &range, TModelUnit window, TJobToken token)
CAlignGlyph::TAlnAnchorPair TAlnAnchorPair
bool IsValidDNAScoringMethod(const string &name)
CIRef< ILayoutPolicy > m_LayoutPolicy
double GetGraphCost(const TSeqRange &range) const
CSGAlignmentDS(objects::CScope &scope, const objects::CSeq_id &id)
void CalcAlnStat(const TAlnMgrVec &aligns, const TSeqRange &range, TModelUnit window, TJobToken token)
bool m_HasCoverageGraph
High level coverage graph?
vector< CConstRef< IAlnGraphicDataSource > > TAlnMgrVec
string m_DNAMethod
default scoring method for DNA alignments
const string & GetDataLoader() const
virtual void ClearJobID(TJobID job_id)
IAlnExplorer::EAlignType m_AlnType
const string & GetDNAScoringMethod() const
void InitAlignQualityScore(CAlignGlyph *aln, const TAlnAnchorPair &align_pair, IAlnExplorer::EAlignType sc_type)
void x_InitScoringMethods(IAlnExplorer::EAlignType aln_type)
string m_ProtMethod
default scoring method for protein alignments
static IAlnExplorer::EAlignType GetAlignType(const objects::CBioseq_Handle &handle, objects::SAnnotSelector &sel, bool &has_quality_map, bool isFastConfig=false)
when isFastConfig set to true, it indicates that that the call is used by seqconfig this means that s...
void SetSortBy(const string &sort_by)
CScoreCache & GetScoreCache()
static const string & GetScoreName()
bool IsJobNeeded(TJobID job_id) const
TJobID x_LaunchJob(IAppJob &job, int report_period=1, const string &pool="ObjManagerEngine")
Launch either a background or foreground job.
bool m_Adaptive
adaptive/exact annot selector
int m_Depth
annotation resolving depth
CAppJobDispatcher::TJobID TJobID
objects::CScope & GetScope(void) const
Get the scope from the handle.
virtual void ClearJobID(TJobID job_id)
virtual void DeleteAllJobs()
Remove waiting jobs from queue or cancel the unfinished jobs.
objects::CBioseq_Handle m_Handle
CScope –.
Definition: scope.hpp:92
void SetScoringMethod(IScoringMethod *method)
void SetAlignment(const IScoringAlignment *aln)
bool HasScores() const
returns "true" if CalculateScores() did produce results
void ResetScores()
IScoringMethod * GetScoringMethod()
void EnableBackgoundProcessing(bool en)
Definition: aln_scoring.cpp:97
void SetListener(IListener *listener)
Definition: aln_scoring.cpp:91
void SetGradNumber(int grad_n)
Sets the number of score gradations.
@ eSubtype_bad
These no longer need to match the FEATDEF values in the C toolkit's objfdef.h.
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
Definition: seq_glyph.hpp:82
list< CRef< CSeqGlyph > > TObjects
Definition: seq_glyph.hpp:85
void SetToken(TJobToken token)
CSeqGraphicJob inline methods.
CDataLoader * GetDataLoader(void) const
Definition: tse_handle.cpp:128
CUIToolRegistry - is a registry providing access to various tools registred in the application.
static CUIToolRegistry * GetInstance()
CIRef< IUITool > CreateToolInstance(const string &method_name)
factory method, returns NULL if name is invalid.
void GetTools(vector< CConstIRef< IUITool > > &tools, ISelector &selector) const
Alignment explorer interface.
IAlnGraphicDataSource - interface to a data source representing an abstract alignment used in graphic...
virtual bool IsCigarUnambiguous() const
Check if cigar doesn't have ambiguous M's.
virtual IAlnExplorer::EAlignType GetAlignType() const
File Description:
virtual TSeqPos GetBaseWidth(IAlnExplorer::TNumrow) const =0
virtual IAlnExplorer::TNumrow GetNumRows() const =0
virtual IAlnExplorer::TNumrow GetAnchor() const =0
IScoringMethod represents an abstract algorithm for calculating alignment scores and assigning colors...
virtual int GetType() const =0
returns combination of EAlignType flags defining types of alignments that can be colored with this me...
IUITool represents an abstract algorithm that is bound to a UI component.
Definition: ui_tool.hpp:59
virtual string GetName() const =0
returns unique name of the method that is used in UI to identify it
void erase(iterator pos)
Definition: map.hpp:167
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
bool empty() const
Definition: map.hpp:149
void clear()
Definition: map.hpp:169
const_iterator find(const key_type &key) const
Definition: map.hpp:153
void swap(this_type &m)
Definition: map.hpp:118
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
void clear()
Definition: set.hpp:153
bool empty() const
Definition: set.hpp:133
const_iterator find(const key_type &key) const
Definition: set.hpp:137
const_iterator end() const
Definition: set.hpp:136
@ fInvalid
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
char data[12]
Definition: iconv.c:80
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 NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define NULL
Definition: ncbistd.hpp:225
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
#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
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
TAlnAnchorPair GetAlnAnchorPair(void) const
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
Definition: utils.cpp:167
const IAlnGraphicDataSource & GetAlignMgr(void) const
Inline methods.
static void SetAnnot(objects::SAnnotSelector &sel, const string &annot)
help function for setting up an annotation.
Definition: utils.cpp:320
void SetScore(const ISGAlnScore &score)
const objects::CSeq_align & GetAlignment(void) const
static void SetResolveDepth(objects::SAnnotSelector &sel, bool adaptive, int depth=-1)
help function for setting selector resolve depth.
Definition: utils.cpp:405
GLdouble TModelUnit
Definition: gltypes.hpp:48
static CAppJobDispatcher & GetInstance()
bool DeleteJob(TJobID job_id)
when a Job is deleted the listener is not notified
string GetName(void) const
@ eThrowIfLocked
Definition: scope.hpp:344
const CTSE_Handle & GetTSE_Handle(void) const
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
SAnnotSelector & SetCollectNames(bool value=true)
Collect available annot names rather than annots.
SAnnotSelector & SetMaxSize(TMaxSize max_size)
Set maximum number of annotations to find.
SAnnotSelector & SetCollectCostOfLoading(bool value=true)
Collect cost of loading requested data.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
static TThisType GetWhole(void)
Definition: range.hpp:272
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
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
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
int i
int len
range(_Ty, _Ty) -> range< _Ty >
T max(T x_, T y_)
Format
Definition: njn_ioutil.hpp:52
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const char * suffix[]
Definition: pcregrep.c:408
USING_SCOPE(objects)
string s_fromatstr(Uint8 bytes)
static const int kColorGradNumber
CSGAlignmentDS.
static const string kCSRADataLoader
static const string kBamDataLoader
static const int kInvalidJobToken
SAnnotSelector –.
#define _ASSERT
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Sat Apr 20 12:22:33 2024 by modify_doxy.py rev. 669887