X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=flowdata.cpp;h=66261e33b922f17be93e3f929582ca9ea7d9208f;hp=5dc7dc3e6c780171f1ee5cacdb1d766864f18a18;hb=a8e2df1b96a57f5f29576b08361b86a96a8eff4f;hpb=c85db0a4be3a1f8037a71a23ca73f9762184e28a diff --git a/flowdata.cpp b/flowdata.cpp index 5dc7dc3..66261e3 100644 --- a/flowdata.cpp +++ b/flowdata.cpp @@ -50,7 +50,7 @@ bool FlowData::getNext(ifstream& flowFile){ translateFlow(); m->gobble(flowFile); } - + if(flowFile){ return 1; } else { return 0; } } @@ -68,9 +68,7 @@ string FlowData::getSequenceName(ifstream& flowFile) { flowFile >> name; if (name.length() != 0) { - for (int i = 0; i < name.length(); i++) { - if (name[i] == ':') { name[i] = '_'; m->changedSeqNames = true; } - } + m->checkName(name); }else{ m->mothurOut("Error in reading your flowfile, at position " + toString(flowFile.tellg()) + ". Blank name."); m->mothurOutEndLine(); m->control_pressed = true; } return name; @@ -86,16 +84,18 @@ string FlowData::getSequenceName(ifstream& flowFile) { void FlowData::updateEndFlow(){ try{ + if (baseFlow.length() > 4) { return; } + //int currLength = 0; float maxIntensity = (float) maxHomoP + 0.49; int deadSpot = 0; - + while(deadSpot < endFlow){ int signal = 0; int noise = 0; - for(int i=0;i<4;i++){ + for(int i=0;i signalIntensity){ signal++; @@ -110,7 +110,7 @@ void FlowData::updateEndFlow(){ break; } - deadSpot += 4; + deadSpot += baseFlow.length(); } endFlow = deadSpot; @@ -122,27 +122,49 @@ void FlowData::updateEndFlow(){ } //********************************************************************************************************************** - +//TATGCT +//1 0 0 0 0 1 +//then the second positive flow is for a T, but you saw a T between the last and previous flow adn it wasn't positive, so something is missing +//Becomes TNT void FlowData::translateFlow(){ - try{ - sequence = ""; - for(int i=0;i charInMiddle; + int oldspot = -1; + bool updateOld = false; + + for(int i=0;i= 1) { + if (oldspot == -1) { updateOld = true; } + else { //check for bases inbetween two 1's + if (charInMiddle.count(base) != 0) { //we want to covert to an N + sequence = sequence.substr(0, oldspot+1); + sequence += 'N'; + } + updateOld = true; + charInMiddle.clear(); + } + } for(int j=0;j 4){ sequence = sequence.substr(4); } else{ sequence = "NNNN"; } - } + } catch(exception& e) { m->errorOut(e, "FlowData", "translateFlow"); exit(1);