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

Go to the SVN repository for this file.

1 #ifndef ALGO_BLAST_API__SEQINFOSRC_BIOSEQ__HPP
2 #define ALGO_BLAST_API__SEQINFOSRC_BIOSEQ__HPP
3 
4 /* $Id: seqinfosrc_bioseq.hpp 72273 2016-04-27 17:19:56Z madden $
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: Christiam Camacho
30  *
31  */
32 
33 /** @file seqinfosrc_bioseq.hpp
34  * Defines a concrete strategy for the IBlastSeqInfoSrc interface for
35  * sequence identifiers retrieval from a CBioseq/CBioseq_set object
36  */
37 
40 
41 /** @addtogroup AlgoBlast
42  *
43  * @{
44  */
45 
47 
49  class CBioseq;
50  class CBioseq_set;
52 
53 BEGIN_SCOPE(blast)
54 
55 /// Implementation of the IBlastSeqInfoSrc interface to encapsulate retrieval
56 /// of sequence identifiers and lengths from a CBioseq/CBioseq_set object
58 {
59 public:
60  /// Parametrized constructor
61  /// @param bs CBioseq object from which to obtain the data [in]
62  /// @param is_prot true if sequence in bs argument is protein, else
63  /// false [in]
64  CBioseqSeqInfoSrc(const objects::CBioseq& bs, bool is_prot);
65 
66  /// Parametrized constructor
67  /// @param bss CBioseq_set object from which to obtain the data [in]
68  /// @param is_prot true if sequences in bss argument are all proteins, else
69  /// false [in]
70  CBioseqSeqInfoSrc(const objects::CBioseq_set& bss, bool is_prot);
71 
72  /// Retrieve a sequence identifier given its index in the vector.
73  /// @param index the ordinal number to retrieve [in]
74  virtual list< CRef<objects::CSeq_id> > GetId(Uint4 index) const;
75 
76  /// Retrieve a sequence identifier given its index in the vector.
77  /// @param index the ordinal number to retrieve [in]
78  virtual CConstRef<objects::CSeq_loc> GetSeqLoc(Uint4 index) const;
79 
80  /// Retrieve sequence length given its index in the vector.
81  /// @param index the ordinal number to retrieve [in]
82  virtual Uint4 GetLength(Uint4 index) const;
83 
84  /// Returns the size of the underlying container of sequences
85  virtual size_t Size() const;
86 
87  /// Is the subject restricted by a GI list? (Always returns false).
88  virtual bool HasGiList() const;
89 
90  /// Retrieves the subject masks for the corresponding index
91  /// @param index the ordinal number to retrieve [in]
92  /// @param target_range range for which to return masks for. Empty ranges
93  /// indicate that no masks should be retrieved, whole ranges mean that
94  /// masks for the whole sequence should be retrieved [in]
95  /// @param retval the masks will be returned through this parameter [out]
96  /// @return true if there were masks returned in retval, otherwise false.
97  virtual bool GetMasks(Uint4 index,
98  const TSeqRange& target_range,
99  TMaskedSubjRegions& retval) const;
100 
101  /// Retrieves the subject masks for the corresponding index
102  /// @param index the ordinal number to retrieve [in]
103  /// @param target_ranges range for which to return masks for. Empty ranges
104  /// indicate that no masks should be retrieved, whole ranges mean that
105  /// masks for the whole sequence should be retrieved [in]
106  /// @param retval the masks will be returned through this parameter [out]
107  /// @return true if there were masks returned in retval, otherwise false.
108  virtual bool GetMasks(Uint4 index,
109  const vector<TSeqRange>& target_ranges,
110  TMaskedSubjRegions& retval) const;
111 
112  /// Return true if the implementation can return anything besides a seq-loc
113  /// for the entire sequence. If in doubt, the implementation must
114  /// return true.
115  /// GetSeqLoc use CreateWholeSeqLocFromIds, so false is returned for this implementation.
116  virtual bool CanReturnPartialSequence() const {return false;}
117 
118 private:
120 };
121 
122 END_SCOPE(blast)
124 
125 /* @} */
126 
127 #endif /* ALGO_BLAST_API__SEQINFOSRC_BIOSEQ_HPP */
Internal auxiliary setup classes/functions for extracting sequence data from Bioseqs.
Defines interface for retrieving sequence identifiers.
Implementation of the IBlastSeqInfoSrc interface to encapsulate retrieval of sequence identifiers and...
Implements the IBlastQuerySource interface using a CBioseq_set as data source.
Abstract base class to encapsulate retrieval of sequence identifiers.
Collection of masked regions for a single query sequence.
Definition: seqlocinfo.hpp:113
virtual bool CanReturnPartialSequence() const
Return true if the implementation can return anything besides a seq-loc for the entire sequence.
CBlastQuerySourceBioseqSet m_DataSource
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,...
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#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
Modified on Tue Apr 23 07:37:34 2024 by modify_doxy.py rev. 669887