NCBI C++ ToolKit
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members

Represents ASN.1 type Hit defined in file blastxml.asn

Search Toolkit Book for CHit

A generalized representation of a pairwise alignment. More...

#include <algo/cobalt/hit.hpp>

+ Inheritance diagram for CHit:
+ Collaboration diagram for CHit:

Public Types

typedef vector< CHit * > TSubHit
 Hits can be grouped hierarchically. More...
 
- Public Types inherited from CHit_Base
enum class  E_memberIndex {
  e__allMandatory = 0 , e_num , e_id , e_def ,
  e_accession , e_len , e_hsps , e__allMandatory = 0 ,
  e_num , e_description , e_len , e_hsps
}
 
enum class  E_memberIndex {
  e__allMandatory = 0 , e_num , e_id , e_def ,
  e_accession , e_len , e_hsps , e__allMandatory = 0 ,
  e_num , e_description , e_len , e_hsps
}
 
typedef int TNum
 
typedef string TId
 
typedef string TDef
 
typedef string TAccession
 
typedef int TLen
 
typedef list< CRef< CHsp > > THsps
 
typedef Tparent::CMemberIndex< E_memberIndex, 7 > TmemberIndex
 
typedef int TNum
 
typedef list< CRef< CHitDescr > > TDescription
 
typedef int TLen
 
typedef list< CRef< CHsp > > THsps
 
typedef Tparent::CMemberIndex< E_memberIndex, 5 > TmemberIndex
 
- 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

 CHit (int seq1_index, int seq2_index)
 Create an empty alignment. More...
 
 CHit (int seq1_index, int seq2_index, BlastHSP *hsp)
 Create an alignment from a BLAST hit. More...
 
 CHit (int seq1_index, int seq2_index, int score, const objects::CDense_seg &denseg)
 Create an alignment from a Dense_seg. More...
 
 CHit (int seq1_index, int seq2_index, int score, const objects::CDense_diag &dendiag)
 Create an alignment from a Dense_diag. More...
 
 CHit (int seq1_index, int seq2_index, TRange seq_range1, TRange seq_range2, int score, CEditScript edit_script)
 Create an alignment with all specified parameters. More...
 
 ~CHit ()
 Destructor. More...
 
void InsertSubHit (CHit *hit)
 Add a to a CHit's list of subhits. More...
 
TSubHitGetSubHit ()
 Retrieve a list of subhits. More...
 
CEditScriptGetEditScript ()
 Retrieve the traceback associated with a CHit. More...
 
bool HasSubHits ()
 Query if a CHit has a hierarchy of subhits available. More...
 
void AddUpSubHits ()
 Sum the score of all subhits, and make the sequence ranges the union of the ranges of all subhits. More...
 
CHitClone ()
 Produce an independent copy of a CHit. More...
 
void GetRangeFromSeq2 (TRange seq_range2, TRange &seq_range1, TRange &new_seq_range2, TRange &traceback_range)
 Retrieve the seq1 range corresponding to a specified seq2 range. More...
 
void GetRangeFromSeq1 (TRange seq_range1, TRange &new_seq_range1, TRange &seq_range2, TRange &traceback_range)
 Retrieve the seq2 range corresponding to a specified seq1 range. More...
 
void VerifyHit ()
 Perform basic integrity checks on a CHit. More...
 
void ResolveSubHitConflicts (CSequence &seq1, int **seq2_pssm, CNWAligner::TScore gap_open, CNWAligner::TScore gap_extend)
 If pairs of subhits have overlapping ranges, either delete one or change one so that the overlap is avoided. More...
 
 CHit (void)
 
 ~CHit (void)
 
 CHit (void)
 
 ~CHit (void)
 
- Public Member Functions inherited from CHit_Base
 CHit_Base (void)
 
virtual ~CHit_Base (void)
 
 DECLARE_INTERNAL_TYPE_INFO ()
 
bool IsSetNum (void) const
 hit number Check if a value has been assigned to Num data member. More...
 
bool CanGetNum (void) const
 Check if it is safe to call GetNum method. More...
 
void ResetNum (void)
 Reset Num data member. More...
 
TNum GetNum (void) const
 Get the Num member data. More...
 
void SetNum (TNum value)
 Assign a value to Num data member. More...
 
TNumSetNum (void)
 Assign a value to Num data member. More...
 
bool IsSetId (void) const
 SeqId of subject Check if a value has been assigned to Id data member. More...
 
bool CanGetId (void) const
 Check if it is safe to call GetId method. More...
 
void ResetId (void)
 Reset Id data member. More...
 
const TIdGetId (void) const
 Get the Id member data. More...
 
void SetId (const TId &value)
 Assign a value to Id data member. More...
 
void SetId (TId &&value)
 
TIdSetId (void)
 Assign a value to Id data member. More...
 
bool IsSetDef (void) const
 definition line of subject Check if a value has been assigned to Def data member. More...
 
bool CanGetDef (void) const
 Check if it is safe to call GetDef method. More...
 
void ResetDef (void)
 Reset Def data member. More...
 
const TDefGetDef (void) const
 Get the Def member data. More...
 
void SetDef (const TDef &value)
 Assign a value to Def data member. More...
 
void SetDef (TDef &&value)
 
TDefSetDef (void)
 Assign a value to Def data member. More...
 
bool IsSetAccession (void) const
 accession Check if a value has been assigned to Accession data member. More...
 
bool CanGetAccession (void) const
 Check if it is safe to call GetAccession method. More...
 
void ResetAccession (void)
 Reset Accession data member. More...
 
const TAccessionGetAccession (void) const
 Get the Accession member data. More...
 
void SetAccession (const TAccession &value)
 Assign a value to Accession data member. More...
 
void SetAccession (TAccession &&value)
 
TAccessionSetAccession (void)
 Assign a value to Accession data member. More...
 
bool IsSetLen (void) const
 length of subject Check if a value has been assigned to Len data member. More...
 
bool CanGetLen (void) const
 Check if it is safe to call GetLen method. More...
 
void ResetLen (void)
 Reset Len data member. More...
 
TLen GetLen (void) const
 Get the Len member data. More...
 
void SetLen (TLen value)
 Assign a value to Len data member. More...
 
TLenSetLen (void)
 Assign a value to Len data member. More...
 
bool IsSetHsps (void) const
 all HSP regions for the given subject Check if a value has been assigned to Hsps data member. More...
 
bool CanGetHsps (void) const
 Check if it is safe to call GetHsps method. More...
 
void ResetHsps (void)
 Reset Hsps data member. More...
 
const THspsGetHsps (void) const
 Get the Hsps member data. More...
 
THspsSetHsps (void)
 Assign a value to Hsps data member. More...
 
virtual void Reset (void)
 Reset the whole object. More...
 
 CHit_Base (void)
 
virtual ~CHit_Base (void)
 
 DECLARE_INTERNAL_TYPE_INFO ()
 
bool IsSetNum (void) const
 hit number Check if a value has been assigned to Num data member. More...
 
bool CanGetNum (void) const
 Check if it is safe to call GetNum method. More...
 
void ResetNum (void)
 Reset Num data member. More...
 
TNum GetNum (void) const
 Get the Num member data. More...
 
void SetNum (TNum value)
 Assign a value to Num data member. More...
 
TNumSetNum (void)
 Assign a value to Num data member. More...
 
bool IsSetDescription (void) const
 ID, title, and taxonomy for each entry in the PIG Check if a value has been assigned to Description data member. More...
 
bool CanGetDescription (void) const
 Check if it is safe to call GetDescription method. More...
 
void ResetDescription (void)
 Reset Description data member. More...
 
const TDescriptionGetDescription (void) const
 Get the Description member data. More...
 
TDescriptionSetDescription (void)
 Assign a value to Description data member. More...
 
bool IsSetLen (void) const
 length of subject Check if a value has been assigned to Len data member. More...
 
bool CanGetLen (void) const
 Check if it is safe to call GetLen method. More...
 
void ResetLen (void)
 Reset Len data member. More...
 
TLen GetLen (void) const
 Get the Len member data. More...
 
void SetLen (TLen value)
 Assign a value to Len data member. More...
 
TLenSetLen (void)
 Assign a value to Len data member. More...
 
bool IsSetHsps (void) const
 all HSP regions for the given subject Check if a value has been assigned to Hsps data member. More...
 
bool CanGetHsps (void) const
 Check if it is safe to call GetHsps method. More...
 
void ResetHsps (void)
 Reset Hsps data member. More...
 
const THspsGetHsps (void) const
 Get the Hsps member data. More...
 
THspsSetHsps (void)
 Assign a value to Hsps data member. More...
 
virtual void Reset (void)
 Reset the whole object. More...
 
- Public Member Functions inherited from CSerialObject
 CSerialObject (void)
 
virtual ~CSerialObject (void)
 
virtual const CTypeInfoGetThisTypeInfo (void) const =0
 
virtual void Assign (const CSerialObject &source, ESerialRecursionMode how=eRecursive)
 Set object to copy of another one. More...
 
virtual bool Equals (const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
 Check if both objects contain the same values. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
void ThrowUnassigned (TMemberIndex index) const
 
void ThrowUnassigned (TMemberIndex index, const char *file_name, int file_line) const
 
bool HasNamespaceName (void) const
 Check if object data type has namespace name. More...
 
const stringGetNamespaceName (void) const
 Get namespace name. More...
 
bool HasNamespacePrefix (void) const
 Check if data type has namespace prefix. More...
 
const stringGetNamespacePrefix (void) const
 Get namespace prefix. 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...
 
- 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
 

Public Attributes

int m_SeqIndex1
 Numerical identifier for first sequence in alignment. More...
 
int m_SeqIndex2
 Numerical identifier for second sequence in alignment. More...
 
int m_Score
 Score of alignment. More...
 
TRange m_SeqRange1
 The range of offsets on the first sequence. More...
 
TRange m_SeqRange2
 The range of offsets on the second sequence. More...
 

Static Public Attributes

static const int kMinHitSize = 2
 Not always used, but useful to avoid extremely small hits. More...
 
- Static Public Attributes inherited from CSerialObject
static const char * ms_UnassignedStr = "<*unassigned*>"
 
static const char ms_UnassignedByte = char(0xcd)
 
- 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...
 

Private Types

typedef CHit_Base Tparent
 
typedef CHit_Base Tparent
 

Private Member Functions

 CHit (const CHit &value)
 
CHitoperator= (const CHit &value)
 
 CHit (const CHit &value)
 
CHitoperator= (const CHit &value)
 

Private Attributes

CEditScript m_EditScript
 Traceback for this alignment. More...
 
vector< CHit * > m_SubHit
 Subhits for this alignment. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CSerialObject
static void SetVerifyDataThread (ESerialVerifyData verify)
 
static void SetVerifyDataGlobal (ESerialVerifyData verify)
 
static string UnassignedString (void)
 
static CStringUTF8 UnassignedStringUTF8 (void)
 
static char UnassignedByte (void)
 
- 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)
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Detailed Description

A generalized representation of a pairwise alignment.

CHit –.

Definition at line 85 of file hit.hpp.

Member Typedef Documentation

◆ TSubHit

typedef vector<CHit *> CHit::TSubHit

Hits can be grouped hierarchically.

Definition at line 93 of file hit.hpp.

Constructor & Destructor Documentation

◆ CHit() [1/5]

CHit::CHit ( int  seq1_index,
int  seq2_index 
)
inline

Create an empty alignment.

Parameters
seq1_indexNumerical identifier for first sequence [in]
seq2_indexNumerical identifier for second sequence [in]

Definition at line 116 of file hit.hpp.

◆ CHit() [2/5]

CHit::CHit ( int  seq1_index,
int  seq2_index,
BlastHSP hsp 
)
inline

Create an alignment from a BLAST hit.

Parameters
seq1_indexNumerical identifier for first sequence [in]
seq2_indexNumerical identifier for second sequence [in]
hspA single pairwise alignment from a blast hit [in]

Definition at line 125 of file hit.hpp.

◆ CHit() [3/5]

CHit::CHit ( int  seq1_index,
int  seq2_index,
int  score,
const objects::CDense_seg &  denseg 
)

Create an alignment from a Dense_seg.

Parameters
seq1_indexNumerical identifier for first sequence [in]
seq2_indexNumerical identifier for second sequence [in]
scoreThe score of the pairwise alignment [in]
densegDense_seg representing a single pairwise alignment from a blast hit [in]

◆ CHit() [4/5]

CHit::CHit ( int  seq1_index,
int  seq2_index,
int  score,
const objects::CDense_diag &  dendiag 
)

Create an alignment from a Dense_diag.

Parameters
seq1_indexNumerical identifier for first sequence [in]
seq2_indexNumerical identifier for second sequence [in]
scoreThe score of the pairwise alignment [in]
dendiagDense_seg representing a single ungapped pairwise alignment from a blast hit [in]

◆ CHit() [5/5]

CHit::CHit ( int  seq1_index,
int  seq2_index,
TRange  seq_range1,
TRange  seq_range2,
int  score,
CEditScript  edit_script 
)
inline

Create an alignment with all specified parameters.

Parameters
seq1_indexNumerical identifier for first sequence [in]
seq2_indexNumerical identifier for second sequence [in]
seq_range1Offsets on the first sequence [in]
seq_range2Offsets on the second sequence [in]
scoreThe score of the alignment [in]
edit_scriptTraceback for the alignment (may be empty) [in]

Definition at line 160 of file hit.hpp.

◆ ~CHit()

BEGIN_blastxml2_SCOPE CHit::~CHit ( void  )
inline

Destructor.

Definition at line 170 of file hit.hpp.

References i, and int.

Member Function Documentation

◆ AddUpSubHits()

void CHit::AddUpSubHits ( )

Sum the score of all subhits, and make the sequence ranges the union of the ranges of all subhits.

Traceback is ignored

Definition at line 87 of file hit.cpp.

References _ASSERT, COpenRange< Position >::CombineWith(), HasSubHits(), i, int, m_Score, m_SeqRange1, m_SeqRange2, and m_SubHit.

Referenced by CHitList::MatchOverlappingSubHits(), and CMultiAligner::x_RealignBlocks().

◆ Clone()

CHit * CHit::Clone ( )

Produce an independent copy of a CHit.

Returns
Pointer to the copy

Definition at line 378 of file hit.cpp.

References CHit(), GetSubHit(), HasSubHits(), InsertSubHit(), m_EditScript, m_Score, m_SeqIndex1, m_SeqIndex2, m_SeqRange1, m_SeqRange2, and NON_CONST_ITERATE.

◆ GetEditScript()

CEditScript& CHit::GetEditScript ( )
inline

Retrieve the traceback associated with a CHit.

Returns
The traceback

Definition at line 190 of file hit.hpp.

Referenced by CHitList::MakeCanonical(), ResolveSubHitConflicts(), CMultiAligner::x_AssignRPSResFreqs(), CMultiAligner::x_FindInClusterConstraints(), and CMultiAligner::x_RealignBlocks().

◆ GetRangeFromSeq1()

void CHit::GetRangeFromSeq1 ( TRange  seq_range1,
TRange new_seq_range1,
TRange seq_range2,
TRange traceback_range 
)

Retrieve the seq2 range corresponding to a specified seq1 range.

Assumes traceback is valid

Parameters
seq_range1The target range on the first sequence [in]
new_seq_range1If seq_range1 starts or ends in a gap on seq_range2, the range is shortened to exclude the gap and seq_range1 is cropped to compensate [out]
seq_range2The corresponding range on the second sequence [out]
traceback_rangeThe range of traceback operations corresponding to seq_range1 and new_seq_range2 [out]

Definition at line 145 of file hit.cpp.

References _ASSERT, CLocalRange< Position >::Contains(), CEditScript::FindOffsetFromSeq1(), CRange_Base::GetFrom(), CRange_Base::GetTo(), m_EditScript, m_SeqRange1, m_SeqRange2, CRange_Base::SetFrom(), and CRange_Base::SetTo().

Referenced by ResolveSubHitConflicts().

◆ GetRangeFromSeq2()

void CHit::GetRangeFromSeq2 ( TRange  seq_range2,
TRange seq_range1,
TRange new_seq_range2,
TRange traceback_range 
)

Retrieve the seq1 range corresponding to a specified seq2 range.

Assumes traceback is valid

Parameters
seq_range2The target range on the second sequence [in]
seq_range1The corresponding range on the first sequence [out]
new_seq_range2If seq_range2 starts or ends in a gap on seq_range1, the range is shortened to exclude the gap and seq_range2 is cropped to compensate [out]
traceback_rangeThe range of traceback operations corresponding to seq_range1 and new_seq_range2 [out]

Definition at line 109 of file hit.cpp.

References _ASSERT, CLocalRange< Position >::Contains(), CEditScript::FindOffsetFromSeq2(), CRange_Base::GetFrom(), CRange_Base::GetTo(), m_EditScript, m_SeqRange1, m_SeqRange2, CRange_Base::SetFrom(), and CRange_Base::SetTo().

Referenced by x_MatchSubHits(), and CMultiAligner::x_RealignBlocks().

◆ GetSubHit()

TSubHit& CHit::GetSubHit ( )
inline

◆ HasSubHits()

bool CHit::HasSubHits ( )
inline

◆ InsertSubHit()

void CHit::InsertSubHit ( CHit hit)
inline

Add a to a CHit's list of subhits.

Parameters
hitThe hit to add [in]

Definition at line 180 of file hit.hpp.

Referenced by Clone(), CHitList::MatchOverlappingSubHits(), CMultiAligner::x_FindConstraints(), and CMultiAligner::x_RealignBlocks().

◆ ResolveSubHitConflicts()

void CHit::ResolveSubHitConflicts ( CSequence seq1,
int **  seq2_pssm,
CNWAligner::TScore  gap_open,
CNWAligner::TScore  gap_extend 
)

If pairs of subhits have overlapping ranges, either delete one or change one so that the overlap is avoided.

Only the sequence 1 range is checked for overlap; in practice, the hits refer to block alignments derived from RPS blast results, and sequence 2 is an RPS database sequence. It is sequence 1 that matters for later processing

Parameters
seq1The sequence data corresponding to the first sequence [in]
seq2_pssmThe PSSM for the second sequence [in]
gap_openPenalty for opening a gap [in]
gap_extendPenalty for extending a gap [in]

Definition at line 285 of file hit.cpp.

References CHit(), GetEditScript(), CRange_Base::GetFrom(), GetRangeFromSeq1(), CEditScript::GetScore(), CRange_Base::GetTo(), i, m_Score, m_SeqIndex1, m_SeqIndex2, m_SeqRange1, m_SeqRange2, m_SubHit, CEditScript::MakeEditScript(), CLocalRange< Position >::StrictlyBelow(), and x_RemoveEnvelopedSubHits().

Referenced by CMultiAligner::x_RealignBlocks().

◆ VerifyHit()

void CHit::VerifyHit ( )

Perform basic integrity checks on a CHit.

Definition at line 180 of file hit.cpp.

References _ASSERT, COpenRange< Position >::Empty(), m_EditScript, m_SeqRange1, m_SeqRange2, and CEditScript::VerifyScript().

Member Data Documentation

◆ kMinHitSize

const int CHit::kMinHitSize = 2
static

Not always used, but useful to avoid extremely small hits.

Definition at line 90 of file hit.hpp.

Referenced by CMultiAligner::x_MakeFillerBlocks(), x_MatchSubHits(), and CMultiAligner::x_RealignBlocks().

◆ m_EditScript

CEditScript CHit::m_EditScript
private

Traceback for this alignment.

Definition at line 267 of file hit.hpp.

Referenced by Clone(), GetRangeFromSeq1(), GetRangeFromSeq2(), and VerifyHit().

◆ m_Score

int CHit::m_Score

◆ m_SeqIndex1

int CHit::m_SeqIndex1

◆ m_SeqIndex2

int CHit::m_SeqIndex2

◆ m_SeqRange1

TRange CHit::m_SeqRange1

◆ m_SeqRange2

TRange CHit::m_SeqRange2

◆ m_SubHit

vector<CHit *> CHit::m_SubHit
private

Subhits for this alignment.

Definition at line 268 of file hit.hpp.

Referenced by AddUpSubHits(), and ResolveSubHitConflicts().


The documentation for this class was generated from the following files:
Modified on Thu Apr 25 08:18:11 2024 by modify_doxy.py rev. 669887