59 m_UseFixedSizeSlices =
true;
60 m_UseBlastDbs = (options & eUseBlastDbDataLoader) ?
true :
false;
61 m_UseGenbank = (options & eUseGenbankDataLoader) ?
true :
false;
63 m_BlastDbName.assign(
dbname);
65 m_IsLoadingProteins = load_proteins;
71 x_LoadBlastDbDataLoaderConfig(
registry);
78 static const string kDataLoadersConfig(
"DATA_LOADERS");
81 const string& kLoaders =
registry.
Get(
"BLAST", kDataLoadersConfig);
110 static const string kProtBlastDbLoaderConfig(
"BLASTDB_PROT_DATA_LOADER");
111 static const string kNuclBlastDbLoaderConfig(
"BLASTDB_NUCL_DATA_LOADER");
114 ? kProtBlastDbLoaderConfig
115 : kNuclBlastDbLoaderConfig;
130 : m_Config(load_proteins)
175 <<
"' as non-default");
179 if (e.
GetMsg().find(
"No alias or index file found ") !=
NPOS) {
180 _TRACE(
"Error initializing local BLAST database "
181 <<
"data loader: '" << e.
GetMsg() <<
"'");
190 <<
"' as non-default");
193 <<
"data loader: " << e.
GetMsg());
194 _TRACE(
"Error initializing remote BLAST database "
195 <<
"data loader: '" << e.
GetMsg() <<
"'");
207 if (db_handle.
Empty()) {
217 <<
"' as non-default");
219 }
catch (
const exception& e) {
225 <<
"loader: '" << e.what() <<
"'");
240 <<
"' as non-default");
243 <<
"data loader: " << e.
GetMsg());
263 <<
"' as non-default");
281 static const string kPrefix =
"BLASTDB_";
299 const int blastdb_loader_priority =
306 blastdb_loader_priority);
356 return !(*
this == rhs);
static const string kPrefixThread
Data loader implementation that uses the blast databases remotely.
static int s_CountBlastDbDataLoaders()
Counts the number of BLAST database data loaders registered in the object manager.
Declares CBlastScopeSource class to create properly configured CScope objects to invoke the BLAST dat...
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, const string &dbname="nr", const EDbType dbtype=eUnknown, bool use_fixed_size_slices=true, CObjectManager::EIsDefault is_default=CObjectManager::eNonDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
EDbType
Describes the type of blast database to use.
@ eNucleotide
nucleotide database
@ eProtein
protein database
void AddDataLoaders(CRef< objects::CScope > scope)
Add the data loader configured in the object to the provided scope.
CBlastScopeSource(bool load_proteins=true, CObjectManager *objmgr=NULL)
Constructor which only registers the Genbank data loader.
static const int kGenbankLoaderPriority
Data loader priority for Genbank data loader.
string m_GbLoaderName
Name of the Genbank data loader.
string m_BlastDbLoaderName
Name of the BLAST database data loader.
static const int kBlastDbLoaderPriority
Data loader priority for BLAST database data loader (if multiple BLAST database data loaders are regi...
CRef< objects::CObjectManager > m_ObjMgr
Our reference to the object manager.
SDataLoaderConfig m_Config
The configuration for this object.
void x_InitGenbankDataLoader()
Initialize the Genbank data loader.
void x_InitBlastDatabaseDataLoader(const string &dbname, EDbType dbtype)
Initializes the BLAST database data loader.
CRef< objects::CScope > NewScope()
Create a new, properly configured CScope.
void RevokeBlastDbDataLoader()
Removes the BLAST database data loader from the object manager.
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
static CNcbiApplication * Instance(void)
Singleton method.
void SetPreopenConnection(bool preopen=true)
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, const string &dbname="nr", const EDbType dbtype=eUnknown, bool use_fixed_size_slices=true, CObjectManager::EIsDefault is_default=CObjectManager::eNonDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
const string & GetDBNameList() const
Get list of database names.
ESeqType GetSequenceType() const
Returns the type of database opened - protein or nucleotide.
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
TLoader * GetLoader(void) const
Get pointer to the loader.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
void GetRegisteredNames(TRegisteredNames &names)
Get names of all registered data loaders.
vector< string > TRegisteredNames
bool RevokeDataLoader(CDataLoader &loader)
Revoke previously registered data loader.
@ kPriority_NotSet
Deprecated: use kPriority_Default instead.
void Reset(void)
Reset reference object.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
virtual const string & Get(const string §ion, const string &name, TFlags flags=0) const
Get the parameter value.
virtual bool HasEntry(const string §ion, const string &name=kEmptyStr, TFlags flags=0) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Uint4 GetSequenceType(const CBioseq_Handle &bsh)
Return a (corrected) set of flags identifying the sequence type.
static SLJIT_INLINE sljit_ins nr(sljit_gpr dst, sljit_gpr src)
Configuration structure for the CBlastScopeSource.
bool operator!=(const SDataLoaderConfig &rhs) const
Inequality operator.
bool m_UseGenbank
Use the Genbank data loader.
static const char * kDefaultProteinBlastDb
Default protein BLAST database to use for the BLAST DB data loaders.
string m_BlastDbName
Name of the BLAST database to use (non-empty if m_UseBlastDbs is true)
void x_LoadDataLoadersConfig(const CNcbiRegistry ®istry)
Load the DATA_LOADERS configuration value from the config file.
static const char * kDefaultNucleotideBlastDb
Default nucleotide BLAST database to use for the BLAST DB data loaders.
bool operator==(const SDataLoaderConfig &rhs) const
Equality operator.
bool m_UseBlastDbs
Use the BLAST database data loaders.
bool m_UseFixedSizeSlices
Argument to configure BLAST database data loader.
void x_LoadBlastDbDataLoaderConfig(const CNcbiRegistry ®istry)
Load the BLAST database configured to search for the blastdb DATA_LOADERS option from the config file...
EConfigOpts
Configuration options for the BlastScopeSource.
bool m_IsLoadingProteins
Is this intended to load protein sequences.