libStatGen Software  1
BaseComposition.h
1 /*
2  * Copyright (C) 2010 Regents of the University of Michigan
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __BASE_COMPOSITION_H__
19 #define __BASE_COMPOSITION_H__
20 
21 #include <map>
22 
23 #include "BaseAsciiMap.h"
24 #include "BaseCount.h"
25 
26 /// Class that tracks the composition of base by read location.
28 {
29 public:
30  /// Constructor.
32 
33  /// Update the composition for the specified index with the specified
34  /// character.
35  /// \return false if the character is not a valid raw sequence character,
36  /// true if it is valid.
37  bool updateComposition(unsigned int rawSequenceCharIndex, char baseChar);
38 
39  /// Get the space type for this composition.
41  {
42  return(myBaseAsciiMap.getSpaceType());
43  }
44 
45  /// Reset the base map type for this composition.
47  {
48  myBaseAsciiMap.resetBaseMapType();
49  };
50 
51  /// Set the base map type for this composition.
53  {
54  myBaseAsciiMap.setBaseMapType(spaceType);
55  }
56 
57  /// Print the composition.
58  void print();
59 
60  /// Clear the composition stored in the base count vector.
61  void clear();
62 
63 private:
64  // Map of bases used to determine if a character is valid and if so
65  // maps it to a number.
66  BaseAsciiMap myBaseAsciiMap;
67 
68  // Vector used to store the occurrence of each base type at a given
69  // read location.
70  vector<BaseCount> myBaseCountVector;
71 };
72 #endif
BaseComposition::setBaseMapType
void setBaseMapType(BaseAsciiMap::SPACE_TYPE spaceType)
Set the base map type for this composition.
Definition: BaseComposition.h:52
BaseComposition::resetBaseMapType
void resetBaseMapType()
Reset the base map type for this composition.
Definition: BaseComposition.h:46
BaseAsciiMap
Map between characters and the associated base type.
Definition: BaseAsciiMap.h:24
BaseComposition::clear
void clear()
Clear the composition stored in the base count vector.
Definition: BaseComposition.cpp:89
BaseComposition::getSpaceType
BaseAsciiMap::SPACE_TYPE getSpaceType()
Get the space type for this composition.
Definition: BaseComposition.h:40
BaseAsciiMap::SPACE_TYPE
SPACE_TYPE
The type of space (color or base) to use in the mapping.
Definition: BaseAsciiMap.h:44
BaseAsciiMap::resetBaseMapType
void resetBaseMapType()
Reset the base mapping type to UNKNOWN.
Definition: BaseAsciiMap.h:164
BaseComposition::BaseComposition
BaseComposition()
Constructor.
Definition: BaseComposition.cpp:23
BaseComposition
Class that tracks the composition of base by read location.
Definition: BaseComposition.h:27
BaseAsciiMap::setBaseMapType
void setBaseMapType(SPACE_TYPE spaceType)
Set the base type based on the passed in option.
Definition: BaseAsciiMap.h:72
BaseComposition::updateComposition
bool updateComposition(unsigned int rawSequenceCharIndex, char baseChar)
Update the composition for the specified index with the specified character.
Definition: BaseComposition.cpp:32
BaseAsciiMap::getSpaceType
SPACE_TYPE getSpaceType()
Return the space type that is currently set.
Definition: BaseAsciiMap.h:134
BaseComposition::print
void print()
Print the composition.
Definition: BaseComposition.cpp:70