- string leftQuery = queryAligned.substr(0, (queryAligned.length() / 3)); //first 1/3 of the sequence
- string rightQuery = queryAligned.substr(((queryAligned.length() / 3)*2)); //last 1/3 of the sequence
+
+ //left side
+ int baseCount = 0;
+ int leftSpot = 0;
+ for (int i = 0; i < queryAligned.length(); i++) {
+ leftQuery += queryAligned[i];
+ //if you are a base
+ if ((queryAligned[i] != '.') && (queryAligned[i] != '-')) { baseCount++; }
+ //if you have 1/3
+ if (baseCount >= numBases) { leftSpot = i; break; } //first 1/3
+ }
+
+ //right side - count through another 1/3, so you are at last third
+ baseCount = 0;
+ int rightSpot = 0;
+ for (int i = leftSpot; i < queryAligned.length(); i++) {
+ //if you are a base
+ if ((queryAligned[i] != '.') && (queryAligned[i] != '-')) { baseCount++; }
+ //if you have 1/3
+ if (baseCount >= numBases) { rightSpot = i; break; } //last 1/3
+ }
+ rightQuery = queryAligned.substr(rightSpot); //sequence from pos spot to end