]> git.donarmstrong.com Git - mothur.git/blobdiff - chimeracheckrdp.cpp
sffinfo bug with flow grams right index when clipQualRight=0
[mothur.git] / chimeracheckrdp.cpp
index 4c93c1b97c5c7edd2a583cb449cf34440be2a324..42b531282c5f020664277a9e907699a3bf227658 100644 (file)
@@ -20,7 +20,7 @@ ChimeraCheckRDP::ChimeraCheckRDP(string filename, string temp, string n, bool s,
                kmerSize = k;
                outputDir = o; 
                
-               templateDB = new AlignmentDB(templateFileName, "kmer", kmerSize, 0.0,0.0,0.0,0.0);
+               templateDB = new AlignmentDB(templateFileName, "kmer", kmerSize, 0.0,0.0,0.0,0.0, rand());
                m->mothurOutEndLine();
                
                kmer = new Kmer(kmerSize);
@@ -47,7 +47,7 @@ ChimeraCheckRDP::~ChimeraCheckRDP() {
        }
 }      
 //***************************************************************************************************************
-int ChimeraCheckRDP::print(ostream& out, ostream& outAcc) {
+Sequence ChimeraCheckRDP::print(ostream& out, ostream& outAcc) {
        try {
                
                m->mothurOut("Processing: " + querySeq->getName()); m->mothurOutEndLine();
@@ -72,7 +72,7 @@ int ChimeraCheckRDP::print(ostream& out, ostream& outAcc) {
                        }
                }
                
-               return 0;
+               return *querySeq;
        }
        catch(exception& e) {
                m->errorOut(e, "ChimeraCheckRDP", "print");
@@ -81,7 +81,7 @@ int ChimeraCheckRDP::print(ostream& out, ostream& outAcc) {
 }
 #ifdef USE_MPI
 //***************************************************************************************************************
-int ChimeraCheckRDP::print(MPI_File& out, MPI_File& outAcc) {
+Sequence ChimeraCheckRDP::print(MPI_File& out, MPI_File& outAcc) {
        try {
                
                cout << "Processing: " << querySeq->getName() << endl; 
@@ -115,7 +115,7 @@ int ChimeraCheckRDP::print(MPI_File& out, MPI_File& outAcc) {
                        }
                }
                
-               return 0;
+               return *querySeq;
        }
        catch(exception& e) {
                m->errorOut(e, "ChimeraCheckRDP", "print");
@@ -283,7 +283,7 @@ void ChimeraCheckRDP::readName(string namefile) {
                delete buffer;
                
                while(!iss.eof()) {
-                       iss >> name; gobble(iss);
+                       iss >> name; m->gobble(iss);
                        names[name] = name;
                }
        
@@ -292,10 +292,10 @@ void ChimeraCheckRDP::readName(string namefile) {
        #else   
        
                ifstream in;
-               openInputFile(namefile, in);
+               m->openInputFile(namefile, in);
                                
                while (!in.eof()) {
-                       in >> name; gobble(in);
+                       in >> name; m->gobble(in);
                        names[name] = name;
                }
                in.close();
@@ -315,25 +315,26 @@ int ChimeraCheckRDP::calcKmers(map<int, int> query, map<int, int> subject) {
        try{
                
                int common = 0;
-               map<int, int>::iterator small;
-               map<int, int>::iterator large;
                
+               map<int, int>::iterator smallone;
+               map<int, int>::iterator largeone;
+
                if (query.size() < subject.size()) {
                
-                       for (small = query.begin(); small != query.end(); small++) {
-                               large = subject.find(small->first);
+                       for (smallone = query.begin(); smallone != query.end(); smallone++) {
+                               largeone = subject.find(smallone->first);
                                
                                //if you found it they have that kmer in common
-                               if (large != subject.end()) {   common++;       }
+                               if (largeone != subject.end()) {        common++;       }
                        }
                        
                }else { 
                 
-                       for (small = subject.begin(); small != subject.end(); small++) {
-                               large = query.find(small->first);
+                       for (smallone = subject.begin(); smallone != subject.end(); smallone++) {
+                               largeone = query.find(smallone->first);
                                
                                //if you found it they have that kmer in common
-                               if (large != query.end()) {             common++;        }
+                               if (largeone != query.end()) {          common++;        }
                        }
                }
                
@@ -431,7 +432,7 @@ void ChimeraCheckRDP::makeSVGpic(vector<sim> info) {
                
                string file = outputDir + querySeq->getName() + ".chimeracheck.svg";
                ofstream outsvg;
-               openOutputFile(file, outsvg);
+               m->openOutputFile(file, outsvg);
                
                int width = (info.size()*5) + 150;