1 #ifndef ID2_PARSER__HPP_INCLUDED 2 #define ID2_PARSER__HPP_INCLUDED 3 /* $Id: split_parser.hpp 490251 2016-01-22 15:40:54Z vasilche $ 4 * =========================================================================== 5 * PUBLIC DOMAIN NOTICE 6 * National Center for Biotechnology Information 7 * 8 * This software/database is a "United States Government Work" under the 9 * terms of the United States Copyright Act. It was written as part of 10 * the author's official duties as a United States Government employee and 11 * thus cannot be copyrighted. This software/database is freely available 12 * to the public for use. The National Library of Medicine and the U.S. 13 * Government have not placed any restriction on its use or reproduction. 14 * 15 * Although all reasonable efforts have been taken to ensure the accuracy 16 * and reliability of the software and data, the NLM and the U.S. 17 * Government do not and cannot warrant the performance or results that 18 * may be obtained by using this software or data. The NLM and the U.S. 19 * Government disclaim all warranties, express or implied, including 20 * warranties of performance, merchantability or fitness for any particular 21 * purpose. 22 * 23 * Please cite the author in any work or product based on this material. 24 * 25 * =========================================================================== 26 * 27 * Author: Eugene Vasilchenko 28 * 29 * File Description: Methods to create object manager structures from ID2 spec 30 * 31 */ 32 33 #include <corelib/ncbiobj.hpp> 34 #include <util/range.hpp> 35 #include <vector> 36 #include <utility> 37 38 BEGIN_NCBI_SCOPE 39 BEGIN_SCOPE(objects) 40 41 class CID2S_Split_Info; 42 class CID2S_Chunk_Info; 43 class CID2S_Chunk; 44 class CID2S_Seq_descr_Info; 45 class CID2S_Seq_annot_Info; 46 class CID2S_Seq_annot_place_Info; 47 class CID2S_Bioseq_place_Info; 48 class CID2S_Seq_data_Info; 49 class CID2S_Seq_loc; 50 class CID2S_Seq_assembly_Info; 51 class CID2S_Seq_feat_Ids_Info; 52 53 class CTSE_Info; 54 class CTSE_Chunk_Info; 55 class CSeq_id_Handle; 56 57 class NCBI_XOBJMGR_EXPORT CSplitParser 58 { 59 public: 60 static void Attach(CTSE_Info& tse, const CID2S_Split_Info& split); 61 62 static CRef<CTSE_Chunk_Info> Parse(const CID2S_Chunk_Info& info); 63 64 static void Load(CTSE_Chunk_Info& chunk, const CID2S_Chunk& data); 65 66 static void x_Attach(CTSE_Chunk_Info& chunk, 67 const CID2S_Seq_descr_Info& descr); 68 static void x_Attach(CTSE_Chunk_Info& chunk, 69 const CID2S_Seq_annot_Info& annot); 70 static void x_Attach(CTSE_Chunk_Info& chunk, 71 const CID2S_Seq_annot_place_Info& place); 72 static void x_Attach(CTSE_Chunk_Info& chunk, 73 const CID2S_Seq_data_Info& data); 74 static void x_Attach(CTSE_Chunk_Info& chunk, 75 const CID2S_Seq_assembly_Info& data); 76 static void x_Attach(CTSE_Chunk_Info& chunk, 77 const CID2S_Bioseq_place_Info& data); 78 static void x_Attach(CTSE_Chunk_Info& chunk, 79 const CID2S_Seq_feat_Ids_Info& ids); 80 81 typedef CSeq_id_Handle TLocationId; 82 typedef CRange<TSeqPos> TLocationRange; 83 typedef pair<TLocationId, TLocationRange> TLocation; 84 typedef vector<TLocation> TLocationSet; 85 86 static void x_ParseLocation(TLocationSet& vec, const CID2S_Seq_loc& loc); 87 88 protected: 89 static void x_AddWhole(TLocationSet& vec, const TLocationId& id); 90 static void x_AddInterval(TLocationSet& vec, const TLocationId& id, 91 TSeqPos start, TSeqPos length); 92 static void x_AddGiWhole(TLocationSet& vec, TGi gi); 93 static void x_AddGiInterval(TLocationSet& vec, TGi gi, 94 TSeqPos start, TSeqPos length); 95 }; 96 97 98 END_SCOPE(objects) 99 END_NCBI_SCOPE 100 101 #endif//ID2_PARSER__HPP_INCLUDED 102