NCBI C++ ToolKit
Classes | Functions
seqdb.cpp File Reference

Implementation for the CSeqDB class, the top level class for SeqDB. More...

#include <ncbi_pch.hpp>
#include <objtools/blast/seqdb_reader/seqdb.hpp>
#include <util/sequtil/sequtil_convert.hpp>
#include "seqdbimpl.hpp"
#include <objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp>
#include <map>
#include <string>
#include <serial/objistr.hpp>
#include <serial/objostr.hpp>
#include <serial/serial.hpp>
#include <serial/objostrasnb.hpp>
#include <serial/objistrasnb.hpp>
#include <objects/general/Object_id.hpp>
#include <objects/general/User_object.hpp>
#include <objects/general/User_field.hpp>
#include <objects/general/Dbtag.hpp>
+ Include dependency graph for seqdb.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CBlastDbFinder
 Functor class for FindFilesInDir. More...
 
class  PathFinder
 Functor object for s_RemoveAliasComponents where the path name is matched in SSeqDBInitInfo. More...
 

Functions

static char s_GetSeqTypeChar (CSeqDB::ESeqType seqtype)
 Helper function to translate enumerated type to character. More...
 
static CSeqDBImpls_SeqDBInit (const string &dbname, char prot_nucl, int oid_begin, int oid_end, bool use_atlas_lock, CSeqDBGiList *gi_list=NULL, CSeqDBNegativeList *neg_list=NULL, CSeqDBIdSet idset=CSeqDBIdSet())
 Helper function to build private implementation object. More...
 
static void s_RemoveAliasComponents (CBlastDbFinder &finder)
 
vector< SSeqDBInitInfoFindBlastDBs (const string &path, const string &dbtype, bool recurse, bool include_alias_files, bool remove_redundant_dbs)
 Find BLAST DBs in the directory specified. More...
 
CSeqDB::ESeqType ParseMoleculeTypeString (const string &s)
 Convert a string to a CSeqDB ESeqType object. More...
 
bool DeleteBlastDb (const string &dbpath, CSeqDB::ESeqType seq_type)
 Deletes all files associated with a BLAST database. More...
 

Detailed Description

Implementation for the CSeqDB class, the top level class for SeqDB.

Definition in file seqdb.cpp.

Function Documentation

◆ DeleteBlastDb()

bool DeleteBlastDb ( const string dbpath,
CSeqDB::ESeqType  seq_type 
)

Deletes all files associated with a BLAST database.

Parameters
dbpathBLAST database file path [in]
seq_typeSequence type [in]
Returns
true if relevant files were deleted, else false

Definition at line 1542 of file seqdb.cpp.

References eBDB_Version4, CSeqDB::eProtein, f(), CSeqDB::FindVolumePaths(), Info(), NStr::IntToString(), ITERATE, LOG_POST, CDirEntry::Remove(), SeqDB_GetFileExtensions(), and SeqDB_GetLMDBFileExtensions().

Referenced by BOOST_AUTO_TEST_CASE(), CBuildDatabase::CBuildDatabase(), CBlastdbConvertApp::Run(), BlastdbCopyApplication::Run(), and s_DeleteMakeprofileDb().

◆ FindBlastDBs()

vector<SSeqDBInitInfo> FindBlastDBs ( const string path,
const string dbtype,
bool  recurse,
bool  include_alias_files = false,
bool  remove_redundant_dbs = false 
)

Find BLAST DBs in the directory specified.

Parameters
pathdirectory to search BLAST DBs [in]
dbtypeBLAST DB molecule type, allowed values are 'prot', 'nucl', and 'guess' (which means any) [in]
recursewhether BLAST DBs should be found recursively or not [in]
include_alias_filesShould alias files be included also? [in]
remove_redundant_dbsShould BLASTDBs that are referenced by other alias files in the return value be removed? [in]

Definition at line 1429 of file seqdb.cpp.

References fFF_File, fFF_Recursive, FindFilesInDir(), flags, CBlastDbFinder::m_DBs, s_RemoveAliasComponents(), and ct::sort().

Referenced by CDirTest::Test().

◆ ParseMoleculeTypeString()

CSeqDB::ESeqType ParseMoleculeTypeString ( const string str)

Convert a string to a CSeqDB ESeqType object.

Parameters
strstring containing the molecule type (e.g.: prot, nucl, guess)

Definition at line 1527 of file seqdb.cpp.

References _ASSERT, NStr::eNocase, CSeqDB::eNucleotide, CSeqDB::eProtein, CSeqDB::eUnknown, and NStr::StartsWith().

Referenced by CBuildDatabase::CBuildDatabase(), CBlastdbConvertApp::Run(), BlastdbCopyApplication::Run(), CDbTest::Test(), CBlastDBCmdApp::x_InitBlastDB(), and CBlastDBCmdApp::x_InitBlastDB_TaxIdList().

◆ s_GetSeqTypeChar()

static char s_GetSeqTypeChar ( CSeqDB::ESeqType  seqtype)
static

Helper function to translate enumerated type to character.

Parameters
seqtypeThe sequence type (eProtein, eNucleotide, or eUnknown).
Returns
The sequence type as a char ('p', 'n', or '-').

Definition at line 62 of file seqdb.cpp.

References CSeqDB::eNucleotide, CSeqDB::eProtein, CSeqDB::eUnknown, and NCBI_THROW.

Referenced by CSeqDB::CSeqDB().

◆ s_RemoveAliasComponents()

static void s_RemoveAliasComponents ( CBlastDbFinder finder)
static

◆ s_SeqDBInit()

static CSeqDBImpl* s_SeqDBInit ( const string dbname,
char  prot_nucl,
int  oid_begin,
int  oid_end,
bool  use_atlas_lock,
CSeqDBGiList gi_list = NULL,
CSeqDBNegativeList neg_list = NULL,
CSeqDBIdSet  idset = CSeqDBIdSet() 
)
static

Helper function to build private implementation object.

This method builds and returns the object which implements the functionality for the CSeqDB API. If this method is called with '-' for the sequence data type, protein will be tried first, then nucleotide. The created object will be returned. Either kSeqTypeProt for a protein database, kSeqTypeNucl for nucleotide, or kSeqTypeUnkn to less this function try one then the other.

Parameters
dbnameA list of database or alias names, seperated by spaces.
prot_nuclSpecify whether to use protein, nucleotide, or either.
oid_beginIterator will skip OIDs less than this value. Only OIDs found in the OID lists (if any) will be returned.
oid_endIterator will return up to (but not including) this OID.
use_mmapIf kSeqDBMMap is specified (the default), memory mapping is attempted. If kSeqDBNoMMap is specified, or memory mapping fails, this platform does not support it, the less efficient read and write calls are used instead.
gi_listThis ID list specifies OIDs and deflines to include.
neg_listThis negative ID list specifies deflines and OIDs to exclude.
idsetIf set, this specifies IDs to either include or exclude.
Returns
The CSeqDBImpl object that was created.

Definition at line 111 of file seqdb.cpp.

References _ASSERT, and dbname().

Referenced by CSeqDB::CSeqDB().

Modified on Thu Apr 25 08:18:20 2024 by modify_doxy.py rev. 669887