NCBI C++ ToolKit
annot_collector.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef ANNOT_COLLECTOR__HPP
2 #define ANNOT_COLLECTOR__HPP
3 
4 /* $Id: annot_collector.hpp 91808 2020-12-14 15:35:18Z grichenk $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Aleksey Grichenko, Michael Kimelman, Eugene Vasilchenko
30 *
31 * File Description:
32 * Annotation collector for annot iterators
33 *
34 */
35 
36 #include <corelib/ncbiobj.hpp>
37 #include <corelib/ncbimtx.hpp>
39 #include <objmgr/tse_handle.hpp>
44 
49 
50 #include <set>
51 #include <vector>
52 #include <memory>
53 #include <utility>
54 
56 
58 
59 class CHandleRangeMap;
60 class CHandleRange;
61 struct SAnnotObject_Index;
62 class CSeq_entry_Info;
63 class CSeq_annot_Info;
66 class CSeqTableInfo;
67 struct SSNP_Info;
68 struct SIdAnnotObjs;
71 class CSeq_feat_Handle;
72 class CMappedFeat;
73 class CAnnot_CI;
74 class CSeqMap_CI;
75 class CGraphRanges;
76 class CIdRangeMap;
77 
79 {
80 public:
81  enum FMappedFlags {
82  fMapped_Partial = 1<<0,
83  fMapped_Product = 1<<1,
84  fMapped_Seq_point = 1<<2,
85  fMapped_Partial_from = 1<<3,
86  fMapped_Partial_to = 1<<4,
87  fFromOtherTSE = 1<<5
88  };
89 
98  eMappedObjType_IdRangeMap // id/range map used for sorting
99  };
100 
101  CAnnotMapping_Info(void);
102  CAnnotMapping_Info(Int1 mapped_flags, Int1 mapped_type, Int1 mapped_strand);
103 
104  void Reset(void);
105 
106  Int1 GetMappedFlags(void) const;
107  bool IsMapped(void) const;
108  bool IsPartial(void) const;
109  bool IsProduct(void) const;
110  EMappedObjectType GetMappedObjectType(void) const;
111 
112  void SetPartial(bool value);
113  void SetProduct(bool product);
114 
115  bool IsMappedLocation(void) const;
116  bool IsMappedProduct(void) const;
117  bool IsMappedPoint(void) const;
118 
120 
121  TSeqPos GetFrom(void) const;
122  TSeqPos GetToOpen(void) const;
123  const TRange& GetTotalRange(void) const;
124  void SetTotalRange(const TRange& range);
125 
126  const CSeq_id* GetLocationId(void) const;
127  const CSeq_id* GetProductId(void) const;
128 
129  ENa_strand GetMappedStrand(void) const;
130  void SetMappedStrand(ENa_strand strand);
131 
132  bool IsFromOtherTSE(void) const;
133  void SetFromOtherTSE(bool from_other_tse = true);
134 
135  const CSeq_loc& GetMappedSeq_loc(void) const;
136  const CSeq_id& GetMappedSeq_id(void) const;
137  CSeq_loc_Conversion& GetMappedSeq_loc_Conv(void) const;
138  const CSeq_feat& GetMappedSeq_feat(void) const;
139  const CSeq_align& GetMappedSeq_align(const CSeq_align& orig) const;
140 
141  void SetMappedSeq_loc(CSeq_loc& loc);
142  void SetMappedSeq_loc(CSeq_loc* loc);
143  void SetMappedSeq_id(CSeq_id& id);
144  void SetMappedPoint(bool point);
145  void SetMappedPartial_from(void);
146  void SetMappedPartial_to(void);
147  void SetMappedSeq_id(CSeq_id& id, bool point);
148  void SetMappedConverstion(CSeq_loc_Conversion& cvt);
149  void SetMappedSeq_feat(CSeq_feat& feat);
150  void SetMappedSeq_align(CSeq_align* align);
151  void SetMappedSeq_align_Cvts(CSeq_loc_Conversion_Set& cvts);
152 
153  void SetGraphRanges(CGraphRanges* ranges);
154  const CGraphRanges* GetGraphRanges(void) const;
155 
156  bool MappedSeq_locNeedsUpdate(void) const;
157  void UpdateMappedSeq_loc(CRef<CSeq_loc>& loc,
158  CRef<CSeq_point>& pnt_ref,
159  CRef<CSeq_interval>& int_ref,
160  const CSeq_feat* orig_feat) const;
161 
162  // Copy non-modified members from original feature
163  // (all except partial flag and location/product, depending on mode.
164  void InitializeMappedSeq_feat(const CSeq_feat& src, CSeq_feat& dst) const;
165 
166  void SetAnnotObjectRange(const TRange& range, bool product);
167 
168  void SetIdRangeMap(CIdRangeMap& id_range_map);
169  const CIdRangeMap& GetIdRangeMap(void) const;
170 
172 
173 private:
174  CRef<CObject> m_MappedObject; // master sequence coordinates
176  Int1 m_MappedFlags; // partial, product
180 };
181 
182 
184 {
185 public:
187  typedef Int4 TAnnotIndex;
188  enum EAnnotType {
189  fAnnot_NoAnnotInfo = 1<<0,
190  fAnnot_SNPTable = 1<<1,
191  fAnnot_SeqTable = 1<<2,
192 
193  eAnnot_Regular = 0,
194  eAnnot_SNPTable = fAnnot_NoAnnotInfo | fAnnot_SNPTable,
195  eAnnot_SeqTable = fAnnot_SeqTable,
196  eAnnot_SortedSeqTable = fAnnot_NoAnnotInfo | fAnnot_SeqTable,
197  };
198 
199  CAnnotObject_Ref(void);
200  CAnnotObject_Ref(const CAnnotObject_Info& object,
201  const CSeq_annot_Handle& annot_handle);
202  CAnnotObject_Ref(const CSeq_annot_SNP_Info& snp_annot,
203  const CSeq_annot_Handle& annot_handle,
204  const SSNP_Info& snp_info,
205  CSeq_loc_Conversion* cvt);
206  CAnnotObject_Ref(const CSeq_annot_Handle& annot_handle,
207  const CSeq_annot_SortedIter& iter,
208  CSeq_loc_Conversion* cvt);
209 
210  // the annotation has CAnnotObject_Info object and entry in annot index
211  bool HasAnnotObject_Info(void) const;
212  // the annotation has CSeq_feat, CAnnotObject_Info, and annot index
213  bool IsPlainFeat(void) const;
214 
215  // the feature is from parsed SNP table (GenBank SNP external annotations)
216  // it doesn't have corresponding CAnnotObject_Info and entry in annot index
217  bool IsSNPTableFeat(void) const;
218  // the feature is from Seq-table
219  // it may or may not have corresponding CAnnotObject_Info and annot index
220  bool IsAnySeqTableFeat(void) const;
221  // the feature is from pre-sorted Seq-table
222  // it doesn't have corresponding CAnnotObject_Info and entry in annot index
223  bool IsSortedSeqTableFeat(void) const;
224 
225  // replaced with IsSNPTableFeat() and IsSortedSeqTableFeat()
226  NCBI_DEPRECATED bool IsSNPFeat(void) const;
227  // replaced with IsAnySeqTableFeat() and IsSortedSeqTableFeat()
228  NCBI_DEPRECATED bool IsTableFeat(void) const;
229 
230  const CSeq_annot_Handle& GetSeq_annot_Handle(void) const;
231  const CSeq_annot_Info& GetSeq_annot_Info(void) const;
232  const CSeq_annot_SNP_Info& GetSeq_annot_SNP_Info(void) const;
233  const CSeqTableInfo& GetSeqTableInfo(void) const;
234  TAnnotIndex GetAnnotIndex(void) const;
235 
236  const CAnnotObject_Info& GetAnnotObject_Info(void) const;
237  const SSNP_Info& GetSNP_Info(void) const;
238 
239  bool IsFeat(void) const;
240  bool IsGraph(void) const;
241  bool IsAlign(void) const;
242  const CSeq_feat& GetFeat(void) const;
243  const CSeq_graph& GetGraph(void) const;
244  const CSeq_align& GetAlign(void) const;
245 
246  CAnnotMapping_Info& GetMappingInfo(void) const;
247 
248  bool IsFromOtherTSE(void) const;
249  void SetFromOtherTSE(bool from_other_tse = true);
250 
251  void ResetLocation(void);
252  bool operator<(const CAnnotObject_Ref& ref) const; // sort by object
253  bool operator==(const CAnnotObject_Ref& ref) const; // sort by object
254  bool operator!=(const CAnnotObject_Ref& ref) const; // sort by object
255 
256  void Swap(CAnnotObject_Ref& ref);
257 
258 private:
259  friend class CAnnot_Collector;
260 
262  mutable CAnnotMapping_Info m_MappingInfo; // 20 or 32
265  // total size:
266  // 32 B on 32-bit system (can be packed into 28 B)
267  // 48 B on 64-bit system (can be packed into 40 B)
268 };
269 
270 
271 class CCreatedFeat_Ref : public CObject
272 {
273 public:
274  CCreatedFeat_Ref(void);
275  ~CCreatedFeat_Ref(void);
276 
277  void ResetRefs(void);
278  void ReleaseRefsTo(CRef<CSeq_feat>* feat,
279  CRef<CSeq_loc>* loc,
280  CRef<CSeq_point>* point,
281  CRef<CSeq_interval>* interval);
282  void ResetRefsFrom(CRef<CSeq_feat>* feat,
283  CRef<CSeq_loc>* loc,
284  CRef<CSeq_point>* point,
285  CRef<CSeq_interval>* interval);
286 
289  const CSeq_feat& orig_feat);
291  const CMappedFeat& feat);
293  const CSeq_feat& orig_feat);
295  const CMappedFeat& feat);
296 private:
301 };
302 
303 
304 class CSeq_annot_Handle;
305 
306 
308 
309 
311 {
312 public:
314  typedef vector<CAnnotObject_Ref> TAnnotSet;
315 
316  CAnnot_Collector(CScope& scope);
317  ~CAnnot_Collector(void);
318 
319 private:
321  CAnnot_Collector& operator= (const CAnnot_Collector&);
322 
323 
324  const TAnnotSet& GetAnnotSet(void) const;
325  CScope& GetScope(void) const;
326 
327  const SAnnotSelector& GetSelector(void) const;
328  bool CanResolveId(const CSeq_id_Handle& idh, const CBioseq_Handle& bh);
329 
330  void x_Initialize0(const SAnnotSelector& selector);
331  void x_Initialize(const SAnnotSelector& selector,
332  const CBioseq_Handle& bioseq,
333  const CRange<TSeqPos>& range,
334  ENa_strand strand);
335  void x_Initialize(const SAnnotSelector& selector,
336  const CHandleRangeMap& master_loc);
337  void x_Initialize(const SAnnotSelector& selector);
338  void x_GetTSE_Info(void);
339 
340  // Search annotations directly referencing the master sequence.
341  // The master_range specifies region of master sequence to search.
342  // Called by: x_Initialize()
343  // Calls: x_SearchTSE()
344  void x_SearchMaster(const CBioseq_Handle& bh,
345  const CSeq_id_Handle& master_id,
346  const CHandleRange& master_range);
347 
348  // Collect segment conversions used by correspondging x_SearchSegments().
349  // Called by: x_Initialize()
350  void x_CollectSegments(const CBioseq_Handle& bh,
351  const CSeq_id_Handle& master_id,
352  const CHandleRange& master_range,
353  CSeq_loc& master_loc_empty,
354  int level,
355  CSeq_loc_Conversion_Set& cvt_set);
356 
357  // Search annotations referencing sequence segments on level 'level'.
358  // The master_range specifies region of master sequence to search.
359  // The master_loc_empty is empty Seq-loc with master Seq-id for sharing.
360  // Called by: x_Initialize()
361  bool x_SearchSegments(const CBioseq_Handle& bh,
362  const CSeq_id_Handle& master_id,
363  const CHandleRange& master_range,
364  CSeq_loc& master_loc_empty,
365  int level);
366 
367  // Collect segment conversions used by correspondging x_SearchSegments().
368  // Called by: x_Initialize()
369  void x_CollectSegments(const CHandleRangeMap& master_loc,
370  int level,
371  CSeq_loc_Conversion_Set& cvt_set);
372 
373  // Search annotations referencing complex sequence location
374  // on level 'level'.
375  // The master_loc_empty is empty Seq-loc with master Seq-id for sharing.
376  // Called by: x_Initialize()
377  // Calls: x_SearchMapped()
378  bool x_SearchSegments(const CHandleRangeMap& master_loc,
379  int level);
380 
381  // Collect conversion that is used by corresponding x_SearchMapped().
382  // Called by: x_CollectSegments()
383  void x_CollectMapped(const CSeqMap_CI& seg,
384  CSeq_loc& master_loc_empty,
385  const CSeq_id_Handle& master_id,
386  const CHandleRange& master_hr,
387  CSeq_loc_Conversion_Set& cvt_set);
388 
389  // Search annotations directly referencing segment of master sequence.
390  // The master_loc_empty is empty Seq-loc with master Seq-id for sharing.
391  // The master_hr specifies region of master sequence to search.
392  // Called by: x_SearchSegments()
393  // Calls: x_SearchLoc()
394  bool x_SearchMapped(const CSeqMap_CI& seg,
395  CSeq_loc& master_loc_empty,
396  const CSeq_id_Handle& master_id,
397  const CHandleRange& master_hr);
398 
399  // Search annotations directly on a complex sequence location with mapping.
400  // The optional mapping is in agument 'cvt'.
401  // The method finds relevant set of TSEs and calls x_SearchTSE() for each.
402  // Called by: x_SearchMapped(), x_SearchRange()
403  // Calls: x_SearchTSE()
404  bool x_SearchLoc(const CHandleRangeMap& loc,
405  CSeq_loc_Conversion* cvt,
406  const CTSE_Handle* using_tse,
407  bool top_level = false);
408 
409  CBioseq_Handle x_GetBioseqHandle(const CSeq_id_Handle& id,
410  bool top_level = false) const;
411  // returns if adaptive depth heuristics should be checked for a segment
412  bool x_CheckAdaptive(const CSeq_id_Handle& id) const;
413  bool x_CheckAdaptive(const CBioseq_Handle& bh) const;
414 
415  // Search annotations within tse before filtering by source location.
416  // Called by: x_SearchLoc(), x_SearchMaster()
417  // Calls: x_SearchTSE2()
418  bool x_SearchTSE(const CTSE_Handle& tse,
419  const CSeq_id_Handle& id,
420  const CHandleRange& hr,
421  CSeq_loc_Conversion* cvt,
422  bool check_adaptive);
423 
424  // Search annotations within tse after filtering by source location.
425  // Called by: x_SearchTSE()
426  // Calls: x_SearchObjects()
427  bool x_SearchTSE2(const CTSE_Handle& tse,
428  const CSeq_id_Handle& id,
429  const CHandleRange& hr,
430  CSeq_loc_Conversion* cvt,
431  bool check_adaptive);
432 
433  // Called by: x_SearchTSE2()
434  // Calls: x_SearchRange()
435  void x_SearchObjects(const CTSE_Handle& tse,
436  const SIdAnnotObjs* objs,
437  CMutexGuard& guard,
438  const CAnnotName& name,
439  const CSeq_id_Handle& id,
440  const CHandleRange& hr,
441  CSeq_loc_Conversion* cvt);
442 
443  // Called by: x_SearchObjects()
444  // Calls: x_SearchLoc() for annotations of type locs.
445  void x_SearchRange(const CTSE_Handle& tse,
446  const SIdAnnotObjs* objs,
447  CMutexGuard& guard,
448  const CAnnotName& name,
449  const CSeq_id_Handle& id,
450  const CHandleRange& hr,
451  CSeq_loc_Conversion* cvt);
452 
453  // The x_SearchAll() is set of methods to search for annotations without
454  // specified location. They collect all matching annotations contained
455  // in argument object (Seq-entry or Seq-annot).
456  void x_SearchAll(void);
457  void x_SearchAll(const CSeq_entry_Info& entry_info);
458  void x_SearchAll(const CSeq_annot_Info& annot_info);
459 
460  // Order collected annotations by requested criteria.
461  void x_Sort(void);
462 
463  void x_AddObjectMapping(CAnnotObject_Ref& object_ref,
464  CSeq_loc_Conversion* cvt,
465  unsigned int loc_index);
466  void x_AddObject(CAnnotObject_Ref& object_ref);
467  void x_AddObject(CAnnotObject_Ref& object_ref,
468  CSeq_loc_Conversion* cvt,
469  unsigned int loc_index);
470 
471  // Release all locked resources TSE etc
472  void x_ReleaseAll(void);
473 
474  bool x_NeedSNPs(void) const;
475  bool x_MatchLimitObject(const CAnnotObject_Info& annot_info) const;
476  bool x_MatchRange(const CHandleRange& hr,
477  const CRange<TSeqPos>& range,
478  const SAnnotObject_Index& index) const;
479  bool x_MatchLocIndex(const SAnnotObject_Index& index) const;
480 
481  bool x_NoMoreObjects(void) const;
482 
483  bool x_FoundAllNamedAnnotAccessions(unique_ptr<SAnnotSelector>& local_sel);
484 
485  void x_AddPostMappings(void);
486  void x_AddPostMappingsCvt(CSeq_loc_Conversion_Set& cvt);
487  void x_AddTSE(const CTSE_Handle& tse);
488 
489  CConstRef<CSerialObject> x_GetMappedObject(const CAnnotObject_Ref& obj);
490 
491  // Set of processed annot-locs to avoid duplicates
494  typedef vector<CSeq_annot_Handle> TAnnotLocks;
497  typedef vector<SAnnotTypeSelector> TAnnotTypes;
498 
499  const TAnnotNames& x_GetAnnotNames(void) const;
500  const TAnnotTypes& x_GetAnnotTypes(void) const;
501 
502  Uint8 x_GetCostOfLoadingInBytes(void) const;
503  double x_GetCostOfLoadingInSeconds(void) const;
504 
505  void x_StopSearchLimits(void);
507  {
508  return m_SearchSegments == 0;
509  }
510 
513  // TSE set to keep all the TSEs locked
515  unique_ptr<CAnnotMappingCollector> m_MappingCollector;
516  // Set of all the annotations found
518 
519  // Temporary objects to be re-used by iterators
522 
523  unique_ptr<TAnnotLocsSet> m_AnnotLocsSet;
528  mutable unique_ptr<TAnnotNames> m_AnnotNames;
531 
539 
540  friend class CAnnotTypes_CI;
541  friend class CMappedFeat;
542  friend class CMappedGraph;
543  friend class CAnnot_CI;
544  friend class CFeat_CI;
545 };
546 
547 
548 /////////////////////////////////////////////////////////////////////////////
549 // CAnnotMapping_Info
550 /////////////////////////////////////////////////////////////////////////////
551 
552 
553 inline
555  : m_MappedFlags(0),
556  m_MappedObjectType(eMappedObjType_not_set),
557  m_MappedStrand(eNa_strand_unknown)
558 {
559 }
560 
561 
562 inline
564  Int1 mapped_type,
565  Int1 mapped_strand)
566  : m_MappedFlags(mapped_flags),
567  m_MappedObjectType(mapped_type),
568  m_MappedStrand(mapped_strand)
569 {
570 }
571 
572 
573 inline
575 {
576  return m_TotalRange.GetFrom();
577 }
578 
579 
580 inline
582 {
583  return m_TotalRange.GetToOpen();
584 }
585 
586 
587 inline
590 {
591  return m_TotalRange;
592 }
593 
594 
595 inline
597 {
599 }
600 
601 
602 inline
604 {
605  return (m_MappedFlags & fMapped_Partial) != 0;
606 }
607 
608 
609 inline
611 {
612  return (m_MappedFlags & fMapped_Product) != 0;
613 }
614 
615 
616 inline
618 {
619  return ENa_strand(m_MappedStrand);
620 }
621 
622 
623 inline
625 {
626  _ASSERT(IsMapped());
627  m_MappedStrand = strand;
628 }
629 
630 
631 inline
633 {
634  return m_MappedFlags;
635 }
636 
637 
638 inline
641 {
643 }
644 
645 
646 inline
648 {
650  !m_MappedObject);
653 }
654 
655 
656 inline
658 {
661 }
662 
663 
664 inline
666 {
667  return IsMapped() && !IsProduct();
668 }
669 
670 
671 inline
673 {
674  return IsMapped() && IsProduct();
675 }
676 
677 
678 inline
680 {
682  return IsProduct() ? GetMappedSeq_feat().GetProduct()
684  }
686  return static_cast<const CSeq_loc&>(*m_MappedObject);
687 }
688 
689 
690 inline
692 {
694  return static_cast<const CSeq_id&>(*m_MappedObject);
695 }
696 
697 
698 inline
700 {
702  return static_cast<const CSeq_feat&>(*m_MappedObject);
703 }
704 
705 
706 inline
708 {
709  _ASSERT(!IsMapped());
710  m_MappedObject.Reset(loc);
711  if ( loc ) {
713  }
714  else {
716  }
717 }
718 
719 
720 inline
722 {
723  _ASSERT(!IsMapped());
724  m_MappedObject.Reset(&loc);
726 }
727 
728 
729 inline
731 {
732  _ASSERT(!IsMapped());
733  m_MappedObject.Reset(&id);
735 }
736 
737 
738 inline
740 {
742  if ( point ) {
744  }
745  else {
747  }
748 }
749 
750 
751 inline
753 {
756 }
757 
758 
759 inline
761 {
764 }
765 
766 
767 inline
769 {
771  return (m_MappedFlags & fMapped_Seq_point) != 0;
772 }
773 
774 
775 inline
777 {
778  SetMappedSeq_id(id);
779  SetMappedPoint(point);
780 }
781 
782 
783 inline
785 {
786  if ( partial ) {
788  }
789  else {
791  }
792 }
793 
794 
795 inline
797 {
798  if ( product ) {
800  }
801  else {
803  }
804 }
805 
806 
807 inline
809 {
810  return (m_MappedFlags & fFromOtherTSE) != 0;
811 }
812 
813 
814 inline
815 void CAnnotMapping_Info::SetFromOtherTSE(bool from_other_tse)
816 {
817  if ( from_other_tse ) {
819  }
820  else {
822  }
823 }
824 
825 
826 inline
828 {
830  SetProduct(product);
831 }
832 
833 
834 inline
836 {
837  m_MappedObject.Swap(info.m_MappedObject);
838  swap(m_TotalRange, info.m_TotalRange);
839  swap(m_MappedFlags, info.m_MappedFlags);
840  swap(m_MappedObjectType, info.m_MappedObjectType);
841  swap(m_MappedStrand, info.m_MappedStrand);
842  m_GraphRanges.Swap(info.m_GraphRanges);
843 }
844 
845 
846 /////////////////////////////////////////////////////////////////////////////
847 // CAnnotObject_Ref
848 /////////////////////////////////////////////////////////////////////////////
849 
850 
851 inline
853  : m_AnnotIndex(0), m_AnnotType(eAnnot_Regular)
854 {
855 }
856 
857 
858 inline
860 {
861  return m_AnnotIndex;
862 }
863 
864 
865 inline
867 {
868  return (m_AnnotType & fAnnot_NoAnnotInfo) == 0;
869 }
870 
871 
872 inline
874 {
875  return m_AnnotType == eAnnot_Regular;
876 }
877 
878 
879 inline
881 {
882  return m_AnnotType == eAnnot_SNPTable;
883 }
884 
885 
886 inline
888 {
890 }
891 
892 
893 inline
895 {
896  return (m_AnnotType & fAnnot_SeqTable) != 0;
897 }
898 
899 
900 inline
902 {
903  return IsSNPTableFeat();
904 }
905 
906 
907 inline
909 {
910  return IsAnySeqTableFeat();
911 }
912 
913 
914 inline
916 {
917  return m_Seq_annot;
918 }
919 
920 
921 inline
923 {
924  return m_Seq_annot.x_GetInfo();
925 }
926 
927 
928 inline
930 {
931  if ( m_Seq_annot != ref.m_Seq_annot ) {
933  }
934  if ( m_AnnotType != ref.m_AnnotType ) {
935  return m_AnnotType < ref.m_AnnotType;
936  }
937  return m_AnnotIndex < ref.m_AnnotIndex;
938 }
939 
940 
941 inline
943 {
944  return (m_AnnotIndex == ref.m_AnnotIndex &&
945  m_AnnotType == ref.m_AnnotType &&
946  m_Seq_annot == ref.m_Seq_annot);
947 }
948 
949 
950 inline
952 {
953  return !(*this == ref);
954 }
955 
956 
957 inline
959 {
960  return m_MappingInfo;
961 }
962 
963 
964 inline
966 {
967  return m_MappingInfo.IsFromOtherTSE();
968 }
969 
970 
971 inline
972 void CAnnotObject_Ref::SetFromOtherTSE(bool from_other_tse)
973 {
974  m_MappingInfo.SetFromOtherTSE(from_other_tse);
975 }
976 
977 
978 /////////////////////////////////////////////////////////////////////////////
979 // CAnnot_Collector
980 /////////////////////////////////////////////////////////////////////////////
981 
982 
983 inline
986 {
987  return m_AnnotSet;
988 }
989 
990 
991 inline
993 {
994  return m_Scope.GetScope();
995 }
996 
997 
998 inline
1000 {
1001  return *m_Selector;
1002 }
1003 
1004 
1005 inline
1007 {
1012 }
1013 
1016 
1017 
1019 inline
1020 void swap(NCBI_NS_NCBI::objects::CAnnotMapping_Info& info1,
1021  NCBI_NS_NCBI::objects::CAnnotMapping_Info& info2)
1022 {
1023  info1.Swap(info2);
1024 }
1025 
1026 
1027 inline
1028 void swap(NCBI_NS_NCBI::objects::CAnnotObject_Ref& ref1,
1029  NCBI_NS_NCBI::objects::CAnnotObject_Ref& ref2)
1030 {
1031  ref1.Swap(ref2);
1032 }
1033 
1035 
1036 #endif // ANNOT_COLLECTOR__HPP
bool operator!=(const _Ht_iterator< _Val, _Nonconst_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__x, const _Ht_iterator< _Val, _Const_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__y)
Definition: _hashtable.h:173
BEGIN_STD_SCOPE void swap(NCBI_NS_NCBI::objects::CAnnotMapping_Info &info1, NCBI_NS_NCBI::objects::CAnnotMapping_Info &info2)
void SetFromOtherTSE(bool from_other_tse=true)
bool MappedSeq_locNeedsUpdate(void) const
CRef< CObject > m_MappedObject
void SetMappedPartial_to(void)
void SetMappedSeq_id(CSeq_id &id)
void SetTotalRange(const TRange &range)
void SetProduct(bool product)
void SetMappedPartial_from(void)
const TRange & GetTotalRange(void) const
bool IsMappedLocation(void) const
CRange< TSeqPos > TRange
TSeqPos GetFrom(void) const
bool IsMapped(void) const
EMappedObjectType GetMappedObjectType(void) const
bool IsProduct(void) const
ENa_strand GetMappedStrand(void) const
void Swap(CAnnotMapping_Info &info)
void SetMappedSeq_loc(CSeq_loc &loc)
const CSeq_feat & GetMappedSeq_feat(void) const
TSeqPos GetToOpen(void) const
bool IsMappedProduct(void) const
bool IsMappedPoint(void) const
void SetMappedStrand(ENa_strand strand)
void SetMappedPoint(bool point)
bool IsPartial(void) const
void SetPartial(bool value)
CRef< CGraphRanges > m_GraphRanges
const CSeq_id & GetMappedSeq_id(void) const
void SetAnnotObjectRange(const TRange &range, bool product)
Int1 GetMappedFlags(void) const
const CSeq_loc & GetMappedSeq_loc(void) const
bool IsFromOtherTSE(void) const
bool IsSortedSeqTableFeat(void) const
bool operator==(const CAnnotObject_Ref &ref) const
bool IsAnySeqTableFeat(void) const
bool operator<(const CAnnotObject_Ref &ref) const
bool operator!=(const CAnnotObject_Ref &ref) const
const CSeq_annot_Info & GetSeq_annot_Info(void) const
bool IsSNPTableFeat(void) const
void Swap(CAnnotObject_Ref &ref)
const CSeq_annot_Handle & GetSeq_annot_Handle(void) const
bool IsFromOtherTSE(void) const
CAnnotMapping_Info m_MappingInfo
void SetFromOtherTSE(bool from_other_tse=true)
TAnnotIndex GetAnnotIndex(void) const
CSeq_annot_Handle m_Seq_annot
bool IsPlainFeat(void) const
bool IsTableFeat(void) const
TAnnotIndex m_AnnotIndex
bool IsSNPFeat(void) const
bool HasAnnotObject_Info(void) const
CRange< TSeqPos > TRange
CAnnotMapping_Info & GetMappingInfo(void) const
CAnnot_CI –.
Definition: annot_ci.hpp:59
TMaxSearchSegments m_SearchSegments
unique_ptr< TAnnotLocsSet > m_AnnotLocsSet
bool x_NeedSNPs(void) const
TTSE_LockMap m_TSE_LockMap
vector< SAnnotTypeSelector > TAnnotTypes
unique_ptr< CAnnotMappingCollector > m_MappingCollector
void x_ReleaseAll(void)
vector< CSeq_annot_Handle > TAnnotLocks
bool x_MaxSearchSegmentsLimitIsReached(void) const
SAnnotSelector::TAnnotTypesBitset TAnnotTypesBitset
set< CAnnotName > TAnnotNames
TAnnotTypesBitset m_CollectAnnotTypes
CAnnot_Collector(const CAnnot_Collector &)
SAnnotSelector::EMaxSearchSegmentsAction m_SearchSegmentsAction
vector< CAnnotObject_Ref > TAnnotSet
set< CConstRef< CSeq_loc > > TAnnotLocsSet
TAnnotTypesBitset m_TriggerTypes
CScope & GetScope(void) const
TAnnotTypes m_AnnotTypes2
TAnnotTypesBitset m_UnseenAnnotTypes
CRef< CCreatedFeat_Ref > m_CreatedMapped
const TAnnotSet & GetAnnotSet(void) const
SAnnotSelector::TMaxSize TMaxSize
map< const CTSE_Info *, CTSE_Handle > TTSE_LockMap
SAnnotSelector::TAnnotType TAnnotType
SAnnotSelector::TMaxSearchSegments TMaxSearchSegments
TAnnotTypesBitset m_AnnotTypes
const SAnnotSelector * m_Selector
const SAnnotSelector & GetSelector(void) const
unique_ptr< TAnnotNames > m_AnnotNames
CRef< CCreatedFeat_Ref > m_CreatedOriginal
CBioseq_Handle –.
CConstRef< CSeq_feat > GetOriginalFeature(const CSeq_feat_Handle &feat_h)
CRef< CSeq_loc > m_CreatedSeq_loc
CRef< CSeq_loc > GetMappedLocation(const CAnnotMapping_Info &map, const CSeq_feat &orig_feat)
CRef< CSeq_point > m_CreatedSeq_point
CRef< CSeq_interval > m_CreatedSeq_interval
void ReleaseRefsTo(CRef< CSeq_feat > *feat, CRef< CSeq_loc > *loc, CRef< CSeq_point > *point, CRef< CSeq_interval > *interval)
CRef< CSeq_feat > m_CreatedSeq_feat
void ResetRefsFrom(CRef< CSeq_feat > *feat, CRef< CSeq_loc > *loc, CRef< CSeq_point > *point, CRef< CSeq_interval > *interval)
CConstRef< CSeq_feat > GetMappedFeature(const CAnnotMapping_Info &map, const CSeq_feat &orig_feat)
CFeat_CI –.
Definition: feat_ci.hpp:64
Helper class for mapping graphs.
CScope & GetScope(void) const
Definition: heap_scope.cpp:68
CMappedFeat –.
Definition: mapped_feat.hpp:59
CMappedGraph –.
Definition: graph_ci.hpp:61
CObject –.
Definition: ncbiobj.hpp:180
CScope –.
Definition: scope.hpp:92
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:252
CSeq_annot_Handle –.
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CStopWatch –.
Definition: ncbitime.hpp:1937
Definition: map.hpp:338
Definition: set.hpp:45
void x_CollectSegments(TAlnConstList &seglist, const TAlnList &aln_list)
bool operator<(const CEquivRange &A, const CEquivRange &B)
bool operator==(const CEquivRange &A, const CEquivRange &B)
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
void Swap(CSeq_annot_Handle &annot)
bool OrderedBefore(const CSeq_annot_Handle &annot) const
More stable comparison - takes loading order in account.
const CSeq_annot_Info & x_GetInfo(void) const
bitset< CSeqFeatData::eSubtype_max+3 > TAnnotTypesBitset
unsigned TMaxSearchSegments
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
void Swap(TThisType &ref)
Swaps the pointer with another reference.
Definition: ncbiobj.hpp:754
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
#define NCBI_DEPRECATED
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
int8_t Int1
1-byte (8-bit) signed integer
Definition: ncbitype.h:98
position_type GetToOpen(void) const
Definition: range.hpp:138
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_STD_SCOPE
Place it for adding new funtionality to STD scope.
Definition: ncbistl.hpp:92
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define END_STD_SCOPE
End previously defined STD scope.
Definition: ncbistl.hpp:95
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define NCBI_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
TFrom GetFrom(void) const
Get the From member data.
Definition: Range_.hpp:222
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
static MDB_envinfo info
Definition: mdb_load.c:37
range(_Ty, _Ty) -> range< _Ty >
void Swap(T &a, T &b) RAPIDJSON_NOEXCEPT
Custom swap() to avoid dependency on C++ <algorithm> header.
Definition: swap.h:33
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Multi-threading – mutexes; rw-locks; semaphore.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
void SetPartial(CSeq_loc &loc, CRef< CSeq_feat > feat, CSeq_loc::TStrand strand, bool partial_start, bool partial_stop)
SAnnotSelector –.
CSeq_annot::C_Data::E_Choice TAnnotType
#define _ASSERT
CScope & GetScope()
Modified on Fri Sep 20 14:57:37 2024 by modify_doxy.py rev. 669887