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

Search Toolkit Book for CEditScript

Interface for the traceback from blast hits. More...

#include <algo/cobalt/traceback.hpp>

Classes

struct  STracebackOp
 Runlength-encoded representation of a traceback operation. More...
 

Public Member Functions

 CEditScript ()
 Generate empty traceback. More...
 
 CEditScript (GapEditScript *blast_tback)
 Generate traceback from a blast alignment. More...
 
 CEditScript (const objects::CDense_seg &denseg)
 Generate traceback from a Dense_seg. More...
 
 CEditScript (const objects::CDense_diag &dendiag)
 Generate traceback from a Dense_diag. More...
 
 ~CEditScript ()
 Destructor. More...
 
bool Empty ()
 Test whether edit script is empty. More...
 
void ReverseEditScript ()
 Reverse an edit script; insertions become deletions and vice versa. More...
 
CEditScript MakeEditScript (TRange tback_range)
 Return an edit script corresponding to a subset of the complete traceback available. More...
 
void FindOffsetFromSeq2 (TOffsetPair start_offsets, TOffsetPair &new_offsets, TOffset seq2_target, TOffset &new_tback, bool go_past_seq1_gap)
 Given a subject offset, find the corresponding query offset. More...
 
void FindOffsetFromSeq1 (TOffsetPair start_offsets, TOffsetPair &new_offsets, TOffset seq1_target, TOffset &new_tback, bool go_past_seq2_gap)
 Given a query offset, find the corresponding subject offset. More...
 
int GetScore (TRange tback_range, TOffsetPair start_offsets, CSequence &seq1, int **seq2_pssm, int gap_open, int gap_extend)
 Compute the score associated with (a portion of) an alignment Assumes that seq1 is a sequence and that seq2 is a PSSM. More...
 
vector< TOffsetPairListMatchRegions (TOffsetPair start_offsets)
 Compile a list of regions in the current edit script that contain substitutions. More...
 
void VerifyScript (TRange seq1_range, TRange seq2_range)
 Validate that the alignment described by the CEditScript has the same size for each sequence as the input ranges. More...
 

Static Public Member Functions

static CEditScript MakeEditScript (const CNWAligner::TTranscript &tback, TRange tback_range)
 Convert a CNWAligner edit script to a CEditScript. More...
 

Private Types

typedef vector< STracebackOpTScriptOps
 Edit script type. More...
 

Private Member Functions

void AddOps (EGapAlignOpType op_type, int num_ops)
 Add a new edit operation to the current list. More...
 

Private Attributes

TScriptOps m_Script
 The list of edit operations in the current edit script. More...
 

Detailed Description

Interface for the traceback from blast hits.

Definition at line 54 of file traceback.hpp.

Member Typedef Documentation

◆ TScriptOps

typedef vector<STracebackOp> CEditScript::TScriptOps
private

Edit script type.

Definition at line 205 of file traceback.hpp.

Constructor & Destructor Documentation

◆ CEditScript() [1/4]

CEditScript::CEditScript ( )
inline

Generate empty traceback.

Definition at line 59 of file traceback.hpp.

◆ CEditScript() [2/4]

CEditScript::CEditScript ( GapEditScript blast_tback)

Generate traceback from a blast alignment.

Parameters
blast_tbackEdit script for the alignment, computed by the blast engine [in]

Definition at line 68 of file traceback.cpp.

References _ASSERT, AddOps(), i, GapEditScript::num, GapEditScript::op_type, and GapEditScript::size.

◆ CEditScript() [3/4]

CEditScript::CEditScript ( const objects::CDense_seg &  denseg)

Generate traceback from a Dense_seg.

Parameters
densegDense_seg representing a single pairwise alignment [in]

◆ CEditScript() [4/4]

CEditScript::CEditScript ( const objects::CDense_diag &  dendiag)

Generate traceback from a Dense_diag.

Parameters
dendiagDense_diag representing a single ungapped pairwise alignment [in]

◆ ~CEditScript()

CEditScript::~CEditScript ( )
inline

Destructor.

Definition at line 80 of file traceback.hpp.

Member Function Documentation

◆ AddOps()

void CEditScript::AddOps ( EGapAlignOpType  op_type,
int  num_ops 
)
private

Add a new edit operation to the current list.

Parameters
op_typeType of new operation [in]
num_opsThe number of such operations [in]

Definition at line 47 of file traceback.cpp.

References CEditScript::STracebackOp::num_ops, and CEditScript::STracebackOp::op_type.

Referenced by CEditScript(), and MakeEditScript().

◆ Empty()

bool CEditScript::Empty ( )
inline

Test whether edit script is empty.

Returns
true if there are no edit operations in the script

Definition at line 85 of file traceback.hpp.

◆ FindOffsetFromSeq1()

void CEditScript::FindOffsetFromSeq1 ( TOffsetPair  start_offsets,
TOffsetPair new_offsets,
TOffset  seq1_target,
TOffset new_tback,
bool  go_past_seq2_gap 
)

Given a query offset, find the corresponding subject offset.

Parameters
start_offsetsThe sequence offsets corresponding to the start of the edit script [in]
new_offsetsThe offsets into the unaligned sequences where the specified query offset occurs [out]
seq1_targetThe query offset to find [in]
new_tbackThe offset of the traceback operation where where seq1_target was found [out]
go_past_seq2_gapIf seq1_target aligns with a gap in seq2, include the gap if true [in]

Definition at line 270 of file traceback.cpp.

References _ASSERT, eGapAlignDel, eGapAlignSub, and m_Script.

Referenced by CHit::GetRangeFromSeq1().

◆ FindOffsetFromSeq2()

void CEditScript::FindOffsetFromSeq2 ( TOffsetPair  start_offsets,
TOffsetPair new_offsets,
TOffset  seq2_target,
TOffset new_tback,
bool  go_past_seq1_gap 
)

Given a subject offset, find the corresponding query offset.

Parameters
start_offsetsThe sequence offsets corresponding to the start of the edit script [in]
new_offsetsThe offsets into the unaligned sequences where the specified subject offset occurs [out]
seq2_targetThe subject offset to find [in]
new_tbackThe offset of the traceback operation where where seq2_target was found [out]
go_past_seq1_gapIf seq2_target aligns with a gap in seq1, include the gap if true [in]

Definition at line 196 of file traceback.cpp.

References _ASSERT, eGapAlignDel, eGapAlignSub, and m_Script.

Referenced by CHit::GetRangeFromSeq2().

◆ GetScore()

int CEditScript::GetScore ( TRange  tback_range,
TOffsetPair  start_offsets,
CSequence seq1,
int **  seq2_pssm,
int  gap_open,
int  gap_extend 
)

Compute the score associated with (a portion of) an alignment Assumes that seq1 is a sequence and that seq2 is a PSSM.

Parameters
tback_rangeThe starting and ending traceback operation of the sub-alignment to score [in]
start_offsetsThe sequence offsets of the beginning of the region described by the CEditScript [in]
seq1The complete first sequence [in]
seq2_pssmPSSM representing the second sequence [in]
gap_openPenalty for opening a gap [in]
gap_extendPenalty for extending a gap [in]
Returns
The score of the (sub-)alignment given by tback_range

Definition at line 343 of file traceback.cpp.

References _ASSERT, eGapAlignDel, eGapAlignIns, eGapAlignSub, COpenRange< Position >::Empty(), CRange_Base::GetFrom(), CSequence::GetLetter(), CRange_Base::GetTo(), i, m_Script, and min().

Referenced by CHit::ResolveSubHitConflicts(), and CMultiAligner::x_RealignBlocks().

◆ ListMatchRegions()

vector< TOffsetPair > CEditScript::ListMatchRegions ( TOffsetPair  start_offsets)

Compile a list of regions in the current edit script that contain substitutions.

Parameters
start_offsetsThe sequence offsets corresponding to the start of the range described by the CEditScript [in]
Returns
List of regions within the CEditScript that contain substitutions

Definition at line 444 of file traceback.cpp.

References eGapAlignDel, eGapAlignIns, eGapAlignSub, and m_Script.

Referenced by CMultiAligner::x_AssignRPSResFreqs(), and CMultiAligner::x_FindInClusterConstraints().

◆ MakeEditScript() [1/2]

CEditScript CEditScript::MakeEditScript ( const CNWAligner::TTranscript tback,
TRange  tback_range 
)
static

Convert a CNWAligner edit script to a CEditScript.

Parameters
tbackThe edit script generated by CNWAligner [in]
tback_rangeThe portion of the traceback desired. The starting and ending offsets in this range will also be included in the traceback structure returned [in]
Returns
The subset of the traceback

Definition at line 111 of file traceback.cpp.

References _ASSERT, AddOps(), eGapAlignDel, eGapAlignIns, eGapAlignSub, COpenRange< Position >::Empty(), CNWAligner::eTS_Delete, CNWAligner::eTS_Insert, CNWAligner::eTS_Match, CNWAligner::eTS_Replace, CRange_Base::GetFrom(), CRange_Base::GetTo(), and i.

◆ MakeEditScript() [2/2]

CEditScript CEditScript::MakeEditScript ( TRange  tback_range)

Return an edit script corresponding to a subset of the complete traceback available.

Parameters
tback_rangeThe portion of the traceback desired. The starting and ending offsets in this range will also be included in the traceback structure returned [in]
Returns
The subset of the traceback

Definition at line 153 of file traceback.cpp.

References _ASSERT, AddOps(), COpenRange< Position >::Empty(), CRange_Base::GetFrom(), CRange_Base::GetTo(), m_Script, and min().

Referenced by CHit::ResolveSubHitConflicts(), and CMultiAligner::x_RealignBlocks().

◆ ReverseEditScript()

void CEditScript::ReverseEditScript ( )
inline

Reverse an edit script; insertions become deletions and vice versa.

Definition at line 90 of file traceback.hpp.

References eGapAlignDel, eGapAlignIns, and i.

Referenced by CHitList::MakeCanonical().

◆ VerifyScript()

void CEditScript::VerifyScript ( TRange  seq1_range,
TRange  seq2_range 
)

Validate that the alignment described by the CEditScript has the same size for each sequence as the input ranges.

Parameters
seq1_rangeStart/stop offsets of the first sequence [in]
seq2_rangeStart/stop offsets of the second sequence [in]

Definition at line 475 of file traceback.cpp.

References _ASSERT, eGapAlignDel, eGapAlignIns, eGapAlignSub, COpenRange< Position >::GetLength(), i, int, and m_Script.

Referenced by CHit::VerifyHit().

Member Data Documentation

◆ m_Script

TScriptOps CEditScript::m_Script
private

The list of edit operations in the current edit script.

Definition at line 208 of file traceback.hpp.

Referenced by FindOffsetFromSeq1(), FindOffsetFromSeq2(), GetScore(), ListMatchRegions(), MakeEditScript(), and VerifyScript().


The documentation for this class was generated from the following files:
Modified on Wed Apr 24 14:11:58 2024 by modify_doxy.py rev. 669887