+
+int Sequence::getNumBases(){
+ return numBases;
+}
+
+//********************************************************************************************************************
+
+void Sequence::printSequence(ostream& out){
+
+ out << ">" << name << endl;
+ if(isAligned){
+ out << aligned << endl;
+ }
+ else{
+ out << unaligned << endl;
+ }
+}
+
+//********************************************************************************************************************
+
+int Sequence::getAlignLength(){
+ return alignmentLength;
+}
+
+//********************************************************************************************************************
+
+int Sequence::getAmbigBases(){
+ if(ambigBases == -1){
+ ambigBases = 0;
+ for(int j=0;j<numBases;j++){
+ if(unaligned[j] != 'A' && unaligned[j] != 'T' && unaligned[j] != 'G' && unaligned[j] != 'C'){
+ ambigBases++;
+ }
+ }
+ }
+
+ return ambigBases;
+}
+
+//********************************************************************************************************************
+
+void Sequence::removeAmbigBases(){
+
+ for(int j=0;j<alignmentLength;j++){
+ if(aligned[j] != 'A' && aligned[j] != 'T' && aligned[j] != 'G' && aligned[j] != 'C'){
+ aligned[j] = '-';
+ }
+ }
+ setUnaligned(aligned);
+}
+
+//********************************************************************************************************************
+
+int Sequence::getLongHomoPolymer(){
+ if(longHomoPolymer == -1){
+ longHomoPolymer = 1;
+ int homoPolymer = 1;
+ for(int j=1;j<numBases;j++){
+ if(unaligned[j] == unaligned[j-1]){
+ homoPolymer++;
+ }
+ else{
+ if(homoPolymer > longHomoPolymer){ longHomoPolymer = homoPolymer; }
+ homoPolymer = 1;
+ }
+ }
+ if(homoPolymer > longHomoPolymer){ longHomoPolymer = homoPolymer; }
+ }
+ return longHomoPolymer;
+}
+
+//********************************************************************************************************************
+
+int Sequence::getStartPos(){
+ if(startPos == -1){
+ for(int j = 0; j < alignmentLength; j++) {
+ if((aligned[j] != '.')&&(aligned[j] != '-')){
+ startPos = j + 1;
+ break;
+ }
+ }
+ }
+ if(isAligned == 0){ startPos = 1; }
+
+ return startPos;
+}
+
+//********************************************************************************************************************
+
+void Sequence::padToPos(int start){
+
+ for(int j = startPos-1; j < start-1; j++) {
+ aligned[j] = '.';
+ }
+ startPos = start;
+
+}
+//********************************************************************************************************************
+
+int Sequence::filterToPos(int start){
+
+ if (start > aligned.length()) { start = aligned.length(); m->mothurOut("[ERROR]: start to large.\n"); }
+
+ for(int j = 0; j < start-1; j++) {
+ aligned[j] = '.';
+ }
+
+ //things like ......----------AT become ................AT
+ for(int j = start-1; j < aligned.length(); j++) {
+ if (isalpha(aligned[j])) { break; }
+ else { aligned[j] = '.'; }
+ }
+ setUnaligned(aligned);
+
+ return 0;
+
+}
+//********************************************************************************************************************
+
+int Sequence::filterFromPos(int end){
+
+ if (end > aligned.length()) { end = aligned.length(); m->mothurOut("[ERROR]: end to large.\n"); }
+
+ for(int j = end; j < aligned.length(); j++) {
+ aligned[j] = '.';
+ }
+
+ for(int j = aligned.length()-1; j < 0; j--) {
+ if (isalpha(aligned[j])) { break; }
+ else { aligned[j] = '.'; }
+ }
+
+ setUnaligned(aligned);
+
+ return 0;
+}
+//********************************************************************************************************************
+
+int Sequence::getEndPos(){
+ if(endPos == -1){
+ for(int j=alignmentLength-1;j>=0;j--){
+ if((aligned[j] != '.')&&(aligned[j] != '-')){
+ endPos = j + 1;
+ break;
+ }
+ }
+ }
+ if(isAligned == 0){ endPos = numBases; }
+
+ return endPos;
+}
+
+//********************************************************************************************************************
+
+void Sequence::padFromPos(int end){
+ cout << end << '\t' << endPos << endl;
+ for(int j = end; j < endPos; j++) {
+ aligned[j] = '.';
+ }
+ endPos = end;
+
+}
+
+//********************************************************************************************************************
+
+bool Sequence::getIsAligned(){
+ return isAligned;
+}
+//********************************************************************************************************************
+
+void Sequence::reverseComplement(){
+
+ string temp;
+ for(int i=numBases-1;i>=0;i--){
+ if(unaligned[i] == 'A') { temp += 'T'; }
+ else if(unaligned[i] == 'T'){ temp += 'A'; }
+ else if(unaligned[i] == 'G'){ temp += 'C'; }
+ else if(unaligned[i] == 'C'){ temp += 'G'; }
+ else { temp += 'N'; }
+ }
+ unaligned = temp;
+ aligned = temp;
+
+}
+
+//********************************************************************************************************************
+
+void Sequence::trim(int length){
+
+ if(numBases > length){
+ unaligned = unaligned.substr(0,length);
+ numBases = length;
+ }
+
+}
+
+///**************************************************************************************************/