00001 #ifndef FILTER_FACTORY_CPP 00002 #define FILTER_FACTORY_CPP 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 "FilterFactory.h" 00038 #include "LengthFilter.h" 00039 #include "LCFilter.h" 00040 #include "arg_parser.h" 00041 00042 void 00043 FilterFactory::displayList(std::ostream &os) { 00044 // Create dummy command-line args to make display prettier and 00045 // easier. 00046 arg_parser::arg_record dummy_args[] = { 00047 {"lengthFilter", "Filter out short ESTs in the FASTA file", 00048 NULL, arg_parser::STRING}, 00049 {"lcFilter", "Filter out entries with Low Complexity regions", 00050 NULL, arg_parser::STRING}, 00051 {NULL, NULL, NULL, arg_parser::BOOLEAN} 00052 }; 00053 arg_parser dummyParser(dummy_args); 00054 os << dummyParser; 00055 } 00056 00057 Filter* 00058 FilterFactory::create(const char* name, ClusterMaker *clusterMaker) { 00059 if (name == NULL) { 00060 return NULL; 00061 } 00062 if (clusterMaker == NULL) { 00063 std::cerr << "A valid cluster maker has not been specified.\n" 00064 << "Use --clusterMaker command line option." << std::endl; 00065 return NULL; 00066 } 00067 00068 if (!strcmp("lengthFilter", name)) { 00069 return new LengthFilter(clusterMaker); 00070 } else if (!strcmp("lcFilter", name)) { 00071 return new LCFilter(clusterMaker); 00072 } 00073 00074 // invalid filter name! 00075 std::cerr << "Invalid filter name '" << name << "'." << std::endl; 00076 return NULL; 00077 } 00078 00079 #endif
1.6.1