1 /* $Id: gff_record.hpp 632624 2021-06-03 17:38:23Z ivanov $ 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government have not placed any restriction on its use or reproduction. 13 * 14 * Although all reasonable efforts have been taken to ensure the accuracy 15 * and reliability of the software and data, the NLM and the U.S. 16 * Government do not and cannot warrant the performance or results that 17 * may be obtained by using this software or data. The NLM and the U.S. 18 * Government disclaim all warranties, express or implied, including 19 * warranties of performance, merchantability or fitness for any particular 20 * purpose. 21 * 22 * Please cite the author in any work or product based on this material. 23 * 24 * =========================================================================== 25 * 26 * Authors: Frank Ludwig 27 * 28 * File Description: Write gff file 29 * 30 */ 31 32 #ifndef OBJTOOLS_WRITERS___GFF_RECORD__HPP 33 #define OBJTOOLS_READERS___GFF_RECORD__HPP 34 35 #include <corelib/ncbistd.hpp> 36 #include <objects/seq/Seq_annot.hpp> 37 #include <objects/seqfeat/Seq_feat.hpp> 38 39 BEGIN_NCBI_SCOPE 40 BEGIN_objects_SCOPE 41 // ============================================================================ 42 class NCBI_XOBJWRITE_EXPORT CGffRecord 43 // ============================================================================ 44 { 45 public: 46 CGffRecord(); ~CGffRecord()47 ~CGffRecord() {}; 48 49 bool SetRecord( 50 const CSeq_annot&, 51 const CSeq_feat& ); 52 53 void DumpRecord( 54 CNcbiOstream& ); 55 56 protected: 57 static string FeatIdString( 58 const CFeat_id& id ); 59 60 bool AssignType( 61 const CSeq_feat& ); 62 bool AssignSeqId( 63 const CSeq_feat& ); 64 bool AssignStart( 65 const CSeq_feat& ); 66 bool AssignStop( 67 const CSeq_feat& ); 68 bool AssignSource( 69 const CSeq_feat& ); 70 bool AssignScore( 71 const CSeq_feat& ); 72 bool AssignStrand( 73 const CSeq_feat& ); 74 bool AssignPhase( 75 const CSeq_feat& ); 76 bool AssignAttributesCore( 77 const CSeq_annot&, 78 const CSeq_feat& ); 79 bool AssignAttributesExtended( 80 const CSeq_feat& ); 81 82 void AddAttribute( 83 const string& key, 84 const string& value ); 85 86 static CSeq_feat::TData::ESubtype GetSubtypeOf( 87 const CSeq_annot&, 88 const CFeat_id& ); 89 90 static bool IsParentOf( 91 CSeq_feat::TData::ESubtype, 92 CSeq_feat::TData::ESubtype ); 93 94 string m_strSeqId; 95 string m_strSource; 96 string m_strType; 97 string m_strStart; 98 string m_strEnd; 99 string m_strScore; 100 string m_strStrand; 101 string m_strPhase; 102 string m_strAttributes; 103 104 map< string, CSeq_feat::TData::ESubtype > m_IdToTypeMap; 105 }; 106 107 END_objects_SCOPE 108 END_NCBI_SCOPE 109 110 #endif // OBJTOOLS_WRITERS___GFF_RECORD__HPP 111