00001 #ifndef CLUSTER_MAKER_FACTORY_CPP
00002 #define CLUSTER_MAKER_FACTORY_CPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "ClusterMakerFactory.h"
00038 #include "ClusterMaker.h"
00039 #include "arg_parser.h"
00040
00041 #include "MSTClusterMaker.h"
00042 #include "TransMSTClusterMaker.h"
00043
00044 void
00045 ClusterMakerFactory::displayList(std::ostream &os) {
00046
00047
00048 arg_parser::arg_record dummy_args[] = {
00049 {"mst", "MST-based Cluster Maker",
00050 NULL, arg_parser::STRING},
00051 {"tmst", "MST-based Cluster Maker with Transitivity",
00052 NULL, arg_parser::STRING},
00053 {NULL, NULL, NULL, arg_parser::BOOLEAN}
00054 };
00055 arg_parser dummyParser(dummy_args);
00056 os << dummyParser;
00057 }
00058
00059 ClusterMaker*
00060 ClusterMakerFactory::create(const char* name, ESTAnalyzer *analyzer,
00061 const int refESTidx,
00062 const std::string& outputFileName) {
00063 if (name == NULL) {
00064 return NULL;
00065 }
00066 if (refESTidx < 0) {
00067 std::cerr << "A reference EST index has not been specified.\n"
00068 << "Use --estIdx command line option." << std::endl;
00069 return NULL;
00070 }
00071 if (analyzer == NULL) {
00072 std::cerr << "A EST analyzer has not been specified.\n"
00073 << "Use --analyzer command line option." << std::endl;
00074 return NULL;
00075 }
00076
00077 if (!strcmp("mst", name)) {
00078 return new MSTClusterMaker(analyzer, refESTidx, outputFileName);
00079 } else if (!strcmp("tmst", name)) {
00080 return new TransMSTClusterMaker(analyzer, refESTidx, outputFileName);
00081 }
00082
00083
00084 std::cerr << "Invalid analyzer name." << std::endl;
00085 return NULL;
00086 }
00087
00088 #endif
00089