libStatGen Software
1
|
00001 /* 00002 * Copyright (C) 2010 Regents of the University of Michigan 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef __BASE_COMPOSITION_H__ 00019 #define __BASE_COMPOSITION_H__ 00020 00021 #include <map> 00022 00023 #include "BaseAsciiMap.h" 00024 #include "BaseCount.h" 00025 00026 /// Class that tracks the composition of base by read location. 00027 class BaseComposition 00028 { 00029 public: 00030 /// Constructor. 00031 BaseComposition(); 00032 00033 /// Update the composition for the specified index with the specified 00034 /// character. 00035 /// \return false if the character is not a valid raw sequence character, 00036 /// true if it is valid. 00037 bool updateComposition(unsigned int rawSequenceCharIndex, char baseChar); 00038 00039 /// Get the space type for this composition. 00040 BaseAsciiMap::SPACE_TYPE getSpaceType() 00041 { 00042 return(myBaseAsciiMap.getSpaceType()); 00043 } 00044 00045 /// Reset the base map type for this composition. 00046 void resetBaseMapType() 00047 { 00048 myBaseAsciiMap.resetBaseMapType(); 00049 }; 00050 00051 /// Set the base map type for this composition. 00052 void setBaseMapType(BaseAsciiMap::SPACE_TYPE spaceType) 00053 { 00054 myBaseAsciiMap.setBaseMapType(spaceType); 00055 } 00056 00057 /// Print the composition. 00058 void print(); 00059 00060 /// Clear the composition stored in the base count vector. 00061 void clear(); 00062 00063 private: 00064 // Map of bases used to determine if a character is valid and if so 00065 // maps it to a number. 00066 BaseAsciiMap myBaseAsciiMap; 00067 00068 // Vector used to store the occurrence of each base type at a given 00069 // read location. 00070 vector<BaseCount> myBaseCountVector; 00071 }; 00072 #endif