Loading...
Searching...
No Matches
BaseComposition Class Reference

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.

## Detailed Description

Class that tracks the composition of base by read location.

Definition at line 27 of file BaseComposition.h.

## Constructor & Destructor Documentation

## BaseComposition()

BaseComposition::BaseComposition | ( |  | ) |

Constructor.

Definition at line 23 of file BaseComposition.cpp.

:
myBaseAsciiMap()
{
}

## Member Function Documentation

## clear()

void BaseComposition::clear | ( |  | ) |

Clear the composition stored in the base count vector.

Definition at line 89 of file BaseComposition.cpp.

{
myBaseCountVector.clear();
}

## getSpaceType()

BaseAsciiMap::SPACE_TYPE BaseComposition::getSpaceType | ( |  | ) |

inline

Get the space type for this composition.

Definition at line 40 of file BaseComposition.h.

{
return(myBaseAsciiMap.getSpaceType());
}

## print()

void BaseComposition::print | ( |  | ) |

Print the composition.

Definition at line 70 of file BaseComposition.cpp.

{
std::cout << std::endl << "Base Composition Statistics:" << std::endl;
std::cout.precision(2);
// This assumes the relationship between indexes that are printed
// by a BaseCount object to be in a specific order based on ATGCN.
std::cout << std::fixed << "Read Index"
<< "\t%A" << "\t%C" << "\t%G" << "\t%T" << "\t%N" << "\tTotal Reads At Index"
<< std::endl;
for(unsigned int i = 0; i < myBaseCountVector.size(); i++)
{
std::cout << std::setw(10) << i << " ";
myBaseCountVector[i].printPercent();
}
std::cout << std::endl;
}

## resetBaseMapType()

void BaseComposition::resetBaseMapType | ( |  | ) |

inline

Reset the base map type for this composition.

Definition at line 46 of file BaseComposition.h.

{
myBaseAsciiMap.resetBaseMapType();
};

## setBaseMapType()

void BaseComposition::setBaseMapType | ( | BaseAsciiMap::SPACE_TYPE | spaceType | ) |

inline

Set the base map type for this composition.

Definition at line 52 of file BaseComposition.h.

{
myBaseAsciiMap.setBaseMapType(spaceType);
}

## updateComposition()

bool BaseComposition::updateComposition | ( | unsigned int | rawSequenceCharIndex,
|  | char | baseChar )

Update the composition for the specified index with the specified character.

Returns
  false if the character is not a valid raw sequence character, true if it is valid.

Definition at line 32 of file BaseComposition.cpp.

{
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);
}

The documentation for this class was generated from the following files:

- fastq/BaseComposition.h
- fastq/BaseComposition.cpp