67 align1.
GetTo() + (seq2_length - 1 - align2.
GetTo()));
68 second =
min(second, seq1_length - 1);
77 vector<double>& self_score,
82 int num_queries = query_data.size();
83 vector<TRange> seq_ranges(num_queries);
88 for (
int i = 0;
i < num_queries;
i++) {
90 seq_ranges[
i].SetEmpty();
97 for (
int i = 0;
i < hitlist.
Size();
i++) {
101 TRange& range1 = seq_ranges[seq1];
102 TRange& range2 = seq_ranges[seq2];
114 for (
int i = 0;
i < num_queries;
i++) {
133 for (
int j =
range.GetFrom(); j <=
range.GetTo(); j++) {
134 unsigned char c = query_data[
i].GetLetter(j);
135 score += score_matrix.
s[c][c];
137 self_score[
i] = karlin_blk.
Lambda * score - karlin_blk.
logK;
142 printf(
"Self scores:\n");
143 for (
int i = 0;
i < num_queries;
i++) {
144 printf(
"query %d(%d): range %d-%d score %lf\n",
i,
146 seq_ranges[
i].GetFrom(), seq_ranges[
i].GetTo(),
161 int num_queries = query_data.size();
162 vector<double> self_score(num_queries);
167 self_score, karlin_blk);
184 for (
int i = 0;
i < hitlist.
Size();
i++) {
188 double align_score = karlin_blk.
Lambda *
192 m_Matrix(j,k) -= 0.5 * align_score *
193 (1.0 / self_score[j] + 1.0 / self_score[k]);
198 for (
int i = 0;
i < num_queries;
i++) {
200 for (
int j = 0; j <
i; j++) {
int TOffset
Basic data type for offsets into a sequence.
CDistMethods::TMatrix m_Matrix
Current distance matrix.
void x_GetSelfScores(vector< CSequence > &query_data, CHitList &hitlist, SNCBIFullScoreMatrix &score_matrix, vector< double > &self_score, Blast_KarlinBlk &karlin_blk)
Compute the self-scores of the input sequences.
void ComputeMatrix(vector< CSequence > &query_data, CHitList &hitlist, SNCBIFullScoreMatrix &score_matrix, Blast_KarlinBlk &karlin_blk)
Recompute the distance matrix using new parameters.
An ordered collection of CHit objects.
int Size() const
Retrieve number of hits in list.
CHit * GetHit(int index)
Retrieve a hit from the hitlist.
A generalized representation of a pairwise alignment.
int m_Score
Score of alignment.
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.
void Resize(size_t i, size_t j, T val=T())
resize this matrix, filling the empty cells with a known value
void Set(T val)
set all values in the matrix to a known value
static void x_UpdateRanges(TRange &seq1, TRange align1, int seq1_length, TRange align2, int seq2_length)
Update the extent of a sequence that figures into its self score, based upon the sequence ranges of a...
Interface for CDistances class.
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
position_type GetLength(void) const
TThisType & Set(position_type from, position_type to)
#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.
range(_Ty, _Ty) -> range< _Ty >
Structure to hold the Karlin-Altschul parameters.
double Lambda
Lambda value used in statistics.
double logK
natural log of K value used in statistics