1 #ifndef OBJTOOLS_FORMAT_ITEMS___PRIMARY_ITEM__HPP
2 #define OBJTOOLS_FORMAT_ITEMS___PRIMARY_ITEM__HPP
3 
4 /*  $Id: primary_item.hpp 577454 2019-01-03 22:58:25Z kans $
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:  Aaron Ucko, NCBI
30 *          Mati Shomrat
31 *
32 * File Description:
33 *   Primary item for flat-file generator
34 *
35 */
36 #include <corelib/ncbistd.hpp>
37 #include <util/range.hpp>
38 
39 #include <list>
40 #include <map>
41 #include <objects/seqloc/Seq_id.hpp>
42 #include <objects/seqalign/Seq_align.hpp>
43 #include <objtools/alnmgr/alnmap.hpp>
44 #include <objtools/format/items/item_base.hpp>
45 
46 
47 BEGIN_NCBI_SCOPE
48 BEGIN_SCOPE(objects)
49 
50 
51 class CBioseqContext;
52 class IFormatter;
53 
54 
55 ///////////////////////////////////////////////////////////////////////////
56 //
57 // PRIMARY
58 
59 class NCBI_FORMAT_EXPORT CPrimaryItem : public CFlatItem
60 {
61 public:
62     CPrimaryItem(CBioseqContext& ctx);
63     void Format(IFormatter& formatter, IFlatTextOStream& text_os) const;
64 
GetString(void) const65     const string& GetString(void) const { return m_Str; }
66 
67     virtual EItem GetItemType(void) const;
68 private:
69     // types
70     typedef CConstRef<CSeq_align>            TAln;
71     typedef list< CRef< CSeq_align > >       TAlnList;
72     typedef list< CConstRef< CSeq_align > >  TAlnConstList;
73     typedef multimap<CAlnMap::TRange,  TAln> TAlnMap;
74 
75     void x_GatherInfo(CBioseqContext& ctx);
76     void x_GetStrForPrimary(CBioseqContext& ctx);
77     void x_CollectSegments(TAlnConstList&, const TAlnList& aln_list);
78     void x_CollectSegments(TAlnConstList&, const CSeq_align& aln);
79 
80     string m_Str;
81 };
82 
83 
84 END_SCOPE(objects)
85 END_NCBI_SCOPE
86 
87 #endif  /* OBJTOOLS_FORMAT_ITEMS___PRIMARY_ITEM__HPP */
88