Loading...
Searching...
No Matches
BaseAsciiMap Class Reference

Map between characters and the associated base type. More...

`#include <BaseAsciiMap.h>`

## Public Types

enum | SPACE_TYPE { UNKNOWN , BASE_SPACE , COLOR_SPACE }
| The type of space (color or base) to use in the mapping. More...

## Public Member Functions

void | setBaseMapType (SPACE_TYPE spaceType)
| Set the base type based on the passed in option.
int | getBaseIndex (const char &letter)
| Returns the baseIndex value for the character passed in.
SPACE_TYPE | getSpaceType ()
| Return the space type that is currently set.
void | setNumPrimerBases (int numPrimerBases)
| Set the number of primer bases expected before the actual base/color space type occurs for the rest of the entries.
void | resetPrimerCount ()
| Reset the number of primers to 0.
void | resetBaseMapType ()
| Reset the base mapping type to UNKNOWN.

## Static Public Attributes

static const int | baseNIndex = 004
| Value associated with 'N' in the ascii to base map (bad read).
static const int | baseXIndex = 005
| Value associated with any non-base character in the ascii to base map (unknown, bad data).
static const char | int2base [] = "ACGTNMXXXXXXXXXX"
| Convert from int representation to the base.
static const char | int2colorSpace [] = "0123NXXXXXXXXXXX"
| Convert from int representation to colorspace representation.
static unsigned char | base2complement []
| This table maps 5' base space to the 3' complement base space values, as well as 5' color space values to the corresponding 3' complement color space values.
static unsigned char | baseColor2int [256+1]
| Map ASCII values to a 2 (or 3) bit encoding for the base pair value for both base and color space.
static unsigned char | base2int [256+1]
| Map ASCII values to a 2 (or 3) bit encoding for the base pair value for just base space (ACTGNactgn).
static unsigned char | color2int [256+1]
| Map ASCII values to a 2 (or 3) bit encoding for the base pair value for just color space (0123).

## Detailed Description

Map between characters and the associated base type.

Definition at line 24 of file BaseAsciiMap.h.

## Member Enumeration Documentation

## SPACE_TYPE

enum BaseAsciiMap::SPACE_TYPE

The type of space (color or base) to use in the mapping.

Enumerator
UNKNOWN | Base decision on the first raw seq character/type has yet to be determined.
BASE_SPACE | Bases only (A,C,G,T,N).
COLOR_SPACE | Color space only (0,1,2,3,.).

Definition at line 44 of file BaseAsciiMap.h.

{
/// Base decision on the first raw seq character/type has yet
/// to be determined.
UNKNOWN,
BASE_SPACE, ///< Bases only (A,C,G,T,N).
COLOR_SPACE ///< Color space only (0,1,2,3,.).
};
BaseAsciiMap::COLOR_SPACE
@ COLOR_SPACE
Color space only (0,1,2,3,.).
Definition BaseAsciiMap.h:49
BaseAsciiMap::UNKNOWN
@ UNKNOWN
Base decision on the first raw seq character/type has yet to be determined.
Definition BaseAsciiMap.h:47
BaseAsciiMap::BASE_SPACE
@ BASE_SPACE
Bases only (A,C,G,T,N).
Definition BaseAsciiMap.h:48

## Constructor & Destructor Documentation

## BaseAsciiMap()

BaseAsciiMap::BaseAsciiMap | ( |  | ) |

Definition at line 137 of file BaseAsciiMap.cpp.

: myNumPrimerBases(1)
{
myBase2IntMapPtr = NULL;
}

## ~BaseAsciiMap()

BaseAsciiMap::~BaseAsciiMap | ( |  | ) |

Definition at line 143 of file BaseAsciiMap.cpp.

{
}

## Member Function Documentation

## getBaseIndex()

int BaseAsciiMap::getBaseIndex | ( | const char & | letter | ) |

inline

Returns the baseIndex value for the character passed in.

Definition at line 94 of file BaseAsciiMap.h.

{
if (myBase2IntMapPtr == NULL)
{
// Check to see if we have hit the number of primer bases.
if (myPrimerCount < myNumPrimerBases)
{
// Still expecting primer bases, so lookup
// the letter in the base map.
++myPrimerCount;
return(base2int[(int)letter]);
}
// Have already processed all the primers, so determine
// whether this is base or color space.
// Need to determime the base type.
setBaseMapType(letter);
// If it is still null, return invalid. Will be set when the first
// letter is either color or base.
if (myBase2IntMapPtr == NULL)
{
return(baseXIndex);
}
}
// Also check if configured as color space that the primers are correct.
if ((myBase2IntMapPtr == color2int) && (myPrimerCount < myNumPrimerBases))
{
// Still expecting primer bases, so lookup
// the letter in the base map.
++myPrimerCount;
return(base2int[(int)letter]);
}
return myBase2IntMapPtr[(int)letter];
}
BaseAsciiMap::setBaseMapType
void setBaseMapType(SPACE_TYPE spaceType)
Set the base type based on the passed in option.
Definition BaseAsciiMap.h:72
BaseAsciiMap::color2int
static unsigned char color2int[256+1]
Map ASCII values to a 2 (or 3) bit encoding for the base pair value for just color space (0123).
Definition BaseAsciiMap.h:65
BaseAsciiMap::baseXIndex
static const int baseXIndex
Value associated with any non-base character in the ascii to base map (unknown, bad data).
Definition BaseAsciiMap.h:31
BaseAsciiMap::base2int
static unsigned char base2int[256+1]
Map ASCII values to a 2 (or 3) bit encoding for the base pair value for just base space (ACTGNactgn).
Definition BaseAsciiMap.h:61

References base2int, baseXIndex, color2int, and setBaseMapType().

Referenced by BaseComposition::updateComposition().

## getSpaceType()

SPACE_TYPE BaseAsciiMap::getSpaceType | ( |  | ) |

inline

Return the space type that is currently set.

Definition at line 134 of file BaseAsciiMap.h.

{
if (myBase2IntMapPtr == base2int)
{
return(BASE_SPACE);
}
else if (myBase2IntMapPtr == color2int)
{
return(COLOR_SPACE);
}
else
{
return(UNKNOWN);
}
}

References base2int, BASE_SPACE, color2int, COLOR_SPACE, and UNKNOWN.

Referenced by BaseComposition::getSpaceType().

## resetBaseMapType()

void BaseAsciiMap::resetBaseMapType | ( |  | ) |

inline

Reset the base mapping type to UNKNOWN.

Definition at line 164 of file BaseAsciiMap.h.

{
myBase2IntMapPtr = NULL;
resetPrimerCount();
};
BaseAsciiMap::resetPrimerCount
void resetPrimerCount()
Reset the number of primers to 0.
Definition BaseAsciiMap.h:158

References resetPrimerCount().

Referenced by BaseComposition::resetBaseMapType().

## resetPrimerCount()

void BaseAsciiMap::resetPrimerCount | ( |  | ) |

inline

Reset the number of primers to 0.

Definition at line 158 of file BaseAsciiMap.h.

{
myPrimerCount = 0;
};

Referenced by resetBaseMapType(), setBaseMapType(), and BaseComposition::updateComposition().

## setBaseMapType()

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

inline

Set the base type based on the passed in option.

Definition at line 72 of file BaseAsciiMap.h.

{
resetPrimerCount();
//First check to see if it is in base space.
switch (spaceType)
{
case BASE_SPACE:
// base space.
myBase2IntMapPtr = base2int;
break;
case COLOR_SPACE:
// color space.
myBase2IntMapPtr = color2int;
break;
default:
// Unknown map type, zero the pointer.
myBase2IntMapPtr = NULL;
break;
}
};

References base2int, BASE_SPACE, color2int, COLOR_SPACE, and resetPrimerCount().

Referenced by getBaseIndex(), and BaseComposition::setBaseMapType().

## setNumPrimerBases()

void BaseAsciiMap::setNumPrimerBases | ( | int | numPrimerBases | ) |

inline

Set the number of primer bases expected before the actual base/color space type occurs for the rest of the entries.

Definition at line 152 of file BaseAsciiMap.h.

{
myNumPrimerBases = numPrimerBases;
}

## Member Data Documentation

## base2complement

unsigned char BaseAsciiMap::base2complement

static

Initial value:
=
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"0123NNNNNNNNNNNN"
"NTNGNNNCNNNNNNNN"
"NNNNANNNNNNNNNNN"
"NTNGNNNCNNNNNNNN"
"NNNNANNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"
"NNNNNNNNNNNNNNNN"

This table maps 5' base space to the 3' complement base space values, as well as 5' color space values to the corresponding 3' complement color space values.

In both cases, invalids are mapped to 'N', which isn't accurate for ABI SOLiD, but internally it shouldn't matter (on output it will).

Definition at line 41 of file BaseAsciiMap.h.

## base2int

unsigned char BaseAsciiMap::base2int

static

Initial value:
=
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\000\005\001\005\005\005\002\005\005\005\005\005\005\004\005"
"\005\005\005\005\003\005\005\005\005\005\005\005\005\005\005\005"
"\005\000\005\001\005\005\005\002\005\005\005\005\005\005\004\005"
"\005\005\005\005\003\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"

Map ASCII values to a 2 (or 3) bit encoding for the base pair value for just base space (ACTGNactgn).

'A'/'a' -> 0; 'C'/'c' -> 1; 'G'/'g' -> 2; 'T'/'t' -> 3; 'N'/'n' -> 4; anything else -> 5.

Definition at line 61 of file BaseAsciiMap.h.

Referenced by getBaseIndex(), getSpaceType(), and setBaseMapType().

## baseColor2int

unsigned char BaseAsciiMap::baseColor2int

static

Initial value:
=
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\004\005"
"\000\001\002\003\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\000\005\001\005\005\005\002\005\005\005\005\005\005\004\005"
"\005\005\005\005\003\005\005\005\005\005\005\005\005\005\005\005"
"\005\000\005\001\005\005\005\002\005\005\005\005\005\005\004\005"
"\005\005\005\005\003\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"

Map ASCII values to a 2 (or 3) bit encoding for the base pair value for both base and color space.

'A'/'a'/'0' -> 0; 'C'/'c'/'1' -> 1; 'G'/'g'/'2' -> 2; 'T'/'t'/'3' -> 3; 'N'/'n'/'4' -> 4; anything else -> 5.

Definition at line 56 of file BaseAsciiMap.h.

## baseNIndex

const int BaseAsciiMap::baseNIndex = 004

static

Value associated with 'N' in the ascii to base map (bad read).

Definition at line 28 of file BaseAsciiMap.h.

Referenced by GenomeSequence::operator[]().

## baseXIndex

const int BaseAsciiMap::baseXIndex = 005

static

Value associated with any non-base character in the ascii to base map (unknown, bad data).

Definition at line 31 of file BaseAsciiMap.h.

Referenced by getBaseIndex().

## color2int

unsigned char BaseAsciiMap::color2int

static

Initial value:
=
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\004\005"
"\000\001\002\003\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
"\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"

Map ASCII values to a 2 (or 3) bit encoding for the base pair value for just color space (0123).

'0' -> 0; '1' -> 1; '2' -> 2; '3' -> 3; '4' -> 4; anything else -> 5.

Definition at line 65 of file BaseAsciiMap.h.

Referenced by getBaseIndex(), getSpaceType(), and setBaseMapType().

## int2base

const char BaseAsciiMap::int2base = "ACGTNMXXXXXXXXXX"

static

Convert from int representation to the base.

Definition at line 38 of file BaseAsciiMap.h.

Referenced by GenomeSequence::operator[]().

## int2colorSpace

const char BaseAsciiMap::int2colorSpace = "0123NXXXXXXXXXXX"

static

Convert from int representation to colorspace representation.

Definition at line 40 of file BaseAsciiMap.h.

Referenced by GenomeSequence::operator[]().

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

- general/BaseAsciiMap.h
- general/BaseAsciiMap.cpp