00001 #ifndef PARAMETER_SET_MANAGER_H 00002 #define PARAMETER_SET_MANAGER_H 00003 00004 //-------------------------------------------------------------------- 00005 // 00006 // This file is part of PEACE. 00007 // 00008 // PEACE is free software: you can redistribute it and/or modify it 00009 // under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation, either version 3 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // PEACE is distributed in the hope that it will be useful, but 00014 // WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with PEACE. If not, see <http://www.gnu.org/licenses/>. 00020 // 00021 // Miami University makes no representations or warranties about the 00022 // suitability of the software, either express or implied, including 00023 // but not limited to the implied warranties of merchantability, 00024 // fitness for a particular purpose, or non-infringement. Miami 00025 // University shall not be liable for any damages suffered by licensee 00026 // as a result of using, result of using, modifying or distributing 00027 // this software or its derivatives. 00028 // 00029 // By using or copying this Software, Licensee agrees to abide by the 00030 // intellectual property laws, and all other applicable laws of the 00031 // U.S., and the terms of GNU General Public License (version 3). 00032 // 00033 // Authors: Dhananjai M. Rao raodm@muohio.edu 00034 // 00035 //--------------------------------------------------------------------- 00036 00037 #include <vector> 00038 #include "ParameterSet.h" 00039 00040 /** Class that manages a list of parameter sets. 00041 00042 <p>This class represents a list of parameter sets that analyzers 00043 and heuristics can access to obtain appropriate parameters for 00044 analysis of sequences with varying characteristics, typically 00045 length. The class initializes the appropriate parameter sets 00046 and provides the necessary parameter values when requested. </p> 00047 00048 */ 00049 class ParameterSetManager { 00050 public: 00051 /** Gets the appropriate parameter set for the given sequence lengths. 00052 00053 \return The parameter set that should be used; NULL if the sequence 00054 lengths are too different to be compared. 00055 */ 00056 ParameterSet* getParameterSet(const int seq1Len, const int seq2Len); 00057 00058 /** Gets the maximum possible frame size over all parameter sets. 00059 00060 \return the maximum possible frame size, an integer 00061 */ 00062 int getMaxFrameSize(); 00063 00064 /** Adds a parameter set to the parameter set manager. 00065 00066 */ 00067 void addParameterSet(ParameterSet* p); 00068 00069 /** Get a pointer to the instance of the parameter set manager. 00070 00071 Since this class is a singleton, the constructor is private 00072 and the only way to obtain an instance of the class is through 00073 this method. The parameter set manager is available only after the 00074 \c setupParameters method (that is invoked from main right after 00075 command line arguments are validated) has successfully 00076 completed its operation. Until such time this method simply 00077 returns \c NULL. 00078 00079 \return The process-wide unique pointer to the parameter set manager. 00080 */ 00081 static inline ParameterSetManager* getParameterSetManager() { 00082 return ptrInstance; 00083 } 00084 00085 /** Set up the parameter set manager. 00086 00087 Initializes the parameter set list to default values. 00088 The default is for 3 parameter sets, one for each of the following 00089 "classes" of sequences: 00090 Short - 0 to 150 bases (but in practice it is 50 to 150, as the 00091 LengthFilter will filter out sequences of fewer than 50 bases length) 00092 Medium - 150 to 400 bases 00093 Long - 400 to (no limit) bases 00094 00095 In the future this class should incorporate command-line arguments 00096 and customizability for the parameter sets. 00097 */ 00098 static void setupParameters(int t1 = 20, int u1 = 4, int ws1 = 4, 00099 int t2 = 30, int u2 = 6, int ws2 = 8, 00100 int t3 = 40, int u3 = 8, int ws3 = 8); 00101 00102 /** The destructor. 00103 00104 The destructor frees up all the parameter sets added to this 00105 parameter set manager. 00106 */ 00107 virtual ~ParameterSetManager(); 00108 00109 protected: 00110 00111 private: 00112 /** The constructor. 00113 00114 This is made private because the parameter set manager is 00115 a singleton, and should only be instantiated from the 00116 getParameterSetManager() static method. 00117 */ 00118 ParameterSetManager(); 00119 00120 00121 /** The vector containing the list of parameter sets. 00122 00123 */ 00124 std::vector<ParameterSet*> parameterSets; 00125 00126 /** The pointer to the singleton instance of this class. 00127 00128 Again, this is made private so that only methods of this class 00129 can access it. The getParameterSetManager() method in this class 00130 must be used to obtain an instance of this class. 00131 */ 00132 static ParameterSetManager* ptrInstance; 00133 }; 00134 00135 #endif