NCBI C++ ToolKit
|
Search Toolkit Book for CSeqMaskerOstat
Base class for computing and saving unit counts data. More...
#include <algo/winmask/seq_masker_ostat.hpp>
Classes | |
class | CSeqMaskerOstatException |
Exceptions that CSeqMaskerOstat can throw. More... | |
Public Member Functions | |
CSeqMaskerOstat (CNcbiOstream &os, bool alloc, string const &metadata) | |
Object constructor. More... | |
virtual | ~CSeqMaskerOstat () |
Trivial object destructor. More... | |
void | setUnitSize (Uint1 us) |
Set the unit size value. More... | |
void | setUnitCount (Uint4 unit, Uint4 count) |
Add count value for a particular unit. More... | |
void | setComment (const string &msg) |
Add a comment to the unit counts file. More... | |
void | setParam (const string &name, Uint4 value) |
Set a value of a WindowMasker parameter. More... | |
void | finalize () |
Perform any final tasks required to generate unit counts in the particular format. More... | |
void | SetStatAlgoVersion (CSeqMaskerVersion const &v) |
Set the counts generation algorithm version explicitly (needed for convertions). More... | |
virtual CSeqMaskerVersion const & | GetStatFmtVersion () const =0 |
Get actual counts format version. More... | |
void | SetMaxCount (Uint4 mc) |
void | SetCount (Uint4 count, double pct) |
![]() | |
CObject (void) | |
Constructor. More... | |
CObject (const CObject &src) | |
Copy constructor. More... | |
virtual | ~CObject (void) |
Destructor. More... | |
CObject & | operator= (const CObject &src) THROWS_NONE |
Assignment operator. More... | |
bool | CanBeDeleted (void) const THROWS_NONE |
Check if object can be deleted. More... | |
bool | IsAllocatedInPool (void) const THROWS_NONE |
Check if object is allocated in memory pool (not system heap) More... | |
bool | Referenced (void) const THROWS_NONE |
Check if object is referenced. More... | |
bool | ReferencedOnlyOnce (void) const THROWS_NONE |
Check if object is referenced only once. More... | |
void | AddReference (void) const |
Add reference to object. More... | |
void | RemoveReference (void) const |
Remove reference to object. More... | |
void | ReleaseReference (void) const |
Remove reference without deleting object. More... | |
virtual void | DoNotDeleteThisObject (void) |
Mark this object as not allocated in heap – do not delete this object. More... | |
virtual void | DoDeleteThisObject (void) |
Mark this object as allocated in heap – object can be deleted. More... | |
void * | operator new (size_t size) |
Define new operator for memory allocation. More... | |
void * | operator new[] (size_t size) |
Define new[] operator for 'array' memory allocation. More... | |
void | operator delete (void *ptr) |
Define delete operator for memory deallocation. More... | |
void | operator delete[] (void *ptr) |
Define delete[] operator for memory deallocation. More... | |
void * | operator new (size_t size, void *place) |
Define new operator. More... | |
void | operator delete (void *ptr, void *place) |
Define delete operator. More... | |
void * | operator new (size_t size, CObjectMemoryPool *place) |
Define new operator using memory pool. More... | |
void | operator delete (void *ptr, CObjectMemoryPool *place) |
Define delete operator. More... | |
virtual void | DebugDump (CDebugDumpContext ddc, unsigned int depth) const |
Define method for dumping debug information. More... | |
![]() | |
CDebugDumpable (void) | |
virtual | ~CDebugDumpable (void) |
void | DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const |
void | DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const |
void | DumpToConsole (void) const |
Static Public Attributes | |
static char const * | STAT_ALGO_COMPONENT_NAME |
static CSeqMaskerVersion | StatAlgoVersion |
Version of the statistics generation algorithm. More... | |
![]() | |
static const TCount | eCounterBitsCanBeDeleted = 1 << 0 |
Define possible object states. More... | |
static const TCount | eCounterBitsInPlainHeap = 1 << 1 |
Heap signature was found. More... | |
static const TCount | eCounterBitsPlaceMask |
Mask for 'in heap' state flags. More... | |
static const int | eCounterStep = 1 << 2 |
Skip over the "in heap" bits. More... | |
static const TCount | eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2) |
Minimal value for valid objects (reference counter is zero) Must be a single bit value. More... | |
static const TCount | eCounterStateMask |
Valid object, and object in heap. More... | |
Protected Member Functions | |
string | FormatParameters () const |
Format algorithm parameters into a string. More... | |
string | FormatMetaData () const |
Combine version data and metadata into a single string. More... | |
void | WriteBinMetaData (std::ostream &os) const |
Write metadata in binary format. More... | |
Methods used to delegate functionality to derived classes | |
virtual void | doSetUnitSize (Uint4 us) |
virtual void | doSetUnitCount (Uint4, Uint4)=0 |
virtual void | doSetComment (const string &) |
virtual void | doSetParam (const string &, Uint4) |
virtual void | doFinalize () |
![]() | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
Protected Attributes | |
CNcbiOstream & | out_stream |
Refers to the C++ stream that should be used to write out the unit counts data. More... | |
bool | alloc |
flag indicating that the stream was allocated More... | |
string | metadata |
metadata string More... | |
Uint1 | unit_size |
unit size More... | |
vector< Uint4 > | pvalues |
vector< pair< Uint4, Uint4 > > | counts |
Unit counts. More... | |
CSeqMaskerVersion | fmt_gen_algo_ver |
version of the algorithm used to generate counts More... | |
Uint4 | max_count = 0 |
information about counts and corresponding pct cutoffs More... | |
std::vector< double > | count_map |
Static Protected Attributes | |
static const char * | PARAMS [] = { "t_low", "t_extend", "t_threshold", "t_high" } |
Algorithm parameter names. More... | |
Private Types | |
enum | { start , ulen , udata , thres , final } |
Private Member Functions | |
Provide reference semantics for the class | |
CSeqMaskerOstat (const CSeqMaskerOstat &) | |
CSeqMaskerOstat & | operator= (const CSeqMaskerOstat &) |
Private Attributes | |
enum CSeqMaskerOstat:: { ... } | state |
Additional Inherited Members | |
![]() | |
enum | EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern } |
Control filling of newly allocated memory. More... | |
typedef CObjectCounterLocker | TLockerType |
Default locker type for CRef. More... | |
typedef atomic< Uint8 > | TCounter |
Counter type is CAtomiCounter. More... | |
typedef Uint8 | TCount |
Alias for value type of counter. More... | |
![]() | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (void) |
Define method to throw null pointer exception. More... | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (const type_info &type) |
static EAllocFillMode | GetAllocFillMode (void) |
static void | SetAllocFillMode (EAllocFillMode mode) |
static void | SetAllocFillMode (const string &value) |
Set mode from configuration parameter value. More... | |
![]() | |
static void | EnableDebugDump (bool on) |
Base class for computing and saving unit counts data.
Definition at line 50 of file seq_masker_ostat.hpp.
|
private |
Enumerator | |
---|---|
start | |
ulen | |
udata | |
thres | |
final |
Definition at line 226 of file seq_masker_ostat.hpp.
|
explicit |
Object constructor.
os | C++ stream that should be used to save the unit counts data |
Definition at line 52 of file seq_masker_ostat_opt.cpp.
|
inlinevirtual |
Trivial object destructor.
Definition at line 90 of file seq_masker_ostat.hpp.
References alloc, and out_stream.
|
private |
|
inlineprotectedvirtual |
Reimplemented in CSeqMaskerOstatOpt, CSeqMaskerOstatBin, and CSeqMaskerOstatAscii.
Definition at line 173 of file seq_masker_ostat.hpp.
Referenced by finalize().
Reimplemented in CSeqMaskerOstatAscii.
Definition at line 170 of file seq_masker_ostat.hpp.
Referenced by setComment().
Definition at line 103 of file seq_masker_ostat_opt.cpp.
References Error(), LOG_POST, PARAMS, and value.
Referenced by setParam().
Implemented in CSeqMaskerOstatOpt, CSeqMaskerOstatBin, and CSeqMaskerOstatAscii.
Referenced by setUnitCount().
|
inlineprotectedvirtual |
Reimplemented in CSeqMaskerOstatOpt.
Definition at line 168 of file seq_masker_ostat.hpp.
References unit_size.
Referenced by CSeqMaskerOstatOpt::doSetUnitSize(), and setUnitSize().
void CSeqMaskerOstat::finalize | ( | ) |
Perform any final tasks required to generate unit counts in the particular format.
Definition at line 192 of file seq_masker_ostat.cpp.
References doFinalize(), NCBI_THROW, state, thres, and udata.
Referenced by CWinMaskCountsConverter::operator()(), and CWinMaskCountsGenerator::operator()().
|
protected |
Combine version data and metadata into a single string.
Definition at line 128 of file seq_masker_ostat.cpp.
References count_map, fmt_gen_algo_ver, FormatParameters(), GetStatFmtVersion(), i, max_count, metadata, and CSeqMaskerVersion::Print().
Referenced by CSeqMaskerOstatAscii::doFinalize(), and CSeqMaskerOstatOptAscii::write_out().
|
protected |
Format algorithm parameters into a string.
Definition at line 69 of file seq_masker_ostat.cpp.
References unit_size.
Referenced by FormatMetaData(), and WriteBinMetaData().
|
pure virtual |
Get actual counts format version.
Implemented in CSeqMaskerOstatOptBin, CSeqMaskerOstatOptAscii, CSeqMaskerOstatBin, and CSeqMaskerOstatAscii.
Referenced by FormatMetaData(), and WriteBinMetaData().
|
private |
Add a comment to the unit counts file.
It is possible that this method is NOP for some unit counts formats.
msg | comment message |
Definition at line 121 of file seq_masker_ostat.hpp.
References doSetComment().
Referenced by CWinMaskCountsGenerator::operator()().
|
inline |
Definition at line 155 of file seq_masker_ostat.hpp.
References assert, count_map, and max_count.
Referenced by CWinMaskCountsConverter::operator()(), and CWinMaskCountsGenerator::operator()().
|
inline |
Definition at line 149 of file seq_masker_ostat.hpp.
References count_map, and max_count.
Referenced by CWinMaskCountsConverter::operator()(), and CWinMaskCountsGenerator::operator()().
Set a value of a WindowMasker parameter.
This method only can be called after all setUnitCount() calls.
name | the name of the parameter |
value | the value of the parameter |
Definition at line 177 of file seq_masker_ostat.cpp.
References doSetParam(), NCBI_THROW, state, thres, udata, ulen, and value.
Referenced by CWinMaskCountsConverter::operator()(), and CWinMaskCountsGenerator::operator()().
|
inline |
Set the counts generation algorithm version explicitly (needed for convertions).
Definition at line 142 of file seq_masker_ostat.hpp.
References fmt_gen_algo_ver.
Referenced by CWinMaskCountsConverter::operator()().
Add count value for a particular unit.
This method can not be called before setUnitSize() and after the first call to setParam().
unit | unit value |
count | number of times the unit and its reverse complement occur in the genome |
Definition at line 162 of file seq_masker_ostat.cpp.
References doSetUnitCount(), NCBI_THROW, state, udata, and ulen.
Referenced by CWinMaskCountsConverter::operator()(), and CWinMaskCountsGenerator::process().
void CSeqMaskerOstat::setUnitSize | ( | Uint1 | us | ) |
Set the unit size value.
This method must be called before any call to setUnitCount().
us | new value of unit size |
Definition at line 147 of file seq_masker_ostat.cpp.
References doSetUnitSize(), NCBI_THROW, start, state, and ulen.
Referenced by CWinMaskCountsConverter::operator()(), and CWinMaskCountsGenerator::operator()().
|
protected |
Write metadata in binary format.
Definition at line 78 of file seq_masker_ostat.cpp.
References count_map, fmt_gen_algo_ver, FormatParameters(), GetStatFmtVersion(), i, max_count, metadata, CSeqMaskerVersion::Print(), and string.
Referenced by CSeqMaskerOstatBin::doFinalize(), and CSeqMaskerOstatOptBin::write_out().
|
protected |
flag indicating that the stream was allocated
Definition at line 192 of file seq_masker_ostat.hpp.
Referenced by ~CSeqMaskerOstat().
|
protected |
Definition at line 213 of file seq_masker_ostat.hpp.
Referenced by FormatMetaData(), SetCount(), SetMaxCount(), and WriteBinMetaData().
Unit counts.
Definition at line 206 of file seq_masker_ostat.hpp.
Referenced by CSeqMaskerOstatAscii::doFinalize(), CSeqMaskerOstatBin::doFinalize(), CSeqMaskerOstatAscii::doSetUnitCount(), and CSeqMaskerOstatBin::doSetUnitCount().
|
protected |
version of the algorithm used to generate counts
Definition at line 209 of file seq_masker_ostat.hpp.
Referenced by FormatMetaData(), SetStatAlgoVersion(), and WriteBinMetaData().
|
protected |
information about counts and corresponding pct cutoffs
Definition at line 212 of file seq_masker_ostat.hpp.
Referenced by FormatMetaData(), SetCount(), SetMaxCount(), and WriteBinMetaData().
|
protected |
metadata string
Definition at line 195 of file seq_masker_ostat.hpp.
Referenced by FormatMetaData(), and WriteBinMetaData().
|
protected |
Refers to the C++ stream that should be used to write out the unit counts data.
Definition at line 189 of file seq_masker_ostat.hpp.
Referenced by CSeqMaskerOstatAscii::doFinalize(), CSeqMaskerOstatBin::doFinalize(), CSeqMaskerOstatOptBin::write_out(), CSeqMaskerOstatOptAscii::write_out(), CSeqMaskerOstatBin::write_word(), CSeqMaskerOstatOptBin::write_word(), and ~CSeqMaskerOstat().
|
staticprotected |
Algorithm parameter names.
Definition at line 164 of file seq_masker_ostat.hpp.
Referenced by doSetParam().
|
protected |
Definition at line 203 of file seq_masker_ostat.hpp.
Referenced by CSeqMaskerOstatOpt::GetParams().
|
static |
Definition at line 54 of file seq_masker_ostat.hpp.
Referenced by CSeqMaskerIstatFactory::create(), and ExtractStatAlgoVersion().
|
static |
Version of the statistics generation algorithm.
Definition at line 57 of file seq_masker_ostat.hpp.
Referenced by CWinMaskApplication::CWinMaskApplication().
enum { ... } CSeqMaskerOstat::state |
Referenced by finalize(), setParam(), setUnitCount(), and setUnitSize().
|
protected |
unit size
Definition at line 198 of file seq_masker_ostat.hpp.
Referenced by CSeqMaskerOstatAscii::doFinalize(), CSeqMaskerOstatBin::doFinalize(), doSetUnitSize(), and FormatParameters().