Difference between revisions of "830 - MaqIndex::BuildIndex()"

From Genome Analysis Wiki
Jump to navigationJump to search
(Created page with "<source lang="cpp"> void MaqIndex::BuildIndex() { // This function could use quite a lot of memory ... // 4 bytes per word // 4 bytes per position // 4 bytes per ...")
 
(No difference)

Latest revision as of 13:38, 28 October 2013

void MaqIndex::BuildIndex()
{
	// This function could use quite a lot of memory ...
	//    4 bytes per word
	//    4 bytes per position
	//    4 bytes per word in the word index

	bases = 0;
	for (unsigned int i = 0; i < mask.Length(); i++)
		if (mask[i] == '1')
			bases++;

	unsigned int indexSize = 0;
	for (unsigned int i = 0; i < reference.Length(); i++)
		if (GetReferenceWord(i) != -1)
			indexSize++;

	sortedPositions.PreAllocate(indexSize);
	for (unsigned int i = 0; i < reference.Length(); i++)
		if (GetReferenceWord(i) != -1)
			sortedPositions.Push(i);

	SortIndex();
}