48 CHit::
CHit(
int seq1_index,
int seq2_index,
int score,
50 : m_SeqIndex1(seq1_index), m_SeqIndex2(seq2_index),
51 m_Score(score), m_EditScript(denseg)
58 int len1 = 0, len2 = 0;
63 if (starts[2*
i+1] >= 0)
66 m_SeqRange1 =
TRange(starts[0], starts[0] + len1 - 1);
67 m_SeqRange2 =
TRange(starts[1], starts[1] + len2 - 1);
72 CHit::CHit(
int seq1_index,
int seq2_index,
int score,
74 : m_SeqIndex1(seq1_index), m_SeqIndex2(seq2_index),
75 m_Score(score), m_EditScript(dendiag)
81 m_SeqRange1 =
TRange(starts[0], starts[0] +
len - 1);
82 m_SeqRange2 =
TRange(starts[1], starts[1] +
len - 1);
124 target_off = seq_range2.
GetFrom();
128 seq_range1.
SetFrom(new_off.first);
129 new_seq_range2.
SetFrom(new_off.second);
130 tback_range.
SetFrom(new_tback);
134 target_off = seq_range2.
GetTo();
138 seq_range1.
SetTo(new_off.first);
139 new_seq_range2.
SetTo(new_off.second);
140 tback_range.
SetTo(new_tback);
160 target_off = seq_range1.
GetFrom();
164 new_seq_range1.
SetFrom(new_off.first);
165 seq_range2.
SetFrom(new_off.second);
166 tback_range.
SetFrom(new_tback);
170 target_off = seq_range1.
GetTo();
174 new_seq_range1.
SetTo(new_off.first);
175 seq_range2.
SetTo(new_off.second);
176 tback_range.
SetTo(new_tback);
204 if (
a->m_SeqRange1.GetFrom() <
b->m_SeqRange1.GetFrom())
206 if (
a->m_SeqRange1.GetFrom() >
b->m_SeqRange1.GetFrom())
209 return (
a->m_SeqRange1.GetTo() <
b->m_SeqRange1.GetTo());
226 int num_subhits = subhits.size();
228 for (
int i = 0;
i < num_subhits - 1;
i++) {
232 CHit *hit1 = subhits[
i];
238 for (
int j =
i + 1; j < num_subhits; j++) {
242 CHit *hit2 = subhits[j];
261 delete subhits[j]; subhits[j] = 0;
265 delete subhits[
i]; subhits[
i] = 0;
275 for (
int i = 0;
i < num_subhits;
i++) {
277 subhits[j++] = subhits[
i];
302 for (
int i = 0;
i < num_subhits - 1;
i++) {
324 new_s_range1, tback_range1);
329 seq1, seq2_pssm, gap_open, gap_extend);
337 new_s_range2, tback_range2);
342 seq1, seq2_pssm, gap_open, gap_extend);
347 printf(
"hit1: qoff %d-%d dboff %d-%d score %d ",
351 printf(
" vs hsp2: %d-%d %d-%d score %d ",
363 new_q_range2, new_s_range2, score2,
369 new_q_range1, new_s_range1, score1,
Interface for CHit class, used to encapsulate operations involving pairwise alignments.
int TOffset
Basic data type for offsets into a sequence.
CLocalRange< TOffset > TRange
define for the fundamental building block of sequence ranges
pair< TOffset, TOffset > TOffsetPair
Basic type specifying a range on a sequence.
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 i...
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 tha...
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.
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.
CEditScript MakeEditScript(TRange tback_range)
Return an edit script corresponding to a subset of the complete traceback available.
A generalized representation of a pairwise alignment.
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.
TSubHit & GetSubHit()
Retrieve a list of subhits.
vector< CHit * > m_SubHit
Subhits for this alignment.
void VerifyHit()
Perform basic integrity checks on a CHit.
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 a...
CEditScript m_EditScript
Traceback for this alignment.
CHit * Clone()
Produce an independent copy of a CHit.
void InsertSubHit(CHit *hit)
Add a to a CHit's list of subhits.
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.
void AddUpSubHits()
Sum the score of all subhits, and make the sequence ranges the union of the ranges of all subhits.
int m_Score
Score of alignment.
CEditScript & GetEditScript()
Retrieve the traceback associated with a CHit.
int m_SeqIndex1
Numerical identifier for first sequence in alignment.
int m_SeqIndex2
Numerical identifier for second sequence in alignment.
TRange m_SeqRange1
The range of offsets on the first sequence.
TRange m_SeqRange2
The range of offsets on the second sequence.
bool HasSubHits()
Query if a CHit has a hierarchy of subhits available.
vector< CHit * > TSubHit
Hits can be grouped hierarchically.
bool StrictlyBelow(const TThisType &r)
Test whether 'this' represents a sequence range strictly less than a given sequence range.
bool Contains(const TThisType &r)
Test whether 'this' completely envelops a given sequence range.
Class for representing protein sequences.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
TThisType & CombineWith(const TThisType &r)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
void SetTo(TTo value)
Assign a value to To data member.
TLen GetLen(void) const
Get the Len member data.
vector< TSignedSeqPos > TStarts
vector< TSeqPos > TStarts
TDim GetDim(void) const
Get the Dim member data.
const TStarts & GetStarts(void) const
Get the Starts member data.
unsigned int
A callback function used to compare two keys in a database.
static void x_RemoveEnvelopedSubHits(CHit::TSubHit &subhits)
Delete any hits from a list that are contained within higher-scoring hits.
constexpr auto sort(_Init &&init)
callback used for sorting HSP lists
bool operator()(CHit *const &a, CHit *const &b) const
functor that implements hit comparison