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

Search Toolkit Book for CSeqDBLMDB

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

+ Inheritance diagram for CSeqDBLMDB:
+ Collaboration diagram for CSeqDBLMDB:

Public Member Functions

 CSeqDBLMDB (const string &fname)
 
virtual ~CSeqDBLMDB ()
 
CSeqDBLMDBoperator= (const CSeqDBLMDB &)=delete
 
 CSeqDBLMDB (const CSeqDBLMDB &)=delete
 
void GetOids (const vector< string > &accessions, vector< blastdb::TOid > &oids) const
 Get OIDs for a vector of string accessions. More...
 
void GetOid (const string &accession, vector< blastdb::TOid > &oids, const bool allow_dup=false) const
 Get OIDs for single string accession. More...
 
void GetVolumesInfo (vector< string > &vol_names, vector< blastdb::TOid > &vol_num_oids)
 Return info for all volumes. More...
 
void NegativeSeqIdsToOids (const vector< string > &ids, vector< blastdb::TOid > &rv) const
 Get Oids excluded from a vector of input accessions An oid only get exlcuded if all its seqids are found in the input list Note that the order or number of oids returned are independent of the input id list. More...
 
void GetOidsForTaxIds (const set< TTaxId > &tax_ids, vector< blastdb::TOid > &oids, vector< TTaxId > &tax_ids_found) const
 Get Oids for Tax Ids list, idenitcal Oids are merged. More...
 
void NegativeTaxIdsToOids (const set< TTaxId > &ids, vector< blastdb::TOid > &rv, vector< TTaxId > &tax_ids_found) const
 Get Oids to exclude for Tax ids @parm ids Input tax ids to exclude /Output tax ids found. More...
 
void GetDBTaxIds (vector< TTaxId > &tax_ids) const
 Get All Unique Tax Ids for db @parma tax_ids Return all unique tax ids found in db. More...
 
void GetTaxIdsForOids (const vector< blastdb::TOid > &oids, set< TTaxId > &tax_ids) const
 Get Tax Ids for oid list. 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 Attributes

string m_LMDBFile
 
string m_Oid2SeqIdsFile
 
string m_Oid2TaxIdsFile
 
string m_TaxId2OidsFile
 
string m_TaxId2OffsetsFile
 
bool m_LMDBFileOpened
 
blastdb::TOid m_NumOids
 

Additional Inherited Members

- 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 CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Detailed Description

Definition at line 43 of file seqdb_lmdb.hpp.

Constructor & Destructor Documentation

◆ CSeqDBLMDB() [1/2]

CSeqDBLMDB::CSeqDBLMDB ( const string fname)

Definition at line 242 of file seqdb_lmdb.cpp.

◆ ~CSeqDBLMDB()

CSeqDBLMDB::~CSeqDBLMDB ( )
virtual

◆ CSeqDBLMDB() [2/2]

CSeqDBLMDB::CSeqDBLMDB ( const CSeqDBLMDB )
delete

Member Function Documentation

◆ GetDBTaxIds()

void CSeqDBLMDB::GetDBTaxIds ( vector< TTaxId > &  tax_ids) const

◆ GetOid()

void CSeqDBLMDB::GetOid ( const string accession,
vector< blastdb::TOid > &  oids,
const bool  allow_dup = false 
) const

Get OIDs for single string accession.

String accession may have ".version" appended. If there are no matches, oids will be returned empty. If there are multiple matches, and allow_dup is true,

Parameters
accessionString accession (with or without version suffix) [in]
oidsReference to vector of TOid to receive found OIDs [out]
allow_dupIf true, return all OIDs which match (default false) [in]

Definition at line 262 of file seqdb_lmdb.cpp.

References lmdb::txn::begin(), CBlastLMDBManager::CloseEnv(), lmdb::error::code(), dbname(), env, CSeqDB_Path::FindBaseName(), CBlastLMDBManager::GetInstance(), CBlastLMDBManager::GetReadEnvAcc(), CSeqDB_Substring::GetString(), m_LMDBFile, m_LMDBFileOpened, MDB_GET_CURRENT, MDB_NEXT_DUP, MDB_NOTFOUND, MDB_RDONLY, MDB_SET, NCBI_THROW, lmdb::cursor::open(), and val.

Referenced by CSeqDBLMDBEntry::AccessionToOids().

◆ GetOids()

void CSeqDBLMDB::GetOids ( const vector< string > &  accessions,
vector< blastdb::TOid > &  oids 
) const

Get OIDs for a vector of string accessions.

Accessions may have ".version" appended. Returned vector of OIDs will have the same length as vector of accessions in one-to-one correspondence. Any accessions which are not found will be assigned OIDs of kSeqDBEntryNotFound (-1).

Parameters
accessionsVector of string accessions [in]
oidsReference to vector of TOid to receive found OIDs [out]

Definition at line 360 of file seqdb_lmdb.cpp.

References lmdb::txn::begin(), CBlastLMDBManager::CloseEnv(), lmdb::error::code(), dbname(), env, CSeqDB_Path::FindBaseName(), CBlastLMDBManager::GetInstance(), CBlastLMDBManager::GetReadEnvAcc(), CSeqDB_Substring::GetString(), i, kSeqDBEntryNotFound, m_LMDBFile, m_LMDBFileOpened, MDB_GET_CURRENT, MDB_NOTFOUND, MDB_RDONLY, MDB_SET, NCBI_THROW, lmdb::cursor::open(), and val.

Referenced by CSeqDBLMDBEntry::AccessionsToOids(), BOOST_AUTO_TEST_CASE(), and NegativeSeqIdsToOids().

◆ GetOidsForTaxIds()

void CSeqDBLMDB::GetOidsForTaxIds ( const set< TTaxId > &  tax_ids,
vector< blastdb::TOid > &  oids,
vector< TTaxId > &  tax_ids_found 
) const

◆ GetTaxIdsForOids()

void CSeqDBLMDB::GetTaxIdsForOids ( const vector< blastdb::TOid > &  oids,
set< TTaxId > &  tax_ids 
) const

Get Tax Ids for oid list.

Parameters
oidsInput oid list
tax_idsOutput tax id list

Definition at line 737 of file seqdb_lmdb.cpp.

References i, set< Key, Compare >::insert(), lookup(), and m_Oid2TaxIdsFile.

Referenced by CSeqDBLMDBEntry::GetTaxIdsForOids().

◆ GetVolumesInfo()

void CSeqDBLMDB::GetVolumesInfo ( vector< string > &  vol_names,
vector< blastdb::TOid > &  vol_num_oids 
)

Return info for all volumes.

Parameters
vol_namesReference to vector to receive volume names [out]
vol_num_oidsReference to vector to receive number of OIDs in each volume [out]

Definition at line 306 of file seqdb_lmdb.cpp.

References lmdb::txn::begin(), CBlastLMDBManager::CloseEnv(), lmdb::dbi_stat(), env, CBlastLMDBManager::GetInstance(), CBlastLMDBManager::GetReadEnvVol(), i, m_LMDBFile, m_NumOids, MDB_GET_CURRENT, MDB_RDONLY, MDB_SET, MDB_stat::ms_entries, NCBI_THROW, lmdb::cursor::open(), and val.

Referenced by BOOST_AUTO_TEST_CASE(), and CSeqDBLMDBEntry::CSeqDBLMDBEntry().

◆ NegativeSeqIdsToOids()

void CSeqDBLMDB::NegativeSeqIdsToOids ( const vector< string > &  ids,
vector< blastdb::TOid > &  rv 
) const

Get Oids excluded from a vector of input accessions An oid only get exlcuded if all its seqids are found in the input list Note that the order or number of oids returned are independent of the input id list.

Parameters
idsAccessions to exclude
rvOids that are excluded

Definition at line 515 of file seqdb_lmdb.cpp.

References SOidSeqIdPair::cmp_oid(), GetOids(), i, kSeqDBEntryNotFound, lookup(), m_Oid2SeqIdsFile, s_CompareIdList(), and ct::sort().

Referenced by BOOST_AUTO_TEST_CASE(), and CSeqDBLMDBEntry::NegativeSeqIdsToOids().

◆ NegativeTaxIdsToOids()

void CSeqDBLMDB::NegativeTaxIdsToOids ( const set< TTaxId > &  ids,
vector< blastdb::TOid > &  rv,
vector< TTaxId > &  tax_ids_found 
) const

Get Oids to exclude for Tax ids @parm ids Input tax ids to exclude /Output tax ids found.

Parameters
rvOids to exclude based on input tax id list

Definition at line 709 of file seqdb_lmdb.cpp.

References set< Key, Compare >::end(), set< Key, Compare >::find(), GetOidsForTaxIds(), i, lookup(), m_Oid2TaxIdsFile, and set< Key, Compare >::size().

Referenced by BOOST_AUTO_TEST_CASE(), and CSeqDBLMDBEntry::NegativeTaxIdsToOids().

◆ operator=()

CSeqDBLMDB& CSeqDBLMDB::operator= ( const CSeqDBLMDB )
delete

Member Data Documentation

◆ m_LMDBFile

string CSeqDBLMDB::m_LMDBFile
private

Definition at line 103 of file seqdb_lmdb.hpp.

Referenced by GetOid(), GetOids(), GetVolumesInfo(), and ~CSeqDBLMDB().

◆ m_LMDBFileOpened

bool CSeqDBLMDB::m_LMDBFileOpened
mutableprivate

Definition at line 108 of file seqdb_lmdb.hpp.

Referenced by GetOid(), GetOids(), and ~CSeqDBLMDB().

◆ m_NumOids

blastdb::TOid CSeqDBLMDB::m_NumOids
private

Definition at line 109 of file seqdb_lmdb.hpp.

Referenced by GetOidsForTaxIds(), and GetVolumesInfo().

◆ m_Oid2SeqIdsFile

string CSeqDBLMDB::m_Oid2SeqIdsFile
private

Definition at line 104 of file seqdb_lmdb.hpp.

Referenced by NegativeSeqIdsToOids().

◆ m_Oid2TaxIdsFile

string CSeqDBLMDB::m_Oid2TaxIdsFile
private

Definition at line 105 of file seqdb_lmdb.hpp.

Referenced by GetTaxIdsForOids(), and NegativeTaxIdsToOids().

◆ m_TaxId2OffsetsFile

string CSeqDBLMDB::m_TaxId2OffsetsFile
private

Definition at line 107 of file seqdb_lmdb.hpp.

Referenced by GetDBTaxIds(), and GetOidsForTaxIds().

◆ m_TaxId2OidsFile

string CSeqDBLMDB::m_TaxId2OidsFile
private

Definition at line 106 of file seqdb_lmdb.hpp.

Referenced by GetOidsForTaxIds().


The documentation for this class was generated from the following files:
Modified on Wed Sep 04 15:01:07 2024 by modify_doxy.py rev. 669887