X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=screenseqscommand.cpp;h=41067396c6f5333faeaf3346afd9b865ad351531;hb=d9c3ceb4147b827719046c7d742df14288a07722;hp=7318f9060cdbf5fa2aa5d23205163c1dfecc048a;hpb=86c838c428a9e7d26f902f5492738241fa72c4e7;p=mothur.git diff --git a/screenseqscommand.cpp b/screenseqscommand.cpp index 7318f90..4106739 100644 --- a/screenseqscommand.cpp +++ b/screenseqscommand.cpp @@ -18,6 +18,7 @@ vector ScreenSeqsCommand::setParameters(){ CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pgroup); CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pqfile); CommandParameter palignreport("alignreport", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(palignreport); + CommandParameter ptax("taxonomy", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(ptax); CommandParameter pstart("start", "Number", "", "-1", "", "", "",false,false); parameters.push_back(pstart); CommandParameter pend("end", "Number", "", "-1", "", "", "",false,false); parameters.push_back(pend); CommandParameter pmaxambig("maxambig", "Number", "", "-1", "", "", "",false,false); parameters.push_back(pmaxambig); @@ -44,8 +45,9 @@ string ScreenSeqsCommand::getHelpString(){ try { string helpString = ""; helpString += "The screen.seqs command reads a fastafile and creates .....\n"; - helpString += "The screen.seqs command parameters are fasta, start, end, maxambig, maxhomop, minlength, maxlength, name, group, qfile, optimize, criteria and processors.\n"; + helpString += "The screen.seqs command parameters are fasta, start, end, maxambig, maxhomop, minlength, maxlength, name, group, qfile, alignreport, taxonomy, optimize, criteria and processors.\n"; helpString += "The fasta parameter is required.\n"; + helpString += "The alignreport and taxonomy parameters allow you to remove bad seqs from taxonomy and alignreport files.\n"; helpString += "The start parameter .... The default is -1.\n"; helpString += "The end parameter .... The default is -1.\n"; helpString += "The maxambig parameter allows you to set the maximum number of ambigious bases allowed. The default is -1.\n"; @@ -80,6 +82,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(){ outputTypes["alignreport"] = tempOutNames; outputTypes["accnos"] = tempOutNames; outputTypes["qfile"] = tempOutNames; + outputTypes["taxonomy"] = tempOutNames; } catch(exception& e) { m->errorOut(e, "ScreenSeqsCommand", "ScreenSeqsCommand"); @@ -94,6 +97,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option) { //allow user to run help if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} else { vector myArray = setParameters(); @@ -117,6 +121,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option) { outputTypes["alignreport"] = tempOutNames; outputTypes["accnos"] = tempOutNames; outputTypes["qfile"] = tempOutNames; + outputTypes["taxonomy"] = tempOutNames; //if the user changes the input directory command factory will send this info to us in the output parameter string inputDir = validParameter.validFile(parameters, "inputdir", false); @@ -163,6 +168,13 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option) { if (path == "") { parameters["qfile"] = inputDir + it->second; } } + it = parameters.find("taxonomy"); + //user has given a template file + if(it != parameters.end()){ + path = m->hasPath(it->second); + //if the user has not given a path then, add inputdir. else leave path alone. + if (path == "") { parameters["taxonomy"] = inputDir + it->second; } + } } //check for required parameters @@ -172,23 +184,31 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option) { if (fastafile != "") { m->mothurOut("Using " + fastafile + " as input file for the fasta parameter."); m->mothurOutEndLine(); } else { m->mothurOut("You have no current fastafile and the fasta parameter is required."); m->mothurOutEndLine(); abort = true; } } - else if (fastafile == "not open") { abort = true; } + else if (fastafile == "not open") { abort = true; } + else { m->setFastaFile(fastafile); } groupfile = validParameter.validFile(parameters, "group", true); if (groupfile == "not open") { abort = true; } else if (groupfile == "not found") { groupfile = ""; } + else { m->setGroupFile(groupfile); } qualfile = validParameter.validFile(parameters, "qfile", true); if (qualfile == "not open") { abort = true; } else if (qualfile == "not found") { qualfile = ""; } + else { m->setQualFile(qualfile); } namefile = validParameter.validFile(parameters, "name", true); if (namefile == "not open") { namefile = ""; abort = true; } else if (namefile == "not found") { namefile = ""; } - + else { m->setNameFile(namefile); } + alignreport = validParameter.validFile(parameters, "alignreport", true); if (alignreport == "not open") { abort = true; } - else if (alignreport == "not found") { alignreport = ""; } + else if (alignreport == "not found") { alignreport = ""; } + + taxonomy = validParameter.validFile(parameters, "taxonomy", true); + if (taxonomy == "not open") { abort = true; } + else if (taxonomy == "not found") { taxonomy = ""; } //if the user changes the output directory command factory will send this info to us in the output parameter outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ @@ -200,26 +220,26 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option) { // ...at some point should added some additional type checking... string temp; temp = validParameter.validFile(parameters, "start", false); if (temp == "not found") { temp = "-1"; } - convert(temp, startPos); + m->mothurConvert(temp, startPos); temp = validParameter.validFile(parameters, "end", false); if (temp == "not found") { temp = "-1"; } - convert(temp, endPos); + m->mothurConvert(temp, endPos); temp = validParameter.validFile(parameters, "maxambig", false); if (temp == "not found") { temp = "-1"; } - convert(temp, maxAmbig); + m->mothurConvert(temp, maxAmbig); temp = validParameter.validFile(parameters, "maxhomop", false); if (temp == "not found") { temp = "-1"; } - convert(temp, maxHomoP); + m->mothurConvert(temp, maxHomoP); temp = validParameter.validFile(parameters, "minlength", false); if (temp == "not found") { temp = "-1"; } - convert(temp, minLength); + m->mothurConvert(temp, minLength); temp = validParameter.validFile(parameters, "maxlength", false); if (temp == "not found") { temp = "-1"; } - convert(temp, maxLength); + m->mothurConvert(temp, maxLength); temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = m->getProcessors(); } m->setProcessors(temp); - convert(temp, processors); + m->mothurConvert(temp, processors); temp = validParameter.validFile(parameters, "optimize", false); //optimizing trumps the optimized values original value if (temp == "not found"){ temp = "none"; } @@ -239,7 +259,12 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option) { if (optimize.size() == 1) { if (optimize[0] == "none") { optimize.clear(); } } temp = validParameter.validFile(parameters, "criteria", false); if (temp == "not found"){ temp = "90"; } - convert(temp, criteria); + m->mothurConvert(temp, criteria); + + if (namefile == "") { + vector files; files.push_back(fastafile); + parser.getNameFile(files); + } } } @@ -256,17 +281,22 @@ int ScreenSeqsCommand::execute(){ if (abort == true) { if (calledHelp) { return 0; } return 2; } //if the user want to optimize we need to know the 90% mark - vector positions; + vector positions; if (optimize.size() != 0) { //get summary is paralellized so we need to divideFile, no need to do this step twice so I moved it here //use the namefile to optimize correctly if (namefile != "") { nameMap = m->readNames(namefile); } getSummary(positions); } else { + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) positions = m->divideFile(fastafile, processors); for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(new linePair(positions[i], positions[(i+1)])); - } + } + #else + positions.push_back(0); positions.push_back(1000); + lines.push_back(new linePair(0, 1000)); + #endif } string goodSeqFile = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "good" + m->getExtension(fastafile); @@ -275,16 +305,16 @@ int ScreenSeqsCommand::execute(){ int numFastaSeqs = 0; set badSeqNames; int start = time(NULL); - + #ifdef USE_MPI int pid, numSeqsPerProcessor; int tag = 2001; - vector MPIPos; + vector MPIPos; MPI_Status status; MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are MPI_Comm_size(MPI_COMM_WORLD, &processors); - + MPI_File inMPI; MPI_File outMPIGood; MPI_File outMPIBadAccnos; @@ -389,7 +419,7 @@ int ScreenSeqsCommand::execute(){ if(processors == 1){ numFastaSeqs = driver(lines[0], goodSeqFile, badAccnosFile, fastafile, badSeqNames); - if (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; } }else{ processIDS.resize(0); @@ -402,13 +432,13 @@ int ScreenSeqsCommand::execute(){ //append alignment and report files for(int i=1;iappendFiles((goodSeqFile + toString(processIDS[i]) + ".temp"), goodSeqFile); - remove((goodSeqFile + toString(processIDS[i]) + ".temp").c_str()); + m->mothurRemove((goodSeqFile + toString(processIDS[i]) + ".temp")); m->appendFiles((badAccnosFile + toString(processIDS[i]) + ".temp"), badAccnosFile); - remove((badAccnosFile + toString(processIDS[i]) + ".temp").c_str()); + m->mothurRemove((badAccnosFile + toString(processIDS[i]) + ".temp")); } - if (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; } //read badSeqs in because root process doesnt know what other "bad" seqs the children found ifstream inBad; @@ -427,7 +457,7 @@ int ScreenSeqsCommand::execute(){ #else numFastaSeqs = driver(lines[0], goodSeqFile, badAccnosFile, fastafile, badSeqNames); - if (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; } #endif @@ -468,18 +498,19 @@ int ScreenSeqsCommand::execute(){ if(namefile != "" && groupfile != "") { screenNameGroupFile(badSeqNames); - if (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; } }else if(namefile != "") { screenNameGroupFile(badSeqNames); - if (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; } }else if(groupfile != "") { screenGroupFile(badSeqNames); } // this screens just the group - if (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; } if(alignreport != "") { screenAlignReport(badSeqNames); } if(qualfile != "") { screenQual(badSeqNames); } + if(taxonomy != "") { screenTaxonomy(badSeqNames); } - if (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; } #ifdef USE_MPI } @@ -514,6 +545,11 @@ int ScreenSeqsCommand::execute(){ if (itTypes != outputTypes.end()) { if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); } } + + itTypes = outputTypes.find("taxonomy"); + if (itTypes != outputTypes.end()) { + if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); } + } m->mothurOut("It took " + toString(time(NULL) - start) + " secs to screen " + toString(numFastaSeqs) + " sequences."); m->mothurOutEndLine(); @@ -542,7 +578,7 @@ int ScreenSeqsCommand::screenNameGroupFile(set badSeqNames){ ofstream goodNameOut; m->openOutputFile(goodNameFile, goodNameOut); while(!inputNames.eof()){ - if (m->control_pressed) { goodNameOut.close(); inputNames.close(); remove(goodNameFile.c_str()); return 0; } + if (m->control_pressed) { goodNameOut.close(); inputNames.close(); m->mothurRemove(goodNameFile); return 0; } inputNames >> seqName >> seqList; it = badSeqNames.find(seqName); @@ -588,7 +624,7 @@ int ScreenSeqsCommand::screenNameGroupFile(set badSeqNames){ ofstream goodGroupOut; m->openOutputFile(goodGroupFile, goodGroupOut); while(!inputGroups.eof()){ - if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); remove(goodNameFile.c_str()); remove(goodGroupFile.c_str()); return 0; } + if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodNameFile); m->mothurRemove(goodGroupFile); return 0; } inputGroups >> seqName >> group; @@ -624,7 +660,7 @@ int ScreenSeqsCommand::screenNameGroupFile(set badSeqNames){ } } //*************************************************************************************************************** -int ScreenSeqsCommand::getSummary(vector& positions){ +int ScreenSeqsCommand::getSummary(vector& positions){ try { vector startPosition; @@ -633,12 +669,23 @@ int ScreenSeqsCommand::getSummary(vector& positions){ vector ambigBases; vector longHomoPolymer; - vector positions = m->divideFile(fastafile, processors); - +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + vector positions = m->divideFile(fastafile, processors); + for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(new linePair(positions[i], positions[(i+1)])); } +#else + lines.push_back(new linePair(0, 1000)); +#endif + +#ifdef USE_MPI + int pid; + MPI_Comm_rank(MPI_COMM_WORLD, &pid); + if (pid == 0) { + driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, fastafile, lines[0]); +#else int numSeqs = 0; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) if(processors == 1){ @@ -652,7 +699,7 @@ int ScreenSeqsCommand::getSummary(vector& positions){ numSeqs = driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, fastafile, lines[0]); if (m->control_pressed) { return 0; } #endif - +#endif sort(startPosition.begin(), startPosition.end()); sort(endPosition.begin(), endPosition.end()); sort(seqLength.begin(), seqLength.end()); @@ -671,6 +718,33 @@ int ScreenSeqsCommand::getSummary(vector& positions){ else if (optimize[i] == "maxlength") { maxLength = seqLength[criteriaPercentile]; m->mothurOut("Optimizing maxlength to " + toString(maxLength) + "."); m->mothurOutEndLine(); } } +#ifdef USE_MPI + } + + MPI_Status status; + MPI_Comm_rank(MPI_COMM_WORLD, &pid); + MPI_Comm_size(MPI_COMM_WORLD, &processors); + + if (pid == 0) { + //send file positions to all processes + for(int i = 1; i < processors; i++) { + MPI_Send(&startPos, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + MPI_Send(&endPos, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + MPI_Send(&maxAmbig, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + MPI_Send(&maxHomoP, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + MPI_Send(&minLength, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + MPI_Send(&maxLength, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + } + }else { + MPI_Recv(&startPos, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + MPI_Recv(&endPos, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + MPI_Recv(&maxAmbig, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + MPI_Recv(&maxHomoP, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + MPI_Recv(&minLength, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + MPI_Recv(&maxLength, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + } + MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case +#endif return 0; } catch(exception& e) { @@ -717,9 +791,9 @@ int ScreenSeqsCommand::driverCreateSummary(vector& startPosition, vectormothurOut("Optimizing sequence: " + toString(count)); m->mothurOutEndLine(); } #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - unsigned long int pos = in.tellg(); + unsigned long long pos = in.tellg(); if ((pos == -1) || (pos >= filePos->end)) { break; } #else if (in.eof()) { break; } @@ -801,7 +875,7 @@ int ScreenSeqsCommand::createProcessesCreateSummary(vector& startPosition, for (int k = 0; k < tempNum; k++) { in >> temp; longHomoPolymer.push_back(temp); } m->gobble(in); in.close(); - remove(tempFilename.c_str()); + m->mothurRemove(tempFilename); } return num; @@ -827,7 +901,7 @@ int ScreenSeqsCommand::screenGroupFile(set badSeqNames){ ofstream goodGroupOut; m->openOutputFile(goodGroupFile, goodGroupOut); while(!inputGroups.eof()){ - if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); remove(goodGroupFile.c_str()); return 0; } + if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodGroupFile); return 0; } inputGroups >> seqName >> group; it = badSeqNames.find(seqName); @@ -841,7 +915,7 @@ int ScreenSeqsCommand::screenGroupFile(set badSeqNames){ m->gobble(inputGroups); } - if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); remove(goodGroupFile.c_str()); return 0; } + if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodGroupFile); return 0; } //we were unable to remove some of the bad sequences if (badSeqNames.size() != 0) { @@ -854,7 +928,7 @@ int ScreenSeqsCommand::screenGroupFile(set badSeqNames){ inputGroups.close(); goodGroupOut.close(); - if (m->control_pressed) { remove(goodGroupFile.c_str()); } + if (m->control_pressed) { m->mothurRemove(goodGroupFile); } return 0; @@ -885,7 +959,7 @@ int ScreenSeqsCommand::screenAlignReport(set badSeqNames){ } while(!inputAlignReport.eof()){ - if (m->control_pressed) { goodAlignReportOut.close(); inputAlignReport.close(); remove(goodAlignReportFile.c_str()); return 0; } + if (m->control_pressed) { goodAlignReportOut.close(); inputAlignReport.close(); m->mothurRemove(goodAlignReportFile); return 0; } inputAlignReport >> seqName; it = badSeqNames.find(seqName); @@ -905,7 +979,7 @@ int ScreenSeqsCommand::screenAlignReport(set badSeqNames){ m->gobble(inputAlignReport); } - if (m->control_pressed) { goodAlignReportOut.close(); inputAlignReport.close(); remove(goodAlignReportFile.c_str()); return 0; } + if (m->control_pressed) { goodAlignReportOut.close(); inputAlignReport.close(); m->mothurRemove(goodAlignReportFile); return 0; } //we were unable to remove some of the bad sequences if (badSeqNames.size() != 0) { @@ -918,7 +992,7 @@ int ScreenSeqsCommand::screenAlignReport(set badSeqNames){ inputAlignReport.close(); goodAlignReportOut.close(); - if (m->control_pressed) { remove(goodAlignReportFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodAlignReportFile); return 0; } return 0; @@ -931,6 +1005,56 @@ int ScreenSeqsCommand::screenAlignReport(set badSeqNames){ } //*************************************************************************************************************** +int ScreenSeqsCommand::screenTaxonomy(set badSeqNames){ + try { + ifstream input; + m->openInputFile(taxonomy, input); + string seqName, tax; + set::iterator it; + + string goodTaxFile = outputDir + m->getRootName(m->getSimpleName(taxonomy)) + "good" + m->getExtension(taxonomy); + outputNames.push_back(goodTaxFile); outputTypes["taxonomy"].push_back(goodTaxFile); + ofstream goodTaxOut; m->openOutputFile(goodTaxFile, goodTaxOut); + + while(!input.eof()){ + if (m->control_pressed) { goodTaxOut.close(); input.close(); m->mothurRemove(goodTaxFile); return 0; } + + input >> seqName >> tax; + it = badSeqNames.find(seqName); + + if(it != badSeqNames.end()){ badSeqNames.erase(it); } + else{ + goodTaxOut << seqName << '\t' << tax << endl; + } + m->gobble(input); + } + + if (m->control_pressed) { goodTaxOut.close(); input.close(); m->mothurRemove(goodTaxFile); return 0; } + + //we were unable to remove some of the bad sequences + if (badSeqNames.size() != 0) { + for (it = badSeqNames.begin(); it != badSeqNames.end(); it++) { + m->mothurOut("Your taxonomy file does not include the sequence " + *it + " please correct."); + m->mothurOutEndLine(); + } + } + + input.close(); + goodTaxOut.close(); + + if (m->control_pressed) { m->mothurRemove(goodTaxFile); return 0; } + + return 0; + + } + catch(exception& e) { + m->errorOut(e, "ScreenSeqsCommand", "screenTaxonomy"); + exit(1); + } + +} +//*************************************************************************************************************** + int ScreenSeqsCommand::screenQual(set badSeqNames){ try { ifstream in; @@ -943,7 +1067,7 @@ int ScreenSeqsCommand::screenQual(set badSeqNames){ while(!in.eof()){ - if (m->control_pressed) { goodQual.close(); in.close(); remove(goodQualFile.c_str()); return 0; } + if (m->control_pressed) { goodQual.close(); in.close(); m->mothurRemove(goodQualFile); return 0; } string saveName = ""; string name = ""; @@ -991,7 +1115,7 @@ int ScreenSeqsCommand::screenQual(set badSeqNames){ } } - if (m->control_pressed) { remove(goodQualFile.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(goodQualFile); return 0; } return 0; @@ -1045,7 +1169,7 @@ int ScreenSeqsCommand::driver(linePair* filePos, string goodFName, string badAcc } #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - unsigned long int pos = inFASTA.tellg(); + unsigned long long pos = inFASTA.tellg(); if ((pos == -1) || (pos >= filePos->end)) { break; } #else if (inFASTA.eof()) { break; } @@ -1071,7 +1195,7 @@ int ScreenSeqsCommand::driver(linePair* filePos, string goodFName, string badAcc } //********************************************************************************************************************** #ifdef USE_MPI -int ScreenSeqsCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& goodFile, MPI_File& badAccnosFile, vector& MPIPos, set& badSeqNames){ +int ScreenSeqsCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& goodFile, MPI_File& badAccnosFile, vector& MPIPos, set& badSeqNames){ try { string outputString = ""; MPI_Status statusGood; @@ -1191,7 +1315,7 @@ int ScreenSeqsCommand::createProcesses(string goodFileName, string badAccnos, st string tempFile = filename + toString(processIDS[i]) + ".num.temp"; m->openInputFile(tempFile, in); if (!in.eof()) { int tempNum = 0; in >> tempNum; num += tempNum; } - in.close(); remove(tempFile.c_str()); + in.close(); m->mothurRemove(tempFile); } return num;