NCBI C++ ToolKit
seq_masker_ostat_ascii.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seq_masker_ostat_ascii.hpp 84663 2018-11-27 18:22:00Z ucko $
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: Aleksandr Morgulis
27  *
28  * File Description:
29  * Definition of CSeqMaskerOStatAscii class.
30  *
31  */
32 
33 #ifndef C_WIN_MASK_USTAT_ASCII_H
34 #define C_WIN_MASK_USTAT_ASCII_H
35 
36 #include <string>
37 #include <vector>
38 
39 #include <corelib/ncbistre.hpp>
40 
42 
44 
45 /**
46  **\brief Class responsible for creation of unit counts statistics
47  ** in text format.
48  **/
50 {
51 public:
52 
53  /// Format version.
55 
56  /**
57  **\brief Exceptions that CSeqMaskerOstatAscii might throw.
58  **/
60  {
61  public:
62 
63  enum EErrCode
64  {
65  eBadOrder /**< Unit information is not added in ascending order of units. */
66  };
67 
68  /**
69  **\brief Get a description string for this exception.
70  **\return C-style description string
71  **/
72  virtual const char * GetErrCodeString() const override;
73 
75  };
76 
77  /**
78  **\brief Object constructor.
79  **\param name name of the output file containing the unit
80  ** counts data
81  **/
82  explicit CSeqMaskerOstatAscii(
83  const string & name, string const & metadat );
84 
85  /**
86  **\brief Object constructor.
87  **\param os the output stream
88  **/
89  explicit CSeqMaskerOstatAscii( CNcbiOstream & os, string const & metadata );
90 
91  /**
92  **\brief Object destructor.
93  **/
94  virtual ~CSeqMaskerOstatAscii();
95 
96  /** Get actual counts format version. */
97  virtual CSeqMaskerVersion const & GetStatFmtVersion() const {
98  return FormatVersion;
99  }
100 
101 protected:
102 
103  /**
104  **\brief Output a line with information about the given unit count.
105  **
106  ** The line contains two words: the unit value in hex format and
107  ** the unit count in decimal format. The function checks that the
108  ** unit value is greater than that of all previously written units.
109  **
110  **\param unit the unit value
111  **\param count the number of times the unit and its reverse complement
112  ** occur in the genome
113  **/
114  virtual void doSetUnitCount( Uint4 unit, Uint4 count );
115 
116  /**
117  **\brief Prints msg as a comment line in the output file.
118  **\param msg the comment message
119  **/
120  virtual void doSetComment( const string & msg );
121 
122  /**
123  **\brief Write data to output file.
124  **/
125  virtual void doFinalize();
126 
127 private:
128 
129  /** Set of comments to print in the end of the stats file. */
130  std::vector< std::string > comments;
131 };
132 
134 
135 #endif
Exceptions that CSeqMaskerOstatAscii might throw.
NCBI_EXCEPTION_DEFAULT(CSeqMaskerOstatAsciiException, CException)
Class responsible for creation of unit counts statistics in text format.
std::vector< std::string > comments
Set of comments to print in the end of the stats file.
virtual CSeqMaskerVersion const & GetStatFmtVersion() const
Get actual counts format version.
static CSeqMaskerVersion FormatVersion
Format version.
Base class for computing and saving unit counts data.
virtual void doSetComment(const string &)
virtual void doFinalize()
virtual void doSetUnitCount(Uint4, Uint4)=0
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_XALGOWINMASK_EXPORT
Definition: ncbi_export.h:1033
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
Modified on Wed May 22 11:28:52 2024 by modify_doxy.py rev. 669887