{
kLDS2_Lock, objects::CLDS2_DataLoader::eLockDatabase},
70{
kLDS2_NoLock, objects::CLDS2_DataLoader::eDoNotLockDatabase},
71{
kLDS2_Cache, objects::CLDS2_DataLoader::eCacheDatabase}
75objects::CLDS2_DataLoader::eCacheDatabase,
84 #define LDS2_GUARD() CFastMutexGuard guard(sx_LDS2_Lock) 89 return "LDS2_dataloader";
95 stringabs_path = db_path;
97 if(db_path !=
":memory:") {
104 return "LDS2_dataloader:"+ abs_path;
129 const string& db_path,
161m_FastaFlags(fasta_flags),
162m_LockMode(lock_mode)
173m_DbPath(db.GetDbFile()),
175m_LockMode(lock_mode)
188lock_mode = TLDS2_LockMode::GetDefault();
191 switch( lock_mode ) {
221 if(fasta_flags == -1) {
260ret = it->second.GetPointerOrNull();
304 ERR_POST_X(2,
"Error loading blob: URL handler '"<<
305finfo.
handler<<
"' not found");
322unique_ptr<CObjectIStream> obj_in;
323 switch( finfo.
format) {
336 switch( blob.
type) {
341*obj_in >> entry->SetSeq();
344*obj_in >> entry->SetSet();
381 switch(annot.
type) {
400id_it->second.range);
412entry->SetSet().SetSeq_set();
415back_inserter(entry->SetSet().SetSeq_set()) );
454locks.
insert(load_lock);
510 if( !ret2.
empty() ) {
547 if( !best_tse || oid > best_oid ) {
577oid = int8_blob_id->GetValue();
608 if( chunk_info->
IsLoaded() )
return;
616 ERR_POST_X(2,
"Error loading blob: URL handler '"<<
617finfo.
handler<<
"' not found");
622unique_ptr<CObjectIStream> obj_in;
623 switch( finfo.
format) {
638 switch( blob.
type) {
649annot->
SetData().SetAlign().push_back(*it);
660annot->
SetData().SetAlign().push_back(align);
719 const string& db_path =
723 stringfasta_flags_str =
730 stringlock_mode_str =
733 if( !lock_mode_str.empty() ) {
745 if( !db_path.empty() ) {
User-defined methods of the data storage class.
void SetNamed(const string &name)
vector< CSeq_id_Handle > TId
const TId & GetId(void) const
Blob state exceptions, used by GenBank loader.
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)
Base class for reading FASTA sequences.
@ eBinaryASN
Binary ASN.1.
@ eFasta
FASTA format sequence record, CFastaReader.
virtual ~CLDS2_DataLoaderCF(void)
virtual CDataLoader * CreateAndRegister(CObjectManager &om, const TPluginManagerParamTree *params) const
virtual CDataLoader * CreateLoader(void) const
CLDS2_LoaderMaker(const string &db_path, CFastaReader::TFlags fasta_flags, CLDS2_DataLoader::ELockMode lock_mode)
CLDS2_Database::TBlobSet TBlobSet
CRef< CLDS2_Database > m_Db
static string GetLoaderNameFromArgs(void)
virtual TTSE_LockSet GetExternalRecords(const CBioseq_Info &bioseq)
Request from a datasource set of blobs with external annotations.
virtual void GetIds(const CSeq_id_Handle &idh, TIds &ids)
void x_LoadTSE(CTSE_LoadLock &load_lock, const SLDS2_Blob &blob)
virtual ~CLDS2_DataLoader(void)
void RegisterUrlHandler(CLDS2_UrlHandler_Base *handler)
Register URL handler.
CRef< CSeq_entry > x_LoadFastaTSE(CNcbiIstream &in, const SLDS2_Blob &blob)
virtual TBlobId GetBlobId(const CSeq_id_Handle &idh)
virtual void GetChunk(TChunk chunk_info)
virtual TTSE_LockSet GetRecords(const CSeq_id_Handle &idh, EChoice choice)
Request from a datasource using handles and ranges instead of seq-loc The TSEs loaded in this call wi...
virtual TTSE_Lock ResolveConflict(const CSeq_id_Handle &id, const TTSE_LockSet &tse_set)
Resolve TSE conflict *select the best TSE from the set of dead TSEs.
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CObjectManager::EIsDefault is_default=CObjectManager::eNonDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
Argument-less loader - for compatibility only, unusable.
virtual bool CanGetBlobById(void) const
virtual CObjectManager::TPriority GetDefaultPriority(void) const
ELockMode
Database lock control.
@ eDoNotLockDatabase
Do not lock the database.
@ eLockDatabase
Lock the database.
@ eCacheDatabase
Clone the database into memory.
@ eDefaultLockMode
Use LDS2_DATALOADER_LOCK parameter, lock by default.
void x_LoadBlobs(const TBlobSet &blobs, TTSE_LockSet &locks)
CFastaReader::TFlags m_FastaFlags
virtual TTSE_LockSet GetExternalAnnotRecords(const CSeq_id_Handle &idh, const SAnnotSelector *sel)
CLDS2_UrlHandler_Base * x_GetUrlHandler(const SLDS2_File &info)
virtual TTSE_Lock GetBlobById(const TBlobId &blob_id)
void GetAnnots(Int8 blob_id, TLDS2Annots &infos)
Get details about all annotations from a blob.
void GetAnnotBlobs(const CSeq_id_Handle &idh, TAnnotChoice choice, TBlobSet &blobs)
Get all blobs, containing annotations for the seq-id.
void GetBioseqBlobs(const CSeq_id_Handle &idh, TBlobSet &blobs)
Get all blobs, containing bioseqs with the seq-id.
void BeginRead(void)
Start reading transaction, lock the db.
void EndRead(void)
End reading transaction, release the lock.
@ fAnnot_External
Annots from blobs not containing the bioseq.
@ fAnnot_Internal
Annots from the blob with the bioseq.
Int8 GetAnnotCountForBlob(Int8 blob_id)
Get number of annotations grouped into a single blob.
SLDS2_Blob GetBlobInfo(const CSeq_id_Handle &idh)
Find blob containing the requested bioseq.
@ eWrite
Read/write access.
@ eRead
Read-only access.
@ eMemory
Copy db to memory and open read-only.
const string & GetDbFile(void) const
Get database file name.
void GetSynonyms(const CSeq_id_Handle &idh, TLdsIdSet &ids)
Get all lds-id synonyms for the seq-id (including lds-id for the seq-id itself).
vector< AutoPtr< SLDS2_Annot > > TLDS2Annots
Int8 GetBioseqId(const CSeq_id_Handle &idh) const
Check if the db contains a bioseq with the given id.
SLDS2_File GetFileInfo(const string &file_name) const
Get complete file info.
Base class for URL handler.
Default handler for local files - registered automatically by LDS2 manager and data loader.
Handler for GZip local files. Not registered by default.
bool IsEntrys(void) const
Simple implementation of ILineReader for i(o)streams.
pair< TBioseqId, TBioseq_setId > TPlace
void x_AddAnnotPlace(const TBioseqId &id)
TBlobId GetBlobId(void) const
void x_LoadAnnot(const TPlace &place, const CSeq_annot &annot)
void SetLoaded(CObject *obj=0)
void x_AddAnnotType(const CAnnotName &annot_name, const SAnnotTypeSelector &annot_type, const TLocationId &location_id)
bool IsLoaded(void) const
const TBlobId & GetBlobId(void) const
CTSE_Split_Info & GetSplitInfo(void)
void SetSeq_entry(CSeq_entry &entry, CTSE_SetObjectInfo *set_info=0)
bool IsLoaded(void) const
void AddChunk(CTSE_Chunk_Info &chunk_info)
definition of a Culling tree
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator end() const
void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler
Operators to edit gaps in sequences.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_THROW2(exception_class, err_code, message, extra)
Throw exception with extra parameter.
static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)
Get an absolute path from some, possibly relative, path.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
virtual CRef< CSeq_entry > ReadOneSeq(ILineErrorListener *pMessageListener=nullptr)
Read a single effective sequence, which may turn out to be a segmented set.
long TFlags
binary OR of EFlags
@ fParseRawID
Try to identify raw accessions.
@ fAssumeNuc
Assume nucs unless accns indicate otherwise.
@ fParseGaps
Make a delta sequence if gaps found.
@ fOneSeq
Just read the first sequence found.
@ fStrictGuess
Assume no typos when guessing sequence type.
TTypeInfo GetTypeInfo(void) const
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
const value_type & GetValue(void) const
TLoader * GetLoader(void) const
Get pointer to the loader.
vector< CSeq_id_Handle > TIds
TRegisterInfo GetRegisterInfo(void)
CDataSource * GetDataSource(void) const
EChoice
main blob is blob with sequence all other blobs are external and contain external annotations
EIsDefault
Flag defining if the data loader is included in the "default" group.
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.
@ kPriority_Local
Default priority for local data storage.
@ eExtFeatures
external features
@ eExtAnnot
all external annotations
@ eExtAlign
external aligns
@ eAll
all blobs (main and external)
@ eOrphanAnnot
all external annotations if no Bioseq exists
@ eGraph
graph annotations from main blob
@ eCore
?only seq-entry core?
@ eAnnot
all annotations from main blob
@ eBioseq
main blob with complete bioseq
@ eAlign
aligns from main blob
@ eBioseqCore
main blob with bioseq core (no seqdata and annots)
@ eExtGraph
external graph annotations
@ eFeatures
features from main blob
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
@ eParam_NoThread
Do not use per-thread values.
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.
int64_t Int8
8-byte (64-bit) signed integer
#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.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Tdata & Set(void)
Assign a value to data member.
list< CRef< CSeq_align > > Tdata
void SetData(TData &value)
Assign a value to Data data member.
const TEntrys & GetEntrys(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
void NCBI_EntryPoint_DataLoader_LDS2(CPluginManager< CDataLoader >::TDriverInfoList &info_list, CPluginManager< CDataLoader >::EEntryPointRequest method)
NCBI_PARAM_ENUM_DEF_EX(objects::CLDS2_DataLoader::ELockMode, LDS2, DataLoader_Lock, objects::CLDS2_DataLoader::eCacheDatabase, eParam_NoThread, LDS2_DATALOADER_LOCK)
typedef NCBI_PARAM_TYPE(LDS2, DataLoader_Lock) TLDS2_LockMode
void NCBI_EntryPoint_xloader_lds2(CPluginManager< objects::CDataLoader >::TDriverInfoList &info_list, CPluginManager< objects::CDataLoader >::EEntryPointRequest method)
void DataLoaders_Register_LDS2(void)
CBlobIdFor< Int8 > CBlobIdInt8
NCBI_PARAM_ENUM_ARRAY(objects::CLDS2_DataLoader::ELockMode, LDS2, DataLoader_Lock)
static CLDS2_DataLoader::TBlobId s_Int8ToBlobId(Int8 id)
const string kDataLoader_LDS2_DriverName("lds")
DEFINE_STATIC_FAST_MUTEX(sx_LDS2_Lock)
NCBI_PARAM_ENUM_DECL(objects::CLDS2_DataLoader::ELockMode, LDS2, DataLoader_Lock)
const char * kLDS2_NoLock
#define kCFParam_LDS2_DbPath
#define kCFParam_LDS2_LockMode
#define kCFParam_LDS2_FastaFlags
std::istream & in(std::istream &in_, double &x_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Plugin manager (using class factory paradigm).
Helper classes and templates to implement plugins.
static SLJIT_INLINE sljit_ins lr(sljit_gpr dst, sljit_gpr src)
CRef< objects::CObjectManager > om
string operator()(Int8 v) const
void SetAnnotType(TAnnotType type)
@ eBioseq_set_element
Used for indexing individual seq-entries from a top-level bioseq-set.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4