55 bool use_fixed_size_slices,
71 default:
return "Unknown";
160 if (tse_sets.
empty()) {
165 vector< CRef<CSeq_id> > ids2fetch;
166 ids2fetch.reserve(tse_sets.
size());
171 ids2fetch.push_back(
id);
180 ERR_POST(
Error <<
"Failed to fetch sequences in batch mode");
185 vector<int>::size_type
i = 0;
191 tse_set->second.insert(lock);
202 if (chunks.empty()) {
207 vector<TSeqRange> ranges;
208 vector< CRef<CSeq_data> > sequence_data;
211 const TChunk& chunk = *chunk_itr;
218 ranges.push_back(it->second);
221 _ASSERT(oids.size() == ranges.size());
228 _ASSERT(sequence_data.size() == oids.size());
230 unsigned int seq_data_idx = 0;
232 TChunk chunk = *chunk_itr;
237 TSeqPos start = it->second.GetFrom();
240 _ASSERT(it->second.GetLength() == (it->second.GetToOpen() - start));
252 _ASSERT(seq_data_idx == sequence_data.size());
258 ddc.
SetFrame(
"CRemoteBlastDbDataLoader");
276 typedef void(*TArgFuncType)(list<CPluginManager<CDataLoader>
279 ::EEntryPointRequest);
281 RegisterEntryPoint<CDataLoader>((TArgFuncType)
326 const string& dbtype_str =
332 if ( !dbtype_str.empty() ) {
User-defined methods of the data storage class.
pair< int, CSeq_id_Handle > TBlastDbId
A BLAST DB (blob) ID The first field represents an OID in the BLAST database.
const string kDataLoader_BlastDb_DriverName
const string kCFParam_BlastDb_DbName
const string kCFParam_BlastDb_DbType
const string kDataLoader_RmtBlastDb_DriverName("rmt_blastdb")
void DataLoaders_Register_RmtBlastDb(void)
CSeqDB::ESeqType DbTypeToSeqType(CRemoteBlastDbDataLoader::EDbType dbtype)
CRemoteBlastDbDataLoader::EDbType SeqTypeToDbType(CSeqDB::ESeqType seq_type)
void NCBI_EntryPoint_DataLoader_RmtBlastDb(CPluginManager< CDataLoader >::TDriverInfoList &info_list, CPluginManager< CDataLoader >::EEntryPointRequest method)
pair< int, CSeq_id_Handle > TBlastDbId
A BLAST DB (blob) ID The first field represents an OID in the BLAST database.
CBlobIdFor< TBlastDbId > CBlobIdBlastDb
Type definition consistent with those defined in objmgr/blob_id.hpp.
void NCBI_EntryPoint_xloader_blastdb_rmt(CPluginManager< objects::CDataLoader >::TDriverInfoList &info_list, CPluginManager< objects::CDataLoader >::EEntryPointRequest method)
string DbTypeToStr(CRemoteBlastDbDataLoader::EDbType dbtype)
Data loader implementation that uses the blast databases remotely.
@ kRmtSequenceSliceSize
Same as above, but used for fetching sequences from remote BLAST databases.
void x_LoadData(const CSeq_id_Handle &idh, int oid, CTSE_LoadLock &lock, int slice_size)
Load sequence data from cache or from the database.
CRef< IBlastDbAdapter > m_BlastDb
The sequence database.
string m_DBName
Blast database name.
EDbType m_DBType
Is this database protein or nucleotide?
int x_GetOid(const CSeq_id_Handle &idh)
Gets the OID from m_Ids cache or the BLAST databases.
EDbType
Describes the type of blast database to use.
@ eNucleotide
nucleotide database
@ eProtein
protein database
@ eUnknown
protein is attempted first, then nucleotide
pair< TBioseqId, TBioseq_setId > TPlace
bool m_UseFixedSizeSlices
Configuration value specified to the CCachedSequence.
CObjectManager::TPriority GetPriority(const TPluginManagerParamTree *params) const
const string & GetDriverName(void) const
CObjectManager::EIsDefault GetIsDefault(const TPluginManagerParamTree *params) const
bool ValidParams(const TPluginManagerParamTree *params) const
CTSE_LoadLock GetTSE_LoadLock(const TBlobId &blob_id)
void SetFrame(const string &frame)
This class allows retrieval of sequence data from BLAST databases at NCBI.
bool SeqidToOidBatch(const vector< CRef< CSeq_id > > &ids, vector< int > &oids)
Batch-version of SeqidToOid.
void GetSequenceBatch(const vector< int > &oids, const vector< TSeqRange > &ranges, vector< CRef< CSeq_data > > &sequence_data)
Batch-version of GetSequence.
virtual void GetBlobs(TTSE_LockSets &tse_sets)
Support for fetching the sequence length by batch.
virtual TTSE_Lock GetBlobById(const TBlobId &blob_id)
For a given TBlobId, get the TTSE_Lock.
virtual void GetChunks(const TChunkSet &chunks)
Support for fetching the sequence chunks by batch.
virtual void DebugDump(CDebugDumpContext ddc, unsigned int depth) const
Define method for dumping debug information.
static const string kNamePrefix
All BLAST DB data loader instances have a name that starts with kNamePrefix.
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)
static string GetLoaderNameFromArgs(const SBlastDbParam ¶m)
CRemoteBlastDbDataLoader(const string &loader_name, const SBlastDbParam ¶m)
Parametrized constructor.
Data Loader Factory for BlastDbDataLoader.
virtual CDataLoader * CreateAndRegister(CObjectManager &om, const TPluginManagerParamTree *params) const
Create and register a data loader.
CRmtBlastDb_DataLoaderCF(void)
Constructor.
virtual ~CRmtBlastDb_DataLoaderCF(void)
Destructor.
ESeqType
Sequence types (eUnknown tries protein, then nucleotide).
TBlobId GetBlobId(void) const
void x_LoadSequence(const TPlace &place, TSeqPos pos, const TSequence &seq)
void SetLoaded(CObject *obj=0)
vector< TLocation > TLocationSet
const TLocationSet & GetSeq_dataInfos(void) const
list< CRef< CSeq_literal > > TSequence
bool IsLoaded(void) const
bool IsLoaded(void) const
definition of a Culling tree
void DebugDumpValue(CDebugDumpContext &_this, const string &name, const T &value, const string &comment=kEmptyStr)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
CConstRef< CSeq_id > GetSeqId(void) const
const value_type & GetValue(void) const
void SetName(const string &loader_name)
TLoader * GetLoader(void) const
Get pointer to the loader.
CDataSource * GetDataSource(void) const
EIsDefault
Flag defining if the data loader is included in the "default" group.
TRegisterInfo GetRegisterInfo(void)
static void RegisterInObjectManager(CObjectManager &om, CLoaderMaker_Base &loader_maker, CObjectManager::EIsDefault is_default, CObjectManager::TPriority priority)
Register the loader only if the name is not yet registered in the object manager.
vector< TChunk > TChunkSet
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
static void NCBI_EntryPointImpl(TDriverInfoList &info_list, EEntryPointRequest method)
Entry point implementation.
string GetParam(const string &driver_name, const TPluginManagerParamTree *params, const string ¶m_name, bool mandatory, const string &default_value) const
Utility function to get an element of parameter tree Throws an exception when mandatory parameter is ...
list< SDriverInfo > TDriverInfoList
List of driver information.
EEntryPointRequest
Actions performed by the entry point.
#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 int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
void SetLength(TLength value)
Assign a value to Length data member.
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Helper classes and templates to implement plugins.
Declaration of the CRemoteBlastDbAdapter class.
CRef< objects::CObjectManager > om
CRef< CSeqDB > m_BlastDbHandle
bool m_UseFixedSizeSlices
string operator()(const TBlastDbId &v) const
Convert TBlastDbId (blob IDs) to human readable strings.