1 /*  $Id: microarray_reader.hpp 632740 2021-06-07 12:13:19Z 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  *   BED file reader
30  *
31  */
32 
33 #ifndef OBJTOOLS_READERS___MICROARRAYREADER__HPP
34 #define OBJTOOLS_READERS___MICROARRAYREADER__HPP
35 
36 #include <corelib/ncbistd.hpp>
37 #include <objects/seq/Seq_annot.hpp>
38 #include <objtools/readers/reader_base.hpp>
39 
40 BEGIN_NCBI_SCOPE
41 BEGIN_objects_SCOPE
42 
43 class CReaderListener;
44 
45 //  ----------------------------------------------------------------------------
46 class NCBI_XOBJREAD_EXPORT CMicroArrayReader
47 //  ----------------------------------------------------------------------------
48     : public CReaderBase
49 {
50 public:
51     enum {
52         fDefaults = 0,
53         fReadAsBed = (1 << 0),          // discard MicroArray specific columns
54                                         //  and produce regular BED seq-annot
55     };
56 
57 public:
58     CMicroArrayReader(
59         int =fDefaults,
60         CReaderListener* = nullptr );
61 
62     virtual ~CMicroArrayReader();
63 
64     CRef<CSeq_annot>
65     ReadSeqAnnot(
66         ILineReader&,
67         ILineErrorListener* = nullptr ) override;
68 
69 protected:
70     CRef<CSeq_annot> xCreateSeqAnnot() override;
71 
72     void xGetData(
73         ILineReader&,
74         TReaderData&) override;
75 
76     void xProcessData(
77         const TReaderData&,
78         CSeq_annot&) override;
79 
80     virtual bool xProcessTrackLine(
81         const string&);
82 
83     bool xProcessFeature(
84         const string&,
85         CSeq_annot&);
86 
87     void xSetFeatureLocation(
88         CRef<CSeq_feat>&,
89         const vector<string>& );
90 
91     void xSetFeatureDisplayData(
92         CRef<CSeq_feat>&,
93         const vector<string>& );
94 
95     static void xCleanColumnValues(
96         vector<string>&);
97 
98 protected:
99     string m_currentId;
100     vector<string>::size_type m_columncount;
101     bool m_usescore;
102     string m_strExpNames;
103     int m_iExpScale;
104     int m_iExpStep;
105 };
106 
107 
108 END_objects_SCOPE
109 END_NCBI_SCOPE
110 
111 #endif // OBJTOOLS_READERS___MICROARRAYREADER__HPP
112