NCBI C++ ToolKit
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CCachedSequence Class Reference

Search Toolkit Book for CCachedSequence

Manages a TSE and its subordinate chunks for all implementations of the IBlastDbAdapter interface. More...

#include "cached_sequence.hpp"
(Private to src/objtools/data_loaders/blastdb.)

+ Inheritance diagram for CCachedSequence:
+ Collaboration diagram for CCachedSequence:

Public Types

typedef vector< CRef< CTSE_Chunk_Info > > TCTSE_Chunk_InfoVector
 A list of 'chunk' objects, generic sequence related data elements. More...
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 

Public Member Functions

 CCachedSequence (IBlastDbAdapter &blastdb, const CSeq_id_Handle &idh, int oid, bool use_fixed_size_slices, TSeqPos slice_size=kSequenceSliceSize)
 Construct and pre-process the sequence. More...
 
void RegisterIds (CBlastDbDataLoader::TIdMap &idmap)
 Add this sequence's identifiers to a lookup table held by the data loader. More...
 
void SplitSeqData (TCTSE_Chunk_InfoVector &chunks)
 Load or split the sequence data chunks. More...
 
CRef< CSeq_entryGetTSE () const
 Get the top-level seq-entry managed by this object. More...
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Private Member Functions

void x_AddSplitSeqChunk (TCTSE_Chunk_InfoVector &chunks, const CSeq_id_Handle &id, TSeqPos begin, TSeqPos end)
 Add a chunk of sequence data. More...
 
void x_AddFullSeq_data (void)
 Add an the entire sequence data to this object's TSE as raw data in its Seq-data field. More...
 

Private Attributes

CSeq_id_Handle m_SIH
 SeqID handle. More...
 
CRef< CSeq_entrym_TSE
 The Seq entry we handle. More...
 
TSeqPos m_Length
 Sequence length in bases. More...
 
IBlastDbAdapterm_BlastDb
 Database reference. More...
 
int m_OID
 Locates this sequence within m_BlastDb. More...
 
bool m_UseFixedSizeSlices
 Determines whether sequences should be fetched in fixed size slices or in incrementally larger sizes. More...
 
TSeqPos m_SliceSize
 Specifies the slice size for splitting the sequence data. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Detailed Description

Manages a TSE and its subordinate chunks for all implementations of the IBlastDbAdapter interface.

Definition at line 46 of file cached_sequence.hpp.

Member Typedef Documentation

◆ TCTSE_Chunk_InfoVector

A list of 'chunk' objects, generic sequence related data elements.

Definition at line 81 of file cached_sequence.hpp.

Constructor & Destructor Documentation

◆ CCachedSequence()

CCachedSequence::CCachedSequence ( IBlastDbAdapter blastdb,
const CSeq_id_Handle idh,
int  oid,
bool  use_fixed_size_slices,
TSeqPos  slice_size = kSequenceSliceSize 
)

Construct and pre-process the sequence.

This constructor starts the processing of the specified sequence. It loads the bioseq (minus sequence data) and caches the sequence length.

Parameters
idhA handle to the sequence identifier.
blastdbThe interface to the BLAST database containing the original sequence.
oidLocates the sequence within the BLAST database.
use_fixed_size_slicesDetermines the strategy to retrieve the sequence data that is split, see comment for this class' m_UseFixedSizeSlices field.
slice_sizeDetermines the slice size for splitting the sequence data.

Definition at line 46 of file cached_sequence.cpp.

References _ASSERT, CSeq_inst_Base::eMol_aa, CSeq_inst_Base::eMol_na, CSeqDB::eProtein, CBioseq::GetFirstId(), CSeq_id_Handle::GetHandle(), CBioseq_Base::SetInst(), and ZERO_GI.

Member Function Documentation

◆ GetTSE()

CRef<CSeq_entry> CCachedSequence::GetTSE ( void  ) const
inline

Get the top-level seq-entry managed by this object.

Definition at line 95 of file cached_sequence.hpp.

References m_TSE.

◆ RegisterIds()

void CCachedSequence::RegisterIds ( CBlastDbDataLoader::TIdMap idmap)

Add this sequence's identifiers to a lookup table held by the data loader.

This method adds identifiers from this sequence to a lookup table so that the OID of the sequence can be found quickly during future processing of the same sequence.

Parameters
idmapA map from CSeq_id_Handle to OID.

Definition at line 98 of file cached_sequence.cpp.

References _ASSERT, CSeq_id_Handle::GetHandle(), CSeq_entry_Base::IsSeq(), ITERATE, m_OID, m_TSE, s_ExtractSeqIds(), CBioseq_Base::SetId(), and CSeq_entry_Base::SetSeq().

◆ SplitSeqData()

void CCachedSequence::SplitSeqData ( TCTSE_Chunk_InfoVector chunks)

Load or split the sequence data chunks.

The sequence data is stored and a list of the available ranges of data is returned via the 'chunks' parameter. For large sequences, these do not contain sequence data, but merely indicate what is available, in other cases, the entire sequence data will be loaded

Parameters
chunksThe sequence data chunks will be returned here.

Definition at line 120 of file cached_sequence.cpp.

References delta(), CSeq_inst_Base::eRepr_delta, CSeq_inst_Base::eRepr_raw, kFastSequenceLoadSize, kRmtSequenceSliceSize, kSliceGrowthFactor, m_Length, m_SIH, m_SliceSize, m_TSE, m_UseFixedSizeSlices, CSeq_inst_Base::SetExt(), CBioseq_Base::SetInst(), CSeq_inst_Base::SetRepr(), CSeq_entry_Base::SetSeq(), x_AddFullSeq_data(), and x_AddSplitSeqChunk().

◆ x_AddFullSeq_data()

void CCachedSequence::x_AddFullSeq_data ( void  )
private

Add an the entire sequence data to this object's TSE as raw data in its Seq-data field.

Definition at line 112 of file cached_sequence.cpp.

References _ASSERT, IBlastDbAdapter::GetSequence(), m_BlastDb, m_Length, m_OID, m_TSE, CRef< C, Locker >::NotEmpty(), CBioseq_Base::SetInst(), and CSeq_entry_Base::SetSeq().

Referenced by SplitSeqData().

◆ x_AddSplitSeqChunk()

void CCachedSequence::x_AddSplitSeqChunk ( TCTSE_Chunk_InfoVector chunks,
const CSeq_id_Handle id,
TSeqPos  begin,
TSeqPos  end 
)
private

Add a chunk of sequence data.

This method builds a description of a specific range of sequence data, returning it via the 'chunks' parameter. The actual data is not built, just a description that identifies the sequence and the range of that sequence's data represented by this chunk.

Parameters
chunksobject where to add the chunk [in|out]
ididentifier for the sequence chunk about to be added [in]
beginstarting offset of the chunk [in]
endending offset of the chunk [in]

Definition at line 157 of file cached_sequence.cpp.

References CTSE_Chunk_Info::x_AddSeq_data().

Referenced by SplitSeqData().

Member Data Documentation

◆ m_BlastDb

IBlastDbAdapter& CCachedSequence::m_BlastDb
private

Database reference.

Definition at line 110 of file cached_sequence.hpp.

Referenced by x_AddFullSeq_data().

◆ m_Length

TSeqPos CCachedSequence::m_Length
private

Sequence length in bases.

Definition at line 107 of file cached_sequence.hpp.

Referenced by SplitSeqData(), and x_AddFullSeq_data().

◆ m_OID

int CCachedSequence::m_OID
private

Locates this sequence within m_BlastDb.

Definition at line 113 of file cached_sequence.hpp.

Referenced by RegisterIds(), and x_AddFullSeq_data().

◆ m_SIH

CSeq_id_Handle CCachedSequence::m_SIH
private

SeqID handle.

Definition at line 101 of file cached_sequence.hpp.

Referenced by SplitSeqData().

◆ m_SliceSize

TSeqPos CCachedSequence::m_SliceSize
private

Specifies the slice size for splitting the sequence data.

Definition at line 122 of file cached_sequence.hpp.

Referenced by SplitSeqData().

◆ m_TSE

CRef<CSeq_entry> CCachedSequence::m_TSE
private

The Seq entry we handle.

Definition at line 104 of file cached_sequence.hpp.

Referenced by GetTSE(), RegisterIds(), SplitSeqData(), and x_AddFullSeq_data().

◆ m_UseFixedSizeSlices

bool CCachedSequence::m_UseFixedSizeSlices
private

Determines whether sequences should be fetched in fixed size slices or in incrementally larger sizes.

The latter improves performance on full sequence retrieval of large sequences, but degrades the performance of retrieval of small sequence segments of large sequences

Definition at line 119 of file cached_sequence.hpp.

Referenced by SplitSeqData().


The documentation for this class was generated from the following files:
Modified on Thu Nov 30 04:52:26 2023 by modify_doxy.py rev. 669887