bool SimulationConfiguration::Implementation::physicalLayerIs( const string &testValue) const { return (stringToUpper(testValue) == stringToUpper(getPhysicalLayerType())); }
bool SimulationConfiguration::Implementation::outputManagerIs( const string &testValue) const { return (stringToUpper(testValue) == stringToUpper(getOutputManagerType())); }
bool SimulationConfiguration::Implementation::simulationTypeIs( const string &testValue) const { return (stringToUpper(testValue) == stringToUpper(getSimulationType())); }
bool SimulationConfiguration::Implementation::optFossilCollManagerTypeIs( const string &testValue) const { return (stringToUpper(testValue) == stringToUpper( getOptFossilCollManagerType())); }
bool SimulationConfiguration::Implementation::eventListOrganizationIs( const string &testValue) const { return (stringToUpper(testValue) == stringToUpper( getEventListOrganization())); }
void InputStructures::read_fasta(string chr_file, map<string, string> & chr_seq) { //chr_seq.clear(); map<string,string>::iterator it; string temp_chr_seq = ""; string line = ""; ifstream inFile(chr_file.c_str()); string chr_num = ""; int chrNumber = 0; string chrName; bool firstContigFound = false; if (!inFile.is_open()) { cout << "Error opening file: " << chr_file << endl; return; } getline(inFile,line); it = chr_seq.begin(); // Read and process records while (!inFile.eof() && line.length() > 0) { if (line.at(0) == '#' && !firstContigFound) { getline(inFile,line); } else if (line.at(0) == '>' || line.at(0) == '<') { firstContigFound = true; if (chrNumber > 0) { //chr_seq.push_back(temp_chr_seq); chr_seq.insert(it, pair<string,string>(chrName,temp_chr_seq)); if (DEBUG) cout << "Chromosome Name = " << chrName << endl; if (temp_chr_seq.length() > 0) { if (DEBUG) cout << temp_chr_seq.length() << endl; temp_chr_seq.clear(); } //chrNumber++; } chrNumber++; //find if there are more than contig name in the line int firstspace = line.find(" "); chrName = line.substr(1, firstspace-1); if (chrName.length() == 0) { cerr << " Reference csfasta file provided has no contig name : " << line << endl; exit(-1); } if (DEBUG) cout << " Chr Name found in Reference csfasta : " << chrName << endl; refSequences.push_back(chrName); getline(inFile, line); } else { // Convert reference sequence to upper case characters stringToUpper(line); temp_chr_seq.append(line); getline(inFile,line); } } if (temp_chr_seq.length() > 0) { //cout << temp_chr_seq.length() << endl;cout << "Dima's seq : " << temp_chr_seq.substr(279750,100) << endl; chr_seq.insert(it, pair<string,string>(chrName,temp_chr_seq)); } inFile.close(); }
/********************************************************************************** * AUTHOR : Vijayakumara M * DATE : 23 Aug 2005 * NAME : main * DESCRIPTION : Model Data viewer main function - Takes file name as its argument * and checks the integrity of the file and displays the options user * entered in the command prompt. * ARGUMENTS : int argc, char *argv[] ( file name and user desired options) * RETURNS : 0 on success and -1 on failure. * NOTES : * CHANGE HISTROY * Author Date Description of change ************************************************************************************/ int main(int argc, char* argv[]) { string m_strLipiRootPath = ""; string m_logFileName = DEFAULT_LOG_FILE; string m_logLevelStr = "ERROR"; LTKLogger::EDebugLevel m_logLevel = DEFAULT_LOG_LEVEL; int index = 1; int tmp = 0; int str = 0; int filteredArgc = argc; bool filFlag = false; // Flag to indicate the file name specified in the comman prompt. bool allFlag = false; // Flag to indicate all options to be displayed or not. bool helpFlag = false; bool preprocFlag = false; // Flag to indicate preproc fields to be displayed. stringStringMap headerSequence; // Get the maped header tokenized stings. stringStructMap optMap; // Gets the options and corresponding values. stringStructMap optPreProcMap; // Gets the Preprocessing options and corresponding values. string fileName; // Model Data file Name. string description; // Option description LTKCheckSumGenerate chFile; // instance of checkSum class for checking file integrity. //Display order char optIndex[][20]={"-PROJNAME","-NUMSHAPES","-RECNAME","-RECVER","-CHECKSUM","-CREATETIME","-MODTIME","-HEADERLEN","-DATAOFFSET","-HEADERVER","-BYTEORDER", "-FEATEXTR"}; if (argc == 1) { helpDisplay(); return SUCCESS; } // Get the argument passed through command prompt. while(index < argc) { // If argument is equal to "-a" or "-all" set allFlag for to display all the options. if(LTKSTRCMP(argv[index], OPTION_ALL) == 0) { allFlag = true; index++; continue; } //Preproc if(LTKSTRCMP(argv[index], OPTION_PREPROC) == 0) { preprocFlag = true; index++; continue; } if(LTKSTRCMP(argv[index], OPTION_HELP) == 0) { // Call helpDisplay function for displaying the help notice. helpDisplay(); return SUCCESS; } if(LTKSTRCMP(argv[index], OPTION_LIPI_ROOT) == 0) { if (index+1 >= argc) { cout << "Please specify LIPI_ROOT " << endl; return FAILURE; } m_strLipiRootPath = argv[index+1]; index++; } if(LTKSTRCMP(argv[index], OPTION_INPUT) == 0) { //set filFlag if the file Name is spcified if(index+1 < argc) { filFlag = true; fileName = argv[index+1]; index++; } } if(LTKSTRCMP(argv[index], OPTION_VER) == 0) { cout << SUPPORTED_MIN_VERSION << endl; return SUCCESS; } if(LTKSTRCMP(argv[index], OPTION_LOGFILE) == 0) { if (index+1 >= argc) { cout << "Please specify log file name " << endl; return FAILURE; } m_logFileName = argv[index+1]; filteredArgc = argc-2; index++; } if(LTKSTRCMP(argv[index], OPTION_LOGLEVEL) == 0) { if (index+1 >= argc) { cout << "Please specify log level " << endl; return FAILURE; } m_logLevelStr = argv[index+1]; int errorCode = mapLogLevel(m_logLevelStr, m_logLevel); if (errorCode != SUCCESS) { LTKReturnError(errorCode); } filteredArgc = argc-2; index++; } index++; } // If nothing specified except the file, display all if( (filteredArgc == 5 || filteredArgc == 3) && filFlag) { allFlag = true; } index = 1; if (m_strLipiRootPath.empty()) { char* envstring = NULL; envstring = getenv(LIPIROOT_ENV_STRING); if(envstring == NULL ) { cout << "Error, Environment variable is not set LIPI_ROOT" << endl; return FAILURE; } m_strLipiRootPath = envstring; envstring = NULL; } // Configure logger LTKLoggerUtil::createLogger(m_strLipiRootPath); LTKLoggerUtil::configureLogger(m_logFileName, m_logLevel); //if filFlag is set, display File name is not specified and display help if(filFlag == false) { cout <<endl<<endl<<"Model data file Name is not given " <<endl; cout <<"Please specify the file Name with \"-input\" option" << endl; cout << endl; //Display Help helpDisplay(); cout << endl; LTKLoggerUtil::destroyLogger(); return FAILURE; } // Check file integrity. If file has been altered then set the chflag. if((tmp = chFile.readMDTHeader(fileName, headerSequence)) != SUCCESS) { if( tmp == EMODEL_DATA_FILE_OPEN) { cout << "Unable to open model data file" << endl; LTKLoggerUtil::destroyLogger(); return FAILURE; } else if( tmp == EMODEL_DATA_FILE_FORMAT) { cout << "Incompatible model data file. The header is not in the desired format." << endl; LTKLoggerUtil::destroyLogger(); return FAILURE; } else if( tmp == EINVALID_INPUT_FORMAT) { cout << endl << "Model data file is corrupted" << endl; LTKLoggerUtil::destroyLogger(); return FAILURE; } } else { cout << endl << "Checksum successfully verified"<<endl<<endl; } if(preprocFlag) { // Map preprocessing options with their values. mapPreprocOptions(optPreProcMap, headerSequence); DisplayPreProc(optPreProcMap); LTKLoggerUtil::destroyLogger(); return 0; } // Map options with their values. mapOptions(optMap, headerSequence); // Iterator pointing at the begining of the option mapped address. map<string, option>::iterator the_begiter = optMap.begin(); if(allFlag) { str = 0; while (optIndex[str][0] != '\0') { if(!(optMap[optIndex[str]].description.empty())) cout << optMap[optIndex[str]].description << optMap[optIndex[str]].value << endl; str++; } // Map preprocessing options with their values. mapPreprocOptions(optPreProcMap, headerSequence); DisplayPreProc(optPreProcMap); if( !(headerSequence[PLATFORM].empty())) { cout << "Platform - " << headerSequence[PLATFORM] << endl; cout << " " << headerSequence[OSVERSION] << endl; cout << " " << headerSequence[PROCESSOR_ARCHITEC] << endl; } if( !(headerSequence[COMMENT].empty())) { cout << "Comment - " << headerSequence[COMMENT] << endl; cout << "Comment length - " << headerSequence[COMMENTLEN] << endl; } if( !(headerSequence[DATASET].empty())) { cout << "Dataset name - " << headerSequence[DATASET] << endl; } LTKLoggerUtil::destroyLogger(); return 0; } // Display the values if file is present and in the desired format while((index < argc)) { if( (LTKSTRCMP(argv[index], "-INPUT") == 0) || (LTKSTRCMP(fileName.c_str(), argv[index]) == 0) || (LTKSTRCMP(argv[index], "-LIPIROOT") == 0) || (LTKSTRCMP(m_strLipiRootPath.c_str(), argv[index]) == 0)) { ++index; continue; } if( (LTKSTRCMP(argv[index], "-DATASET") == 0) || (LTKSTRCMP(argv[index], "-COMMENT") == 0) || (LTKSTRCMP(argv[index], "-COMMENTLEN") == 0)) { ++index; continue; } if(LTKSTRCMP(argv[index], "-PLATFORM") == 0) { cout << "Platform - " << headerSequence[PLATFORM] << endl; cout << " " << headerSequence[OSVERSION] << endl; cout << " " << headerSequence[PROCESSOR_ARCHITEC] << endl; ++index; continue; } description = optMap[stringToUpper(argv[index])].description; if(description.empty()) cout << "UnKnown Option - "<< argv[index] << endl; else cout << optMap[argv[index]].description << optMap[argv[index]].value << endl; ++index; } LTKLoggerUtil::destroyLogger(); return SUCCESS; }