63 if (
a->m_SeqIndex1 <
b->m_SeqIndex1)
65 if (
a->m_SeqIndex1 >
b->m_SeqIndex1)
68 if (
a->m_SeqIndex2 <
b->m_SeqIndex2)
70 if (
a->m_SeqIndex2 >
b->m_SeqIndex2)
73 if (
a->m_SeqRange1.GetFrom() <
b->m_SeqRange1.GetFrom())
75 if (
a->m_SeqRange1.GetFrom() >
b->m_SeqRange1.GetFrom())
78 if (
a->m_SeqRange1.GetTo() <
b->m_SeqRange1.GetTo())
80 if (
a->m_SeqRange1.GetTo() >
b->m_SeqRange1.GetTo())
83 if (
a->m_SeqRange2.GetFrom() <
b->m_SeqRange2.GetFrom())
85 if (
a->m_SeqRange2.GetFrom() >
b->m_SeqRange2.GetFrom())
88 if (
a->m_SeqRange2.GetTo() <
b->m_SeqRange2.GetTo())
90 if (
a->m_SeqRange2.GetTo() >
b->m_SeqRange2.GetTo())
93 return (
a->m_Score <
b->m_Score);
106 for (
int i = 0;
i <
Size();
i++) {
117 CHit *subhit = *subitr;
130 int num_hits =
Size();
131 while(
i < num_hits) {
133 for (j =
i + 1; j < num_hits; j++) {
179 TRange q_range1, q_range2;
216 return (
a.second->m_SeqIndex2 <
b.second->m_SeqIndex2);
223 int num_hits =
Size();
231 for (
int i = 0;
i < num_hits - 1;
i++) {
240 for (
int j =
i + 1; j < num_hits; j++) {
271 if (new_subhit != 0) {
282 subhits.back()->m_SeqRange1.GetTo() !=
284 subhits.back()->m_SeqRange2.GetTo()) {
292 printf(
"collapse query %d %d-%d / %d-%d "
293 "query %d %d-%d %d-%d\n",
295 subhits.back()->m_SeqRange1.GetFrom(),
296 subhits.back()->m_SeqRange1.GetTo(),
300 subhits.back()->m_SeqRange2.GetFrom(),
301 subhits.back()->m_SeqRange2.GetTo(),
306 subhits.back()->m_SeqRange1.SetTo(
308 subhits.back()->m_SeqRange2.SetTo(
310 subhits.back()->m_Score += new_subhit->
m_Score;
344 return (
a.second->m_Score >
b.second->m_Score);
369 if (
a->m_SeqRange1.GetFrom() <
b->m_SeqRange1.GetFrom())
371 if (
a->m_SeqRange1.GetFrom() >
b->m_SeqRange1.GetFrom())
374 return (
a->m_SeqRange2.GetFrom() <
b->m_SeqRange2.GetFrom());
387 for (
int i = 0;
i < hitlist.
Size();
i++) {
Interface for the traceback from blast hits.
void ReverseEditScript()
Reverse an edit script; insertions become deletions and vice versa.
An ordered collection of CHit objects.
void Append(CHitList &hitlist)
Append one hitlist to another.
int Size() const
Retrieve number of hits in list.
void MakeCanonical()
Sort the list in a canonical form: first swap the indices and ranges on all hits and subhits so that ...
void SetKeepHit(int index, bool keep)
Set whether a hit in the hitlist will be scheduled for deletion.
bool Empty()
Determine whether a list contains no hits.
pair< bool, CHit * > TListEntry
add a reminder of whether a hit should be kept
CHit * GetHit(int index)
Retrieve a hit from the hitlist.
void PurgeUnwantedHits()
Delete all hits scheduled to be deleted.
void SortByStartOffset()
Sort the hits in the hitlist by increasing sequence1 index, then by increasing sequence1 start offset...
void SortByScore()
Sort the hits in the hitlist in order of decreasing score.
void MatchOverlappingSubHits(CHitList &matched_list)
For each pair of hits with the same sequence2, produce a list of hits between sequence1 of the first ...
TList m_List
current list of hits
void AddToHitList(CHit *hit)
Append a hit to the hitlist.
A generalized representation of a pairwise alignment.
TSubHit & GetSubHit()
Retrieve a list of subhits.
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.
static const int kMinHitSize
Not always used, but useful to avoid extremely small hits.
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.
callback used to sort hits in order of decreasing score
bool operator()(CHitList::TListEntry const &a, CHitList::TListEntry const &b) const
Compare hits by score.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
position_type GetLength(void) const
TThisType IntersectionWith(const TThisType &r) const
#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.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
static CHit * x_MatchSubHits(CHit *hit1, CHit *hit2)
Given two hits, representing alignments of different sequences A and B to the same common sequence,...
Interface for CHitList class.
constexpr auto sort(_Init &&init)
Callback used to sort hits into canonical order.
bool operator()(CHitList::TListEntry const &aa, CHitList::TListEntry const &bb) const
Sort by seq1 index, then seq2 index, then seq1 range, then seq2 range, then score.
Callback to sort a list of hits in order of increasing sequence 2 index.
bool operator()(CHitList::TListEntry const &a, CHitList::TListEntry const &b) const
Sort two hits by increasing sequence 2 index.
callback used to sort hits in order of increasing sequence offset
bool operator()(CHitList::TListEntry const &aa, CHitList::TListEntry const &bb) const
Compare hits by sequence offset.