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().
00034 { 00035 bool validIndex = true; 00036 00037 // Each time we return to index 0, reset the primer count in the base/ascii 00038 // map. 00039 if(rawSequenceCharIndex == 0) 00040 { 00041 myBaseAsciiMap.resetPrimerCount(); 00042 } 00043 00044 // Check to see if the vector size is already sized to include this 00045 // index. If it is not sized appropriately, add entries until it contains 00046 // the rawSequenceCharIndex. 00047 while(rawSequenceCharIndex >= myBaseCountVector.size()) 00048 { 00049 // Add an entry of the base count array object to the vector. 00050 BaseCount baseCountEntry; 00051 myBaseCountVector.push_back(baseCountEntry); 00052 } 00053 00054 // Get the base info for the specified character. 00055 int baseIndex = myBaseAsciiMap.getBaseIndex(baseChar); 00056 00057 // Increment the count for the given character. This method returns false 00058 // if the character's index falls outside the range of the base array. 00059 // This relies on the myBaseAsciiMap indexes and the BaseCOunt object array 00060 // to use the same indexing values for valid bases. 00061 validIndex = 00062 myBaseCountVector[rawSequenceCharIndex].incrementCount(baseIndex); 00063 00064 // Return whether or not the specified character was valid. 00065 return(validIndex); 00066 }