NCBI C++ ToolKit
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CAlnStats< _TAlnIdVec > Class Template Reference

Search Toolkit Book for CAlnStats

Helper class which collects seq-align statistics: seq-ids participating in alignments and rows, potential anchors etc. More...

#include <objtools/alnmgr/aln_stats.hpp>

+ Inheritance diagram for CAlnStats< _TAlnIdVec >:
+ Collaboration diagram for CAlnStats< _TAlnIdVec >:

Public Types

typedef _TAlnIdVec TAlnIdVec
 Container with one entry per seq-align using the same indexing as m_AlnVec. More...
 
typedef _TAlnIdVec::TAlnVec TAlnVec
 Vector of original seq-aligns. More...
 
typedef _TAlnIdVec::TIdVec TIdVec
 Vector of ids used in all alignments. More...
 
typedef vector< size_t > TIdxVec
 Vector of indexes in TIdVec. More...
 
typedef map< TAlnSeqIdIRef, TIdxVec, SAlnSeqIdIRefCompTIdMap
 Each id mapped to a vector of indexes in TIdVec. More...
 
typedef int TDim
 
typedef vector< TDimTRowVec
 Vector, describing how a single id participates in all alignments from TAlnVec. More...
 
typedef vector< TRowVecTRowVecVec
 One entry per id (in sync with TIdVec). More...
 
typedef bm::bvector TBitVec
 Bitmap where each bit indicates an alignment from TAlnVec. More...
 
typedef vector< TBitVecTBitVecVec
 One entry per id (in sync with TIdVec). More...
 
- 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

 CAlnStats (const TAlnIdVec &aln_id_vec)
 Constructor. More...
 
size_t GetAlnCount (void) const
 How many alignments do we have? More...
 
const TAlnVecGetAlnVec (void) const
 Access the underlying vector of alignments. More...
 
TDim GetDimForAln (size_t aln_idx) const
 What is the dimension of an alignment? More...
 
const TIdVecGetSeqIdsForAln (size_t aln_idx) const
 Access the vector of seq-ids of a particular alignment. More...
 
const TIdVecGetSeqIdsForAln (const CSeq_align &aln) const
 Access the vector of seq-ids of a particular alignment. More...
 
const TIdVecGetAlignedIds (const TAlnSeqIdIRef &id) const
 Get a set of ids that are aligned to a particular id. More...
 
const TRowVecVecGetRowVecVec (void) const
 Get vector describing ids usage in each alignment. More...
 
const TIdMapGetIdMap (void) const
 Get map of ids to there indexes in TIdVec. More...
 
const TIdVecGetIdVec (void) const
 Get vector of all ids from all alignments. More...
 
bool IsCanonicalQueryAnchored (void) const
 Canonical Query-Anchored: all alignments have 2 or 3 rows and exactly 2 sequences (A and B), A is present on all alignments on row 1, B on rows 2 (and possibly 3). More...
 
bool IsCanonicalMultiple (void) const
 Canonical Multiple: Single alignment with multiple sequences. More...
 
bool CanBeAnchored (void) const
 Check if there are any ids which can be used as anchors for the whole set of alignments. More...
 
const TIdMapGetAnchorIdMap (void) const
 Get map of potential anchor ids. More...
 
const TIdVecGetAnchorIdVec (void) const
 Get vector of potential anchor ids. More...
 
const TIdxVecGetAnchorIdxVec (void) const
 Get vector of id indexes (from IdVec) for potential anchors. More...
 
- 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
 

Private Types

typedef map< TAlnSeqIdIRef, TIdVecTAlignedIdsMap
 

Private Member Functions

size_t x_AddId (const TAlnSeqIdIRef &id, size_t aln_i, size_t row_i)
 
void x_IdentifyPotentialAnchors (void) const
 

Private Attributes

const TAlnIdVecm_AlnIdVec
 
const TAlnVecm_AlnVec
 
size_t m_AlnCount
 
TIdVec m_IdVec
 
TIdMap m_IdMap
 
TBitVecVec m_BitVecVec
 
TRowVecVec m_RowVecVec
 
TAlignedIdsMap m_AlignedIdsMap
 
TIdxVec m_AnchorIdxVec
 
TIdMap m_AnchorIdMap
 
TIdVec m_AnchorIdVec
 
int m_CanBeAnchored
 

Additional Inherited Members

- 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 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 inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Detailed Description

template<class _TAlnIdVec>
class CAlnStats< _TAlnIdVec >

Helper class which collects seq-align statistics: seq-ids participating in alignments and rows, potential anchors etc.

The class is used to create anchored alignments.

See also
TAlnStats
TScopeAlnStats
CreateAnchoredAlnFromAln
CreateAnchoredAlnVec

Definition at line 56 of file aln_stats.hpp.

Member Typedef Documentation

◆ TAlignedIdsMap

template<class _TAlnIdVec >
typedef map<TAlnSeqIdIRef, TIdVec> CAlnStats< _TAlnIdVec >::TAlignedIdsMap
private

Definition at line 380 of file aln_stats.hpp.

◆ TAlnIdVec

template<class _TAlnIdVec >
typedef _TAlnIdVec CAlnStats< _TAlnIdVec >::TAlnIdVec

Container with one entry per seq-align using the same indexing as m_AlnVec.

Each element is a vector of ids referenced by the seq-align. See CAlnIdMap for an example of the container implementation.

See also
CAlnIdMap

Definition at line 63 of file aln_stats.hpp.

◆ TAlnVec

template<class _TAlnIdVec >
typedef _TAlnIdVec::TAlnVec CAlnStats< _TAlnIdVec >::TAlnVec

Vector of original seq-aligns.

Definition at line 66 of file aln_stats.hpp.

◆ TBitVec

template<class _TAlnIdVec >
typedef bm::bvector CAlnStats< _TAlnIdVec >::TBitVec

Bitmap where each bit indicates an alignment from TAlnVec.

Definition at line 90 of file aln_stats.hpp.

◆ TBitVecVec

template<class _TAlnIdVec >
typedef vector<TBitVec> CAlnStats< _TAlnIdVec >::TBitVecVec

One entry per id (in sync with TIdVec).

Each entry is a bitmap - one bit per alignment, indicating if the id is participating in this alignment.

Definition at line 95 of file aln_stats.hpp.

◆ TDim

template<class _TAlnIdVec >
typedef int CAlnStats< _TAlnIdVec >::TDim

Definition at line 78 of file aln_stats.hpp.

◆ TIdMap

template<class _TAlnIdVec >
typedef map<TAlnSeqIdIRef, TIdxVec, SAlnSeqIdIRefComp> CAlnStats< _TAlnIdVec >::TIdMap

Each id mapped to a vector of indexes in TIdVec.

Definition at line 76 of file aln_stats.hpp.

◆ TIdVec

template<class _TAlnIdVec >
typedef _TAlnIdVec::TIdVec CAlnStats< _TAlnIdVec >::TIdVec

Vector of ids used in all alignments.

Some ids may be included several times in case of self-aligned sequences.

Definition at line 70 of file aln_stats.hpp.

◆ TIdxVec

template<class _TAlnIdVec >
typedef vector<size_t> CAlnStats< _TAlnIdVec >::TIdxVec

Vector of indexes in TIdVec.

Definition at line 73 of file aln_stats.hpp.

◆ TRowVec

template<class _TAlnIdVec >
typedef vector<TDim> CAlnStats< _TAlnIdVec >::TRowVec

Vector, describing how a single id participates in all alignments from TAlnVec.

Each element contains row index for the id or -1 if the id is not present in the alignment.

Definition at line 83 of file aln_stats.hpp.

◆ TRowVecVec

template<class _TAlnIdVec >
typedef vector<TRowVec> CAlnStats< _TAlnIdVec >::TRowVecVec

One entry per id (in sync with TIdVec).

Each entry describes how a single id participates in all alignments (see TRowVec).

Definition at line 87 of file aln_stats.hpp.

Constructor & Destructor Documentation

◆ CAlnStats()

template<class _TAlnIdVec >
CAlnStats< _TAlnIdVec >::CAlnStats ( const TAlnIdVec aln_id_vec)
inline

Member Function Documentation

◆ CanBeAnchored()

template<class _TAlnIdVec >
bool CAlnStats< _TAlnIdVec >::CanBeAnchored ( void  ) const
inline

Check if there are any ids which can be used as anchors for the whole set of alignments.

Definition at line 284 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_CanBeAnchored, and CAlnStats< _TAlnIdVec >::x_IdentifyPotentialAnchors().

Referenced by CAlnSpanVertModel::CAlnSpanVertModel(), operator<<(), and CAlnBuildApp::Run().

◆ GetAlignedIds()

template<class _TAlnIdVec >
const TIdVec& CAlnStats< _TAlnIdVec >::GetAlignedIds ( const TAlnSeqIdIRef id) const
inline

◆ GetAlnCount()

template<class _TAlnIdVec >
size_t CAlnStats< _TAlnIdVec >::GetAlnCount ( void  ) const
inline

◆ GetAlnVec()

template<class _TAlnIdVec >
const TAlnVec& CAlnStats< _TAlnIdVec >::GetAlnVec ( void  ) const
inline

Access the underlying vector of alignments.

Definition at line 152 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_AlnVec.

◆ GetAnchorIdMap()

template<class _TAlnIdVec >
const TIdMap& CAlnStats< _TAlnIdVec >::GetAnchorIdMap ( void  ) const
inline

Get map of potential anchor ids.

NOTE: each is is mapped to vector of indexes in IdVec, not AnchorIdVec.

Definition at line 294 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_AnchorIdMap, CAlnStats< _TAlnIdVec >::m_CanBeAnchored, and CAlnStats< _TAlnIdVec >::x_IdentifyPotentialAnchors().

Referenced by operator<<().

◆ GetAnchorIdVec()

template<class _TAlnIdVec >
const TIdVec& CAlnStats< _TAlnIdVec >::GetAnchorIdVec ( void  ) const
inline

◆ GetAnchorIdxVec()

template<class _TAlnIdVec >
const TIdxVec& CAlnStats< _TAlnIdVec >::GetAnchorIdxVec ( void  ) const
inline

Get vector of id indexes (from IdVec) for potential anchors.

Definition at line 312 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_AnchorIdxVec, CAlnStats< _TAlnIdVec >::m_CanBeAnchored, and CAlnStats< _TAlnIdVec >::x_IdentifyPotentialAnchors().

Referenced by operator<<(), and CAlnBuildApp::Run().

◆ GetDimForAln()

template<class _TAlnIdVec >
TDim CAlnStats< _TAlnIdVec >::GetDimForAln ( size_t  aln_idx) const
inline

What is the dimension of an alignment?

Definition at line 158 of file aln_stats.hpp.

References _ASSERT, CAlnStats< _TAlnIdVec >::GetAlnCount(), CAlnStats< _TAlnIdVec >::m_AlnIdVec, and ncbi::grid::netcache::search::fields::size.

Referenced by operator<<().

◆ GetIdMap()

template<class _TAlnIdVec >
const TIdMap& CAlnStats< _TAlnIdVec >::GetIdMap ( void  ) const
inline

Get map of ids to there indexes in TIdVec.

See also
TIdMap

Definition at line 234 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_IdMap.

Referenced by operator<<().

◆ GetIdVec()

template<class _TAlnIdVec >
const TIdVec& CAlnStats< _TAlnIdVec >::GetIdVec ( void  ) const
inline

Get vector of all ids from all alignments.

See also
TIdVec

Definition at line 241 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_IdVec.

Referenced by operator<<(), CAlnBuildApp::Run(), CAlignCleanup::x_Cleanup_AnchoredAln(), and CMergeAlignmentsJob::x_CreateProjectItems().

◆ GetRowVecVec()

template<class _TAlnIdVec >
const TRowVecVec& CAlnStats< _TAlnIdVec >::GetRowVecVec ( void  ) const
inline

Get vector describing ids usage in each alignment.

See also
TRowVecVec

Definition at line 227 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_RowVecVec.

◆ GetSeqIdsForAln() [1/2]

template<class _TAlnIdVec >
const TIdVec& CAlnStats< _TAlnIdVec >::GetSeqIdsForAln ( const CSeq_align aln) const
inline

Access the vector of seq-ids of a particular alignment.

Definition at line 172 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::m_AlnIdVec.

◆ GetSeqIdsForAln() [2/2]

template<class _TAlnIdVec >
const TIdVec& CAlnStats< _TAlnIdVec >::GetSeqIdsForAln ( size_t  aln_idx) const
inline

Access the vector of seq-ids of a particular alignment.

Definition at line 165 of file aln_stats.hpp.

References _ASSERT, CAlnStats< _TAlnIdVec >::GetAlnCount(), and CAlnStats< _TAlnIdVec >::m_AlnIdVec.

Referenced by operator<<().

◆ IsCanonicalMultiple()

template<class _TAlnIdVec >
bool CAlnStats< _TAlnIdVec >::IsCanonicalMultiple ( void  ) const
inline

Canonical Multiple: Single alignment with multiple sequences.

Definition at line 277 of file aln_stats.hpp.

References CAlnStats< _TAlnIdVec >::GetAlnCount(), and CAlnStats< _TAlnIdVec >::IsCanonicalQueryAnchored().

Referenced by operator<<().

◆ IsCanonicalQueryAnchored()

template<class _TAlnIdVec >
bool CAlnStats< _TAlnIdVec >::IsCanonicalQueryAnchored ( void  ) const
inline

Canonical Query-Anchored: all alignments have 2 or 3 rows and exactly 2 sequences (A and B), A is present on all alignments on row 1, B on rows 2 (and possibly 3).

B can be present on 2 rows only if they represent different strands.

Definition at line 250 of file aln_stats.hpp.

References count, CAlnStats< _TAlnIdVec >::m_AlnCount, CAlnStats< _TAlnIdVec >::m_BitVecVec, and CAlnStats< _TAlnIdVec >::m_IdVec.

Referenced by CAlnStats< _TAlnIdVec >::IsCanonicalMultiple(), and operator<<().

◆ x_AddId()

template<class _TAlnIdVec >
size_t CAlnStats< _TAlnIdVec >::x_AddId ( const TAlnSeqIdIRef id,
size_t  aln_i,
size_t  row_i 
)
inlineprivate

◆ x_IdentifyPotentialAnchors()

template<class _TAlnIdVec >
void CAlnStats< _TAlnIdVec >::x_IdentifyPotentialAnchors ( void  ) const
inlineprivate

Member Data Documentation

◆ m_AlignedIdsMap

template<class _TAlnIdVec >
TAlignedIdsMap CAlnStats< _TAlnIdVec >::m_AlignedIdsMap
mutableprivate

Definition at line 381 of file aln_stats.hpp.

Referenced by CAlnStats< _TAlnIdVec >::GetAlignedIds().

◆ m_AlnCount

template<class _TAlnIdVec >
size_t CAlnStats< _TAlnIdVec >::m_AlnCount
private

◆ m_AlnIdVec

template<class _TAlnIdVec >
const TAlnIdVec& CAlnStats< _TAlnIdVec >::m_AlnIdVec
private

◆ m_AlnVec

template<class _TAlnIdVec >
const TAlnVec& CAlnStats< _TAlnIdVec >::m_AlnVec
private

◆ m_AnchorIdMap

template<class _TAlnIdVec >
TIdMap CAlnStats< _TAlnIdVec >::m_AnchorIdMap
mutableprivate

◆ m_AnchorIdVec

template<class _TAlnIdVec >
TIdVec CAlnStats< _TAlnIdVec >::m_AnchorIdVec
mutableprivate

◆ m_AnchorIdxVec

template<class _TAlnIdVec >
TIdxVec CAlnStats< _TAlnIdVec >::m_AnchorIdxVec
mutableprivate

◆ m_BitVecVec

template<class _TAlnIdVec >
TBitVecVec CAlnStats< _TAlnIdVec >::m_BitVecVec
private

◆ m_CanBeAnchored

template<class _TAlnIdVec >
int CAlnStats< _TAlnIdVec >::m_CanBeAnchored
mutableprivate

◆ m_IdMap

template<class _TAlnIdVec >
TIdMap CAlnStats< _TAlnIdVec >::m_IdMap
private

◆ m_IdVec

template<class _TAlnIdVec >
TIdVec CAlnStats< _TAlnIdVec >::m_IdVec
private

◆ m_RowVecVec

template<class _TAlnIdVec >
TRowVecVec CAlnStats< _TAlnIdVec >::m_RowVecVec
private

The documentation for this class was generated from the following file:
Modified on Fri Sep 20 14:58:01 2024 by modify_doxy.py rev. 669887