1 /*  $Id: psl_data.hpp 632526 2021-06-02 17:25:01Z 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  * Author: Frank Ludwig
27  *
28  * File Description:
29  *   PSL intermediate representation
30  *
31  */
32 
33 #ifndef OBJTOOLS_READERS___PSL_DATA__HPP
34 #define OBJTOOLS_READERS___PSL_DATA__HPP
35 
36 #include <objects/seqloc/Na_strand.hpp>
37 //#include <objtools/readers/message_listener.hpp>
38 
39 #include <objtools/readers/psl_reader.hpp>
40 #include "reader_message_handler.hpp"
41 
42 BEGIN_NCBI_SCOPE
43 BEGIN_objects_SCOPE // namespace ncbi::objects::
44 
45 
46 //  ----------------------------------------------------------------------------
47 struct SAlignSegment
48 //  ----------------------------------------------------------------------------
49 {
50     int mLen;
51     int mStartQ;
52     int mStartT;
53     ENa_strand mStrandQ;
54     ENa_strand mStrandT;
55 };
56 
57 //  ----------------------------------------------------------------------------
58 class CPslData
59 //  ----------------------------------------------------------------------------
60 {
61 public:
62     CPslData(
63         CReaderMessageHandler* = nullptr);
64 
65     //
66     //  Input/output:
67     //
68     void Initialize(
69         const CPslReader::TReaderLine& );
70 
71     void Dump(
72         ostream& ostr);
73 
74     void ExportToSeqAlign(
75         CPslReader::SeqIdResolver,
76         CSeq_align& seqAlign);
77 
78 private:
79     void xReset();
80 
81     void xConvertBlocksToSegments(
82         vector<SAlignSegment>&) const;
83 
84     //
85     // Data:
86     //
87 private:
88     CReaderMessageHandler* mpEL;
89     int mFirstDataColumn = -1;
90 
91     int mMatches;
92     int mMisMatches;
93     int mRepMatches;
94     int mCountN;
95     int mNumInsertQ;
96     int mBaseInsertQ;
97     int mNumInsertT;
98     int mBaseInsertT;
99     ENa_strand mStrandT;
100     string mNameQ;
101     int mSizeQ;
102     int mStartQ;
103     int mEndQ;
104     string mNameT;
105     int mSizeT;
106     int mStartT;
107     int mEndT;
108     int mBlockCount;
109     vector<int> mBlockSizes;
110     vector<int> mBlockStartsQ;
111     vector<int> mBlockStartsT;
112 };
113 
114 END_objects_SCOPE
115 END_NCBI_SCOPE
116 
117 #endif // OBJTOOLS_READERS___PSL_DATA__HPP
118