NCBI C++ ToolKit
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Attributes | List of all members
CSeqMaskerOstat Class Referenceabstract

Search Toolkit Book for CSeqMaskerOstat

Base class for computing and saving unit counts data. More...

#include <algo/winmask/seq_masker_ostat.hpp>

+ Inheritance diagram for CSeqMaskerOstat:
+ Collaboration diagram for CSeqMaskerOstat:

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 constGetStatFmtVersion () const =0
 Get actual counts format version. More...
 
void SetMaxCount (Uint4 mc)
 
void SetCount (Uint4 count, double pct)
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (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...
 
- Public Member Functions inherited from CDebugDumpable
 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 constSTAT_ALGO_COMPONENT_NAME
 
static CSeqMaskerVersion StatAlgoVersion
 Version of the statistics generation algorithm. More...
 
- Static Public Attributes inherited from CObject
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 ()
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Protected Attributes

CNcbiOstreamout_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< Uint4pvalues
 
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 &)
 
CSeqMaskerOstatoperator= (const CSeqMaskerOstat &)
 

Private Attributes

enum CSeqMaskerOstat:: { ... }  state
 

Additional Inherited Members

- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 
- Static Public Member Functions inherited from CObject
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 Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 

Detailed Description

Base class for computing and saving unit counts data.

Definition at line 50 of file seq_masker_ostat.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
start 
ulen 
udata 
thres 
final 

Definition at line 226 of file seq_masker_ostat.hpp.

Constructor & Destructor Documentation

◆ CSeqMaskerOstat() [1/2]

CSeqMaskerOstat::CSeqMaskerOstat ( CNcbiOstream os,
bool  alloc,
string const metadata 
)
explicit

Object constructor.

Parameters
osC++ stream that should be used to save the unit counts data

Definition at line 52 of file seq_masker_ostat_opt.cpp.

◆ ~CSeqMaskerOstat()

virtual CSeqMaskerOstat::~CSeqMaskerOstat ( )
inlinevirtual

Trivial object destructor.

Definition at line 90 of file seq_masker_ostat.hpp.

References alloc, and out_stream.

◆ CSeqMaskerOstat() [2/2]

CSeqMaskerOstat::CSeqMaskerOstat ( const CSeqMaskerOstat )
private

Member Function Documentation

◆ doFinalize()

virtual void CSeqMaskerOstat::doFinalize ( )
inlineprotectedvirtual

Reimplemented in CSeqMaskerOstatOpt, CSeqMaskerOstatBin, and CSeqMaskerOstatAscii.

Definition at line 173 of file seq_masker_ostat.hpp.

Referenced by finalize().

◆ doSetComment()

virtual void CSeqMaskerOstat::doSetComment ( const string )
inlineprotectedvirtual

Reimplemented in CSeqMaskerOstatAscii.

Definition at line 170 of file seq_masker_ostat.hpp.

Referenced by setComment().

◆ doSetParam()

void CSeqMaskerOstat::doSetParam ( const string name,
Uint4  value 
)
protectedvirtual

Definition at line 103 of file seq_masker_ostat_opt.cpp.

References Error(), LOG_POST, PARAMS, and value.

Referenced by setParam().

◆ doSetUnitCount()

virtual void CSeqMaskerOstat::doSetUnitCount ( Uint4  ,
Uint4   
)
protectedpure virtual

◆ doSetUnitSize()

virtual void CSeqMaskerOstat::doSetUnitSize ( Uint4  us)
inlineprotectedvirtual

Reimplemented in CSeqMaskerOstatOpt.

Definition at line 168 of file seq_masker_ostat.hpp.

References unit_size.

Referenced by CSeqMaskerOstatOpt::doSetUnitSize(), and setUnitSize().

◆ finalize()

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()().

◆ FormatMetaData()

string CSeqMaskerOstat::FormatMetaData ( ) const
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().

◆ FormatParameters()

string CSeqMaskerOstat::FormatParameters ( ) const
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().

◆ GetStatFmtVersion()

virtual CSeqMaskerVersion const& CSeqMaskerOstat::GetStatFmtVersion ( ) const
pure virtual

Get actual counts format version.

Implemented in CSeqMaskerOstatOptBin, CSeqMaskerOstatOptAscii, CSeqMaskerOstatBin, and CSeqMaskerOstatAscii.

Referenced by FormatMetaData(), and WriteBinMetaData().

◆ operator=()

CSeqMaskerOstat& CSeqMaskerOstat::operator= ( const CSeqMaskerOstat )
private

◆ setComment()

void CSeqMaskerOstat::setComment ( const string msg)
inline

Add a comment to the unit counts file.

It is possible that this method is NOP for some unit counts formats.

Parameters
msgcomment message

Definition at line 121 of file seq_masker_ostat.hpp.

References doSetComment().

Referenced by CWinMaskCountsGenerator::operator()().

◆ SetCount()

void CSeqMaskerOstat::SetCount ( Uint4  count,
double  pct 
)
inline

◆ SetMaxCount()

void CSeqMaskerOstat::SetMaxCount ( Uint4  mc)
inline

◆ setParam()

void CSeqMaskerOstat::setParam ( const string name,
Uint4  value 
)

Set a value of a WindowMasker parameter.

This method only can be called after all setUnitCount() calls.

Parameters
namethe name of the parameter
valuethe 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()().

◆ SetStatAlgoVersion()

void CSeqMaskerOstat::SetStatAlgoVersion ( CSeqMaskerVersion const v)
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()().

◆ setUnitCount()

void CSeqMaskerOstat::setUnitCount ( Uint4  unit,
Uint4  count 
)

Add count value for a particular unit.

This method can not be called before setUnitSize() and after the first call to setParam().

Parameters
unitunit value
countnumber 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().

◆ setUnitSize()

void CSeqMaskerOstat::setUnitSize ( Uint1  us)

Set the unit size value.

This method must be called before any call to setUnitCount().

Parameters
usnew 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()().

◆ WriteBinMetaData()

void CSeqMaskerOstat::WriteBinMetaData ( std::ostream &  os) const
protected

Member Data Documentation

◆ alloc

bool CSeqMaskerOstat::alloc
protected

flag indicating that the stream was allocated

Definition at line 192 of file seq_masker_ostat.hpp.

Referenced by ~CSeqMaskerOstat().

◆ count_map

std::vector< double > CSeqMaskerOstat::count_map
protected

Definition at line 213 of file seq_masker_ostat.hpp.

Referenced by FormatMetaData(), SetCount(), SetMaxCount(), and WriteBinMetaData().

◆ counts

vector< pair< Uint4, Uint4 > > CSeqMaskerOstat::counts
protected

◆ fmt_gen_algo_ver

CSeqMaskerVersion CSeqMaskerOstat::fmt_gen_algo_ver
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().

◆ max_count

Uint4 CSeqMaskerOstat::max_count = 0
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().

◆ metadata

string CSeqMaskerOstat::metadata
protected

metadata string

Definition at line 195 of file seq_masker_ostat.hpp.

Referenced by FormatMetaData(), and WriteBinMetaData().

◆ out_stream

CNcbiOstream& CSeqMaskerOstat::out_stream
protected

◆ PARAMS

const char * CSeqMaskerOstat::PARAMS = { "t_low", "t_extend", "t_threshold", "t_high" }
staticprotected

Algorithm parameter names.

Definition at line 164 of file seq_masker_ostat.hpp.

Referenced by doSetParam().

◆ pvalues

vector< Uint4 > CSeqMaskerOstat::pvalues
protected

Definition at line 203 of file seq_masker_ostat.hpp.

Referenced by CSeqMaskerOstatOpt::GetParams().

◆ STAT_ALGO_COMPONENT_NAME

char const * CSeqMaskerOstat::STAT_ALGO_COMPONENT_NAME
static
Initial value:
=
"windowmasker-statistics-algorithm-version"

Definition at line 54 of file seq_masker_ostat.hpp.

Referenced by CSeqMaskerIstatFactory::create(), and ExtractStatAlgoVersion().

◆ StatAlgoVersion

CSeqMaskerVersion CSeqMaskerOstat::StatAlgoVersion
static

Version of the statistics generation algorithm.

Definition at line 57 of file seq_masker_ostat.hpp.

Referenced by CWinMaskApplication::CWinMaskApplication().

◆ 

enum { ... } CSeqMaskerOstat::state

◆ unit_size

Uint1 CSeqMaskerOstat::unit_size
protected

The documentation for this class was generated from the following files:
Modified on Sat Dec 02 09:19:39 2023 by modify_doxy.py rev. 669887