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

Go to the SVN repository for this file.

1 /* $Id: segment_map_ds.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  */
29 
30 #include <ncbi_pch.hpp>
39 
40 #include <objmgr/table_field.hpp>
41 #include <objmgr/annot_ci.hpp>
43 #include <objmgr/seqdesc_ci.hpp>
44 #include <objmgr/util/sequence.hpp>
45 #include <objects/seq/MolInfo.hpp>
46 #include <objects/seq/Seq_hist.hpp>
49 
50 #include <util/cache/icache.hpp>
51 #include <corelib/perf_log.hpp>
53 
56 
57 class ICache;
58 
59 ///////////////////////////////////////////////////////////////////////////////
60 /// CSGSegmentMapJob declaration
61 ///
63 {
64 public:
65  CSGSegmentMapJob(const string& desc, objects::CBioseq_Handle handle,
66  const TSeqRange& range, int depth, int cutoff, TJobToken token);
67 
68  static int GetSegmentMapLevels(const objects::CBioseq_Handle& handle,
69  const TSeqRange& range);
70 
71  static bool HasSegmentMap(const objects::CBioseq_Handle& Handle, int level,
72  const TSeqRange& range);
73 
74 protected:
75  virtual EJobState x_Execute();
76 
77 private:
78  bool x_AdaptiveDepth() const
79  { return m_Depth == -1; }
80 
81  /// merge equal segment maps into one map.
83  CSeqGlyph::TObjects& objs);
84 
85 private:
86  objects::CBioseq_Handle m_Handle; ///< target sequence
87  TSeqRange m_Range; ///< target range
88 
89  /// Resolve depth for selector.
90  /// Valid numbers include: -1: adaptive, 0: first level, 1: second
91  /// Depending on the sequence currently shown, first level may be
92  /// the scaffolds (chromosome) or the compoments (config)
93  int m_Depth;
94 
95  /// limit of number of segments we want to show.
96  /// <=0 means there is no limit.
97  int m_Cutoff;
98 };
99 
100 ///////////////////////////////////////////////////////////////////////////////
101 /// CSGSegmentSmearJob declaration
102 ///
104 {
105 public:
106  CSGSegmentSmearJob(const string& desc, objects::CBioseq_Handle handle,
107  const TSeqRange& range, TModelUnit scale, const string& annot, ICache* cache = 0, const CSeqVector* seq_vec = nullptr);
108 
109  static void GetAnnotNames(const objects::CBioseq_Handle& handle,
110  const TSeqRange& range, objects::SAnnotSelector& sel,
111  TAnnotNameTitleMap& annots);
112 
113 protected:
114  virtual EJobState x_Execute();
115 
116 private:
118 
120 
122 
123  void x_WriteToCache(const string& key, const CSegmentSmearGlyph::CSegMap& density_map);
124 
125  string x_GetCacheKey() const;
126 
127 
128  bool x_IsGap(vector<char> is_gaps, int row) const
129  {
130  return is_gaps[row / 8] & 0x01 << (8 - row % 8);
131  }
132 
133  void x_LoadGaps();
134 
135 private:
136  TModelUnit m_Scale; ///< bases per pixel
137  string m_Annot; ///< annotation storing the segments
138  ICache* m_Cache; ///< cache to store segment ranges
140 };
141 
142 ///////////////////////////////////////////////////////////////////////////////
143 /// CSGSegmentsSeqIDJob declaration
144 ///
146 {
147 public:
148  CSGSegmentsSeqIDJob(const string& desc, CSeqGlyph::TObjects& objs,
149  objects::CScope& scope, TJobToken token);
150 
151 protected:
152  virtual EJobState x_Execute();
153 
154  CSeqGlyph::TObjects m_Objs; ///< objects for post-processing
155  objects::CScope& m_Scope; ///< scope for retrieving the CBioseq
156 };
157 
158 
159 ///////////////////////////////////////////////////////////////////////////////
160 /// CSGSwitchPointJob declaration
161 ///
163 {
164 public:
165  CSGSwitchPointJob(const string& desc, objects::CBioseq_Handle handle);
166 
167 protected:
168  virtual EJobState x_Execute();
169 
170 private:
171  objects::CBioseq_Handle m_Handle; ///< target sequence
172 };
173 
174 
175 ///////////////////////////////////////////////////////////////////////////////
176 /// CSGSegmentMapDS implementation
177 ///
178 
180 bool CSGSegmentMapDS::m_Enabled = true;
181 
183  : CSGGenBankDS(scope, id)
184  , m_IsChromosome(true)
185 {}
186 
187 
189  int cutoff, TJobToken token)
190 {
192  new CSGSegmentMapJob("SegmentMap", m_Handle,
193  range, m_Depth, cutoff, token));
194  x_LaunchJob(*job);
195 }
196 
197 
199  TModelUnit scale, const CSeqVector* seq_vec)
200 {
202  new CSGSegmentSmearJob("SegmentSmear",
203  m_Handle, range, scale, m_Annot, m_Cache, seq_vec));
204  x_LaunchJob(*job);
205 }
206 
207 
209  TJobToken token)
210 {
212  new CSGSegmentsSeqIDJob("Resolving component IDs",
213  objs, GetScope(), token) );
214  x_LaunchJob(*job);
215 }
216 
217 
219 {
221  new CSGSwitchPointJob("Switch points", m_Handle) );
222  x_LaunchJob(*job);
223 }
224 
225 
227 {
229 }
230 
231 
232 bool CSGSegmentMapDS::HasSegmentMap(int level, const TSeqRange& range) const
233 {
235 }
236 
237 
239 {
240  int level = IsChromosome() ? 1 : 0;
241  return HasSegmentMap(level, range);
242 }
243 
244 
246 {
247  if (IsChromosome()) {
248  return HasSegmentMap(0, range);
249  }
250 
251  return false;
252 }
253 
254 
255 void CSGSegmentMapDS::GetAnnotNames(objects::SAnnotSelector& sel,
256  const TSeqRange& range,
257  TAnnotNameTitleMap& names) const
258 {
259  CSeqUtils::SetResolveDepth(sel, true, -1);
261 }
262 
263 
265 {
266  int depth = x_ConceptualToRealDepth(level);
267  SetDepth(depth);
268 }
269 
271 {
272  m_Cache = pCache;
273 }
274 
275 void CSGSegmentMapDS::SetEnabled(bool enabled)
276 {
277  m_Enabled = enabled;
278 }
279 
281 {
282  return m_Enabled;
283 }
284 
286 {
287  int depth = level;
288  if ( !m_IsChromosome ) {
289  if (level == eComponent) {
290  depth = 0;
291  } else if (level == eContig) {
292  depth = -2; /// invalid
293  }
294  }
295  return depth;
296 }
297 
298 ///////////////////////////////////////////////////////////////////////////////
299 /// CSGSegmentMapDSType implementation
300 ///
303 {
304  const CSeq_id& id = dynamic_cast<const CSeq_id&>(object.object.GetObject());
305  return new CSGSegmentMapDS(object.scope.GetObject(), id);
306 }
307 
308 
310 {
311  static string sid("seqgraphic_segment_map_ds_type");
312  return sid;
313 }
314 
315 
317 {
318  static string slabel("Graphical View Segment Map Data Source Type");
319  return slabel;
320 }
321 
322 
324 {
325  return false;
326 }
327 
328 
329 
330 ///////////////////////////////////////////////////////////////////////////////
331 /// CSGSegmentMapJob implementation
332 ///
334  const TSeqRange& range, int depth,
335  int cutoff, TJobToken token)
336  : CSeqGraphicJob(desc)
337  , m_Handle(handle)
338  , m_Range(range)
339  , m_Depth(depth)
340  , m_Cutoff(cutoff)
341 {
342  SetToken(token);
343 }
344 
345 
346 int CSGSegmentMapJob::GetSegmentMapLevels(const objects::CBioseq_Handle& handle,
347  const TSeqRange& range)
348 {
351  int max_search_segs = CSeqUtils::GetMaxSearchSegments(view);
353  int total_levels = 0;
354  for (int level = 0; level < 2; ++level) {
355  int nSegs{0};
356  sel.SetResolveCount(level);
357  TSeqPos start = range.GetFrom();
358  TSeqPos stop = range.GetTo();
359  TSeqPos step = 1000000;
360  bool isMaxSegmentsReached{false};
361  while (start <= stop) {
362  TSeqRange r(start, min(start + step - 1, stop));
363  start += step;
364  CSeqMap::const_iterator seg(handle, sel, r);
365  while (seg && seg.GetType() != CSeqMap::eSeqRef) {
366  ++nSegs;
367  ++seg;
368  isMaxSegmentsReached = CSeqUtils::CheckMaxSearchSegments(nSegs, max_search_segs, action);
369  if(isMaxSegmentsReached) {
370  break;
371  }
372  }
373  if(isMaxSegmentsReached) {
374  break;
375  }
376  if(seg) {
377  ++total_levels;
378  break;
379  }
380  }
381 // LOG_POST(Trace << "Scanned: " << nSegs << " segments at level: " << level);
382  }
383  return total_levels;
384 }
385 
386 
387 bool CSGSegmentMapJob::HasSegmentMap(const objects::CBioseq_Handle& handle,
388  int level, const TSeqRange& range)
389 {
390  int max_level = 3;
392  level = min(level, max_level);
393 
394  int start_l = level;
395  int end_l = level;
396  if (level < 0) {
397  start_l = 0;
398  end_l = max_level;
399  }
400 
401  for (int l = start_l; l <= end_l; ++l) {
402  sel.SetResolveCount(l);
403  CSeqMap::const_iterator seg(handle, sel, range);
404  while (seg && seg.GetType() != CSeqMap::eSeqRef) {
405  ++seg;
406  }
407  if (seg) return true;
408  }
409  return false;
410 }
411 
412 
414 {
415  try {
418  result->m_Token = m_Token;
419 
420  // -2 means we have already known there is no data for
421  // the given level.
422  if (m_Depth == -2){
423  return eCompleted;
424  }
425 
426  bool over_limit = false;
428 
429  CSeq_id_Handle target_sih = m_Handle.GetSeq_id_Handle();
430  /*
431  LOG_POST(Info << "CSGSegmentMapJob::x_Execute() started "
432  << " SeqId=" << target_sih.AsString()
433  << " Range.GetFrom()=" << m_Range.GetFrom()
434  << " Range.GetLength()=" << m_Range.GetLength()
435  << " Depth=" << m_Depth
436  );
437  */
438 
439  for (size_t levels = 0; levels < 4; ++levels) {
441  x_AdaptiveDepth() ? levels : m_Depth);
442 
443  seg_maps.clear();
444 
445  if (IsCanceled()) {
446  return eCanceled;
447  }
448 
449  /// determine how many segments we have here
450  /// this determines if we should try to retrieve the skeletons
451  size_t seg_count = 0;
452 
453  try {
454  for (CSeqMap_CI seg(m_Handle, sel, m_Range);
455  seg && seg.GetPosition() < m_Range.GetTo();
456  ++seg)
457  {
458  if (IsCanceled()) {
459  return eCanceled;
460  }
461 
462  if (seg.GetType() == CSeqMap::eSeqRef) {
463  ++seg_count;
464  }
465  if (seg.GetEndPosition() > m_Range.GetTo()) {
466  break;
467  }
468  if (m_Cutoff > 0 && seg_count > (size_t)m_Cutoff) {
469  over_limit = true;
470  break;
471  }
472  }
473 
474  if (over_limit) break;
475 
476  // We set a limit on the number of components to retrieve. If more
477  // than kSegmentLoadLimit (see segment_map_ds.hpp) components are
478  // visible, the component overlaps will not be displayed.
479  // If the component sequence already been in scope, it will!
480  bool fetch_sequences = (seg_count < kSegmentLoadLimit);
481 
482  seg_count = 0;
483  for (CSeqMap_CI seg(m_Handle, sel, m_Range);
484  seg && seg.GetPosition() < m_Range.GetTo();
485  ++seg)
486  {
487  if (IsCanceled()) {
488  return eCanceled;
489  }
490 
491  if ( seg.GetType() == CSeqMap::eSeqRef ) {
492  ++seg_count;
493  CSeq_id_Handle sih = seg.GetRefSeqid();
494 
495  /// these are the mapped coordinates - i.e., the chunk of
496  /// the main sequence (in main sequence coordinates)
497  /// represented by this piece
498  TSeqPos seg_from = seg.GetPosition();
499  TSeqPos seg_to = seg.GetEndPosition() - 1;
500 
501  /// these are the coordinates on the actual chunk
502  TSeqPos ref_from = seg.GetRefPosition();
503  TSeqPos ref_to = seg.GetRefEndPosition() - 1;
504 
505 
506 
507  CScope::EGetBioseqFlag flag = fetch_sequences ?
510 
511  CRef<CSegmentGlyph> seqmap;
512  CBioseq_Handle bsh = m_Handle.GetScope().GetBioseqHandle(sih, flag);
513  TSeqRange ref_r = TSeqRange(ref_from, ref_to);
514  TSeqRange seg_r = TSeqRange(seg_from, seg_to);
515  bool neg = seg.GetRefMinusStrand();
516 
517  if (bsh) {
518  TSeqPos length = bsh.GetBioseqLength();
519  seqmap.Reset(new CSegmentGlyph(sih, ref_r, target_sih,
520  seg_r, neg, length));
521  } else {
522  seqmap.Reset(new CSegmentGlyph(sih, ref_r, target_sih,
523  seg_r, neg ));
524  }
525 
526  //CRef<CSeqGlyph> ref;
527  //ref.Reset(seqmap.GetPointer());
528  seg_maps.push_back(seqmap);
529  }
530  if (seg.GetEndPosition() > m_Range.GetTo()) {
531  break;
532  }
533  }
534  }
535  catch (CException& e) {
536  LOG_POST(Info << "CSGSegmentMapJob::GetSeqMaps(): "
537  "exception in retrieval of seq-maps: " << e.GetMsg());
538  }
539 
540  /// make sure we preserve the last state - it is possible we will
541  /// get through our iteration and leave maps empty
542  if (seg_maps.size()) {
544  EJobState state = x_MergeSeqSegments(seg_maps, tmp);
545  if (state != eCompleted) {
546  return state;
547  }
548  result->m_ObjectList.swap(tmp);
549  }
550 
551  if (result->Size() > 1 ||
552  (m_Range.GetLength() >= 1000000 && result->Size() > 0)) {
553  break;
554  }
555 
556  if (!x_AdaptiveDepth()) {
557  break;
558  }
559  }
560 
561  if (over_limit && result->m_ObjectList.empty()) {
562  string msg = "There are more than ";
563  msg += NStr::IntToString(m_Cutoff);
564  msg += " segments for the given range. Segment map is not shown at this zooming level!";
565  TModelUnit x = (m_Range.GetFrom() + m_Range.GetTo() ) * 0.5;
566  CRef<CSeqGlyph> message_glyph(
567  new CCommentGlyph(msg, TModelPoint(x, 0.0), true));
568  result->m_ObjectList.push_back(message_glyph);
569  }
570  } catch (CException& ex) {
571  m_Error.Reset(new CAppJobError(ex.GetMsg()));
572  return eFailed;
573  } catch (std::exception& ex) {
574  m_Error.Reset(new CAppJobError(ex.what()));
575  return eFailed;
576  }
577 
578  return eCompleted;
579 }
580 
581 
584  CSeqGlyph::TObjects& objs)
585 {
586  CSeqGlyph::TObjects merged;
587  typedef pair<const TSeqRange, CRef<CSegmentGlyph> > CSegMapPair;
589  CSegMapMap merge_map;
590  set <TSeqRange> map_keys;
591 
592  // first, build out structure
593  ITERATE(CSegmentGlyph::TSeqMapList, iter, seg_maps) {
594  if (IsCanceled()) {
595  return eCanceled;
596  }
597 
598  CRef<CSegmentGlyph> segmap = *iter;
599  const TSeqRange& range = segmap->GetLocation().GetTotalRange();
600 
601  merge_map.insert( CSegMapPair(range, segmap) ); // values
602  map_keys.insert( range ); // keys (ranges)
603  }
604 
605  // do the merger
606  ITERATE(set <TSeqRange>, iter, map_keys) {
607  if (IsCanceled()) {
608  return eCanceled;
609  }
610 
611  pair<CSegMapMap::iterator, CSegMapMap::iterator> the_bounds;
612  the_bounds = merge_map.equal_range(*iter);
613 
614  CRef<CSegmentGlyph> ref; // resulting map
615  set<TSeqRange> comp_range; // accumulated ranges
616  set<TSeqRange> mapped_range;
617  for (CSegMapMap::iterator it = the_bounds.first;
618  it != the_bounds.second; it++)
619  {
620  CSegMapPair pair = *it;
621  CRef<CSegmentGlyph> segmap = pair.second;
622 
623  ITERATE (set<TSeqRange>, cr_it, segmap->GetComponentRanges())
624  comp_range.insert(*cr_it);
625 
626  ITERATE (set<TSeqRange>, mr_it, segmap->GetMappedRanges())
627  mapped_range.insert(*mr_it);
628 
629  if (ref.Empty())
630  ref.Reset(pair.second.GetPointer());
631  }
632 
633  ref->SetComponentRanges(comp_range);
634  ref->SetMappedRanges(mapped_range);
635 
636  CRef<CSeqGlyph> obj_ref;
637  obj_ref.Reset(ref.GetPointer());
638  objs.push_back(obj_ref);
639  }
640  return eCompleted;
641 }
642 
643 
644 
645 /// utility function
647 {
648  switch (tech) {
651  return CSegmentConfig::eDraft;
654  case CMolInfo::eTech_wgs:
655  return CSegmentConfig::eWgs;
656  default:
657  return CSegmentConfig::eOther;
658  }
659 }
660 
661 ///////////////////////////////////////////////////////////////////////////////
662 /// CSGSegmentSmearJob implementation
663 ///
665  objects::CBioseq_Handle handle,
666  const TSeqRange& range,
667  TModelUnit scale,
668  const string& annot,
669  ICache* cache,
670  const CSeqVector* seq_vec)
671  : CSGAnnotJob(desc, handle,
672  CSeqUtils::GetAnnotSelector(CSeq_annot::C_Data::e_Seq_table), range)
673  , m_Scale(scale)
674  , m_Annot(annot)
675  , m_Cache(cache)
676  , m_SeqVector(seq_vec)
677 {
678  SetTaskName("Loading segment map...");
679  if ( !m_Annot.empty() ) {
680  m_Sel.AddNamedAnnots(m_Annot);
681  m_Sel.IncludeNamedAnnotAccession(m_Annot);
682  }
683 }
684 
685 
686 void CSGSegmentSmearJob::GetAnnotNames(const objects::CBioseq_Handle& handle,
687  const TSeqRange& /*range*/,
688  objects::SAnnotSelector& sel,
689  TAnnotNameTitleMap& annots)
690 {
691  sel.SetCollectNames();
692  // LOG_POST(Error << "Before CAnnotTypes_CI()");
695  // LOG_POST(Error << "After CAnnotTypes_CI()");
697  if (iter->IsNamed()) {
698  if (iter->GetName().find("@@") == string::npos) {
699  annots.insert(TAnnotNameTitleMap::value_type(iter->GetName(), ""));
700  }
701  } else {
704  }
705  }
706 
707  // In case there are more than one NA accesssions with the same accession,
708  // but different versions, we pick the most recent one.
709  TAnnotNameTitleMap::iterator pre = annots.begin();
710  while (pre != annots.end()) {
711  TAnnotNameTitleMap::iterator iter = pre;
712  ++iter;
713  if (iter != annots.end()
714  && CSeqUtils::IsNAA(pre->first, true)
715  && CSeqUtils::IsNAA(iter->first, true)
716  && pre->first.substr(0, 11) == iter->first.substr(0, 11)) {
717  annots.erase(pre);
718  }
719  pre = iter;
720  }
721 }
722 
723 
725 {
726  if (m_Cache) {
727  CConstRef<CSeq_id> id = m_Handle.GetInitialSeqIdOrNull();
728  if (!id.Empty() && id->IsLocal()) {
729  return eFailed;
730  }
731  string key = x_GetCacheKey();
732  try {
733  if (m_Cache->HasBlobs(key,""))
734  return x_LoadFromNetCache(key);
735  }
736  catch (const CException& e) {
737  LOG_POST(Warning << "CSGSegmentSmearJob::x_Execute: "
738  "failed to retrieve map from cache: " << e.GetMsg());
739  }
740  }
741  x_LoadGaps();
742  if (m_Annot.empty()) {
743  // brute force, load data from delta seqs
744  return x_LoadFromDeltaSeqs();
745  }
746  return x_LoadFromNA();
747 }
748 
749 void CSGSegmentSmearJob::x_LoadGaps() // pre-warming cache for later faster loads
750 {
751  if (!m_SeqVector)
752  return;
753 
754  TSeqPos from = m_Cache ? 0 : m_Range.GetFrom();
755  TSeqPos to = m_Cache ? m_Handle.GetBioseqLength() - 1 : m_Range.GetTo();
756 
757  CSeqVector_CI seq_vec_it(*m_SeqVector, from);
758  CSeqMap_CI it = seq_vec_it.GetCurrentSeqMap_CI();
759 
760  while(it)
761  {
762  const TSeqPos start = it.GetPosition();
763  if (start > to)
764  break;
765  auto t = it.GetType();
766  ++it;
767  }
768 }
769 
771 {
772  CLogPerformance perfLog("CSGSegmentSmearJob::x_LoadFromDeltaSeqs");
773  perfLog.AddParameter ("description", "Load segment smear map from delta seqs");
776  typedef CSegmentSmearGlyph::TValueType TValType;
777 
778  bool is_chromosome =
780  int depth = is_chromosome ? 1 : 0;
781  CSeq_id_Handle target_sih = m_Handle.GetSeq_id_Handle();
782 
783  TSeqPos r_from = m_Cache ? 0 : m_Range.GetFrom();
784  TSeqPos r_to = m_Cache ? m_Handle.GetBioseqLength() - 1 : m_Range.GetTo();
785  TSeqRange range(r_from, r_to);
786 
787  unique_ptr<CSegmentSmearGlyph::CSegMap>
788  the_map(new CSegmentSmearGlyph::CSegMap(
789  r_from, r_to,
790  (float)m_Scale, new max_func<TValType>));
791 
792  TSeqPos pre_to = r_from;
793  TValType gap_val = (TValType)CSegmentConfig::eGap;
795  using TSegData = struct {
797  TValType val;
798  size_t index;
799  };
800  vector<TSegData> data;
801  CScope::TIds ids;
802  size_t index = 0;
803  // collect gaps and for non-gaps collect list of seq_id for bulk retrieval
804  // store index, the index of seq_id in the list
805  for (CSeqMap_CI seg(m_Handle, sel, range); seg && seg.GetPosition() < r_to; ++seg) {
806  if (IsCanceled())
807  return eCanceled;
808  if ( seg.GetType() == CSeqMap::eSeqRef ) {
809  /// these are the mapped coordinates
810  TSeqPos seg_from = seg.GetPosition();
811  TSeqPos seg_to = seg.GetEndPosition() - 1;
812  if (pre_to < seg_from) {
813  data.push_back({TSeqRange(pre_to, seg_from - 1), gap_val, 0});
814  }
815  ids.push_back(seg.GetRefSeqid());
816  // val will be resolved after bulk seq_id retrieval
817  data.push_back({TSeqRange(seg_from, seg_to), (TValType)(CSegmentConfig::eOther), index});
818  ++index;
819  pre_to = seg_to + 1;
820  }
821  if (seg.GetEndPosition() > r_to) {
822  break;
823  }
824  }
825  if (pre_to < r_to)
826  data.push_back({TSeqRange(pre_to, r_to), gap_val, 0});
827 
828  // do bulk retireval
829  auto handles = m_Handle.GetScope().GetBioseqHandles(ids);
830  // update val for the retrieved seq_ids
831  // and fill the density map
832  for (auto& d : data) {
833  if (d.val != gap_val) {
834  CBioseq_Handle& bsh = handles[d.index];
835  if (bsh && bsh.CanGetInst_Mol()) {
837  if (di && di->GetMolinfo().IsSetTech()) {
838  d.val = SGetSeqQuality(di->GetMolinfo().GetTech());
839  }
840  }
841  }
842  the_map->AddRange(d.range, d.val, false);
843  }
844  // no need for data
845  data.clear();
846  if (m_Cache) {
847  x_WriteToCache(x_GetCacheKey(), *the_map);
848  if (m_Range != range)
849  the_map->SetRange(m_Range);
850  }
851  CRef<CSeqGlyph> glyph(new CSegmentSmearGlyph(the_map.release()));
852  result->m_ObjectList.push_back(glyph);
853 
854  perfLog.Post(CRequestStatus::e200_Ok);
855 
856  return eCompleted;
857 }
858 
859 
861 {
862  CLogPerformance perfLog("CSGSegmentSmearJob::x_LoadFromNA");
863  perfLog.AddParameter ("description", "Loading segment smear map from NA");
866 
867  typedef CSegmentSmearGlyph::TValueType TValType;
868  CConstRef<CSeq_loc> loc =
869  m_Handle.GetRangeSeq_loc(m_Range.GetFrom(), m_Range.GetTo());
870  CAnnot_CI it(m_Handle.GetScope(), *loc, m_Sel);
871 
872  if (it) {
873  TSeqPos r_from = m_Cache ? 0 : m_Range.GetFrom();
874  TSeqPos r_to = m_Cache ? m_Handle.GetBioseqLength() - 1 : m_Range.GetTo();
875  TSeqRange range(r_from, r_to);
876 
877  unique_ptr<CSegmentSmearGlyph::CSegMap> the_map(
878  new CSegmentSmearGlyph::CSegMap(r_from, r_to, (float)m_Scale,
879  new max_func<TValType>));
882  CTableFieldHandle<int> col_tech("data");
883  for (; it; ++it) {
884  CSeq_annot_Handle annot = *it;
885  size_t rows = annot.GetSeq_tableNumRows();
886 
887  int from = 0;
888  int to = 0;
889 
890  col_to.TryGet(annot, rows - 1, to);
891  if ((TSeqPos)to < r_from) {
892  continue;
893  }
894 
895  col_from.TryGet(annot, 0, from);
896  if (r_to < (TSeqPos)from) break;
897 
898  // for case that 'is_gap' column is stored as bit
899  const CSeq_table::TColumns& cols =
901  const CSeqTable_column* col_gap = NULL;
902  ITERATE (CSeq_table::TColumns, iter, cols) {
903  if ((*iter)->GetHeader().CanGetField_name() &&
904  (*iter)->GetHeader().GetField_name() == "is_gap") {
905  col_gap = iter->GetPointer();
906  break;
907  }
908  }
909  if ( !col_gap ) return eFailed;
910 
911  // for case that 'is_gap' column is stored as types
912  //vector<char> is_gaps;
913  //CTableFieldHandle<int> col_gap("is_gap");
914  //if ( !col_gap.TryGet(annot, 0, is_gaps) ) return eFailed;
915 
916  // find the start row
917  size_t row = 0;
918  int value = 0;
919  size_t r_start = 0;
920  size_t r_end = rows - 1;
921  bool is_gap = true;
922  do {
923  row = (r_start + r_end) / 2;
924  col_from.TryGet(annot, row, from);
925  if ((TSeqPos)from < r_from ) r_start = row;
926  else r_end = row;
927  } while ((TSeqPos)from != r_from && r_start < r_end - 1);
928 
929 
930  for (row = (r_start + r_end) / 2; (size_t)row < rows; ++row) {
931  if (col_from.TryGet(annot, row, from) &&
932  col_to.TryGet(annot, row, to) &&
933  col_tech.TryGet(annot, row, value) &&
934  col_gap->TryGetBool(row, is_gap)) {
935  if ((TSeqPos)from > r_to) break;
937  //if ( !is_gaps[row] > 0 ) {
938  if ( !is_gap ) {
940  }
941  the_map->AddRange(TSeqRange(from, to), (TValType)qual, false);
942  }
943  }
944  }
945 
946  if (m_Cache) {
947  x_WriteToCache(x_GetCacheKey(),*the_map);
948  if (m_Range != range)
949  the_map->SetRange(m_Range);
950  }
951  CRef<CSeqGlyph> hist(new CSegmentSmearGlyph(the_map.release()));
952  result->m_ObjectList.push_back(hist);
953  }
954 
955  perfLog.Post(CRequestStatus::e200_Ok);
956 
957  return eCompleted;
958 }
959 
961 {
962  _ASSERT(m_Cache);
963 
964  CLogPerformance perfLog("CSGSegmentSmearJob::x_LoadFromNetCache");
965  perfLog.AddParameter ("description", "Loading segment smear map from NetCache");
966 
967  TSeqPos r_from = m_Range.GetFrom();
968  TSeqPos r_to = m_Range.GetTo();
969 
970  unique_ptr<CSegmentSmearGlyph::CSegMap> the_map(
971  new CSegmentSmearGlyph::CSegMap(r_from, r_to, (float)m_Scale,
973 
974  unique_ptr<IReader> reader(m_Cache->GetReadStream(key, 0, ""));
975  the_map->Deserialize(*reader);
976 
977  CRef<CSeqGlyph> hist(new CSegmentSmearGlyph(the_map.release()));
980  result->m_ObjectList.push_back(hist);
981 
982  perfLog.Post(CRequestStatus::e200_Ok);
983 
984  return eCompleted;
985 }
986 
988 {
989  _ASSERT(m_Cache);
990 
991  try {
992  unique_ptr<IWriter> writer (m_Cache->GetWriteStream(key, 0, ""));
993  density_map.Serialize(*writer);
994  }
995  catch (const CException& e) {
996  LOG_POST(Warning << "CSGSegmentSmearJob::x_WriteToCache: "
997  "failed to store map to cache: " << e.GetMsg());
998  }
999 }
1000 
1002 {
1003  CNcbiOstrstream os;
1004 
1006  string name;
1007  best_idh.GetSeqId()->GetLabel(&name, CSeq_id::eContent);
1008  os << name;
1009  os << "_SM";
1010 
1011  return CNcbiOstrstreamToString(os);
1012 }
1013 
1014 ///////////////////////////////////////////////////////////////////////////////
1015 /// CSGSegmentsSeqIDJob implementation
1016 ///
1018  CSeqGlyph::TObjects& objs,
1019  objects::CScope& scope,
1020  TJobToken token)
1021  : CSeqGraphicJob(desc)
1022  , m_Objs(objs)
1023  , m_Scope(scope)
1024 {
1025  SetToken(token);
1026  SetTaskName("Resolving component seq-ids...");
1027 }
1028 
1029 
1031 {
1034  result->m_Token = m_Token;
1035  SetTaskTotal(static_cast<int>(m_Objs.size()));
1036  if (!m_Objs.empty()) {
1037  SetTaskCompleted(0);
1038  CScope::TIds ids;
1039  ids.reserve(m_Objs.size());
1040  for (auto&& iter : m_Objs) {
1041  if (IsCanceled())
1042  return eCanceled;
1043  CSeqGlyph* obj = const_cast<CSeqGlyph*>(iter.GetPointer());
1044  CSegmentGlyph* seq_map = dynamic_cast<CSegmentGlyph*>(obj);
1045  if (!seq_map)
1046  return eFailed;
1047  const CSeq_id* seq_id = seq_map->GetLocation().GetId();
1048  ids.push_back(CSeq_id_Handle::GetHandle(*seq_id));
1049  }
1050  SetTaskCompleted(ceil(0.25 * m_Objs.size()));
1051  _ASSERT(m_Objs.size() == ids.size());
1052  CScope::TBioseqHandles bshs = m_Scope.GetBioseqHandles(ids);
1053  _ASSERT(bshs.size() == ids.size());
1054  if (bshs.size() != ids.size())
1055  return eFailed;
1056  size_t i = 0;
1057  for (auto&& iter : m_Objs) {
1058  if (IsCanceled())
1059  return eCanceled;
1060  if (bshs[i] && bshs[i].CanGetInst_Mol()) {
1061  CSeqdesc_CI di(bshs[i], CSeqdesc::e_Molinfo);
1062  if (di && di->GetMolinfo().IsSetTech()) {
1063  CSeqGlyph* obj = const_cast<CSeqGlyph*>(iter.GetPointer());
1064  CSegmentGlyph* seq_map = dynamic_cast<CSegmentGlyph*>(obj);
1065  seq_map->SetSeqQuality(SGetSeqQuality(di->GetMolinfo().GetTech()));
1066  }
1067  }
1068  ++i;
1069  }
1070  }
1071  SetTaskCompleted(static_cast<int>(m_Objs.size()));
1072  return eCompleted;
1073 }
1074 
1075 
1076 ///////////////////////////////////////////////////////////////////////////////
1077 /// CSGSwitchPointJob implementation
1078 ///
1079 
1081  : CSeqGraphicJob(desc)
1082  , m_Handle(handle)
1083 {}
1084 
1086 {
1087  CSGJobResult* result = new CSGJobResult();
1089 
1090  CSeqGlyph::TObjects all_objs;
1091 
1092  CConstRef<CBioseq> bioseq = m_Handle.GetCompleteBioseq();
1093  if ( !bioseq->IsSetInst() )
1094  return eFailed;
1095 
1096  const CBioseq::TInst& inst = bioseq->GetInst();
1097  if ( !inst.IsSetHist() )
1098  return eFailed;
1099 
1100  const CSeq_hist& hist = inst.GetHist();
1101  if ( !hist.IsSetAssembly() )
1102  return eFailed;
1103 
1104  const CSeq_hist::TAssembly& assm = hist.GetAssembly();
1105  if (assm.empty()) // do nothing if no assembly at all
1106  return eFailed;
1107 
1109  ITERATE(TSeqMapSwitchPoints, iter, spoints) {
1110  if (IsCanceled()) {
1111  return eCanceled;
1112  }
1113 
1114  CRef<CSeqMapSwitchPoint> one_point = *iter;
1115 
1116  CRef<CSeqGlyph> sp(new CSwitchPointGlyph(one_point));
1117  all_objs.push_back(sp);
1118  } // ITERATE
1119 
1120  result->m_ObjectList.swap(all_objs);
1121  result->m_Token = m_Token;
1122  return eCompleted;
1123 }
1124 
1125 
1126 
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
const TAnnotNames & GetAnnotNames(void) const
CAnnot_CI –.
Definition: annot_ci.hpp:59
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CBioseq_Handle –.
CCommentGlyph – utility class for having comments in graphical glyphs.
CJobResultBase – the basic job result class holding a token.
void AddParameter(const std::string &name, const std::string &value)
void Post(CRequestStatus::ECode status=CRequestStatus::e200_Ok)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
CRef –.
Definition: ncbiobj.hpp:618
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
objects::SAnnotSelector m_Sel
our annotation selector
TSeqRange m_Range
target range
objects::CBioseq_Handle m_Handle
target sequence
TJobID x_LaunchJob(IAppJob &job, int report_period=1, const string &pool="ObjManagerEngine")
Launch either a background or foreground job.
int m_Depth
annotation resolving depth
objects::CScope & GetScope(void) const
Get the scope from the handle.
void SetDepth(int depth)
Set the annotation selector resolving depth.
objects::CBioseq_Handle m_Handle
CSGJobResult – the data structure holding the seqgraphic job results.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
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 bool IsSharable() const
check if the data source can be shared.
CSGSegmentMapDS.
bool IsChromosome() const
bool HasComponent(const TSeqRange &range) const
void LoadSegmentMap(const TSeqRange &range, int cutoff, TJobToken token)
static void SetICacheClient(ICache *pCache)
Set cache client to use.
static bool GetEnabled()
Indicates if the segment map is enabled.
void SetSegmentLevel(ESegmentLevel level)
Set which segment level to show.
void LoadSegmentSmear(const TSeqRange &range, TModelUnit scale, const objects::CSeqVector *seq_vec=nullptr)
Used in sequence track for showing segment color.
int GetSegmentMapLevels(const TSeqRange &range) const
Get total number of segment map levels.
bool HasSegmentMap(int level, const TSeqRange &range) const
Query if there is segment maps for given level.
int x_ConceptualToRealDepth(ESegmentLevel level) const
Convert conceptual segment level to real segment depth.
static ICache * m_Cache
Cache, used to store segment smear.
bool m_IsChromosome
Flag to indicate if the sequence is a chromosome sequence.
ESegmentLevel
It is not technically correct to name a specific segment level as config/scaffold and component becau...
static bool m_Enabled
Indicates if the segment map is enabled.
void GetAnnotNames(objects::SAnnotSelector &sel, const TSeqRange &range, TAnnotNameTitleMap &names) const
void LoadSegmentMapSeqIDs(CSeqGlyph::TObjects &objs, TJobToken token)
static void SetEnabled(bool enabled=true)
Enables/disables the segment map.
string m_Annot
The named annotation storing segment map data.
CSGSegmentMapDS(objects::CScope &scope, const objects::CSeq_id &id)
bool HasScaffold(const TSeqRange &range) const
CSGSegmentMapJob declaration.
static bool HasSegmentMap(const objects::CBioseq_Handle &Handle, int level, const TSeqRange &range)
objects::CBioseq_Handle m_Handle
target sequence
int m_Cutoff
limit of number of segments we want to show.
TSeqRange m_Range
target range
virtual EJobState x_Execute()
method truly doing the job.
CSGSegmentMapJob(const string &desc, objects::CBioseq_Handle handle, const TSeqRange &range, int depth, int cutoff, TJobToken token)
CSGSegmentMapJob implementation.
bool x_AdaptiveDepth() const
static int GetSegmentMapLevels(const objects::CBioseq_Handle &handle, const TSeqRange &range)
IAppJob::EJobState x_MergeSeqSegments(CSegmentGlyph::TSeqMapList &seg_maps, CSeqGlyph::TObjects &objs)
merge equal segment maps into one map.
int m_Depth
Resolve depth for selector.
CSGSegmentSmearJob declaration.
void x_WriteToCache(const string &key, const CSegmentSmearGlyph::CSegMap &density_map)
string m_Annot
annotation storing the segments
static void GetAnnotNames(const objects::CBioseq_Handle &handle, const TSeqRange &range, objects::SAnnotSelector &sel, TAnnotNameTitleMap &annots)
ICache * m_Cache
cache to store segment ranges
const CSeqVector * m_SeqVector
IAppJob::EJobState x_LoadFromNetCache(const string &key)
TModelUnit m_Scale
bases per pixel
IAppJob::EJobState x_LoadFromNA()
bool x_IsGap(vector< char > is_gaps, int row) const
virtual EJobState x_Execute()
method truly doing the job.
CSGSegmentSmearJob(const string &desc, objects::CBioseq_Handle handle, const TSeqRange &range, TModelUnit scale, const string &annot, ICache *cache=0, const CSeqVector *seq_vec=nullptr)
CSGSegmentSmearJob implementation.
string x_GetCacheKey() const
IAppJob::EJobState x_LoadFromDeltaSeqs()
CSGSegmentsSeqIDJob declaration.
objects::CScope & m_Scope
scope for retrieving the CBioseq
CSGSegmentsSeqIDJob(const string &desc, CSeqGlyph::TObjects &objs, objects::CScope &scope, TJobToken token)
CSGSegmentsSeqIDJob implementation.
virtual EJobState x_Execute()
method truly doing the job.
CSeqGlyph::TObjects m_Objs
objects for post-processing
CSGSwitchPointJob declaration.
objects::CBioseq_Handle m_Handle
target sequence
virtual EJobState x_Execute()
method truly doing the job.
CSGSwitchPointJob(const string &desc, objects::CBioseq_Handle handle)
CSGSwitchPointJob implementation.
static bool IsChromosome(const objects::CBioseq_Handle &handle, objects::CScope &scope)
CScope –.
Definition: scope.hpp:92
void SetSeqQuality(CSegmentConfig::TSegMapQuality quality)
const objects::CSeq_loc & GetLocation(void) const
access the position of this object.
vector< CRef< CSegmentGlyph > > TSeqMapList
void Serialize(IWriter &writer) const
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
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.
void SetToken(TJobToken token)
CSeqGraphicJob inline methods.
TJobToken m_Token
Job token recognizable by job listener.
CRef< CAppJobError > m_Error
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:252
bool TryGetBool(size_t row, bool &v) const
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_annot_Handle –.
CSeq_hist –.
Definition: Seq_hist.hpp:66
CSeqdesc_CI –.
Definition: seqdesc_ci.hpp:65
bool TryGet(const CFeat_CI &feat_ci, Value &v) const
Definition: table_field.hpp:78
BLOB cache read/write/maintenance interface.
Definition: icache.hpp:64
virtual IWriter * GetWriteStream(const string &key, TBlobVersion version, const string &subkey, unsigned int time_to_live=0, const string &owner=kEmptyStr)=0
Return sequential stream interface to write BLOB data.
virtual bool HasBlobs(const string &key, const string &subkey)=0
Check if any BLOB exists (any version)
virtual IReader * GetReadStream(const string &key, TBlobVersion version, const string &subkey)=0
Return sequential stream interface to read BLOB data.
File Description:
void erase(iterator pos)
Definition: map.hpp:167
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
static unsigned char depth[2 *(256+1+29)+1]
bool Empty(const CNcbiOstrstream &src)
Definition: fileutil.cpp:523
static const struct name_t names[]
#define true
Definition: bool.h:35
static char tmp[3200]
Definition: utf8.c:42
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 NULL
Definition: ncbistd.hpp:225
#define Handle
Definition: ncbistd.hpp:119
#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
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
static bool IsNAA(const string &annot, bool isStrict=false)
check if a given annotation is a named annotation accession[.version][number] when isSctrict == false...
Definition: utils.cpp:796
static int GetMaxSearchSegments(const CRegistryReadView &view)
Definition: utils.cpp:359
static objects::SAnnotSelector::EMaxSearchSegmentsAction GetMaxSearchSegmentsAction(const CRegistryReadView &view)
Definition: utils.cpp:364
static const string & GetUnnamedAnnot()
Get the commonly used symbol representing a unnnamed annotation.
Definition: utils.hpp:531
static CRegistryReadView GetSelectorRegistry()
helper functions to read selector-related tune-up info (mostly segment limits) from registry:
Definition: utils.cpp:353
static void SetResolveDepth(objects::SAnnotSelector &sel, bool adaptive, int depth=-1)
help function for setting selector resolve depth.
Definition: utils.cpp:405
static bool CheckMaxSearchSegments(int actual, int max, objects::SAnnotSelector::EMaxSearchSegmentsAction action)
check actual number of segments against max and perform the action if the actual number is more than ...
Definition: utils.cpp:378
GLdouble TModelUnit
Definition: gltypes.hpp:48
CGlPoint< TModelUnit > TModelPoint
Definition: gltypes.hpp:51
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
@ eFailed
Definition: app_job.hpp:90
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2040
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ eContent
Untagged human-readable accession or the like.
Definition: Seq_id.hpp:605
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,...
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
Definition: sequence.hpp:101
vector< CBioseq_Handle > TBioseqHandles
Definition: scope.hpp:144
EGetBioseqFlag
Definition: scope.hpp:125
vector< CSeq_id_Handle > TIds
Definition: scope.hpp:143
@ eGetBioseq_Loaded
Search in all loaded TSEs in the scope.
Definition: scope.hpp:127
@ eGetBioseq_All
Search bioseq, load if not loaded yet.
Definition: scope.hpp:128
TSeqPos GetBioseqLength(void) const
CConstRef< CSeq_annot > GetCompleteSeq_annot(void) const
Complete and return const reference to the current seq-annot.
size_t GetSeq_tableNumRows(void) const
bool CanGetInst_Mol(void) const
SSeqMapSelector & SetResolveCount(size_t res_cnt)
Set max depth of resolving seq-map.
Definition: seq_map_ci.hpp:151
CSeqMap::ESegmentType GetType(void) const
Definition: seq_map_ci.hpp:651
TSeqPos GetPosition(void) const
return position of current segment in sequence
Definition: seq_map_ci.hpp:665
const CSeqMap_CI & GetCurrentSeqMap_CI() const
vector< CRef< CSeqMapSwitchPoint > > TSeqMapSwitchPoints
TSeqMapSwitchPoints GetAllSwitchPoints(const CBioseq_Handle &seq, const TSeqMapSwitchAligns &aligns)
@ fFindAnyLeaf
Definition: seq_map.hpp:139
@ fFindExactLevel
Definition: seq_map.hpp:133
@ eSeqRef
reference to Bioseq
Definition: seq_map.hpp:100
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
position_type GetLength(void) const
Definition: range.hpp:158
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
Definition: range.hpp:419
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
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
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
const TColumns & GetColumns(void) const
Get the Columns member data.
Definition: Seq_table_.hpp:433
vector< CRef< CSeqTable_column > > TColumns
Definition: Seq_table_.hpp:92
bool IsLocal(void) const
Check if variant Local is selected.
Definition: Seq_id_.hpp:775
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
list< CRef< CSeq_align > > TAssembly
Definition: Seq_hist_.hpp:248
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:336
bool IsSetAssembly(void) const
how was this assembled? Check if a value has been assigned to Assembly data member.
Definition: Seq_hist_.hpp:500
bool IsSetHist(void) const
sequence history Check if a value has been assigned to Hist data member.
Definition: Seq_inst_.hpp:847
TTech GetTech(void) const
Get the Tech member data.
Definition: MolInfo_.hpp:497
bool IsSetInst(void) const
the sequence data Check if a value has been assigned to Inst data member.
Definition: Bioseq_.hpp:324
const TAssembly & GetAssembly(void) const
Get the Assembly member data.
Definition: Seq_hist_.hpp:512
const THist & GetHist(void) const
Get the Hist member data.
Definition: Seq_inst_.hpp:859
const TSeq_table & GetSeq_table(void) const
Get the variant data.
Definition: Seq_annot_.cpp:153
bool IsSetTech(void) const
Check if a value has been assigned to Tech data member.
Definition: MolInfo_.hpp:472
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_annot_.hpp:873
const TMolinfo & GetMolinfo(void) const
Get the variant data.
Definition: Seqdesc_.cpp:588
@ eTech_htgs_2
ordered High Throughput sequence contig
Definition: MolInfo_.hpp:138
@ eTech_htgs_3
finished High Throughput sequence
Definition: MolInfo_.hpp:139
@ eTech_htgs_1
unordered High Throughput sequence contig
Definition: MolInfo_.hpp:137
@ eTech_wgs
whole genome shotgun sequencing
Definition: MolInfo_.hpp:143
@ e_Molinfo
info on the molecule and techniques
Definition: Seqdesc_.hpp:134
Interfaces for a local cache of versioned binary large objects (BLOBS).
int i
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
EIPRangeType t
Definition: ncbi_localip.c:101
T min(T x_, T y_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Defines NCBI C++ API for timing-and-logging, classes, and macros.
USING_SCOPE(objects)
CSegmentConfig::ESequenceQuality SGetSeqQuality(CMolInfo_Base::TTech tech)
utility function
const int kSegmentLoadLimit
#define row(bind, expected)
Definition: string_bind.c:73
Selector used in CSeqMap methods returning iterators.
Definition: seq_map_ci.hpp:113
TEMPLATE STRUCT max.
Definition: density_map.hpp:88
#define _ASSERT
else result
Definition: token2.c:20
Modified on Mon May 20 05:06:13 2024 by modify_doxy.py rev. 669887