-
-
- return reverse;
- }
- catch(exception& e) {
- m->errorOut(e, "PcrSeqsCommand", "reverseOligo");
- exit(1);
- }
-}
-
-//***************************************************************************************************************
-bool PcrSeqsCommand::readOligos(){
- try {
- ifstream inOligos;
- m->openInputFile(oligosfile, inOligos);
-
- string type, oligo, group;
- int primerCount = 0;
-
- while(!inOligos.eof()){
-
- inOligos >> type;
-
- if(type[0] == '#'){ //ignore
- while (!inOligos.eof()) { char c = inOligos.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
- m->gobble(inOligos);
- }else{
- m->gobble(inOligos);
- //make type case insensitive
- for(int i=0;i<type.length();i++){ type[i] = toupper(type[i]); }
-
- inOligos >> oligo;
-
- for(int i=0;i<oligo.length();i++){
- oligo[i] = toupper(oligo[i]);
- if(oligo[i] == 'U') { oligo[i] = 'T'; }
- }
-
- if(type == "FORWARD"){
- // get rest of line in case there is a primer name
- while (!inOligos.eof()) {
- char c = inOligos.get();
- if (c == 10 || c == 13 || c == -1){ break; }
- else if (c == 32 || c == 9){;} //space or tab
- }
- primers[oligo] = primerCount; primerCount++;
- }else if(type == "REVERSE"){
- string oligoRC = reverseOligo(oligo);
- revPrimer.push_back(oligoRC);
- //cout << "oligo = " << oligo << " reverse = " << oligoRC << endl;
- }else if(type == "BARCODE"){
- inOligos >> group;
- }else if((type == "LINKER")||(type == "SPACER")) {;}
- else{ m->mothurOut(type + " is not recognized as a valid type. Choices are forward, reverse, linker, spacer and barcode. Ignoring " + oligo + "."); m->mothurOutEndLine(); m->control_pressed = true; }
- }
- m->gobble(inOligos);
- }
- inOligos.close();
-
- if ((primers.size() == 0) && (revPrimer.size() == 0)) {
- m->mothurOut("[ERROR]: your oligos file does not contain valid primers or reverse primers. Please correct."); m->mothurOutEndLine();
- m->control_pressed = true;
- return false;
- }