NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CWigGraph Class Reference

Search Toolkit Book for CWigGraph

CWigGraph. More...

#include <gui/widgets/seq_graphic/wig_graph.hpp>

+ Inheritance diagram for CWigGraph:
+ Collaboration diagram for CWigGraph:

Public Types

enum  EDataType { eSummary , eData }
 
- Public Types inherited from CSparseGraph
using TValType = uint64_t
 
typedef map< string, vector< TValType > * > TUpdateMap
 
- 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...
 

Public Member Functions

 CWigGraph (const string &cache_key)
 Copy constructor is invoked by CGraphCache which clones the data for aynchroneous saving operation. More...
 
 CWigGraph (const CWigGraph &data)
 
virtual ~CWigGraph ()
 Init is invoked by CGraphCache when a new instance of CWigGraph is initialized. More...
 
virtual void Init (TGraphCachePool &icache_pool) override
 Save is invoked by CGraphCache when cached data needs to be permanently saved into NetCache. More...
 
virtual void Save (TGraphCachePool &icache_pool) override
 GetData serializes the data into CDensityMap for the range provided in @data. More...
 
void GetData (CHistogramGlyph::TMap &data)
 GetDataCoverage returns fraction (0. More...
 
float GetDataCoverage (const TSeqRange &range)
 
bool IsSummary () const
 
void Prefetch (const TSeqRange &range)
 
- Public Member Functions inherited from CSparseGraph
 CSparseGraph ()
 
 CSparseGraph (const CSparseGraph &data)
 
virtual ~CSparseGraph ()
 
void InitFromCompoundID (CCompoundID id)
 
bool IsCacheGood () const
 inline methods More...
 
void Update (const TSeqRange &range, const TUpdateMap &update)
 
void GetMissingRegions (const TSeqRange &range, vector< TSeqRange > &missing_ranges)
 
- 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 Member Functions

static string GetStorageName ()
 
static string GetCacheKey (objects::CScope &scope, const objects::CSeq_id &seq_id, const string &wig_id, const string &remote_path, const string &last_modified, EDataType data_type)
 CWigGraph. More...
 
- Static Public Member Functions inherited from CSparseGraph
static CCompoundID CreateCompoundID (objects::CScope &scope, const objects::CSeq_id &seq_id, const string &remote_path)
 CSparseGraph. 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)
 

Static Public Attributes

static constexpr float kFract = 1000.
 CWigGraph data come in two flavors Summary - low-res representation for the whole sequence length and raw data - hi-res sparse cache. 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 Types

using TPrefetchRequest = struct { TSeqRange range
 
using TPrefetchData = unique_ptr< TPrefetchRequest >
 
using TPrefetchSummary = unique_ptr< TSparseVector >
 
- Protected Types inherited from CSparseGraph
typedef bm::sparse_vector< TValType, bm::bvector<> > TSparseVector
 

Protected Member Functions

void x_CreateNetCacheKey ()
 
void x_SaveSummary (ICache &icache, TSparseVector &sv)
 
bool x_ReadSummary (ICache &icache, TSparseVector &sv)
 
int x_RunBigWigScript (const TSeqRange &range, const string tmp_file)
 
void x_GetBigWigSummary (TSparseVector &summary_sv)
 
void x_GetBigWigData (const TSeqRange &range, vector< TValType > &v_out)
 
void x_EncodeDelta (const TSeqRange &range, const vector< float > &v_in, vector< TValType > &v_out)
 
void x_DecodeDelta (const TSeqRange &range, vector< float > &v_out)
 
void x_AddDataToMap (const vector< float > &data, const TSeqPos from, CHistogramGlyph::TMap &the_map)
 
void x_PackFloat (float v_in, TSparseVector::value_type &v_out)
 Float values are packed with precision loss (3 decimal places retained) values are conveeted to postive unsigned long long and the first bit is used to indicated the sign. More...
 
void x_UnPackFloat (TSparseVector::value_type v_in, float &v_out)
 
uint64_t x_EncodeSign (int64_t v)
 Encode/Decode negtaive vaues to positive ones. More...
 
int64_t x_DecodeSign (uint64_t v)
 
void x_FetchSummary ()
 
void x_FetchData ()
 
- Protected Member Functions inherited from CSparseGraph
void x_WriteMap (ICache &icache, bm::word_t *tb=0)
 
void x_WriteData (ICache &icache, const string &data_key, TSparseVector &sv)
 
void x_ReadMap (ICache &icache, string &tag, string &remote_path, string &last_modified, time_t &last_checked, string &md5, bm::bvector<> &bv, bm::word_t *tb=0)
 
bool x_ReadData (ICache &icache, const string &data_key, const string &tag, TSparseVector &sv, bm::word_t *tb=0)
 
void x_CheckRemoteData ()
 
void x_Sync (TGraphCachePool &icache_pool)
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Protected Attributes

string m_WigId
 WigFile id, e.g. chr1. More...
 
EDataType m_DataType = eSummary
 
int m_SummaryBinCount = 100000
 
atomic< boolm_PrefetchRequested {false}
 Number od data points in one Summary point. More...
 
vector< TValTypedata
 
map< TSeqRange, future< TPrefetchData > > m_PendingData
 
future< TPrefetchSummarym_PendingSummary
 
- Protected Attributes inherited from CSparseGraph
string m_SessionTag
 A current session tag, used to separate session netcache blobs from the blobs saved by other sessions. More...
 
string m_NetCacheKey
 data access key More...
 
bm::bvector m_DataMap
 bvector shows the regions m_Data exist More...
 
string m_SeqId
 NCBI seq_id, e.g. NC_000001. More...
 
size_t m_DataSize = 0
 size of each vector of m_Data More...
 
map< string, unique_ptr< TSparseVector > > m_Data
 map of sprasvectors, the key is used as a part of suffix of NetCache key (m_NetCacheKey + "_" + this map key More...
 
mutex m_DataMutex
 data access mutex More...
 
string m_RemotePath
 path to remote data or srz accession More...
 
string m_LastModified
 timestamp of the remote data last modified date as reported by www server More...
 
time_t m_LastChecked = 0
 timestamp: last time when m_LastModified was checked More...
 
bool m_IsCacheGood = true
 false value indicates that remote data were updated and the cache was reset More...
 
CTime m_LastSynced
 

Static Protected Attributes

static const int kMinBinSize = 500
 

Detailed Description

CWigGraph.

Definition at line 57 of file wig_graph.hpp.

Member Typedef Documentation

◆ TPrefetchData

using CWigGraph::TPrefetchData = unique_ptr<TPrefetchRequest>
protected

Definition at line 150 of file wig_graph.hpp.

◆ TPrefetchRequest

using CWigGraph::TPrefetchRequest = struct { TSeqRange range
protected

Definition at line 146 of file wig_graph.hpp.

◆ TPrefetchSummary

using CWigGraph::TPrefetchSummary = unique_ptr<TSparseVector>
protected

Definition at line 153 of file wig_graph.hpp.

Member Enumeration Documentation

◆ EDataType

Enumerator
eSummary 
eData 

Definition at line 70 of file wig_graph.hpp.

Constructor & Destructor Documentation

◆ CWigGraph() [1/2]

CWigGraph::CWigGraph ( const string cache_key)

◆ CWigGraph() [2/2]

CWigGraph::CWigGraph ( const CWigGraph data)

Definition at line 139 of file wig_graph.cpp.

◆ ~CWigGraph()

CWigGraph::~CWigGraph ( )
inlinevirtual

Init is invoked by CGraphCache when a new instance of CWigGraph is initialized.

Definition at line 162 of file wig_graph.hpp.

Member Function Documentation

◆ GetCacheKey()

string CWigGraph::GetCacheKey ( objects::CScope &  scope,
const objects::CSeq_id &  seq_id,
const string wig_id,
const string remote_path,
const string last_modified,
EDataType  data_type 
)
static

◆ GetData()

void CWigGraph::GetData ( CHistogramGlyph::TMap data)

GetDataCoverage returns fraction (0.

  • 1f) of retrieved data in the given range

Definition at line 521 of file wig_graph.cpp.

References _ASSERT, data, eSummary, f(), i, len, CSparseGraph::m_Data, CSparseGraph::m_DataSize, m_DataType, m_PrefetchRequested, m_SummaryBinCount, Prefetch(), r(), s_SplitRange(), x_AddDataToMap(), x_DecodeDelta(), x_FetchData(), x_FetchSummary(), and x_UnPackFloat().

◆ GetDataCoverage()

float CWigGraph::GetDataCoverage ( const TSeqRange range)

Definition at line 587 of file wig_graph.cpp.

References CSparseGraph::GetMissingRegions(), len, r(), and compile_time_bits::range().

◆ GetStorageName()

static string CWigGraph::GetStorageName ( )
inlinestatic

Definition at line 61 of file wig_graph.hpp.

◆ Init()

void CWigGraph::Init ( TGraphCachePool icache_pool)
overridevirtual

◆ IsSummary()

bool CWigGraph::IsSummary ( ) const

◆ Prefetch()

void CWigGraph::Prefetch ( const TSeqRange range)

◆ Save()

void CWigGraph::Save ( TGraphCachePool icache_pool)
overridevirtual

GetData serializes the data into CDensityMap for the range provided in @data.

Reimplemented from CSparseGraph.

Definition at line 243 of file wig_graph.cpp.

References CTime::eCurrent, eSummary, CTime::GetTimeT(), CSparseGraph::m_Data, m_DataType, CSparseGraph::m_LastChecked, CSparseGraph::Save(), x_FetchSummary(), and x_SaveSummary().

◆ x_AddDataToMap()

void CWigGraph::x_AddDataToMap ( const vector< float > &  data,
const TSeqPos  from,
CHistogramGlyph::TMap the_map 
)
protected

Definition at line 495 of file wig_graph.cpp.

References CDensityMap< CntType >::AddRange(), data, last(), and val.

Referenced by GetData().

◆ x_CreateNetCacheKey()

void CWigGraph::x_CreateNetCacheKey ( )
protected

◆ x_DecodeDelta()

void CWigGraph::x_DecodeDelta ( const TSeqRange range,
vector< float > &  v_out 
)
protected

◆ x_DecodeSign()

int64_t CWigGraph::x_DecodeSign ( uint64_t  v)
inlineprotected

Definition at line 197 of file wig_graph.hpp.

References negative(), and val.

Referenced by x_DecodeDelta(), and x_UnPackFloat().

◆ x_EncodeDelta()

void CWigGraph::x_EncodeDelta ( const TSeqRange range,
const vector< float > &  v_in,
vector< TValType > &  v_out 
)
protected

Definition at line 362 of file wig_graph.cpp.

References _ASSERT, kDeltaFrameSize, kFract, len, round(), and x_EncodeSign().

Referenced by x_GetBigWigData().

◆ x_EncodeSign()

uint64_t CWigGraph::x_EncodeSign ( int64_t  v)
inlineprotected

Encode/Decode negtaive vaues to positive ones.

Definition at line 186 of file wig_graph.hpp.

References abs.

Referenced by x_EncodeDelta(), and x_PackFloat().

◆ x_FetchData()

void CWigGraph::x_FetchData ( )
protected

◆ x_FetchSummary()

void CWigGraph::x_FetchSummary ( )
protected

Definition at line 645 of file wig_graph.cpp.

References CSparseGraph::m_Data, CSparseGraph::m_DataMutex, m_PendingSummary, and m_PrefetchRequested.

Referenced by GetData(), and Save().

◆ x_GetBigWigData()

void CWigGraph::x_GetBigWigData ( const TSeqRange range,
vector< TValType > &  v_out 
)
protected

◆ x_GetBigWigSummary()

void CWigGraph::x_GetBigWigSummary ( TSparseVector summary_sv)
protected

◆ x_PackFloat()

void CWigGraph::x_PackFloat ( float  v_in,
TSparseVector::value_type v_out 
)
inlineprotected

Float values are packed with precision loss (3 decimal places retained) values are conveeted to postive unsigned long long and the first bit is used to indicated the sign.

Definition at line 171 of file wig_graph.hpp.

References kFract, round(), and x_EncodeSign().

Referenced by x_GetBigWigSummary().

◆ x_ReadSummary()

bool CWigGraph::x_ReadSummary ( ICache icache,
TSparseVector sv 
)
protected

◆ x_RunBigWigScript()

int CWigGraph::x_RunBigWigScript ( const TSeqRange range,
const string  tmp_file 
)
protected

◆ x_SaveSummary()

void CWigGraph::x_SaveSummary ( ICache icache,
TSparseVector sv 
)
protected

◆ x_UnPackFloat()

void CWigGraph::x_UnPackFloat ( TSparseVector::value_type  v_in,
float &  v_out 
)
inlineprotected

Definition at line 178 of file wig_graph.hpp.

References kFract, and x_DecodeSign().

Referenced by GetData().

Member Data Documentation

◆ data

vector<TValType> CWigGraph::data
protected

Definition at line 148 of file wig_graph.hpp.

Referenced by GetData(), x_AddDataToMap(), x_GetBigWigData(), and x_SaveSummary().

◆ kFract

constexpr float CWigGraph::kFract = 1000.
staticconstexpr

CWigGraph data come in two flavors Summary - low-res representation for the whole sequence length and raw data - hi-res sparse cache.

Definition at line 65 of file wig_graph.hpp.

Referenced by x_DecodeDelta(), x_EncodeDelta(), x_PackFloat(), and x_UnPackFloat().

◆ kMinBinSize

const int CWigGraph::kMinBinSize = 500
staticprotected

Definition at line 141 of file wig_graph.hpp.

Referenced by CWigGraph().

◆ m_DataType

EDataType CWigGraph::m_DataType = eSummary
protected

◆ m_PendingData

map<TSeqRange, future<TPrefetchData> > CWigGraph::m_PendingData
protected

Definition at line 151 of file wig_graph.hpp.

Referenced by Prefetch(), and x_FetchData().

◆ m_PendingSummary

future<TPrefetchSummary> CWigGraph::m_PendingSummary
protected

Definition at line 154 of file wig_graph.hpp.

Referenced by Init(), and x_FetchSummary().

◆ m_PrefetchRequested

atomic<bool> CWigGraph::m_PrefetchRequested {false}
protected

Number od data points in one Summary point.

Definition at line 144 of file wig_graph.hpp.

Referenced by GetData(), Init(), Prefetch(), x_FetchData(), and x_FetchSummary().

◆ m_SummaryBinCount

int CWigGraph::m_SummaryBinCount = 100000
protected

◆ m_WigId

string CWigGraph::m_WigId
protected

WigFile id, e.g. chr1.

Definition at line 138 of file wig_graph.hpp.

Referenced by CWigGraph(), x_CreateNetCacheKey(), and x_RunBigWigScript().


The documentation for this class was generated from the following files:
Modified on Thu Feb 29 12:21:16 2024 by modify_doxy.py rev. 669887