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

Go to the SVN repository for this file.

1 /* $Id: Seq_loc.hpp 99792 2023-05-10 18:02:42Z vasilche $
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  * Author: Cliff Clausen, Eugene Vasilchenko, Mati Shomrat
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the ASN data definition file
34  * 'seqloc.asn'.
35  *
36  * ===========================================================================
37  */
38 
39 #ifndef OBJECTS_SEQLOC_SEQ_LOC_HPP
40 #define OBJECTS_SEQLOC_SEQ_LOC_HPP
41 
42 
43 // generated includes
51 //
52 ////
53 //#include <corelib/ncbiexpt.hpp>
54 //#include <util/range.hpp>
55 //#include <vector>
56 
58 BEGIN_objects_SCOPE // namespace ncbi::objects::
59 
60 /** @addtogroup OBJECTS_Seqloc
61  *
62  * @{
63  */
64 
65 
66 class CSeq_id_Handle;
67 class ISynonymMapper;
68 class ILengthGetter;
69 class CSeq_loc_CI;
70 class CSeq_loc_I;
71 
72 /// Seq-loc exceptions
74 {
75 public:
76  enum EErrCode {
77  eNotSet, ///< Seq-loc is not set
78  eMultipleId, ///< Seq-loc on multiple ids when one id is required
79  eUnsupported, ///< Seq-loc has data that is not supported yet
80  eBadLocation, ///< Seq-loc is incorrectly formed
81  eBadIterator, ///< Seq-loc iterator is in bad state
82  eIncomatible, ///< Seq-loc type is incompatible with operation
83  eOutOfRange, ///< parameter is out of valid range
84 
85  eOtherError
86  };
87 
88  virtual const char* GetErrCodeString(void) const override;
90 };
91 
92 
94 {
95 public:
100  typedef CSeq_id TId;
102  typedef TSeqPos TPoint;
104 
105  /// constructors
106  CSeq_loc(void);
107  CSeq_loc(E_Choice index);
108  CSeq_loc(TId& id, TPoint point, TStrand strand = eNa_strand_unknown);
109  CSeq_loc(TId& id, const TPoints& points, TStrand strand = eNa_strand_unknown);
110  CSeq_loc(TId& id, TPoint from, TPoint to, TStrand strand = eNa_strand_unknown);
111  CSeq_loc(TId& id, TRanges ivals, TStrand strand = eNa_strand_unknown);
112 
113  // destructor
114  virtual ~CSeq_loc(void);
115 
116  /// See related functions in objmgr/util/seq_loc_util.hpp:
117  ///
118  /// TSeqPos GetLength(const CSeq_loc&, CScope*)
119  /// bool IsOneBioseq(const CSeq_loc&, CScope*)
120  /// const CSeq_id& GetId(const CSeq_loc&, CScope*)
121  /// TSeqPos GetStart(const CSeq_loc&, CScope*)
122  /// sequence::ECompare Compare(const CSeq_loc&, CSeq_loc&, CScope*)
123  /// sequence::SeqLocMerge(...)
124  ///
125 
127 
128  TRange GetTotalRange(void) const;
129  void InvalidateTotalRangeCache(void) const;
130 
131  /// Check if strand is set for any/all part(s) of the seq-loc
132  /// depending on the flag.
133  bool IsSetStrand(EIsSetStrand flag = eIsSetStrand_Any) const;
134  /// Get the location's strand. If no strand is set, returns
135  /// eNa_strand_unknown. If different strands are set in different
136  /// parts, returns eNa_strand_other. Explicitly set unknown strand
137  /// is ignored when combined whith plus or minus strand.
138  /// Examples:
139  /// not-set = unknown
140  /// not-set + plus = plus
141  /// unknown + plus = plus
142  /// unknown + both = other
143  /// plus + minus = other
144  ENa_strand GetStrand(void) const;
145  /// Return true if all ranges have reverse strand
146  bool IsReverseStrand(void) const;
147  /// Flip the strand (e.g. plus to minus)
148  void FlipStrand(void);
149  /// Set the strand for all of the location's ranges.
150  void SetStrand(ENa_strand strand);
151  /// Reset the strand on this location
152  void ResetStrand(void);
153 
154  /// Return start and stop positions of the seq-loc.
155  /// Start position is the start of the first range in the seq-loc,
156  /// stop is the end of the last range. if eExtreme_Biological flag
157  /// is used, the effective order of ranges and range direction depends
158  /// on the strand.
159  /// NOTE: The returned values are not necessarily the same as
160  /// the boundaries returned by GetTotalRange(). It's also not
161  /// guaranteed that the value returned by GetStart() is less or
162  /// equal to the one returned by GetStop().
163  TSeqPos GetStart(ESeqLocExtremes ext) const;
164  TSeqPos GetStop (ESeqLocExtremes ext) const;
165 
166  /// Special case for circular sequences. No ID is checked for
167  /// circular locations. If the sequence is not circular
168  /// (seq_len == kInvalidSeqPos) the function works like GetTotalRange()
169  TSeqPos GetCircularLength(TSeqPos seq_len) const;
170 
171  /// Appends a label suitable for display (e.g., error messages)
172  /// label must point to an existing string object
173  /// Method just returns if label is null. Note this label is NOT
174  /// GenBank-style.
175  void GetLabel(string* label) const;
176 
177  /// check start or stop of location for e_Lim fuzz
178  bool IsPartialStart(ESeqLocExtremes ext) const;
179  bool IsPartialStop(ESeqLocExtremes ext) const;
180 
181  /// set / remove e_Lim fuzz on start or stop
182  /// (lt/gt - indicating partial interval)
183  void SetPartialStart(bool val, ESeqLocExtremes ext);
184  void SetPartialStop (bool val, ESeqLocExtremes ext);
185 
186  /// check if parts of the seq-loc are missing
187  bool IsTruncatedStart(ESeqLocExtremes ext) const;
188  bool IsTruncatedStop (ESeqLocExtremes ext) const;
189 
190  /// set / remove e_Lim fuzz on start or stop
191  /// (tl/tr - indicating removed parts of the seq-loc)
192  void SetTruncatedStart(bool val, ESeqLocExtremes ext);
193  void SetTruncatedStop (bool val, ESeqLocExtremes ext);
194 
195  /// Get the id of the location
196  /// return NULL if has multiple ids or no id at all.
197  const CSeq_id* GetId(void) const;
198 
199  /// check that the 'id' field in all parts of the location is the same
200  /// as the specifies id.
201  /// if the id parameter is NULL will return the location's id (if unique)
202  /// @return true on success
203  bool CheckId(const CSeq_id*& id, bool may_throw = true) const;
204  void InvalidateIdCache(void) const;
205 
206  /// set the 'id' field in all parts of this location
207  void SetId(CSeq_id& id); // stores id
208  void SetId(const CSeq_id& id); // stores a new copy of id
209 
210  /// Combine invalidation of all cached values
211  void InvalidateCache(void) const;
212 
213  /// Override Assign() to incorporate cache invalidation.
214  virtual void Assign(const CSerialObject& source,
216 
217  /// Override all setters to incorporate cache invalidation.
218  void SetNull(void);
219  void SetEmpty(TEmpty& v);
220  TEmpty& SetEmpty(void);
221  void SetWhole(TWhole& v);
222  TWhole& SetWhole(void);
223  void SetInt(TInt& v);
224  TInt& SetInt(void);
225  void SetPacked_int(TPacked_int& v);
226  TPacked_int& SetPacked_int(void);
227  void SetPnt(TPnt& v);
228  TPnt& SetPnt(void);
229  void SetPacked_pnt(TPacked_pnt& v);
230  TPacked_pnt& SetPacked_pnt(void);
231  void SetMix(TMix& v);
232  TMix& SetMix(void);
233  void SetEquiv(TEquiv& v);
234  TEquiv& SetEquiv(void);
235  void SetBond(TBond& v);
236  TBond& SetBond(void);
237  void SetFeat(TFeat& v);
238  TFeat& SetFeat(void);
239 
240  /// Invalidate id/range cache after deserialization.
241  void PostRead(void) const;
242 
243  /// Flags for location comparison.
245  fCompare_Default = 0,
246  fCompare_Strand = 1
247  };
248  typedef int TCompareFlags;
249 
250  /// @deprecated Use the 2-argument version taking flags.
251  NCBI_DEPRECATED int Compare(const CSeq_loc& loc) const;
252 
253  /// Compare locations by total range for each seq-id.
254  /// Compares seq-ids (@sa CSeq_loc::CompareOrdered()), then compares
255  /// total range starts (left to right) and lengths (longerst first).
256  /// Optionally compares strands; location without strand goes first.
257  int Compare(const CSeq_loc& loc, TCompareFlags flags) const;
258 
259  /// Used as a helper for determining which pieces of a
260  /// CSeq_loc to compare.
262  public:
263  virtual ~ISubLocFilter() {}
264  // Returns true for pieces we should use.
265  // Must be able to handle "NULL" input
266  virtual bool operator()( const CSeq_id *id ) const = 0;
267  };
268 
269  /// Compare first-level sub-locations sequentially to order them
270  /// by biological "complexity". More "complex" location will come last.
271  /// Sub-locations are checked in Seq-loc-mix and Packed-seqint.
272  /// Minus strand locations' order is reversed.
273  /// Seq-ids are not checked in this method, unless you set
274  /// filter, which will allow the user to pick which parts to skip.
275  int CompareSubLoc(const CSeq_loc& loc, ENa_strand strand,
276  const ISubLocFilter *filter = NULL) const;
277 
278  /// Simple adding of seq-locs.
279  void Add(const CSeq_loc& other);
280 
281  void ChangeToMix(void);
282  /// Works only if location is currently an interval, point,
283  /// packed-int (handled trivially), or a mix built recursively from these.
284  void ChangeToPackedInt(void);
285 
286  /// CSeq_loc operations
287  ///
288  /// Flags for operations:
289  /// fStrand_Ignore - if set, strands will be ignored and any ranges
290  /// may be merged/sorted. If not set, ranges on plus and minus strands
291  /// are treated as different sub-sets. In some operations strand may
292  /// still be checked (see fMerge_Abutting and order of ranges).
293  ///
294  /// NOTE: merge flags do not sort ranges, so only overlaps bewtween
295  /// neighbor ranges can be detected. To merge all overlappig ranges
296  /// add fSort flag. The only exception is fSortAndMerge_All which
297  /// already includes fSort;
298  ///
299  /// fMerge_Contained - merges (removes) any range which is completely
300  /// contained in another range.
301  /// fMerge_Abutting - merge abutting ranges. Also forces merging of
302  /// contained ranges. Even if fStrand_Ignore is set, only the ranges
303  /// with the correct order are merged (e.g. loc2.to == loc1.from must be
304  /// true if loc1.strand is minus).
305  /// fMerge_Overlapping - merge overlapping ranges. Also forces merging of
306  /// contained ranges.
307  /// fMerge_All - merge any ranges if possible (contained, overlapping,
308  /// abutting). The flag does not force sorting, so only neighbor ranges
309  /// can be merged. To sort ranges before merging add fSort flag or use
310  /// fSortAndMerge_All.
311  /// fSortAndMerge_All - combination of fSort and fMerge_All.
312  /// fMerge_SingleRange - creates a single range, covering all original ranges.
313  /// Strand is set to the first strand in the original seq-loc, regardless of the
314  /// strand flag.
315  ///
316  /// fSort - forces sorting of the resulting ranges. All ranges on the
317  /// same ID are grouped together, but the order of IDs is undefined. Strand
318  /// is preserved if all values having the same direction are equal. Otherwise
319  /// strand is reset to plus and minuns (in strand-preserve mode) or unknown (in
320  /// strand-ignore mode). NULLs are always merged to a single NULL. The order
321  /// of locations for each ID is: NULL, whole, empty, plus strand intervals,
322  /// minus strand intervals.
323 
324  enum EOpFlags {
325  fStrand_Ignore = 1<<0,
326  fMerge_Contained = 1<<1,
327  fMerge_AbuttingOnly = 1<<2,
328  fMerge_Abutting = fMerge_AbuttingOnly | fMerge_Contained,
329  fMerge_OverlappingOnly = 1<<3,
330  fMerge_Overlapping = fMerge_OverlappingOnly | fMerge_Contained,
331  fMerge_All = fMerge_Abutting | fMerge_Overlapping,
332  fMerge_SingleRange = 1<<4,
333  fSort = 1<<5,
334  fSortAndMerge_All = fSort | fMerge_All
335  };
336  typedef int TOpFlags;
337 
338  /// All functions create and return a new seq-loc object.
339  /// Optional synonym mapper may be provided to detect and convert
340  /// synonyms of a bioseq. Length getter is used by Subtract() to
341  /// calculate real sequence length.
342 
343  /// Merge ranges depending on flags, return a new seq-loc object.
345  ISynonymMapper* syn_mapper) const;
346 
347  /// Add seq-loc, merge/sort resulting ranges depending on flags.
348  /// Return a new seq-loc object.
349  CRef<CSeq_loc> Add(const CSeq_loc& other,
350  TOpFlags flags,
351  ISynonymMapper* syn_mapper) const;
352 
353  /// Subtract seq-loc from this, merge/sort resulting ranges depending on
354  /// flags. Return a new seq-loc object.
355  CRef<CSeq_loc> Subtract(const CSeq_loc& other,
356  TOpFlags flags,
357  ISynonymMapper* syn_mapper,
358  ILengthGetter* len_getter) const;
359 
360  /// Find the intersection with the seq-loc, merge/sort resulting
361  /// ranges depending on flags. Return a new seq-loc object.
362  CRef<CSeq_loc> Intersect(const CSeq_loc& other,
363  TOpFlags flags,
364  ISynonymMapper* syn_mapper) const;
365 
366  /// Make CSeq_loc look like an STL container
368  const_iterator begin(void) const;
369  const_iterator end(void) const;
370 
371 private:
372  // Prohibit copy constructor & assignment operator
375 
376  TRange x_UpdateTotalRange(void) const;
377  TRange x_CalculateTotalRangeCheckId(const CSeq_id*& id) const;
378  bool x_CheckId(const CSeq_id*& id, bool may_throw = true) const;
379  bool x_UpdateId(const CSeq_id*& total_id, const CSeq_id* id,
380  bool may_throw = true) const;
381  void x_ChangeToMix(const CSeq_loc& other);
382  void x_ChangeToPackedInt(const CSeq_interval& other);
383  void x_ChangeToPackedInt(const CSeq_loc& other);
384  void x_ChangeToPackedPnt(const CSeq_loc& other);
385 
386  /// Compare single-id locations, or throw an exception if any location
387  /// is multi-id.
388  int x_CompareSingleId(const CSeq_loc& loc, const CSeq_id* id1,
389  const CSeq_id* id2,
390  TCompareFlags flags) const;
391 
392  enum {
393  kDirtyCache = -2,
394  kSeveralIds = -3
395  };
396 
397  mutable atomic<TSeqPos> m_TotalRangeCacheFrom;
398  mutable atomic<TSeqPos> m_TotalRangeCacheToOpen;
399  // Seq-id for the whole seq-loc or null if multiple IDs were found
400  mutable atomic<const CSeq_id*> m_IdCache;
401 };
402 
403 
404 /// Interface for mapping IDs to the best synonym. Should provide
405 /// GetBestSynonym() method which returns the ID which should replace
406 /// the original one in the destination seq-loc.
408 {
409 public:
410  ISynonymMapper(void) {}
411  virtual ~ISynonymMapper(void) {}
412 
413  virtual CSeq_id_Handle GetBestSynonym(const CSeq_id& id) = 0;
414 };
415 
416 
417 /// Interface for getting bioseq length. Should provide GetLength()
418 /// method.
420 {
421 public:
422  ILengthGetter(void) {}
423  virtual ~ILengthGetter(void) {}
424 
425  virtual TSeqPos GetLength(const CSeq_id& id) = 0;
426 };
427 
428 
429 // Simple location structure: id/from/to
431  SSeq_loc_CI_RangeInfo(void);
432  ~SSeq_loc_CI_RangeInfo(void);
433 
434  void SetStrand(ENa_strand strand);
435 
437 
444  pair<CConstRef<CInt_fuzz>, CConstRef<CInt_fuzz> > m_Fuzz;
445 };
446 
447 
448 class CSeq_loc_CI_Impl;
449 
450 /// Seq-loc iterator class -- iterates all intervals from a seq-loc
451 /// in the correct order.
453 {
454 public:
455  /// Options for empty locations processing
456  enum EEmptyFlag {
457  eEmpty_Skip, /// ignore empty locations
458  eEmpty_Allow /// treat empty locations as usual
459  };
461  eOrder_Positional, /// Iterate sub-locations in positional order
462  eOrder_Biological /// Iterate sub-locations in biological order
463  };
465 
466  /// constructors
467  CSeq_loc_CI(void);
468  CSeq_loc_CI(const CSeq_loc& loc,
469  EEmptyFlag empty_flag = eEmpty_Skip,
470  ESeqLocOrder order = eOrder_Biological);
471  /// construct iterator at a different position in the same location
472  /// @sa GetPos()
473  CSeq_loc_CI(const CSeq_loc_CI& iter, size_t pos);
474  /// destructor
475  virtual ~CSeq_loc_CI(void);
476 
477  CSeq_loc_CI(const CSeq_loc_CI& iter);
478  CSeq_loc_CI& operator= (const CSeq_loc_CI& iter);
479 
480  CSeq_loc_CI& operator++ (void);
481  DECLARE_OPERATOR_BOOL(x_IsValid());
482 
483  bool operator== (const CSeq_loc_CI& iter) const;
484  bool operator!= (const CSeq_loc_CI& iter) const;
485 
486  /// Location of type equiv define set of equivalent locations.
487  /// Each equiv set consist of several equivalent parts.
488  /// Each equiv part can contain equiv location too,
489  /// so equiv sets are recursive.
490 
491  /// Return true if current position is part of a bond
492  bool IsInBond(void) const;
493  /// Return true if current position is A part of a bond
494  bool IsBondA(void) const;
495  /// Return true if current position is B part of a bond
496  bool IsBondB(void) const;
497  /// Return iterators that cover bond of current position
498  /// result.first is the first segment in the equiv set
499  /// result.second is the first segment after the equiv set
500  pair<CSeq_loc_CI, CSeq_loc_CI> GetBondRange(void) const;
501 
502  /// Return true if location has equiv parts
503  bool HasEquivSets(void) const;
504  /// Return true if current position is in some equiv part
505  bool IsInEquivSet(void) const;
506  /// Return number of recursuve equiv parts current position in
507  size_t GetEquivSetsCount(void) const;
508  /// Return iterators that cover equiv set of current position
509  /// result.first is the first segment in the equiv set
510  /// result.second is the first segment after the equiv set
511  /// level specify equiv set if there are more than one of them
512  /// level = 0 is the smallest equiv set (innermost)
513  pair<CSeq_loc_CI, CSeq_loc_CI> GetEquivSetRange(size_t level = 0) const;
514  /// Return iterators that cover equiv part of current position
515  /// result.first is the first segment in the equiv part
516  /// result.second is the first segment after the equiv part
517  /// level specify equiv set if there are more than one of them
518  /// level = 0 is the smallest equiv set (innermost)
519  pair<CSeq_loc_CI, CSeq_loc_CI> GetEquivPartRange(size_t level = 0) const;
520 
521  /// Get seq_id of the current location
522  const CSeq_id& GetSeq_id(void) const;
523  CSeq_id_Handle GetSeq_id_Handle(void) const;
524 
525  /// Get the range
526  TRange GetRange(void) const;
527  /// Get strand
528  bool IsSetStrand(void) const;
529  ENa_strand GetStrand(void) const;
530 
531  /// Get seq-loc for the current iterator position. New CSeq_loc object may
532  /// be created if the current range is a part of a packed/mixed seq-loc.
533  /// The resulting seq-loc will always include only one range (which may
534  /// be whole or empty).
535  /// @sa GetEmbeddingSeq_loc
536  CConstRef<CSeq_loc> GetRangeAsSeq_loc(void) const;
537 
538  /// Get the nearest seq-loc containing the current range.
539  /// For packed/mixed locations the embedding seq-loc may
540  /// include other ranges.
541  /// @note Don't ever confuse it with GetRangeAsSeq_loc!
542  const CSeq_loc& GetEmbeddingSeq_loc(void) const;
543 
544  /// @deprecated You probably actually wanted to use GetRangeAsSeq_loc
545  /// or GetEmbeddingSeq_loc instead.
546  NCBI_DEPRECATED const CSeq_loc& GetSeq_loc(void) const;
547 
548  // Return null if non-fuzzy
549  const CInt_fuzz* GetFuzzFrom(void) const;
550  const CInt_fuzz* GetFuzzTo (void) const;
551 
552  /// True if the current location is a whole sequence
553  bool IsWhole(void) const;
554  /// True if the current location is empty
555  bool IsEmpty(void) const;
556  /// True if the current location is a single point
557  bool IsPoint(void) const;
558 
559  /// Reset the iterator to the initial state
560  void Rewind(void);
561 
562  /// Get number of ranges.
563  size_t GetSize(void) const;
564 
565  /// Get iterator's position.
566  size_t GetPos(void) const;
567 
568  /// Set iterator's position.
569  void SetPos(size_t pos);
570 
571  // Required by range-based for loop.
572  const CSeq_loc_CI& operator*() const { return *this; }
573 
574 protected:
575  const SSeq_loc_CI_RangeInfo& x_GetRangeInfo(void) const;
576 
578 
579  // Check the iterator position
580  bool x_IsValid(void) const;
581  // Check the position, throw exception if not valid
582  virtual const char* x_GetIteratorType(void) const;
583  void x_CheckValid(const char* where) const;
584  void x_ThrowNotValid(const char* where) const;
585 
586  size_t m_Index;
587 };
588 
589 
590 /// Seq-loc iterator class -- iterates all intervals from a seq-loc
591 /// in the correct order.
593 {
594 public:
595  /// Options for creation modified locations
596  /// Bond and equiv types are preserved if possible
597  enum EMakeType {
598  eMake_CompactType, /// use most compact Seq-loc type (default)
599  eMake_PreserveType /// keep original Seq-loc type if possible
600  };
601 
602  /// constructors
603  CSeq_loc_I(void);
604  CSeq_loc_I(CSeq_loc& loc);
605  /// construct iterator at a different position in the same location
606  /// @sa GetPos()
607  CSeq_loc_I(const CSeq_loc_I& iter, size_t pos);
608  /// destructor
609  virtual ~CSeq_loc_I(void);
610 
611  /// return true of any part was changed since initialization
612  bool HasChanges(void) const;
613 
614  /// return constructed CSeq_loc with all changes
615  CRef<CSeq_loc> MakeSeq_loc(EMakeType make_type = eMake_CompactType) const;
616 
617  /// Delete current element, and make iterator to point to the next element.
618  /// All other iterators of the same CSeq_loc object will become invalid.
619  /// If the deleted element is contained in any equiv set then the equiv set
620  /// and its corresponding part will be reduced in size appropriately,
621  /// and if the part and/or the set become empty after the deletion
622  /// they will be removed completely.
623  void Delete(void);
624 
625  /// Set of Insert*() methods.
626  /// All of them insert new element before the one the iterator points to.
627  /// If the iterator is at the end of CSeq_loc then the new element is
628  /// inserted after the last element of the CSeq_loc.
629  /// After the insertion this iterator will point to the element
630  /// it was pointing before (or end), and the result iterator will point
631  /// to the inserted element.
632  /// All other iterators of the same CSeq_loc object will become invalid.
633  /// If the insertion point is completely within an equiv set (excluding
634  /// the equiv set boundary) the equiv set will be expanded appropriately.
635  /// If the insertion point is completely within an equiv part (excluding
636  /// the equiv part boundary) the new element is added to that equiv part.
637  /// If the insertion point is between two equiv parts of the same set
638  /// then the new element is appended to the part just before
639  /// the insertion point.
640  /// The effect of the insertion on equiv sets can be modified
641  /// by calling SetEquivMode(EEquivMode).
642  /// @sa SetEquivMode()
643  CSeq_loc_I InsertNull(void);
644 
645  /// Insert new element before the current one (@sa InsertNull()).
646  CSeq_loc_I InsertEmpty(const CSeq_id_Handle& id);
647  /// Insert new element before the current one (@sa InsertNull()).
649  {
650  return InsertEmpty(CSeq_id_Handle::GetHandle(id));
651  }
652  /// Insert new element before the current one (@sa InsertNull()).
653  CSeq_loc_I InsertWhole(const CSeq_id_Handle& id);
654  /// Insert new element before the current one (@sa InsertNull()).
656  {
657  return InsertWhole(CSeq_id_Handle::GetHandle(id));
658  }
659 
660  /// Insert new element before the current one (@sa InsertNull()).
661  /// The strand value eNa_strand_unknown produces strand field not set,
662  /// If eNa_strand_unknown is expicitly required, call SetStrand().
663  CSeq_loc_I InsertInterval(const CSeq_id_Handle& id,
664  const TRange& range,
665  ENa_strand strand = eNa_strand_unknown);
666  /// Insert new element before the current one (@sa InsertNull()).
667  /// The strand value eNa_strand_unknown produces strand field not set,
668  /// If eNa_strand_unknown is expicitly required, call SetStrand().
670  const TRange& range,
672  {
673  return InsertInterval(CSeq_id_Handle::GetHandle(id), range, strand);
674  }
675  /// Insert new element before the current one (@sa InsertNull()).
676  /// The strand value eNa_strand_unknown produces strand field not set,
677  /// If eNa_strand_unknown is expicitly required, call SetStrand().
679  TSeqPos from, TSeqPos to,
681  {
682  return InsertInterval(id, TRange(from, to), strand);
683  }
684  /// Insert new element before the current one (@sa InsertNull()).
685  /// The strand value eNa_strand_unknown produces strand field not set,
686  /// If eNa_strand_unknown is expicitly required, call SetStrand().
688  TSeqPos from, TSeqPos to,
690  {
691  return InsertInterval(id, TRange(from, to), strand);
692  }
693 
694  /// Insert new element before the current one (@sa InsertNull()).
695  /// The strand value eNa_strand_unknown produces strand field not set,
696  /// If eNa_strand_unknown is expicitly required, call SetStrand().
697  CSeq_loc_I InsertPoint(const CSeq_id_Handle& id,
698  TSeqPos pos,
699  ENa_strand strand = eNa_strand_unknown);
700  /// Insert new element before the current one (@sa InsertNull()).
701  /// The strand value eNa_strand_unknown produces strand field not set,
702  /// If eNa_strand_unknown is expicitly required, call SetStrand().
704  TSeqPos pos,
706  {
707  return InsertPoint(CSeq_id_Handle::GetHandle(id), pos, strand);
708  }
709 
710  /// Set seq_id of the current location
711  void SetSeq_id_Handle(const CSeq_id_Handle& id);
712  /// Set seq_id of the current location
713  void SetSeq_id(const CSeq_id& id)
714  {
715  SetSeq_id_Handle(CSeq_id_Handle::GetHandle(id));
716  }
717 
718  /// Set the range
719  void SetRange(const TRange& range);
720  /// Set the range from position
721  void SetFrom(TSeqPos from);
722  /// Set the range to position
723  void SetTo(TSeqPos to);
724  /// Set the range from and to positions
725  void SetPoint(TSeqPos pos);
726 
727  /// Reset the range strand
728  void ResetStrand(void);
729  /// Set the range strand
730  void SetStrand(ENa_strand strand);
731 
732  /// Reset fuzz from
733  void ResetFuzzFrom(void);
734  /// Change fuzz from
735  void SetFuzzFrom(CInt_fuzz& fuzz);
736  /// Reset fuzz to
737  void ResetFuzzTo(void);
738  /// Change fuzz to values
739  void SetFuzzTo(CInt_fuzz& fuzz);
740  /// Reset fuzz of a point
741  void ResetFuzz(void);
742  /// Change fuzz of a point
743  void SetFuzz(CInt_fuzz& fuzz);
744 
745  /// Return iterators that cover equiv set of current position
746  /// result.first is the first segment in the equiv set
747  /// result.second is the first segment after the equiv set
748  /// level specify equiv set if there are more than one of them
749  /// level = 0 is the smallest equiv set (innermost)
750  pair<CSeq_loc_I, CSeq_loc_I> GetEquivSetRange(size_t level = 0) const;
751  /// Return iterators that cover equiv part of current position
752  /// result.first is the first segment in the equiv part
753  /// result.second is the first segment after the equiv part
754  /// level specify equiv set if there are more than one of them
755  /// level = 0 is the smallest equiv set (innermost)
756  pair<CSeq_loc_I, CSeq_loc_I> GetEquivPartRange(size_t level = 0) const;
757 
758  /// This enum defines a way equiv sets are expanded or created
759  /// when one of Insert*() methods is called.
760  enum EEquivMode {
761  /// By default no equiv sets are created or expanded except
762  /// if insertion point is completely inside of an equiv or its part.
764 
765  /// A new equiv set will be created, even if the insertion point
766  /// is already inside of an existing equiv, so that new equiv set may
767  /// become a sub-unit of an exisiting equiv set.
768  /// The new equiv set will contain one part with the inserted element
769  /// as its content.
770  /// The mode will switch to eEquiv_append after the insertion.
772 
773  /// New equiv part will be started with the inserted element.
774  /// If the insertion point is not in or near any existing equiv part
775  /// then exception is thrown.
776  /// If...
777  /// A. the insertion point is exactly between two equiv sets
778  /// then a new equiv part will be created at the end of the first set
779  /// with the inserted element as its content.
780  /// B. the insertion point is at a boundary of any equiv part
781  /// then a new equiv part will be created at this point
782  /// with the inserted element as its content.
783  /// C. the insertion point is in the middle of existing part
784  /// then the existing part will be split at the insertion point
785  /// and new element will be added to the second part after splitting.
786  ///
787  /// The mode will switch to eEquiv_append after the insertion.
789 
790  /// If the insertion point is just after any equiv part, including
791  /// the last one in an equiv, then the inserted element is appended
792  /// to the part, and the equiv mode will remain eEquiv_append.
793  /// Otherwise the equiv mode will switch to eEquiv_none.
794  /// Change the mode to eEquiv_none explicitly if you want to stop
795  /// expanding existing equiv.
797 
798  /// If the insertion point is just before any equiv part, including
799  /// the first one in an equiv, then the inserted element is prepended
800  /// to the part, and the equiv mode will remain eEquiv_prepend.
801  /// Otherwise the equiv mode will switch to eEquiv_none.
802  /// Change the mode to eEquiv_none explicitly if you want to stop
803  /// expanding existing equiv.
804  eEquiv_prepend
805  };
806  /// Change equiv modification mode
807  /// @sa InsertNull()
808  void SetEquivMode(EEquivMode mode);
809  /// Change equiv modification mode to add new equiv set for the next
810  /// insert operation.
811  /// @sa SetEquivMode()
812  void StartNewEquiv(void)
813  {
814  SetEquivMode(eEquiv_new_equiv);
815  }
816  /// Change equiv modification mode to add new equiv part for the next
817  /// insert operation.
818  /// @sa SetEquivMode()
819  void StartNewEquivPart(void)
820  {
821  SetEquivMode(eEquiv_new_part);
822  }
823  /// Change equiv modification mode to normal behavior that will only
824  /// update existing equiv sets.
825  /// @sa SetEquivMode()
826  void StopEquiv(void)
827  {
828  SetEquivMode(eEquiv_none);
829  }
830  /// Get equiv modification mode.
831  /// @sa SetEquivMode()
832  EEquivMode GetEquivMode(void) const;
833 
834  /// Remove equiv set, all pieces that are part of the set will be
835  /// preserved as independent pieces.
836  void RemoveEquiv(size_t level = 0);
837  /// Create equiv set with one part from current position to
838  /// the position pointed by end_it argument exclusive.
839  /// The end_it position must be after current position.
840  /// If there are any conflicts with existing equiv sets or bond pairs
841  /// no new equiv set will be made and an exception will be thrown.
842  /// New set's level will be assigned depending on its size in relation
843  /// to existing overlapping equiv sets.
844  void MakeEquiv(const CSeq_loc_I& end_it);
845  /// Create equiv set with one part from current position to
846  /// the position pointed by end_it argument exclusive.
847  /// The end_it position must be after current position.
848  /// If there are any conflicts with existing equiv sets or bond pairs
849  /// no new equiv set will be made and an exception will be thrown.
850  void MakeEquivPartBreak(size_t level = 0);
851 
852  /// Remove bond at current position - it may be either A or B part
853  void RemoveBond(void);
854  /// Make bond at current position (only A)
855  /// The current part must be a point
856  /// If current posision is already a bond A part, it will be updated
857  void MakeBondA(void);
858  /// Make bond at current position with the next position (A and B)
859  /// The current and next parts must be points
860  /// If current posision is already a bond A part, it will be updated
861  void MakeBondAB(void);
862  /// Make bond at previous position with the current position (A and B)
863  /// The current and previous parts must be points
864  /// If previous posision is already a bond A part, it will be updated
865  void MakeBondB(void);
866 
867 protected:
869  SSeq_loc_CI_RangeInfo& x_GetRangeInfo(void);
870 
871  void x_SetSeq_id_Handle(SSeq_loc_CI_RangeInfo& info,
872  const CSeq_id_Handle& id);
873 
874  bool x_IsValidForInsert(void) const;
875  void x_CheckValidForInsert(const char* where) const;
876  virtual const char* x_GetIteratorType(void) const;
877 };
878 
879 
880 /////////////////// CSeq_loc inline methods
881 
882 inline
884 {
885  m_TotalRangeCacheFrom.store(TSeqPos(kDirtyCache), memory_order_release);
886 }
887 
888 
889 inline
891 {
892  m_IdCache.store(NULL, memory_order_release);
893 }
894 
895 
896 inline
898 {
901 }
902 
903 
904 // constructor
905 inline
907 {
908  InvalidateCache();
909 }
910 
911 
912 inline
914 {
915  TSeqPos range_from = m_TotalRangeCacheFrom.load(memory_order_acquire);
916  if ( range_from == TSeqPos(kDirtyCache) ) {
917  return x_UpdateTotalRange();
918  }
919  else {
920  TSeqPos range_to_open = m_TotalRangeCacheToOpen.load(memory_order_relaxed);
921  return COpenRange<TSeqPos>(range_from, range_to_open);
922  }
923 }
924 
925 
926 inline
927 bool CSeq_loc::CheckId(const CSeq_id*& id, bool may_throw) const
928 {
929  const CSeq_id* my_id = m_IdCache.load(memory_order_acquire);
930  if ( my_id == NULL ) {
931  if ( !x_CheckId(my_id, may_throw) ) {
932  return false;
933  }
934  m_IdCache.store(my_id, memory_order_release);
935  }
936  return x_UpdateId(id, my_id, may_throw);
937 }
938 
939 
940 inline
941 const CSeq_id* CSeq_loc::GetId(void) const
942 {
943  const CSeq_id* sip = NULL;
944  return CheckId(sip, false) ? sip : NULL;
945 }
946 
947 
948 inline
949 void CSeq_loc::SetId(const CSeq_id& id)
950 {
952  CRef<CSeq_id> nc_id(new CSeq_id);
953  nc_id->Assign(id);
954  SetId(*nc_id);
955  m_IdCache.store(nc_id.GetPointer(), memory_order_release);
956 }
957 
958 
959 inline
961 {
964 }
965 
966 #define DEFINE_NCBI_SEQ_LOC_SETTERS(x) \
967 inline \
968 void CSeq_loc::Set##x(T##x& v) \
969 { \
970  InvalidateCache(); \
971  Tparent::Set##x(v); \
972 } \
973  \
974 inline \
975 CSeq_loc::T##x& CSeq_loc::Set##x(void) \
976 { \
977  InvalidateCache(); \
978  return Tparent::Set##x(); \
979 }
980 
991 
992 #undef DEFINE_NCBI_SEQ_LOC_SETTERS
993 
994 inline
996 {
997  return IsReverse(GetStrand());
998 }
999 
1000 
1001 /////////////////// end of CSeq_loc inline methods
1002 
1003 /////////////////// CSeq_loc_CI inline methods
1004 
1005 inline
1007 {
1008  m_IsSetStrand = true;
1009  m_Strand = strand;
1010 }
1011 
1012 inline
1013 void CSeq_loc_CI::x_CheckValid(const char* where) const
1014 {
1015  if ( !x_IsValid() )
1016  x_ThrowNotValid(where);
1017 }
1018 
1019 inline
1021 {
1022  x_CheckValid("operator++");
1023  ++m_Index;
1024  return *this;
1025 }
1026 
1027 inline
1029 {
1030  x_CheckValid("GetSeq_id()");
1031  return *x_GetRangeInfo().m_Id;
1032 }
1033 
1034 inline
1036 {
1037  x_CheckValid("GetSeq_id_Handle()");
1038  return x_GetRangeInfo().m_IdHandle;
1039 }
1040 
1041 inline
1043 {
1044  x_CheckValid("GetRange()");
1045  return x_GetRangeInfo().m_Range;
1046 }
1047 
1048 inline
1050 {
1051  x_CheckValid("IsSetStrand()");
1052  return x_GetRangeInfo().m_IsSetStrand;
1053 }
1054 
1055 inline
1057 {
1058  x_CheckValid("GetStrand()");
1059  return x_GetRangeInfo().m_Strand;
1060 }
1061 
1062 inline
1064 {
1065  x_CheckValid("GetFuzzFrom()");
1066  return x_GetRangeInfo().m_Fuzz.first;
1067 }
1068 
1069 inline
1071 {
1072  x_CheckValid("GetFuzzTo()");
1073  return x_GetRangeInfo().m_Fuzz.second;
1074 }
1075 
1076 inline
1077 bool CSeq_loc_CI::IsWhole(void) const
1078 {
1079  x_CheckValid("IsWhole()");
1080  return x_GetRangeInfo().m_Range.IsWhole();
1081 }
1082 
1083 inline
1084 bool CSeq_loc_CI::IsEmpty(void) const
1085 {
1086  x_CheckValid("IsEmpty()");
1087  return x_GetRangeInfo().m_Range.Empty();
1088 }
1089 
1090 inline
1091 bool CSeq_loc_CI::IsPoint(void) const
1092 {
1093  x_CheckValid("IsPoint()");
1094  return x_GetRangeInfo().m_Range.GetLength() == 1;
1095 }
1096 
1097 inline
1098 size_t CSeq_loc_CI::GetPos(void) const
1099 {
1100  return m_Index;
1101 }
1102 
1103 inline
1105 {
1106  m_Index = 0;
1107 }
1108 
1109 /////////////////// CSeq_loc_I inline methods
1110 
1111 inline
1112 void CSeq_loc_I::x_CheckValidForInsert(const char* where) const
1113 {
1114  if ( !x_IsValidForInsert() )
1115  x_ThrowNotValid(where);
1116 }
1117 
1119 
1120 /////////////////// end of CSeq_loc_CI inline methods
1121 
1122 
1123 /* @} */
1124 
1125 
1126 END_objects_SCOPE // namespace ncbi::objects::
1128 
1129 #endif // OBJECTS_SEQLOC_SEQ_LOC_HPP
bool IsReverse(ENa_strand s)
Definition: Na_strand.hpp:75
ESeqLocExtremes
Used to determine the meaning of a location's Start/Stop positions.
Definition: Na_strand.hpp:61
EIsSetStrand
Flag used by IsSetStrand() to switch between any/all modes.
Definition: Na_strand.hpp:51
@ eIsSetStrand_Any
Check if any part has strand.
Definition: Na_strand.hpp:52
Data storage class.
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
CLocalRange< TOffset > TRange
define for the fundamental building block of sequence ranges
Definition: base.hpp:115
Definition: bond.hpp:50
CFeat_id –.
Definition: Feat_id.hpp:66
vector< CRange< TSeqPos > > TRanges
Seq-loc exceptions.
Definition: Seq_loc.hpp:74
Used as a helper for determining which pieces of a CSeq_loc to compare.
Definition: Seq_loc.hpp:261
*** Sequence locations ********************************** *
Definition: Seq_loc_.hpp:83
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Definition: Seq_loc.hpp:453
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Definition: Seq_loc.hpp:593
Base class for all serializable objects.
Definition: serialbase.hpp:150
Interface for getting bioseq length.
Definition: Seq_loc.hpp:420
Interface for mapping IDs to the best synonym.
Definition: Seq_loc.hpp:408
static uch flags
bool operator==(const CEquivRange &A, const CEquivRange &B)
bool Empty(const CNcbiOstrstream &src)
Definition: fileutil.cpp:523
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define NULL
Definition: ncbistd.hpp:225
EErrCode
Error types that an application can generate.
Definition: ncbiexpt.hpp:884
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
Definition: ncbiexpt.cpp:444
ESerialRecursionMode
How to assign and compare child sub-objects of serial objects.
Definition: serialdef.hpp:191
#define NCBISER_HAVE_POST_READ(Class)
Definition: serialbase.hpp:943
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
@ eRecursive
Recursively.
Definition: serialdef.hpp:192
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
string GetLabel(const CSeq_id &id)
void InvalidateIdCache(void) const
Definition: Seq_loc.hpp:890
ISynonymMapper(void)
Definition: Seq_loc.hpp:410
void Rewind(void)
Reset the iterator to the initial state.
Definition: Seq_loc.hpp:1104
DECLARE_OPERATOR_BOOL(x_IsValid())
void InvalidateCache(void) const
Combine invalidation of all cached values.
Definition: Seq_loc.hpp:897
bool x_IsValid(void) const
Definition: Seq_loc.cpp:2609
CSeq_loc_CI & operator++(void)
Definition: Seq_loc.hpp:1020
ENa_strand GetStrand(void) const
Get the location's strand.
Definition: Seq_loc.cpp:882
void x_CheckValidForInsert(const char *where) const
Definition: Seq_loc.hpp:1112
CRange< TSeqPos > TRange
See related functions in objmgr/util/seq_loc_util.hpp:
Definition: Seq_loc.hpp:126
bool x_UpdateId(const CSeq_id *&total_id, const CSeq_id *id, bool may_throw=true) const
Definition: Seq_loc.cpp:403
virtual ~ILengthGetter(void)
Definition: Seq_loc.hpp:423
CSeq_id TId
Definition: Seq_loc.hpp:100
bool IsReverseStrand(void) const
Return true if all ranges have reverse strand.
Definition: Seq_loc.hpp:995
CSeq_loc::TRange TRange
Definition: Seq_loc.hpp:436
EEmptyFlag
Options for empty locations processing.
Definition: Seq_loc.hpp:456
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
Definition: Seq_loc.cpp:3474
atomic< TSeqPos > m_TotalRangeCacheFrom
Definition: Seq_loc.hpp:397
size_t GetPos(void) const
Get iterator's position.
Definition: Seq_loc.hpp:1098
CSeq_loc_mix_Base::Tdata TLocations
Definition: Seq_loc.hpp:99
void RemoveEquiv(size_t level=0)
Remove equiv set, all pieces that are part of the set will be preserved as independent pieces.
void StartNewEquiv(void)
Change equiv modification mode to add new equiv set for the next insert operation.
Definition: Seq_loc.hpp:812
void x_CheckValid(const char *where) const
Definition: Seq_loc.hpp:1013
EMakeType
Options for creation modified locations Bond and equiv types are preserved if possible.
Definition: Seq_loc.hpp:597
TRange GetTotalRange(void) const
Definition: Seq_loc.hpp:913
EOpFlags
CSeq_loc operations.
Definition: Seq_loc.hpp:324
CSeq_loc_CI const_iterator
Make CSeq_loc look like an STL container.
Definition: Seq_loc.hpp:367
virtual CSeq_id_Handle GetBestSynonym(const CSeq_id &id)=0
CSeq_loc::TRange TRange
Definition: Seq_loc.hpp:464
CSeq_loc_I InsertEmpty(const CSeq_id &id)
Insert new element before the current one (.
Definition: Seq_loc.hpp:648
void StopEquiv(void)
Change equiv modification mode to normal behavior that will only update existing equiv sets.
Definition: Seq_loc.hpp:826
pair< CConstRef< CInt_fuzz >, CConstRef< CInt_fuzz > > m_Fuzz
Definition: Seq_loc.hpp:444
bool IsSetStrand(void) const
Get strand.
Definition: Seq_loc.hpp:1049
CSeq_loc_I InsertInterval(const CSeq_id_Handle &id, TSeqPos from, TSeqPos to, ENa_strand strand=eNa_strand_unknown)
Insert new element before the current one (.
Definition: Seq_loc.hpp:687
CSeq_id_Handle GetSeq_id_Handle(void) const
Definition: Seq_loc.hpp:1035
void SetSeq_id(const CSeq_id &id)
Set seq_id of the current location.
Definition: Seq_loc.hpp:713
TSeqPos TPoint
Definition: Seq_loc.hpp:102
size_t m_Index
Definition: Seq_loc.hpp:586
bool IsWhole(void) const
True if the current location is a whole sequence.
Definition: Seq_loc.hpp:1077
const CInt_fuzz * GetFuzzFrom(void) const
Definition: Seq_loc.hpp:1063
bool x_IsValidForInsert(void) const
Definition: Seq_loc.cpp:2679
CSeq_loc_I InsertInterval(const CSeq_id &id, TSeqPos from, TSeqPos to, ENa_strand strand=eNa_strand_unknown)
Insert new element before the current one (.
Definition: Seq_loc.hpp:678
const CInt_fuzz * GetFuzzTo(void) const
Definition: Seq_loc.hpp:1070
const CSeq_loc_CI & operator*() const
Definition: Seq_loc.hpp:572
CSeq_loc_I InsertInterval(const CSeq_id &id, const TRange &range, ENa_strand strand=eNa_strand_unknown)
Insert new element before the current one (.
Definition: Seq_loc.hpp:669
int TCompareFlags
Definition: Seq_loc.hpp:248
CSeq_loc_I InsertPoint(const CSeq_id &id, TSeqPos pos, ENa_strand strand=eNa_strand_unknown)
Insert new element before the current one (.
Definition: Seq_loc.hpp:703
bool CheckId(const CSeq_id *&id, bool may_throw=true) const
check that the 'id' field in all parts of the location is the same as the specifies id.
Definition: Seq_loc.hpp:927
void MakeEquivPartBreak(size_t level=0)
Create equiv set with one part from current position to the position pointed by end_it argument exclu...
virtual ~ISynonymMapper(void)
Definition: Seq_loc.hpp:411
void StartNewEquivPart(void)
Change equiv modification mode to add new equiv part for the next insert operation.
Definition: Seq_loc.hpp:819
void MakeEquiv(const CSeq_loc_I &end_it)
Create equiv set with one part from current position to the position pointed by end_it argument exclu...
CPacked_seqint_Base::Tdata TIntervals
Definition: Seq_loc.hpp:98
ENa_strand m_Strand
Definition: Seq_loc.hpp:442
ECompareFlags
Flags for location comparison.
Definition: Seq_loc.hpp:244
bool IsEmpty(void) const
True if the current location is empty.
Definition: Seq_loc.hpp:1084
CRef< CSeq_loc_CI_Impl > m_Impl
Definition: Seq_loc.hpp:577
#define DEFINE_NCBI_SEQ_LOC_SETTERS(x)
Definition: Seq_loc.hpp:966
CPacked_seqint::TRanges TRanges
Definition: Seq_loc.hpp:103
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
Definition: Seq_loc.hpp:941
ILengthGetter(void)
Definition: Seq_loc.hpp:422
CPacked_seqpnt_Base::TPoints TPoints
Definition: Seq_loc.hpp:97
atomic< const CSeq_id * > m_IdCache
Definition: Seq_loc.hpp:400
virtual bool operator()(const CSeq_id *id) const =0
CSeq_id_Handle m_IdHandle
Definition: Seq_loc.hpp:438
TRange GetRange(void) const
Get the range.
Definition: Seq_loc.hpp:1042
ENa_strand TStrand
Definition: Seq_loc.hpp:101
void InvalidateTotalRangeCache(void) const
Definition: Seq_loc.hpp:883
virtual TSeqPos GetLength(const CSeq_id &id)=0
void x_ThrowNotValid(const char *where) const
Definition: Seq_loc.cpp:2615
const SSeq_loc_CI_RangeInfo & x_GetRangeInfo(void) const
Definition: Seq_loc.cpp:2629
EEquivMode
This enum defines a way equiv sets are expanded or created when one of Insert*() methods is called.
Definition: Seq_loc.hpp:760
ENa_strand GetStrand(void) const
Definition: Seq_loc.hpp:1056
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
Definition: Seq_loc.hpp:1028
int TOpFlags
Definition: Seq_loc.hpp:336
CSeq_loc_Base Tparent
Definition: Seq_loc.hpp:96
TRange x_UpdateTotalRange(void) const
Definition: Seq_loc.cpp:385
void SetStrand(ENa_strand strand)
Definition: Seq_loc.hpp:1006
virtual ~ISubLocFilter()
Definition: Seq_loc.hpp:263
bool IsPoint(void) const
True if the current location is a single point.
Definition: Seq_loc.hpp:1091
CSeq_loc(void)
constructors
Definition: Seq_loc.hpp:906
NCBI_EXCEPTION_DEFAULT(CSeqLocException, CException)
atomic< TSeqPos > m_TotalRangeCacheToOpen
Definition: Seq_loc.hpp:398
CConstRef< CSeq_id > m_Id
Definition: Seq_loc.hpp:439
void SetNull(void)
Override all setters to incorporate cache invalidation.
Definition: Seq_loc.hpp:960
CConstRef< CSeq_loc > m_Loc
Definition: Seq_loc.hpp:443
CSeq_loc_I InsertWhole(const CSeq_id &id)
Insert new element before the current one (.
Definition: Seq_loc.hpp:655
CSeq_loc(const CSeq_loc &)
bool x_CheckId(const CSeq_id *&id, bool may_throw=true) const
Definition: Seq_loc.cpp:3541
@ eOrder_Positional
Definition: Seq_loc.hpp:461
@ eMake_CompactType
Definition: Seq_loc.hpp:598
@ eEquiv_new_part
New equiv part will be started with the inserted element.
Definition: Seq_loc.hpp:788
@ eEquiv_new_equiv
A new equiv set will be created, even if the insertion point is already inside of an existing equiv,...
Definition: Seq_loc.hpp:771
@ eEquiv_append
If the insertion point is just after any equiv part, including the last one in an equiv,...
Definition: Seq_loc.hpp:796
@ eEquiv_none
By default no equiv sets are created or expanded except if insertion point is completely inside of an...
Definition: Seq_loc.hpp:763
@ kDirtyCache
Definition: Seq_loc.hpp:393
@ eMultipleId
Seq-loc on multiple ids when one id is required.
Definition: Seq_loc.hpp:78
@ eNotSet
Seq-loc is not set.
Definition: Seq_loc.hpp:77
@ eIncomatible
Seq-loc type is incompatible with operation.
Definition: Seq_loc.hpp:82
@ eBadLocation
Seq-loc is incorrectly formed.
Definition: Seq_loc.hpp:80
@ eOutOfRange
parameter is out of valid range
Definition: Seq_loc.hpp:83
@ eBadIterator
Seq-loc iterator is in bad state.
Definition: Seq_loc.hpp:81
@ eUnsupported
Seq-loc has data that is not supported yet.
Definition: Seq_loc.hpp:79
TSeqPos GetStop(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the stop of the location.
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,...
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
TSeqPos GetStart(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the start of the location.
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
#define NCBI_DEPRECATED
position_type GetLength(void) const
Definition: range.hpp:158
bool Empty(void) const
Definition: range.hpp:148
bool IsWhole(void) const
Definition: range.hpp:284
#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 NCBI_SEQLOC_EXPORT
Definition: ncbi_export.h:776
#define NCBI_SEQ_EXPORT
Definition: ncbi_export.h:825
static const char label[]
TWhole & SetWhole(void)
Select the variant.
Definition: Seq_loc_.cpp:178
TEquiv & SetEquiv(void)
Select the variant.
Definition: Seq_loc_.cpp:310
bool IsEmpty(void) const
Check if variant Empty is selected.
Definition: Seq_loc_.hpp:516
list< CRef< CSeq_interval > > Tdata
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
TFeat & SetFeat(void)
Select the variant.
Definition: Seq_loc_.cpp:354
void SetNull(void)
Select the variant.
Definition: Seq_loc_.hpp:510
TPacked_pnt & SetPacked_pnt(void)
Select the variant.
Definition: Seq_loc_.cpp:266
TMix & SetMix(void)
Select the variant.
Definition: Seq_loc_.cpp:288
list< CRef< CSeq_loc > > Tdata
TBond & SetBond(void)
Select the variant.
Definition: Seq_loc_.cpp:332
TPnt & SetPnt(void)
Select the variant.
Definition: Seq_loc_.cpp:244
TEmpty & SetEmpty(void)
Select the variant.
Definition: Seq_loc_.cpp:156
vector< TSeqPos > TPoints
CSeq_loc_Base & operator=(const CSeq_loc_Base &)
TInt & SetInt(void)
Select the variant.
Definition: Seq_loc_.cpp:200
bool IsWhole(void) const
Check if variant Whole is selected.
Definition: Seq_loc_.hpp:522
E_Choice
Choice variants.
Definition: Seq_loc_.hpp:96
TPacked_int & SetPacked_int(void)
Select the variant.
Definition: Seq_loc_.cpp:222
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
static MDB_envinfo info
Definition: mdb_load.c:37
void CheckId(const string &seqId, const vector< SLineInfo > &orderedIds, int idCount, int lineNum, bool firstBlock)
Definition: aln_util.cpp:47
range(_Ty, _Ty) -> range< _Ty >
mdb_mode_t mode
Definition: lmdb++.h:38
const CharType(& source)[N]
Definition: pointer.h:1149
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
Definition: wx_utils.cpp:579
Modified on Wed Apr 17 13:09:17 2024 by modify_doxy.py rev. 669887