830 - BestAlignment::EvaluateAlignment() (detailed comparison)

From Genome Analysis Wiki
Revision as of 13:47, 28 October 2013 by Goncalo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
void BestAlignment::EvaluateAlignment(String & reference, FastQ & read, unsigned int pos, bool fwd)
{
	if (pos < 0 || read.Length() + pos > reference.Length())
		return;

	if (!isNewPosition(pos))
		return;

	int iMismatches = 0;
	int iSumQ = 0;

	for (unsigned int i = 0; i < read.Length(); i++)
		if (reference[pos + i] <= 0 || read[i] <= 0 || read[i] != reference[pos + i])
		{
			iMismatches++;
			iSumQ += read.quality[i];
		}

	if (sumQ > iSumQ)
	{
		position = pos;
		sumQ = iSumQ;
		mismatches = iMismatches;
		forward = fwd;
	}

	mapQdenominator += pow(10.0, -0.1 * iSumQ);
}