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

Function createConsensus

MergePaths/MergeContigs.cpp:176–197  ·  view source on GitHub ↗

Return a consensus sequence of a and b. * @return an empty string if a consensus could not be found */

Source from the content-addressed store, hash-verified

174 * @return an empty string if a consensus could not be found
175 */
176static string
177createConsensus(const Sequence& a, const Sequence& b)
178{
179 assert(a.length() == b.length());
180 if (a == b)
181 return a;
182 string s;
183 s.reserve(a.length());
184 for (string::const_iterator ita = a.begin(), itb = b.begin(); ita != a.end(); ++ita, ++itb) {
185 bool mask = islower(*ita) || islower(*itb);
186 char ca = toupper(*ita), cb = toupper(*itb);
187 char c = ca == cb
188 ? ca
189 : ca == 'N'
190 ? cb
191 : cb == 'N' ? ca : ambiguityIsSubset(ca, cb) ? ambiguityOr(ca, cb) : 'x';
192 if (c == 'x')
193 return string("");
194 s += mask ? tolower(c) : c;
195 }
196 return s;
197}
198
199typedef ContigGraph<DirectedGraph<ContigProperties, Distance>> Graph;
200typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor;

Callers 1

mergeContigsFunction · 0.70

Calls 5

ambiguityIsSubsetFunction · 0.85
ambiguityOrFunction · 0.85
lengthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected