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

Go to the SVN repository for this file.

1 #ifndef BIOSEQ_HANDLE__HPP
2 #define BIOSEQ_HANDLE__HPP
3 
4 /* $Id: bioseq_handle.hpp 84799 2018-12-12 19:07:08Z vasilche $
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 *
33 */
34 
35 #include <corelib/ncbistd.hpp>
36 
38 #include <objects/seqset/Bioseq_set.hpp> // for EClass
39 #include <objects/seq/Seq_inst.hpp> // for EMol
40 
42 #include <objmgr/tse_handle.hpp>
43 
46 
47 
48 /** @addtogroup ObjectManagerHandles
49  *
50  * @{
51  */
52 
53 
54 class CDataSource;
55 class CSeqMap;
56 class CSeqVector;
57 class CScope;
58 class CSeq_id;
59 class CSeq_loc;
60 class CBioseq_Info;
61 class CSeq_descr;
62 class CSeqdesc;
63 class CTSE_Info;
64 class CSeq_entry;
65 class CSeq_annot;
66 class CSynonymsSet;
67 class CBioseq_ScopeInfo;
68 class CSeq_id_ScopeInfo;
69 class CTSE_Lock;
70 
71 class CBioseq_Handle;
72 class CBioseq_set_Handle;
73 class CSeq_annot_Handle;
74 class CSeq_entry_Handle;
75 class CBioseq_EditHandle;
79 class CBioObjectId;
80 
81 
82 /////////////////////////////////////////////////////////////////////////////
83 ///
84 /// CBioseq_Handle --
85 ///
86 /// Proxy to access the bioseq data
87 ///
88 
89 // Bioseq handle -- must be a copy-safe const type.
91 {
92 public:
93  // Default constructor
94  CBioseq_Handle(void);
95 
96  /// Reset handle and make it not to point to any bioseq
97  void Reset(void);
98 
99  /// Get scope this handle belongs to
100  CScope& GetScope(void) const;
101 
102  /// Get id which can be used to access this bioseq handle
103  /// Throws an exception if none is available
104  CConstRef<CSeq_id> GetSeqId(void) const;
105  /// Get id used to obtain this bioseq handle
106  CConstRef<CSeq_id> GetInitialSeqIdOrNull(void) const;
107 
108  /// Find a non-local ID if present, consulting assembly details if
109  /// all IDs for the overall sequence are local.
110  CConstRef<CSeq_id> GetNonLocalIdOrNull(void) const;
111 
112  // Find a local ID if present
113  CConstRef<CSeq_id> GetLocalIdOrNull(void) const;
114 
115  /// Get unique object id
116  const CBioObjectId& GetBioObjectId(void) const;
117 
118 
119  /// Get handle of id used to obtain this bioseq handle
120  const CSeq_id_Handle& GetSeq_id_Handle(void) const;
121 
122  /// Get any CSeq_id_Handle handle that can be used to access this bioseq
123  /// Use GetSeq_id_Handle() if it's non-null
124  CSeq_id_Handle GetAccessSeq_id_Handle(void) const;
125 
126  /// State of bioseq handle.
128  fState_none = 0,
129  fState_suppress_temp = 1 << 0,
130  fState_suppress_perm = 1 << 1,
131  fState_suppress = fState_suppress_temp |
132  fState_suppress_perm,
133  fState_dead = 1 << 2,
134  fState_confidential = 1 << 3,
135  fState_withdrawn = 1 << 4,
136  fState_no_data = 1 << 5,
137  fState_conflict = 1 << 6,
138  fState_not_found = 1 << 7,
139  fState_other_error = 1 << 8
140  };
141  typedef int TBioseqStateFlags;
142 
143  /// Get state of the bioseq. May be used with an empty bioseq handle
144  /// to check why the bioseq retrieval failed.
145  TBioseqStateFlags GetState(void) const;
146  bool State_SuppressedTemp(void) const;
147  bool State_SuppressedPerm(void) const;
148  bool State_Suppressed(void) const;
149  bool State_Confidential(void) const;
150  bool State_Dead(void) const;
151  bool State_Withdrawn(void) const;
152  bool State_NoData(void) const;
153  bool State_Conflict(void) const;
154  bool State_NotFound(void) const;
155 
156  /// Check if this id can be used to obtain this bioseq handle
157  bool IsSynonym(const CSeq_id& id) const;
158  bool IsSynonym(const CSeq_id_Handle& idh) const;
159 
160  /// Get the bioseq's synonyms
161  CConstRef<CSynonymsSet> GetSynonyms(void) const;
162 
163  /// Get parent Seq-entry handle
164  ///
165  /// @sa
166  /// GetSeq_entry_Handle()
167  CSeq_entry_Handle GetParentEntry(void) const;
168 
169  /// Return a handle for the parent Bioseq-set, or null handle
170  CBioseq_set_Handle GetParentBioseq_set(void) const;
171 
172  /// Get parent Seq-entry handle
173  ///
174  /// @sa
175  /// GetParentEntry()
177 
178  /// Get top level Seq-entry handle
179  CSeq_entry_Handle GetTopLevelEntry(void) const;
180 
181  /// Get 'edit' version of handle
182  CBioseq_EditHandle GetEditHandle(void) const;
183 
184  /// Bioseq core -- using partially populated CBioseq
186 
187  /// Get bioseq core structure
188  TBioseqCore GetBioseqCore(void) const;
189 
190  /// Get the complete bioseq
191  CConstRef<CBioseq> GetCompleteBioseq(void) const;
192 
193  /// Unified interface for templates
194  typedef CBioseq TObject;
195  CConstRef<TObject> GetCompleteObject(void) const;
196  CConstRef<TObject> GetObjectCore(void) const;
197 
198  //////////////////////////////////////////////////////////////////
199  // Bioseq members
200  // id
201  typedef vector<CSeq_id_Handle> TId;
202  bool IsSetId(void) const;
203  bool CanGetId(void) const;
204  const TId& GetId(void) const;
205  // descr
207  bool IsSetDescr(void) const;
208  bool CanGetDescr(void) const;
209  const TDescr& GetDescr(void) const;
210  // inst
211  typedef CSeq_inst TInst;
212  bool IsSetInst(void) const;
213  bool CanGetInst(void) const;
214  const TInst& GetInst(void) const;
215  // inst.repr
217  bool IsSetInst_Repr(void) const;
218  bool CanGetInst_Repr(void) const;
219  TInst_Repr GetInst_Repr(void) const;
220  // inst.mol
222  bool IsSetInst_Mol(void) const;
223  bool CanGetInst_Mol(void) const;
224  TInst_Mol GetInst_Mol(void) const;
225  // inst.length
227  bool IsSetInst_Length(void) const;
228  bool CanGetInst_Length(void) const;
229  TInst_Length GetInst_Length(void) const;
230  TSeqPos GetBioseqLength(void) const; // try to calculate it if not set
231  // inst.fuzz
233  bool IsSetInst_Fuzz(void) const;
234  bool CanGetInst_Fuzz(void) const;
235  const TInst_Fuzz& GetInst_Fuzz(void) const;
236  // inst.topology
238  bool IsSetInst_Topology(void) const;
239  bool CanGetInst_Topology(void) const;
240  TInst_Topology GetInst_Topology(void) const;
241  // inst.strand
243  bool IsSetInst_Strand(void) const;
244  bool CanGetInst_Strand(void) const;
245  TInst_Strand GetInst_Strand(void) const;
246  // inst.seq-data
248  bool IsSetInst_Seq_data(void) const;
249  bool CanGetInst_Seq_data(void) const;
250  const TInst_Seq_data& GetInst_Seq_data(void) const;
251  // inst.ext
253  bool IsSetInst_Ext(void) const;
254  bool CanGetInst_Ext(void) const;
255  const TInst_Ext& GetInst_Ext(void) const;
256  // inst.hist
258  bool IsSetInst_Hist(void) const;
259  bool CanGetInst_Hist(void) const;
260  const TInst_Hist& GetInst_Hist(void) const;
261  // annot
262  bool HasAnnots(void) const;
263 
264  // Check sequence type
266  TMol GetSequenceType(void) const;
267  bool IsProtein(void) const;
268  bool IsNucleotide(void) const;
269 
270  //////////////////////////////////////////////////////////////////
271  // Old interface:
272 
273  /// Go up to a certain complexity level (or the nearest level of the same
274  /// priority if the required class is not found):
275  /// level class
276  /// 0 not-set (0) ,
277  /// 3 nuc-prot (1) , -- nuc acid and coded proteins
278  /// 2 segset (2) , -- segmented sequence + parts
279  /// 2 conset (3) , -- constructed sequence + parts
280  /// 1 parts (4) , -- parts for 2 or 3
281  /// 1 gibb (5) , -- geninfo backbone
282  /// 1 gi (6) , -- geninfo
283  /// 5 genbank (7) , -- converted genbank
284  /// 3 pir (8) , -- converted pir
285  /// 4 pub-set (9) , -- all the seqs from a single publication
286  /// 4 equiv (10) , -- a set of equivalent maps or seqs
287  /// 3 swissprot (11) , -- converted SWISSPROT
288  /// 3 pdb-entry (12) , -- a complete PDB entry
289  /// 4 mut-set (13) , -- set of mutations
290  /// 4 pop-set (14) , -- population study
291  /// 4 phy-set (15) , -- phylogenetic study
292  /// 4 eco-set (16) , -- ecological sample study
293  /// 4 gen-prod-set (17) , -- genomic products, chrom+mRNa+protein
294  /// 4 wgs-set (18) , -- whole genome shotgun project
295  /// 0 other (255)
296  CSeq_entry_Handle GetComplexityLevel(CBioseq_set::EClass cls) const;
297 
298  /// Return level with exact complexity, or empty handle if not found.
299  CSeq_entry_Handle GetExactComplexityLevel(CBioseq_set::EClass cls) const;
300 
301  /// Get some values from core:
302  TMol GetBioseqMolType(void) const;
303  bool IsNa(void) const;
304  bool IsAa(void) const;
305 
310  eSequenceClass_TPA
311  };
312  ESequenceClass GetSequenceClass(void) const;
313 
314  /// Get sequence map.
315  const CSeqMap& GetSeqMap(void) const;
316 
317  /// Segment search flags
319  eFindSegment_NoLimit, ///< No limit on resolving seq-map
320  eFindSegment_LimitTSE ///< Resolve in the parent TSE only
321  };
322 
323  /// Check if the seq-id describes a segment of the bioseq
324  ///
325  /// @param id
326  /// Seq-id to be checked for being a segment of the handle.
327  ///
328  /// @param resolve_depth
329  /// Depth of resolving segments. Zero allows to check only top-level
330  /// segments.
331  ///
332  /// @param limit_flag
333  /// Allow/prohibit resolving far references. By default all segments are
334  /// resolved. If the flag is set to eFindSegment_LimitTSE, only near
335  /// references are checked.
336  bool ContainsSegment(const CSeq_id& id,
337  size_t resolve_depth = kMax_Int,
338  EFindSegment limit_flag = eFindSegment_NoLimit) const;
339  bool ContainsSegment(CSeq_id_Handle id,
340  size_t resolve_depth = kMax_Int,
341  EFindSegment limit_flag = eFindSegment_NoLimit) const;
342  bool ContainsSegment(const CBioseq_Handle& part,
343  size_t resolve_depth = kMax_Int,
344  EFindSegment limit_flag = eFindSegment_NoLimit) const;
345 
346  /// CSeqVector constructor flags
348  eCoding_NotSet, ///< Use original coding - DANGEROUS! - may change
349  eCoding_Ncbi, ///< Set coding to binary coding (Ncbi4na or Ncbistdaa)
350  eCoding_Iupac ///< Set coding to printable coding (Iupacna or Iupacaa)
351  };
353  eStrand_Plus, ///< Plus strand
354  eStrand_Minus ///< Minus strand
355  };
356 
357  /// Get sequence: Iupacna or Iupacaa if use_iupac_coding is true
358  CSeqVector GetSeqVector(EVectorCoding coding,
359  ENa_strand strand = eNa_strand_plus) const;
360  /// Get sequence
361  CSeqVector GetSeqVector(ENa_strand strand = eNa_strand_plus) const;
362  /// Get sequence: Iupacna or Iupacaa if use_iupac_coding is true
363  CSeqVector GetSeqVector(EVectorCoding coding, EVectorStrand strand) const;
364  /// Get sequence
365  CSeqVector GetSeqVector(EVectorStrand strand) const;
366 
367  /// Return CSeq_loc referencing the given range and strand on the bioseq
368  /// If start == 0, stop == 0, and strand == eNa_strand_unknown,
369  /// CSeq_loc will be of type 'whole'.
370  CRef<CSeq_loc> GetRangeSeq_loc(TSeqPos start,
371  TSeqPos stop,
372  ENa_strand strand
373  = eNa_strand_unknown) const;
374 
375  /// Map a seq-loc from the bioseq's segment to the bioseq
376  CRef<CSeq_loc> MapLocation(const CSeq_loc& loc) const;
377 
378  // Utility methods/operators
379 
380  /// Check if handles point to the same bioseq
381  ///
382  /// @sa
383  /// operator!=()
384  bool operator== (const CBioseq_Handle& h) const;
385 
386  // Check if handles point to different bioseqs
387  ///
388  /// @sa
389  /// operator==()
390  bool operator!= (const CBioseq_Handle& h) const;
391 
392  /// For usage in containers
393  bool operator< (const CBioseq_Handle& h) const;
394 
395  /// Check if handle points to a bioseq and is not removed
396  ///
397  /// @sa
398  /// operator !()
399  DECLARE_OPERATOR_BOOL(m_Info.IsValid());
400 
401  /// Check if handle points to a removed bioseq
402  bool IsRemoved(void) const;
403 
404  /// Get CTSE_Handle of containing TSE
405  const CTSE_Handle& GetTSE_Handle(void) const;
406 
407 
408  // these methods are for cross scope move only.
409  /// Copy current bioseq into seq-entry
410  ///
411  /// @param entry
412  /// Current bioseq will be inserted into seq-entry pointed
413  /// by this handle.
414  // If seq-entry is not seqset exception will be thrown
415  /// @param index
416  /// Start index is 0 and -1 means end
417  ///
418  /// @return
419  /// Edit handle to inserted bioseq
420  CBioseq_EditHandle CopyTo(const CSeq_entry_EditHandle& entry,
421  int index = -1) const;
422 
423  /// Copy current bioseq into seqset
424  ///
425  /// @param entry
426  /// Current bioseq will be inserted into seqset pointed
427  /// by this handle.
428  /// @param index
429  /// Start index is 0 and -1 means end
430  ///
431  /// @return
432  /// Edit handle to inserted bioseq
433  CBioseq_EditHandle CopyTo(const CBioseq_set_EditHandle& seqset,
434  int index = -1) const;
435 
436  /// Copy current bioseq into seq-entry and set seq-entry as bioseq
437  ///
438  /// @param entry
439  /// Seq-entry pointed by entry handle will be set to bioseq
440  ///
441  /// @return
442  /// Edit handle to inserted bioseq
443  CBioseq_EditHandle CopyToSeq(const CSeq_entry_EditHandle& entry) const;
444 
445  /// Register argument bioseq as used by this bioseq, so it will be
446  /// released by scope only after this bioseq is released.
447  ///
448  /// @param bh
449  /// Used bioseq handle
450  ///
451  /// @return
452  /// True if argument bioseq was successfully registered as 'used'.
453  /// False if argument bioseq was not registered as 'used'.
454  /// Possible reasons:
455  /// Circular reference in 'used' tree.
456  bool AddUsedBioseq(const CBioseq_Handle& bh) const;
457 
458  /// Feature fetch policy describes when to look for features on sequence
459  /// segments.
461  eFeatureFetchPolicy_default = 0, // no valid feature policy found
462  eFeatureFetchPolicy_only_near = 1,
463  eFeatureFetchPolicy_allow_far = 2
464  };
465  EFeatureFetchPolicy GetFeatureFetchPolicy(void) const;
466 
467 protected:
468  friend class CScope_Impl;
469  friend class CSynonymsSet;
470  friend class CSeq_entry_EditHandle;
471 
474 
475  CBioseq_Handle(const CSeq_id_Handle& id, const TScopeInfo& info);
476  CBioseq_Handle(const CSeq_id_Handle& id, const TLock& lock);
477 
478  CScope_Impl& x_GetScopeImpl(void) const;
479  const CBioseq_ScopeInfo& x_GetScopeInfo(void) const;
480 
483 
484 public: // non-public section
485  const CBioseq_Info& x_GetInfo(void) const;
486 };
487 
488 
489 /////////////////////////////////////////////////////////////////////////////
490 ///
491 /// CBioseq_EditHandle --
492 ///
493 /// Proxy to access and edit the bioseq data
494 ///
495 
497 {
498 public:
499  CBioseq_EditHandle(void);
500  /// create edit interface class to the object which already allows editing
501  /// throw an exception if the argument is not in editing mode
502  explicit CBioseq_EditHandle(const CBioseq_Handle& h);
503 
504  /// Navigate object tree
505  CSeq_entry_EditHandle GetParentEntry(void) const;
506 
507  // Modification functions
508 
509  //////////////////////////////////////////////////////////////////
510  // Bioseq members
511  // id
512  void ResetId(void) const;
513  bool AddId(const CSeq_id_Handle& id) const;
514  bool RemoveId(const CSeq_id_Handle& id) const;
515  // descr
516  void ResetDescr(void) const;
517  void SetDescr(TDescr& v) const;
518  TDescr& SetDescr(void) const;
519  bool AddSeqdesc(CSeqdesc& d) const;
520  CRef<CSeqdesc> RemoveSeqdesc(const CSeqdesc& d) const;
521  CRef<CSeqdesc> ReplaceSeqdesc(const CSeqdesc& old_desc, CSeqdesc& new_desc) const;
522  void AddSeq_descr(TDescr& v) const;
523  // inst
524  void SetInst(TInst& v) const;
525  // inst.repr
526  void SetInst_Repr(TInst_Repr v) const;
527  // inst.mol
528  void SetInst_Mol(TInst_Mol v) const;
529  // inst.length
530  void SetInst_Length(TInst_Length v) const;
531  // inst.fuzz
532  void SetInst_Fuzz(TInst_Fuzz& v) const;
533  // inst.topology
534  void SetInst_Topology(TInst_Topology v) const;
535  // inst.strand
536  void SetInst_Strand(TInst_Strand v) const;
537  // inst.seq-data
538  void SetInst_Seq_data(TInst_Seq_data& v) const;
539  // inst.ext
540  void SetInst_Ext(TInst_Ext& v) const;
541  // inst.hist
542  void SetInst_Hist(TInst_Hist& v) const;
543  // annot
544  //////////////////////////////////////////////////////////////////
545 
546 
547  /// Attach an annotation
548  ///
549  /// @param annot
550  /// Reference to this annotation will be attached
551  ///
552  /// @return
553  /// Edit handle to the attached annotation
554  ///
555  /// @sa
556  /// CopyAnnot()
557  /// TakeAnnot()
558  CSeq_annot_EditHandle AttachAnnot(CSeq_annot& annot) const;
559 
560  /// Attach a copy of the annotation
561  ///
562  /// @param annot
563  /// Copy of the annotation pointed by this handle will be attached
564  ///
565  /// @return
566  /// Edit handle to the attached annotation
567  ///
568  /// @sa
569  /// AttachAnnot()
570  /// TakeAnnot()
571  CSeq_annot_EditHandle CopyAnnot(const CSeq_annot_Handle& annot) const;
572 
573  /// Remove the annotation from its location and attach to current one
574  ///
575  /// @param annot
576  /// An annotation pointed by this handle will be removed and attached
577  ///
578  /// @return
579  /// Edit handle to the attached annotation
580  ///
581  /// @sa
582  /// AttachAnnot()
583  /// CopyAnnot()
584  CSeq_annot_EditHandle TakeAnnot(const CSeq_annot_EditHandle& annot) const;
585 
586  // Tree modification, target handle must be in the same TSE
587  // entry.Which() must be e_not_set or e_Set.
588 
589  /// Move current bioseq into seq-entry
590  ///
591  /// @param entry
592  /// Current bioseq will be inserted into seq-entry pointed
593  /// by this handle.
594  // If seq-entry is not seqset exception will be thrown
595  /// @param index
596  /// Start index is 0 and -1 means end
597  ///
598  /// @return
599  /// Edit handle to inserted bioseq
600  CBioseq_EditHandle MoveTo(const CSeq_entry_EditHandle& entry,
601  int index = -1) const;
602 
603  /// Move current bioseq into seqset
604  ///
605  /// @param entry
606  /// Current bioseq will be inserted into seqset pointed
607  /// by this handle.
608  /// @param index
609  /// Start index is 0 and -1 means end
610  ///
611  /// @return
612  /// Edit handle to inserted bioseq
613  CBioseq_EditHandle MoveTo(const CBioseq_set_EditHandle& seqset,
614  int index = -1) const;
615 
616  /// Move current bioseq into seq-entry and set seq-entry as bioseq
617  ///
618  /// @param entry
619  /// seq-entry pointed by entry handle will be set to bioseq
620  ///
621  /// @return
622  /// Edit handle to inserted bioseq
623  CBioseq_EditHandle MoveToSeq(const CSeq_entry_EditHandle& entry) const;
624 
625  /// Remove current bioseq from its location
626  enum ERemoveMode {
628  eKeepSeq_entry
629  };
630  void Remove(ERemoveMode mode = eRemoveSeq_entry) const;
631 
632  /// Get CSeqMap object for sequence editing
633  CSeqMap& SetSeqMap(void) const;
634 
635 protected:
636  friend class CScope_Impl;
637 
639  CBioseq_EditHandle(const CSeq_id_Handle& id, const TLock& lock);
640 
641  void x_Detach(void) const;
642 
643 public: // non-public section
644  CBioseq_ScopeInfo& x_GetScopeInfo(void) const;
645  CBioseq_Info& x_GetInfo(void) const;
646 
647 public:
648  void x_RealResetDescr(void) const;
649  void x_RealSetDescr(TDescr& v) const;
650  bool x_RealAddSeqdesc(CSeqdesc& d) const;
651  CRef<CSeqdesc> x_RealRemoveSeqdesc(const CSeqdesc& d) const;
652  CRef<CSeqdesc> x_RealReplaceSeqdesc(const CSeqdesc& old_desc, CSeqdesc& new_desc) const;
653  void x_RealAddSeq_descr(TDescr& v) const;
654 
655  void x_RealResetId(void) const;
656  bool x_RealAddId(const CSeq_id_Handle& id) const;
657  bool x_RealRemoveId(const CSeq_id_Handle& id) const;
658 
659  void x_RealSetInst(TInst& v) const;
660  void x_RealSetInst_Repr(TInst_Repr v) const;
661  void x_RealSetInst_Mol(TInst_Mol v) const;
662  void x_RealSetInst_Length(TInst_Length v) const;
663  void x_RealSetInst_Fuzz(TInst_Fuzz& v) const;
664  void x_RealSetInst_Topology(TInst_Topology v) const;
665  void x_RealSetInst_Strand(TInst_Strand v) const;
666  void x_RealSetInst_Seq_data(TInst_Seq_data& v) const;
667  void x_RealSetInst_Ext(TInst_Ext& v) const;
668  void x_RealSetInst_Hist(TInst_Hist& v) const;
669  void x_RealResetInst() const;
670  void x_RealResetInst_Repr() const;
671  void x_RealResetInst_Mol() const;
672  void x_RealResetInst_Length() const;
673  void x_RealResetInst_Fuzz() const;
674  void x_RealResetInst_Topology() const;
675  void x_RealResetInst_Strand() const;
676  void x_RealResetInst_Seq_data() const;
677  void x_RealResetInst_Ext() const;
678  void x_RealResetInst_Hist() const;
679 
680 };
681 
682 
683 /////////////////////////////////////////////////////////////////////////////
684 // CBioseq_Handle inline methods
685 /////////////////////////////////////////////////////////////////////////////
686 
687 
688 inline
690 {
691 }
692 
693 
694 inline
696 {
697  return (GetState() & fState_suppress_temp) != 0;
698 }
699 
700 
701 inline
703 {
704  return (GetState() & fState_suppress_perm) != 0;
705 }
706 
707 
708 inline
710 {
711  return (GetState() & fState_suppress) != 0;
712 }
713 
714 
715 inline
717 {
718  return (GetState() & fState_confidential) != 0;
719 }
720 
721 
722 inline
724 {
725  return (GetState() & fState_dead) != 0;
726 }
727 
728 
729 inline
731 {
732  return (GetState() & fState_withdrawn) != 0;
733 }
734 
735 
736 inline
738 {
739  return (GetState() & fState_no_data) != 0;
740 }
741 
742 
743 inline
745 {
746  return (GetState() & fState_conflict) != 0;
747 }
748 
749 
750 inline
752 {
753  return (GetState() & fState_not_found) != 0;
754 }
755 
756 
757 inline
759 {
760  return m_Info.GetObject().GetTSE_Handle();
761 }
762 
763 
764 inline
766 {
767  return m_Info && m_Info.GetPointerOrNull()->IsDetached();
768 }
769 
770 
771 inline
773 {
774  return m_Handle_Seq_id;
775 }
776 
777 
778 inline
780 {
781  return CConstRef<CSeq_id>(GetBioseqCore()->GetNonLocalId());
782 }
783 
784 inline
786 {
787  return CConstRef<CSeq_id>(GetBioseqCore()->GetLocalId());
788 }
789 
790 inline
792 {
793  return GetTSE_Handle().GetScope();
794 }
795 
796 
797 inline
799 {
800  return GetTSE_Handle().x_GetScopeImpl();
801 }
802 
803 
804 inline
806 {
807  // No need to check m_TSE, because m_ScopeInfo is scope specific too.
808  return m_Info == h.m_Info;
809 }
810 
811 
812 inline
814 {
815  return m_Info < h.m_Info;
816 }
817 
818 
819 inline
821 {
822  return m_Info != h.m_Info;
823 }
824 
825 
826 inline
828 {
829  return const_cast<CBioseq_ScopeInfo&>(CBioseq_Handle::x_GetScopeInfo());
830 }
831 
832 
833 inline
835 {
836  return const_cast<CBioseq_Info&>(CBioseq_Handle::x_GetInfo());
837 }
838 
839 
840 inline
842 {
843  return GetCompleteBioseq();
844 }
845 
846 
847 inline
849 {
850  return GetBioseqCore();
851 }
852 
853 
854 inline
856 {
857  return GetInst_Mol();
858 }
859 
860 
861 inline
863 {
865 }
866 
867 
868 inline
870 {
872 }
873 
874 
875 /* @} */
876 
877 
880 
881 #endif // BIOSEQ_HANDLE__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
static CSeq_entry_Handle GetSeq_entry_Handle(TTypeInfo type, TConstObjectPtr ptr, CScope &scope)
CBioseq_EditHandle –.
CBioseq_Handle –.
CBioseq_set_EditHandle –.
CBioseq_set_Handle –.
bool IsDetached(void) const
Definition: tse_handle.hpp:403
const CTSE_Handle & GetTSE_Handle(void) const
Definition: tse_handle.hpp:445
friend class CBioseq_EditHandle
Definition: scope_impl.hpp:670
CScope –.
Definition: scope.hpp:92
CSeqMap –.
Definition: seq_map.hpp:93
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_annot_Handle –.
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
CSeq_entry_Handle –.
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
CSeq_ext –.
Definition: Seq_ext.hpp:66
CSeq_hist –.
Definition: Seq_hist.hpp:66
bool IsAa(void) const
Definition: Seq_inst.hpp:113
bool IsNa(void) const
Definition: Seq_inst.hpp:106
CScope_Impl & x_GetScopeImpl(void) const
Definition: tse_handle.hpp:332
CScope & GetScope(void) const
Returns scope.
Definition: tse_handle.hpp:325
Include a standard set of the NCBI C++ Toolkit most basic headers.
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
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,...
DECLARE_OPERATOR_BOOL(m_Info.IsValid())
Check if handle points to a bioseq and is not removed.
TInst::TSeq_data TInst_Seq_data
vector< CSeq_id_Handle > TId
CSeq_inst::TMol TMol
CConstRef< CSeq_id > GetLocalIdOrNull(void) const
bool IsNucleotide(void) const
const CTSE_Handle & GetTSE_Handle(void) const
Get CTSE_Handle of containing TSE.
TScopeInfo & x_GetScopeInfo(void) const
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
bool State_NotFound(void) const
TBioseqStateFlags GetState(void) const
Get state of the bioseq.
TInst::TStrand TInst_Strand
CBioseq_ScopeInfo TScopeInfo
EBioseqStateFlags
State of bioseq handle.
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
EFindSegment
Segment search flags.
CConstRef< TObject > GetCompleteObject(void) const
CScope_Impl & x_GetScopeImpl(void) const
TInst::THist TInst_Hist
TInst::TMol TInst_Mol
CBioseq_Info & x_GetInfo(void) const
friend class CBioseq_Handle
bool State_Conflict(void) const
CConstRef< CBioseq > TBioseqCore
Bioseq core – using partially populated CBioseq.
bool State_NoData(void) const
CBioseq TObject
Unified interface for templates.
TInst::TLength TInst_Length
const CSeq_id_Handle & GetSeq_id_Handle(void) const
Get handle of id used to obtain this bioseq handle.
TInst::TFuzz TInst_Fuzz
TInst_Mol GetInst_Mol(void) const
bool State_Dead(void) const
const CBioseq_ScopeInfo & x_GetScopeInfo(void) const
EFeatureFetchPolicy
Feature fetch policy describes when to look for features on sequence segments.
bool operator==(const CBioseq_Handle &h) const
Check if handles point to the same bioseq.
EVectorCoding
CSeqVector constructor flags.
bool IsRemoved(void) const
Check if handle points to a removed bioseq.
bool IsProtein(void) const
CSeq_id_Handle m_Handle_Seq_id
bool State_SuppressedTemp(void) const
CConstRef< TObject > GetObjectCore(void) const
TInst::TRepr TInst_Repr
bool State_SuppressedPerm(void) const
CConstRef< CSeq_id > GetNonLocalIdOrNull(void) const
Find a non-local ID if present, consulting assembly details if all IDs for the overall sequence are l...
CScopeInfo_Ref< TScopeInfo > TLock
TMol GetSequenceType(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
TInst::TTopology TInst_Topology
bool State_Suppressed(void) const
ERemoveMode
Remove current bioseq from its location.
const CBioseq_Info & x_GetInfo(void) const
CSeq_descr TDescr
bool operator<(const CBioseq_Handle &h) const
For usage in containers.
bool State_Confidential(void) const
TInst::TExt TInst_Ext
CSeq_entry_Info & x_GetInfo(void) const
CBioseq_ScopeInfo & x_GetScopeInfo(void) const
CScope_Impl & x_GetScopeImpl(void) const
bool operator!=(const CBioseq_Handle &h) const
bool State_Withdrawn(void) const
@ eFindSegment_NoLimit
No limit on resolving seq-map.
@ eStrand_Plus
Plus strand.
@ eCoding_NotSet
Use original coding - DANGEROUS! - may change.
@ eCoding_Ncbi
Set coding to binary coding (Ncbi4na or Ncbistdaa)
TObjectType & GetObject(void)
Get object.
Definition: ncbiobj.hpp:1011
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:986
#define kMax_Int
Definition: ncbi_limits.h:184
#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_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define NCBI_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
@ eNa_strand_plus
Definition: Na_strand_.hpp:66
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
ERepr
representation class
Definition: Seq_inst_.hpp:91
ETopology
topology of molecule
Definition: Seq_inst_.hpp:121
EMol
molecule class in living organism
Definition: Seq_inst_.hpp:108
EStrand
strandedness in living organism
Definition: Seq_inst_.hpp:133
TSeqPos TLength
Definition: Seq_inst_.hpp:147
static MDB_envinfo info
Definition: mdb_load.c:37
mdb_mode_t mode
Definition: lmdb++.h:38
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
Uint4 GetSequenceType(const CBioseq_Handle &bsh)
Return a (corrected) set of flags identifying the sequence type.
Definition: sequtils.cpp:42
CScope & GetScope()
Modified on Tue May 28 05:52:36 2024 by modify_doxy.py rev. 669887