]> git.donarmstrong.com Git - mothur.git/blobdiff - chimera.cpp
fixed bug in chimera.uchime
[mothur.git] / chimera.cpp
index 483e5530b094ce011a1e8894a6160a9ea60f2361..54124872b7a5e87ce4aa545585fcb4b94c759044 100644 (file)
@@ -31,6 +31,8 @@ string Chimera::createFilter(vector<Sequence*> seqs, float t) {
                        if (m->control_pressed) { return filterString; }
                
                        string seqAligned = seqs[i]->getAligned();
+                       
+                       if (seqAligned.length() != filterString.length()) {  m->mothurOut(seqs[i]->getName() + " is not the same length as the template sequences. Aborting!\n");  exit(1); }
                
                        for (int j = 0; j < seqAligned.length(); j++) {
                                //if this spot is a gap
@@ -102,7 +104,7 @@ vector<Sequence*> Chimera::readSeqs(string file) {
                
                #ifdef USE_MPI  
                        int pid, processors;
-                       vector<long> positions;
+                       vector<unsigned long int> positions;
                        int numSeqs;
                        int tag = 2001;
                
@@ -121,7 +123,7 @@ vector<Sequence*> Chimera::readSeqs(string file) {
                        //delete inFileName;
 
                        if (pid == 0) {
-                               positions = setFilePosFasta(file, numSeqs); //fills MPIPos, returns numSeqs
+                               positions = m->setFilePosFasta(file, numSeqs); //fills MPIPos, returns numSeqs
 
                                //send file positions to all processes
                                for(int i = 1; i < processors; i++) { 
@@ -165,14 +167,14 @@ vector<Sequence*> Chimera::readSeqs(string file) {
        #else
 
                ifstream in;
-               openInputFile(file, in);
+               m->openInputFile(file, in);
                
                //read in seqs and store in vector
                while(!in.eof()){
                        
                        if (m->control_pressed) { return container; }
                        
-                       Sequence* current = new Sequence(in);  gobble(in);
+                       Sequence* current = new Sequence(in);  m->gobble(in);
                        
                        if (count == 0) {  length = current->getAligned().length();  count++;  } //gets first seqs length
                        else if (length != current->getAligned().length()) {    unaligned = true;       }
@@ -184,6 +186,8 @@ vector<Sequence*> Chimera::readSeqs(string file) {
        
                m->mothurOut("Done."); m->mothurOutEndLine();
                
+               filterString = (string(container[0]->getAligned().length(), '1'));
+               
                return container;
        }
        catch(exception& e) {
@@ -239,7 +243,7 @@ void Chimera::setMask(string filename) {
        #else
        
                        ifstream infile;
-                       openInputFile(filename, infile);
+                       m->openInputFile(filename, infile);
                        
                        if (!infile.eof()) {
                                Sequence temp(infile);