|
libStatGen Software
1
|
Class that tracks the composition of base by read location. More...
#include <BaseComposition.h>
Public Member Functions | |
| BaseComposition () | |
| Constructor. | |
| bool | updateComposition (unsigned int rawSequenceCharIndex, char baseChar) |
| Update the composition for the specified index with the specified character. | |
| BaseAsciiMap::SPACE_TYPE | getSpaceType () |
| Get the space type for this composition. | |
| void | resetBaseMapType () |
| Reset the base map type for this composition. | |
| void | setBaseMapType (BaseAsciiMap::SPACE_TYPE spaceType) |
| Set the base map type for this composition. | |
| void | print () |
| Print the composition. | |
| void | clear () |
| Clear the composition stored in the base count vector. | |
Class that tracks the composition of base by read location.
Definition at line 27 of file BaseComposition.h.
| bool BaseComposition::updateComposition | ( | unsigned int | rawSequenceCharIndex, |
| char | baseChar | ||
| ) |
Update the composition for the specified index with the specified character.
Definition at line 32 of file BaseComposition.cpp.
References BaseAsciiMap::getBaseIndex(), and BaseAsciiMap::resetPrimerCount().
{
bool validIndex = true;
// Each time we return to index 0, reset the primer count in the base/ascii
// map.
if(rawSequenceCharIndex == 0)
{
myBaseAsciiMap.resetPrimerCount();
}
// Check to see if the vector size is already sized to include this
// index. If it is not sized appropriately, add entries until it contains
// the rawSequenceCharIndex.
while(rawSequenceCharIndex >= myBaseCountVector.size())
{
// Add an entry of the base count array object to the vector.
BaseCount baseCountEntry;
myBaseCountVector.push_back(baseCountEntry);
}
// Get the base info for the specified character.
int baseIndex = myBaseAsciiMap.getBaseIndex(baseChar);
// Increment the count for the given character. This method returns false
// if the character's index falls outside the range of the base array.
// This relies on the myBaseAsciiMap indexes and the BaseCOunt object array
// to use the same indexing values for valid bases.
validIndex =
myBaseCountVector[rawSequenceCharIndex].incrementCount(baseIndex);
// Return whether or not the specified character was valid.
return(validIndex);
}