NCBI C++ ToolKit
vdbgraphloader_impl.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS_DATA_LOADERS_SRA___VDBGRAPHLOADER_IMPL__HPP
2 #define OBJTOOLS_DATA_LOADERS_SRA___VDBGRAPHLOADER_IMPL__HPP
3 
4 /* $Id: vdbgraphloader_impl.hpp 100510 2023-08-08 16:07:50Z vasilche $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Author: Eugene Vasilchenko
30  *
31  * File Description: VDB graph file data loader
32  *
33  * ===========================================================================
34  */
35 
36 
37 #include <corelib/ncbistd.hpp>
38 #include <corelib/ncbimtx.hpp>
42 
45 
46 class CDataLoader;
47 class CVDBGraphBlobId;
48 
50 {
51 public:
52  typedef vector<string> TVDBFiles;
56 
57  explicit CVDBGraphDataLoader_Impl(const TVDBFiles& vdb_files);
59 
61 
62  typedef vector<CAnnotName> TAnnotNames;
64 
65  template<class Call>
67  CallWithRetry(Call&& call,
68  const char* name,
69  unsigned retry_count = 0);
70 
71  TBlobId GetBlobId(const CSeq_id_Handle& idh);
72  TBlobId GetBlobIdFromString(const string& str) const;
73  TTSE_Lock GetBlobById(CDataSource* ds, const TBlobId& blob_id);
74  TTSE_Lock GetBlobByIdOnce(CDataSource* ds, const TBlobId& blob_id);
76  const CSeq_id_Handle& idh,
77  CDataLoader::EChoice choice);
79  const CSeq_id_Handle& idh,
80  const SAnnotSelector* sel,
81  CDataLoader::TProcessedNAs* processed_nas);
83  const CSeq_id_Handle& idh,
84  const SAnnotSelector* sel,
85  CDataLoader::TProcessedNAs* processed_nas);
86  void GetChunk(CTSE_Chunk_Info& chunk);
87  void GetChunkOnce(CTSE_Chunk_Info& chunk);
88 
90  void LoadSplitEntry(CTSE_Info& tse, const CVDBGraphBlobId& blob_id);
91 
92  struct SVDBFileInfo : CObject {
94  string m_VDBFile;
96  string GetMainAnnotName(void) const;
97  string GetOverviewAnnotName(void) const;
98  string GetMidZoomAnnotName(void) const;
99  bool ContainsAnnotsFor(const CSeq_id_Handle& id) const;
100  };
101 
102  CRef<SVDBFileInfo> OpenVDBGraphFile(const string& name);
103  CRef<SVDBFileInfo> OpenVDBGraphFileOnce(const string& name);
104 
105 protected:
109 
110  CRef<SVDBFileInfo> x_GetFileInfo(const string& name);
111  CRef<SVDBFileInfo> x_GetNAFileInfo(const string& na_acc);
112 
113  // mutex guarding input into the map
116  unsigned m_RetryCount;
120 };
121 
124 
125 #endif // OBJTOOLS_DATA_LOADERS_SRA___VDBGRAPHLOADER_IMPL__HPP
CMutex –.
Definition: ncbimtx.hpp:749
CObject –.
Definition: ncbiobj.hpp:180
CDataLoader::TBlobId TBlobId
CRef< SVDBFileInfo > OpenVDBGraphFileOnce(const string &name)
TTSE_LockSet GetOrphanAnnotRecords(CDataSource *ds, const CSeq_id_Handle &idh, const SAnnotSelector *sel, CDataLoader::TProcessedNAs *processed_nas)
CDataLoader::TTSE_Lock TTSE_Lock
std::invoke_result< Call >::type CallWithRetry(Call &&call, const char *name, unsigned retry_count=0)
void GetChunkOnce(CTSE_Chunk_Info &chunk)
void GetChunk(CTSE_Chunk_Info &chunk)
TTSE_Lock GetBlobById(CDataSource *ds, const TBlobId &blob_id)
CRef< SVDBFileInfo > x_GetFileInfo(const string &name)
CRef< CSeq_entry > LoadFullEntry(const CVDBGraphBlobId &blob_id)
CDataLoader::TTSE_LockSet TTSE_LockSet
TAnnotNames GetPossibleAnnotNames(void) const
TTSE_Lock GetBlobByIdOnce(CDataSource *ds, const TBlobId &blob_id)
CVDBGraphDataLoader_Impl(const TVDBFiles &vdb_files)
limited_size_map< string, bool > TMissingFileSet
TBlobId GetBlobId(const CSeq_id_Handle &idh)
TBlobId GetBlobIdFromString(const string &str) const
CRef< SVDBFileInfo > OpenVDBGraphFile(const string &name)
map< string, CRef< SVDBFileInfo > > TFixedFileMap
CObjectManager::TPriority GetDefaultPriority(void) const
CRef< SVDBFileInfo > x_GetNAFileInfo(const string &na_acc)
TTSE_LockSet GetRecords(CDataSource *ds, const CSeq_id_Handle &idh, CDataLoader::EChoice choice)
limited_size_map< string, CRef< SVDBFileInfo > > TAutoFileMap
TTSE_LockSet GetOrphanAnnotRecordsOnce(CDataSource *ds, const CSeq_id_Handle &idh, const SAnnotSelector *sel, CDataLoader::TProcessedNAs *processed_nas)
vector< CAnnotName > TAnnotNames
void LoadSplitEntry(CTSE_Info &tse, const CVDBGraphBlobId &blob_id)
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
static int type
Definition: getdata.c:31
EChoice
main blob is blob with sequence all other blobs are external and contain external annotations
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
Generic map with size limited by some number.
Multi-threading – mutexes; rw-locks; semaphore.
static const char * str(char *buf, int n)
Definition: stats.c:84
bool ContainsAnnotsFor(const CSeq_id_Handle &id) const
SAnnotSelector –.
Modified on Mon Mar 04 05:09:48 2024 by modify_doxy.py rev. 669887