X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=screenseqscommand.cpp;h=bf702e13534f507576bee7c24bcf6462aacb7ca3;hp=29e541319081d5bbd2254923919a03b255a00ca7;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=7439a3c94e96c9e0e78ca53f0356415a879f8b80 diff --git a/screenseqscommand.cpp b/screenseqscommand.cpp index 29e5413..bf702e1 100644 --- a/screenseqscommand.cpp +++ b/screenseqscommand.cpp @@ -14,7 +14,7 @@ vector ScreenSeqsCommand::setParameters(){ try { CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","fasta",false,true,true); parameters.push_back(pfasta); - CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,true,true); parameters.push_back(pcontigsreport); + CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,false,true); parameters.push_back(pcontigsreport); CommandParameter palignreport("alignreport", "InputTypes", "", "", "report", "none", "none","alignreport",false,false); parameters.push_back(palignreport); CommandParameter psummary("summary", "InputTypes", "", "", "report", "none", "none","summary",false,false); parameters.push_back(psummary); CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","name",false,false,true); parameters.push_back(pname); @@ -294,7 +294,8 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option) { summaryfile = validParameter.validFile(parameters, "summary", true); if (summaryfile == "not open") { summaryfile = ""; abort = true; } - else if (summaryfile == "not found") { summaryfile = ""; } + else if (summaryfile == "not found") { summaryfile = ""; } + else { m->setSummaryFile(summaryfile); } if ((namefile != "") && (countfile != "")) { m->mothurOut("[ERROR]: you may only use one of the following: name or count."); m->mothurOutEndLine(); abort = true; @@ -682,7 +683,7 @@ int ScreenSeqsCommand::screenReports(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true, false); nameMap = ct.getNameMap(); } getSummary(positions); @@ -713,7 +714,7 @@ int ScreenSeqsCommand::screenReports(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true, false); nameMap = ct.getNameMap(); } getSummaryReport(); @@ -816,7 +817,7 @@ int ScreenSeqsCommand::screenAlignReport(map& badSeqNames){ m->mothurRemove(outSummary+".temp"); } - if (numFastaSeqs != count) { m->mothurOut("[ERROR]: found " + toString(numFastaSeqs) + " sequences in your fasta file, and " + toString(count) + " sequences in your contigs report file, quitting.\n"); m->control_pressed = true; } + if (numFastaSeqs != count) { m->mothurOut("[ERROR]: found " + toString(numFastaSeqs) + " sequences in your fasta file, and " + toString(count) + " sequences in your align report file, quitting.\n"); m->control_pressed = true; } return count; @@ -1018,7 +1019,7 @@ int ScreenSeqsCommand::screenFasta(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true, false); nameMap = ct.getNameMap(); } getSummary(positions); @@ -1819,7 +1820,6 @@ int ScreenSeqsCommand::getSummary(vector& positions){ vector longHomoPolymer; vector numNs; - vector positions; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) positions = m->divideFile(fastafile, processors); for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(linePair(positions[i], positions[(i+1)])); } @@ -1844,8 +1844,9 @@ int ScreenSeqsCommand::getSummary(vector& positions){ int pid; MPI_Comm_rank(MPI_COMM_WORLD, &pid); - if (pid == 0) { - driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, numNs, fastafile, lines[0]); + if (pid == 0) { + linePair tempLine(0, positions[positions.size()-1]); + driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, numNs, fastafile, tempLine); #else int numSeqs = 0; //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) @@ -2118,7 +2119,7 @@ int ScreenSeqsCommand::screenGroupFile(map badSeqNames){ while(!inputGroups.eof()){ if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodGroupFile); return 0; } - inputGroups >> seqName; m->gobble(inputGroups); inputGroups >> group; + inputGroups >> seqName; m->gobble(inputGroups); inputGroups >> group; m->gobble(inputGroups); it = badSeqNames.find(seqName); if(it != badSeqNames.end()){ @@ -2127,7 +2128,6 @@ int ScreenSeqsCommand::screenGroupFile(map badSeqNames){ else{ goodGroupOut << seqName << '\t' << group << endl; } - m->gobble(inputGroups); } if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodGroupFile); return 0; } @@ -2176,19 +2176,18 @@ int ScreenSeqsCommand::screenCountFile(map badSeqNames){ if (m->control_pressed) { goodCountOut.close(); in.close(); m->mothurRemove(goodCountFile); return 0; } in >> name; m->gobble(in); - in >> thisTotal; m->gobble(in); + in >> thisTotal; rest = m->getline(in); m->gobble(in); it = badSeqNames.find(name); if(it != badSeqNames.end()){ - badSeqNames.erase(it); + badSeqNames.erase(it); } else{ goodCountOut << name << '\t' << thisTotal << '\t' << rest << endl; } } - if (m->control_pressed) { goodCountOut.close(); in.close(); m->mothurRemove(goodCountFile); return 0; } //we were unable to remove some of the bad sequences @@ -2205,7 +2204,7 @@ int ScreenSeqsCommand::screenCountFile(map badSeqNames){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(goodCountFile)) { - ct.readTable(goodCountFile); + ct.readTable(goodCountFile, true, false); ct.printTable(goodCountFile); } @@ -2301,7 +2300,7 @@ int ScreenSeqsCommand::screenQual(map badSeqNames){ saveName = name.substr(1); while (!in.eof()) { char c = in.get(); - if (c == 10 || c == 13){ break; } + if (c == 10 || c == 13 || c == -1){ break; } else { name += c; } } m->gobble(in); @@ -2408,10 +2407,10 @@ int ScreenSeqsCommand::driver(linePair filePos, string goodFName, string badAccn #endif //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+"\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+"\n"); } goodFile.close(); @@ -2503,7 +2502,7 @@ int ScreenSeqsCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& } //report progress - if((i) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(i)); m->mothurOutEndLine(); } + if((i) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(i)+"\n"); } } return 1;