MCPcopy Create free account
hub / github.com/BirolLab/abyss / countMatches

Function countMatches

Align/dialign.cpp:164–189  ·  view source on GitHub ↗

Return the minimum number of matches. */

Source from the content-addressed store, hash-verified

162
163/** Return the minimum number of matches. */
164static unsigned countMatches(const alignment& o,
165 const string& consensus)
166{
167 unsigned minMatches = consensus.size();
168 const seq_col& scol = *o.scol;
169 vector<int> proc(scol.length, 0);
170 algn_pos **ap = o.algn;
171 for (int s = 0; s < scol.length; s++) {
172 unsigned matches = 0;
173 const seq& sq = scol.seqs[s];
174 for (int j = 0; j < o.max_pos; j++) {
175 if (proc[s] < sq.length) {
176 const algn_pos& ap1 = *find_eqc(ap, s, proc[s]);
177 assert(j <= *ap1.eqcAlgnPos);
178 if (*ap1.eqcAlgnPos == j) {
179 char c = sq.data[proc[s]];
180 if (toupper(c) == toupper(consensus[j]))
181 matches++;
182 proc[s]++;
183 }
184 }
185 }
186 minMatches = min(minMatches, matches);
187 }
188 return minMatches;
189}
190
191static struct seq_col* read_seqs(const vector<string>& amb_seqs)
192{

Callers 1

dialignFunction · 0.85

Calls 2

find_eqcFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected