+
+ //if you found the barcode or if you don't want to allow for diffs
+ if ((diffs == 0) || (success == 1)) { return success; }
+
+ else { //try aligning and see if you can find it
+ //can you find the barcode
+ for(map<string,int>::iterator it=barcodes.begin();it!=barcodes.end();it++){
+ string oligo = it->first;
+ if(rawSequence.length() < oligo.length()){ //let's just assume that the barcodes are the same length
+ success = 0;
+ break;
+ }
+
+ //use needleman to align first barcode.length()+numdiffs of sequence to each barcode
+ Alignment* alignment = new NeedlemanOverlap(-2.0, 1.0, -1.0, (oligo.length()+diffs+1));
+ Sequence* templateSeq = new Sequence("temp", rawSequence.substr(0,(oligo.length()+diffs)));
+ Sequence* candidateSeq = new Sequence("temp2", oligo);
+ Nast nast(alignment, candidateSeq, templateSeq);
+
+ oligo = candidateSeq->getAligned();
+ cout << "barcode = " << oligo << " raw = " << rawSequence.substr(0,(oligo.length())) << endl;
+ delete alignment;
+ delete templateSeq;
+ delete candidateSeq;
+
+ if(compareDNASeq(oligo, rawSequence.substr(0,oligo.length()))){
+ group = it->second;
+ seq.setUnaligned(rawSequence.substr(0,oligo.length()));
+ success = 1;
+ break;
+ }
+ }
+ }