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

Search Toolkit Book for CSeqDBIdxFile

Index file. More...

#include <objtools/blast/seqdb_reader/impl/seqdbfile.hpp>

+ Inheritance diagram for CSeqDBIdxFile:
+ Collaboration diagram for CSeqDBIdxFile:

Public Member Functions

 CSeqDBIdxFile (CSeqDBAtlas &atlas, const string &dbname, char prot_nucl)
 Constructor. More...
 
virtual ~CSeqDBIdxFile ()
 Destructor. More...
 
bool GetAmbStartEnd (int oid, TIndx &start, TIndx &end) const
 Get the location of a sequence's ambiguity data. More...
 
void GetHdrStartEnd (int oid, TIndx &start, TIndx &end) const
 Get the location of a sequence's header data. More...
 
void GetSeqStartEnd (int oid, TIndx &start, TIndx &end) const
 Get the location of a sequence's packed sequence data. More...
 
void GetSeqStart (int oid, TIndx &start) const
 Get the location of a sequence's packed sequence data. More...
 
char GetSeqType () const
 Get the sequence data type. More...
 
string GetTitle () const
 Get the volume title. More...
 
string GetDate () const
 Get the construction date of the volume. More...
 
int GetNumOIDs () const
 Get the number of oids in this volume. More...
 
Uint8 GetVolumeLength () const
 Get the length of the volume (in bases). More...
 
int GetMaxLength () const
 Get the length of the longest sequence in this volume. More...
 
int GetMinLength () const
 Get the length of the shortest sequence in this volume. More...
 
void UnLease ()
 Release any memory leases temporarily held here. More...
 
string GetLMDBFileName () const
 
- Public Member Functions inherited from CSeqDBExtFile
 CSeqDBExtFile (CSeqDBAtlas &atlas, const string &dbfilename, char prot_nucl)
 Constructor. More...
 
virtual ~CSeqDBExtFile ()
 Destructor. More...
 
void UnLease ()
 Release memory held in the atlas layer 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_ClrHdr () const
 Return header data (assumes locked). More...
 
void x_ClrSeq () const
 Return sequence data (assumes locked). More...
 
void x_ClrAmb () const
 Return ambiguity data (assumes locked). More...
 
Uint4x_GetHdr () const
 Get header data (assumes locked). More...
 
Uint4x_GetSeq () const
 Get sequence data (assumes locked). More...
 
Uint4x_GetAmb () const
 Get ambiguity data (assumes locked). More...
 

Private Attributes

CSeqDBFileMemMap m_HdrLease
 Verify the integrity of this object and subobjects. More...
 
CSeqDBFileMemMap m_SeqLease
 A memory lease used by the sequence section of this file. More...
 
CSeqDBFileMemMap m_AmbLease
 A memory lease used by the ambiguity section of this file. More...
 
string m_Title
 The volume title. More...
 
string m_Date
 The construction date of the volume. More...
 
Uint4 m_NumOIDs
 The number of oids in this volume. More...
 
Uint8 m_VolLen
 The length of the volume (in bases). More...
 
Uint4 m_MaxLen
 The length of the longest sequence in this volume. More...
 
Uint4 m_MinLen
 The length of the shortest sequence in this volume. More...
 
TIndx m_OffHdr
 offset of the start of the header section. More...
 
TIndx m_EndHdr
 Offset of the end of the header section. More...
 
TIndx m_OffSeq
 Offset of the start of the sequence section. More...
 
TIndx m_EndSeq
 Offset of the end of the sequence section. More...
 
TIndx m_OffAmb
 Offset of the start of the ambiguity section. More...
 
TIndx m_EndAmb
 Offset of the end of the ambiguity section. More...
 
string m_LMDBFile
 Name of matching SQLite file (empty if version 4 DB) More...
 
Uint4 m_Volume
 Volume number (only set in version 5 DBs) More...
 

Additional Inherited Members

- Public Types inherited from CSeqDBExtFile
typedef CSeqDBAtlas::TIndx TIndx
 Type which spans possible file offsets. 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...
 
- 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 CSeqDBExtFile
void x_ReadBytes (char *buf, TIndx start, TIndx end) const
 Read part of the file into a buffer. More...
 
template<class T >
TIndx x_ReadSwapped (CSeqDBFileMemMap &lease, TIndx offset, T *value)
 Read a numerical object from the file. More...
 
char x_GetSeqType () const
 Get the volume's sequence data type. More...
 
void x_SetFileType (char prot_nucl)
 Sets the sequence data type. More...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 
- Protected Attributes inherited from CSeqDBExtFile
CSeqDBAtlasm_Atlas
 The memory layer management object. More...
 
string m_FileName
 The name of this file. More...
 
char m_ProtNucl
 Either 'p' for protein or 'n' for nucleotide. More...
 
CSeqDBFileMemMap m_Lease
 A memory lease used by this file. More...
 
CSeqDBRawFile m_File
 The raw file object. More...
 

Detailed Description

Index file.

This is the .pin or .nin file; it provides indices into the other files. The version, title, date, and other summary information is also stored here.

Definition at line 410 of file seqdbfile.hpp.

Constructor & Destructor Documentation

◆ CSeqDBIdxFile()

CSeqDBIdxFile::CSeqDBIdxFile ( CSeqDBAtlas atlas,
const string dbname,
char  prot_nucl 
)

Constructor.

This builds an object which provides access to the index file for a volume. The index file contains metadata about the volume, such as the title and construction date. The index file also contains indices into the header and sequence data files. Because these offsets are four byte integers, all volumes have a size of no more than 2^32 bytes, but in practice, they are usually kept under 2^30 bytes.

Parameters
atlasThe memory management layer object.
dbnameThe name of the database volume.
prot_nuclThe sequence data type.
lockedThe lock holder object for this thread.

Definition at line 134 of file seqdbfile.cpp.

References dbname(), m_Date, m_EndAmb, m_EndHdr, m_EndSeq, CSeqDBExtFile::m_Lease, m_LMDBFile, m_MaxLen, m_NumOIDs, m_OffAmb, m_OffHdr, m_OffSeq, m_Title, m_VolLen, m_Volume, NCBI_THROW, offset, CSeqDBExtFile::x_GetSeqType(), and CSeqDBExtFile::x_ReadSwapped().

◆ ~CSeqDBIdxFile()

virtual CSeqDBIdxFile::~CSeqDBIdxFile ( )
inlinevirtual

Destructor.

Definition at line 436 of file seqdbfile.hpp.

References UnLease().

Member Function Documentation

◆ GetAmbStartEnd()

bool CSeqDBIdxFile::GetAmbStartEnd ( int  oid,
TIndx start,
TIndx end 
) const
inline

Get the location of a sequence's ambiguity data.

This method returns the offsets of the start and end of the ambiguity data for a specific nucleotide sequence. If this range is non-empty, then this sequence has ambiguous regions, which are encoded as a series of instructions for modifying the compressed 4 base/byte nucleotide data. The ambiguity data is encoded as randomized noise, with the intention of minimizing accidental matches.

Parameters
oidThe sequence to get data for.
startThe returned start offset of the sequence.
endThe returned end offset of the sequence.
Returns
true if the sequence has ambiguity data.

Definition at line 694 of file seqdbfile.hpp.

References CSeqDBFileMemMap::Init(), CSeqDBFileMemMap::IsMapped(), CSeqDBExtFile::m_Lease, SeqDB_GetStdOrd(), x_GetAmb(), x_GetSeq(), and CSeqDBExtFile::x_GetSeqType().

Referenced by CSeqDBVol::GetRawSeqAndAmbig(), and CSeqDBVol::x_GetAmbChar().

◆ GetDate()

string CSeqDBIdxFile::GetDate ( void  ) const
inline

Get the construction date of the volume.

Definition at line 539 of file seqdbfile.hpp.

References m_Date.

Referenced by CSeqDBVol::GetDate().

◆ GetHdrStartEnd()

void CSeqDBIdxFile::GetHdrStartEnd ( int  oid,
TIndx start,
TIndx end 
) const
inline

Get the location of a sequence's header data.

This method returns the offsets of the start and end of the header data for a specific database sequence. The header data is a Blast-def-line-set in binary ASN.1. This data includes associated taxonomy data, Seq-ids, and membership bits.

Parameters
oidThe sequence to get data for.
startThe returned start offset of the sequence.
endThe returned end offset of the sequence.

Definition at line 708 of file seqdbfile.hpp.

References CSeqDBFileMemMap::Init(), CSeqDBFileMemMap::IsMapped(), CSeqDBExtFile::m_Lease, SeqDB_GetStdOrd(), and x_GetHdr().

Referenced by CSeqDBVol::x_GetHdrAsn1Binary().

◆ GetLMDBFileName()

string CSeqDBIdxFile::GetLMDBFileName ( ) const
inline

Definition at line 577 of file seqdbfile.hpp.

References m_LMDBFile.

Referenced by CSeqDBVol::GetLMDBFileName().

◆ GetMaxLength()

int CSeqDBIdxFile::GetMaxLength ( ) const
inline

Get the length of the longest sequence in this volume.

Definition at line 557 of file seqdbfile.hpp.

References m_MaxLen.

Referenced by CSeqDBVol::GetMaxLength().

◆ GetMinLength()

int CSeqDBIdxFile::GetMinLength ( ) const
inline

Get the length of the shortest sequence in this volume.

Definition at line 563 of file seqdbfile.hpp.

References m_MinLen.

Referenced by CSeqDBVol::GetMinLength().

◆ GetNumOIDs()

int CSeqDBIdxFile::GetNumOIDs ( ) const
inline

◆ GetSeqStart()

void CSeqDBIdxFile::GetSeqStart ( int  oid,
TIndx start 
) const
inline

Get the location of a sequence's packed sequence data.

This method returns the offsets of the start and end of the packed sequence data for a specific database sequence. For protein data, the packed version is the only supported encoding, and is stored at one base per byte. The header data is encoded as a Blast-def-line-set in binary ASN.1. This data includes taxonomy information, Seq-ids for this sequence, and membership bits.

Parameters
oidThe sequence to get data for.
startThe returned start offset of the sequence.

Definition at line 729 of file seqdbfile.hpp.

References CSeqDBFileMemMap::Init(), CSeqDBFileMemMap::IsMapped(), CSeqDBExtFile::m_Lease, SeqDB_GetStdOrd(), and x_GetSeq().

Referenced by CSeqDBVol::x_GetSeqResidueOffset().

◆ GetSeqStartEnd()

void CSeqDBIdxFile::GetSeqStartEnd ( int  oid,
TIndx start,
TIndx end 
) const
inline

Get the location of a sequence's packed sequence data.

This method returns the offsets of the start and end of the packed sequence data for a specific database sequence. For protein data, the packed version is the only supported encoding, and is stored at one base per byte. The header data is encoded as a Blast-def-line-set in binary ASN.1. This data includes taxonomy information, Seq-ids for this sequence, and membership bits.

Parameters
oidThe sequence to get data for.
startThe returned start offset of the sequence.
endThe returned end offset of the sequence.

Definition at line 716 of file seqdbfile.hpp.

References CSeqDBFileMemMap::Init(), CSeqDBFileMemMap::IsMapped(), CSeqDBExtFile::m_Lease, SeqDB_GetStdOrd(), x_GetAmb(), x_GetSeq(), and CSeqDBExtFile::x_GetSeqType().

Referenced by CSeqDBVol::GetRawSeqAndAmbig(), CSeqDBVol::GetSeqLengthApprox(), CSeqDBVol::GetSeqLengthExact(), CSeqDBVol::GetSeqLengthProt(), and CSeqDBVol::x_GetSequence().

◆ GetSeqType()

char CSeqDBIdxFile::GetSeqType ( ) const
inline

◆ GetTitle()

string CSeqDBIdxFile::GetTitle ( void  ) const
inline

Get the volume title.

Definition at line 533 of file seqdbfile.hpp.

References m_Title.

Referenced by CSeqDBVol::GetTitle().

◆ GetVolumeLength()

Uint8 CSeqDBIdxFile::GetVolumeLength ( ) const
inline

Get the length of the volume (in bases).

Definition at line 551 of file seqdbfile.hpp.

References m_VolLen.

Referenced by CSeqDBVol::GetVolumeLength().

◆ UnLease()

void CSeqDBIdxFile::UnLease ( )
inline

Release any memory leases temporarily held here.

Definition at line 569 of file seqdbfile.hpp.

References x_ClrAmb(), x_ClrHdr(), and x_ClrSeq().

Referenced by CSeqDBVol::UnLease(), and ~CSeqDBIdxFile().

◆ x_ClrAmb()

void CSeqDBIdxFile::x_ClrAmb ( ) const
inlineprivate

Return ambiguity data (assumes locked).

Definition at line 641 of file seqdbfile.hpp.

References CSeqDBFileMemMap::Clear(), and m_AmbLease.

Referenced by UnLease().

◆ x_ClrHdr()

void CSeqDBIdxFile::x_ClrHdr ( ) const
inlineprivate

Return header data (assumes locked).

Definition at line 629 of file seqdbfile.hpp.

References CSeqDBFileMemMap::Clear(), and m_HdrLease.

Referenced by UnLease().

◆ x_ClrSeq()

void CSeqDBIdxFile::x_ClrSeq ( ) const
inlineprivate

Return sequence data (assumes locked).

Definition at line 635 of file seqdbfile.hpp.

References CSeqDBFileMemMap::Clear(), and m_SeqLease.

Referenced by UnLease().

◆ x_GetAmb()

Uint4* CSeqDBIdxFile::x_GetAmb ( ) const
inlineprivate

Get ambiguity data (assumes locked).

Definition at line 661 of file seqdbfile.hpp.

References _ASSERT, CSeqDBFileMemMap::GetFileDataPtr(), m_AmbLease, CSeqDBExtFile::m_FileName, m_OffAmb, and CSeqDBExtFile::x_GetSeqType().

Referenced by GetAmbStartEnd(), and GetSeqStartEnd().

◆ x_GetHdr()

Uint4* CSeqDBIdxFile::x_GetHdr ( ) const
inlineprivate

Get header data (assumes locked).

Definition at line 647 of file seqdbfile.hpp.

References CSeqDBFileMemMap::GetFileDataPtr(), CSeqDBExtFile::m_FileName, m_HdrLease, and m_OffHdr.

Referenced by GetHdrStartEnd().

◆ x_GetSeq()

Uint4* CSeqDBIdxFile::x_GetSeq ( ) const
inlineprivate

Get sequence data (assumes locked).

Definition at line 654 of file seqdbfile.hpp.

References CSeqDBFileMemMap::GetFileDataPtr(), CSeqDBExtFile::m_FileName, m_OffSeq, and m_SeqLease.

Referenced by GetAmbStartEnd(), GetSeqStart(), and GetSeqStartEnd().

Member Data Documentation

◆ m_AmbLease

CSeqDBFileMemMap CSeqDBIdxFile::m_AmbLease
mutableprivate

A memory lease used by the ambiguity section of this file.

Definition at line 599 of file seqdbfile.hpp.

Referenced by x_ClrAmb(), and x_GetAmb().

◆ m_Date

string CSeqDBIdxFile::m_Date
private

The construction date of the volume.

Definition at line 608 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and GetDate().

◆ m_EndAmb

TIndx CSeqDBIdxFile::m_EndAmb
private

Offset of the end of the ambiguity section.

Definition at line 685 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile().

◆ m_EndHdr

TIndx CSeqDBIdxFile::m_EndHdr
private

Offset of the end of the header section.

Definition at line 673 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile().

◆ m_EndSeq

TIndx CSeqDBIdxFile::m_EndSeq
private

Offset of the end of the sequence section.

Definition at line 679 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile().

◆ m_HdrLease

CSeqDBFileMemMap CSeqDBIdxFile::m_HdrLease
mutableprivate

Verify the integrity of this object and subobjects.

A memory lease used by the header section of this file.

Definition at line 591 of file seqdbfile.hpp.

Referenced by x_ClrHdr(), and x_GetHdr().

◆ m_LMDBFile

string CSeqDBIdxFile::m_LMDBFile
private

Name of matching SQLite file (empty if version 4 DB)

Definition at line 688 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and GetLMDBFileName().

◆ m_MaxLen

Uint4 CSeqDBIdxFile::m_MaxLen
private

The length of the longest sequence in this volume.

Definition at line 617 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and GetMaxLength().

◆ m_MinLen

Uint4 CSeqDBIdxFile::m_MinLen
private

The length of the shortest sequence in this volume.

Definition at line 620 of file seqdbfile.hpp.

Referenced by GetMinLength().

◆ m_NumOIDs

Uint4 CSeqDBIdxFile::m_NumOIDs
private

The number of oids in this volume.

Definition at line 611 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and GetNumOIDs().

◆ m_OffAmb

TIndx CSeqDBIdxFile::m_OffAmb
private

Offset of the start of the ambiguity section.

Definition at line 682 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and x_GetAmb().

◆ m_OffHdr

TIndx CSeqDBIdxFile::m_OffHdr
private

offset of the start of the header section.

Definition at line 670 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and x_GetHdr().

◆ m_OffSeq

TIndx CSeqDBIdxFile::m_OffSeq
private

Offset of the start of the sequence section.

Definition at line 676 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and x_GetSeq().

◆ m_SeqLease

CSeqDBFileMemMap CSeqDBIdxFile::m_SeqLease
mutableprivate

A memory lease used by the sequence section of this file.

Definition at line 595 of file seqdbfile.hpp.

Referenced by x_ClrSeq(), and x_GetSeq().

◆ m_Title

string CSeqDBIdxFile::m_Title
private

The volume title.

Definition at line 605 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and GetTitle().

◆ m_VolLen

Uint8 CSeqDBIdxFile::m_VolLen
private

The length of the volume (in bases).

Definition at line 614 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile(), and GetVolumeLength().

◆ m_Volume

Uint4 CSeqDBIdxFile::m_Volume
private

Volume number (only set in version 5 DBs)

Definition at line 690 of file seqdbfile.hpp.

Referenced by CSeqDBIdxFile().


The documentation for this class was generated from the following files:
Modified on Tue Feb 27 05:50:02 2024 by modify_doxy.py rev. 669887