1 #ifndef OBJTOOLS_DATA_LOADERS_SRA___VDBGRAPHLOADER_IMPL__HPP 2 #define OBJTOOLS_DATA_LOADERS_SRA___VDBGRAPHLOADER_IMPL__HPP 3 4 /* $Id: vdbgraphloader_impl.hpp 563188 2018-05-03 18:22:09Z 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> 39 #include <sra/data_loaders/vdbgraph/vdbgraphloader.hpp> 40 #include <sra/readers/sra/graphread.hpp> 41 #include <util/limited_size_map.hpp> 42 43 BEGIN_NCBI_SCOPE 44 BEGIN_SCOPE(objects) 45 46 class CDataLoader; 47 class CVDBGraphBlobId; 48 49 class CVDBGraphDataLoader_Impl : public CObject 50 { 51 public: 52 typedef vector<string> TVDBFiles; 53 typedef CDataLoader::TBlobId TBlobId; 54 typedef CDataLoader::TTSE_Lock TTSE_Lock; 55 typedef CDataLoader::TTSE_LockSet TTSE_LockSet; 56 57 explicit CVDBGraphDataLoader_Impl(const TVDBFiles& vdb_files); 58 ~CVDBGraphDataLoader_Impl(void); 59 60 CObjectManager::TPriority GetDefaultPriority(void) const; 61 62 typedef vector<CAnnotName> TAnnotNames; 63 TAnnotNames GetPossibleAnnotNames(void) const; 64 65 TBlobId GetBlobId(const CSeq_id_Handle& idh); 66 TBlobId GetBlobIdFromString(const string& str) const; 67 TTSE_Lock GetBlobById(CDataSource* ds, const TBlobId& blob_id); 68 TTSE_LockSet GetRecords(CDataSource* ds, 69 const CSeq_id_Handle& idh, 70 CDataLoader::EChoice choice); 71 TTSE_LockSet GetOrphanAnnotRecords(CDataSource* ds, 72 const CSeq_id_Handle& idh, 73 const SAnnotSelector* sel, 74 CDataLoader::TProcessedNAs* processed_nas); 75 void GetChunk(CTSE_Chunk_Info& chunk); 76 77 CRef<CSeq_entry> LoadFullEntry(const CVDBGraphBlobId& blob_id); 78 void LoadSplitEntry(CTSE_Info& tse, const CVDBGraphBlobId& blob_id); 79 80 struct SVDBFileInfo : CObject { 81 CVDBGraphDb m_VDB; 82 string m_VDBFile; 83 string m_BaseAnnotName; 84 string GetMainAnnotName(void) const; 85 string GetOverviewAnnotName(void) const; 86 string GetMidZoomAnnotName(void) const; 87 bool ContainsAnnotsFor(const CSeq_id_Handle& id) const; 88 }; 89 protected: 90 typedef map<string, CRef<SVDBFileInfo> > TFixedFileMap; 91 typedef limited_size_map<string, CRef<SVDBFileInfo> > TAutoFileMap; 92 typedef limited_size_map<string, bool> TMissingFileSet; 93 94 CRef<SVDBFileInfo> x_GetFileInfo(const string& name); 95 CRef<SVDBFileInfo> x_GetNAFileInfo(const string& na_acc); 96 97 // mutex guarding input into the map 98 CMutex m_Mutex; 99 CVDBMgr m_Mgr; 100 TFixedFileMap m_FixedFileMap; 101 TAutoFileMap m_AutoFileMap; 102 TMissingFileSet m_MissingFileSet; 103 }; 104 105 END_SCOPE(objects) 106 END_NCBI_SCOPE 107 108 #endif // OBJTOOLS_DATA_LOADERS_SRA___VDBGRAPHLOADER_IMPL__HPP 109