NCBI C++ ToolKit
|
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< TOffsetPair > | ListMatchRegions (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< STracebackOp > | TScriptOps |
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... | |
Interface for the traceback from blast hits.
Definition at line 54 of file traceback.hpp.
|
private |
Edit script type.
Definition at line 205 of file traceback.hpp.
|
inline |
Generate empty traceback.
Definition at line 59 of file traceback.hpp.
CEditScript::CEditScript | ( | GapEditScript * | blast_tback | ) |
Generate traceback from a blast alignment.
blast_tback | Edit 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::CEditScript | ( | const objects::CDense_seg & | denseg | ) |
Generate traceback from a Dense_seg.
denseg | Dense_seg representing a single pairwise alignment [in] |
CEditScript::CEditScript | ( | const objects::CDense_diag & | dendiag | ) |
Generate traceback from a Dense_diag.
dendiag | Dense_diag representing a single ungapped pairwise alignment [in] |
|
inline |
Destructor.
Definition at line 80 of file traceback.hpp.
|
private |
Add a new edit operation to the current list.
op_type | Type of new operation [in] |
num_ops | The 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().
|
inline |
Test whether edit script is empty.
Definition at line 85 of file traceback.hpp.
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.
start_offsets | The sequence offsets corresponding to the start of the edit script [in] |
new_offsets | The offsets into the unaligned sequences where the specified query offset occurs [out] |
seq1_target | The query offset to find [in] |
new_tback | The offset of the traceback operation where where seq1_target was found [out] |
go_past_seq2_gap | If 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().
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.
start_offsets | The sequence offsets corresponding to the start of the edit script [in] |
new_offsets | The offsets into the unaligned sequences where the specified subject offset occurs [out] |
seq2_target | The subject offset to find [in] |
new_tback | The offset of the traceback operation where where seq2_target was found [out] |
go_past_seq1_gap | If 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().
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.
tback_range | The starting and ending traceback operation of the sub-alignment to score [in] |
start_offsets | The sequence offsets of the beginning of the region described by the CEditScript [in] |
seq1 | The complete first sequence [in] |
seq2_pssm | PSSM representing the second sequence [in] |
gap_open | Penalty for opening a gap [in] |
gap_extend | Penalty for extending a gap [in] |
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().
vector< TOffsetPair > CEditScript::ListMatchRegions | ( | TOffsetPair | start_offsets | ) |
Compile a list of regions in the current edit script that contain substitutions.
start_offsets | The sequence offsets corresponding to the start of the range described by the CEditScript [in] |
Definition at line 444 of file traceback.cpp.
References eGapAlignDel, eGapAlignIns, eGapAlignSub, and m_Script.
Referenced by CMultiAligner::x_AssignRPSResFreqs(), and CMultiAligner::x_FindInClusterConstraints().
|
static |
Convert a CNWAligner edit script to a CEditScript.
tback | The edit script generated by CNWAligner [in] |
tback_range | The portion of the traceback desired. The starting and ending offsets in this range will also be included in the traceback structure returned [in] |
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.
CEditScript CEditScript::MakeEditScript | ( | TRange | tback_range | ) |
Return an edit script corresponding to a subset of the complete traceback available.
tback_range | The portion of the traceback desired. The starting and ending offsets in this range will also be included in the traceback structure returned [in] |
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().
|
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().
Validate that the alignment described by the CEditScript has the same size for each sequence as the input ranges.
seq1_range | Start/stop offsets of the first sequence [in] |
seq2_range | Start/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().
|
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().